|
@@ -126,8 +126,6 @@ task unzipBullet(type: Copy) {
|
|
|
unzipBullet.dependsOn {
|
|
|
def zipFilePath = project.projectDir.absolutePath + File.separator + bulletZipFile
|
|
|
def zipFile = new File(zipFilePath)
|
|
|
-// println "zipFile path: " + zipFile.absolutePath
|
|
|
-// println "zipFile exists: " + zipFile.exists()
|
|
|
if (!zipFile.exists()) {
|
|
|
downloadBullet
|
|
|
}
|
|
@@ -135,40 +133,45 @@ unzipBullet.dependsOn {
|
|
|
|
|
|
compileJava.dependsOn {
|
|
|
def bulletUnzipDir = new File(project.projectDir.absolutePath + File.separator + bulletFolder)
|
|
|
-// println "bulletUnzipDir path: " + bulletUnzipDir.absolutePath
|
|
|
-// println "bulletUnzipDir exists: " + bulletUnzipDir.isDirectory()
|
|
|
if (!bulletUnzipDir.isDirectory()) {
|
|
|
unzipBullet
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-//task buildAllExecutables {
|
|
|
-// dependsOn binaries.withType(SharedLibraryBinary).matching {
|
|
|
-// it.buildable
|
|
|
-// }
|
|
|
-//}
|
|
|
-
|
|
|
-// Adds all built binaries to java jar task
|
|
|
+// Adds all available binaries to java jar task
|
|
|
binaries.withType(SharedLibraryBinary) { binary ->
|
|
|
+ // For all binaries that can't be built on the current system
|
|
|
if (!buildable) {
|
|
|
- //TODO: obtain elsewhere if not available
|
|
|
+ //Get from libs folder if no fresh build is available in the build folder and add to jar file
|
|
|
if(!binary.tasks.outputFile.get(0).exists()){
|
|
|
+ def fileName = binary.tasks.outputFile.get(0).getName();
|
|
|
+ def precompiledFile = new File("libs/native/${targetPlatform.operatingSystem.name}/${targetPlatform.architecture.name}/${fileName}")
|
|
|
+ if(precompiledFile.exists()){
|
|
|
+ jar.into("native/${targetPlatform.operatingSystem.name}/${targetPlatform.architecture.name}") { from precompiledFile }
|
|
|
+ }
|
|
|
return
|
|
|
- }else{
|
|
|
- // Add output to jar file if the binary exists in the build folder already,
|
|
|
+ } else{
|
|
|
+ // Add binary to jar file if the binary exists in the build folder already,
|
|
|
// e.g. when the build of jme3-bullet-native has been run on a virtual box
|
|
|
// and the project hasn't been cleaned yet.
|
|
|
jar.into("native/${targetPlatform.operatingSystem.name}/${targetPlatform.architecture.name}") { from binary.tasks.outputFile }
|
|
|
return
|
|
|
}
|
|
|
}
|
|
|
- // Get builder of this binary
|
|
|
- def builderTask = binary.tasks
|
|
|
|
|
|
+ // For all binaries that can be built on the current system
|
|
|
+ def builderTask = binary.tasks
|
|
|
// Add output to jar file
|
|
|
jar.into("native/${targetPlatform.operatingSystem.name}/${targetPlatform.architecture.name}") { from builderTask.outputFile }
|
|
|
// Add depend on build
|
|
|
jar.dependsOn builderTask
|
|
|
+ // Add output to libs folder
|
|
|
+ task "copyBinaryToLibs${targetPlatform}"(type: Copy) {
|
|
|
+ from builderTask.outputFile
|
|
|
+ into "libs/native/${targetPlatform.operatingSystem.name}/${targetPlatform.architecture.name}"
|
|
|
+ }
|
|
|
+ // Add depend on copy
|
|
|
+ jar.dependsOn("copyBinaryToLibs${targetPlatform}")
|
|
|
}
|
|
|
|
|
|
// Helper class to wrap ant dowload task
|