Fixes Bullet-Native Artifacts not containing natives when not building from cpp source and not using the build target.

fix-openal-soft-deadlink
MeFisto94 5 years ago
parent 77c521fefa
commit ec491575be
  1. 36
      build.gradle

@ -158,29 +158,29 @@ task configureAndroidNDK {
gradle.rootProject.ext.set("usePrebuildNatives", buildNativeProjects!="true"); gradle.rootProject.ext.set("usePrebuildNatives", buildNativeProjects!="true");
if(skipPrebuildLibraries!="true"&&buildNativeProjects!="true"){ if (skipPrebuildLibraries != "true" && buildNativeProjects != "true") {
String rootPath = rootProject.projectDir.absolutePath String rootPath = rootProject.projectDir.absolutePath
Properties nativesSnasphotProp = new Properties() Properties nativesSnasphotProp = new Properties()
File nativesSnasphotPropF=new File("${rootPath}/natives-snapshot.properties"); File nativesSnasphotPropF = new File("${rootPath}/natives-snapshot.properties");
if(nativesSnasphotPropF.exists()){ if (nativesSnasphotPropF.exists()) {
nativesSnasphotPropF.withInputStream { nativesSnasphotProp.load(it) } nativesSnasphotPropF.withInputStream { nativesSnasphotProp.load(it) }
String nativesSnasphot=nativesSnasphotProp.getProperty("natives.snapshot"); String nativesSnasphot = nativesSnasphotProp.getProperty("natives.snapshot");
String nativesUrl=PREBUILD_NATIVES_URL.replace('${natives.snapshot}',nativesSnasphot) String nativesUrl = PREBUILD_NATIVES_URL.replace('${natives.snapshot}', nativesSnasphot)
println "Use natives snapshot: "+nativesUrl println "Use natives snapshot: " + nativesUrl
String nativesZipFile="${rootPath}" + File.separator + "build"+ File.separator +nativesSnasphot+"-natives.zip" String nativesZipFile = "${rootPath}" + File.separator + "build" + File.separator + nativesSnasphot + "-natives.zip"
String nativesPath="${rootPath}" + File.separator + "build"+ File.separator +"native" String nativesPath = "${rootPath}" + File.separator + "build" + File.separator + "native"
task getNativesZipFile { task getNativesZipFile {
outputs.file nativesZipFile outputs.file nativesZipFile
doFirst { doFirst {
File target = file(nativesZipFile); File target = file(nativesZipFile);
println("Download natives from "+nativesUrl+" to "+nativesZipFile); println("Download natives from " + nativesUrl + " to " + nativesZipFile);
target.getParentFile().mkdirs(); target.getParentFile().mkdirs();
ant.get(src: nativesUrl, dest: target); ant.get(src: nativesUrl, dest: target);
} }
@ -192,28 +192,26 @@ if(skipPrebuildLibraries!="true"&&buildNativeProjects!="true"){
dependsOn getNativesZipFile dependsOn getNativesZipFile
doFirst { doFirst {
for(File src : zipTree(nativesZipFile)){ for (File src : zipTree(nativesZipFile)) {
String srcRel=src.getAbsolutePath().substring((int)(nativesZipFile.length()+1)); String srcRel = src.getAbsolutePath().substring((int) (nativesZipFile.length() + 1));
srcRel=srcRel.substring(srcRel.indexOf( File.separator)+1); srcRel = srcRel.substring(srcRel.indexOf(File.separator) + 1);
File dest=new File(nativesPath+File.separator+srcRel); File dest = new File(nativesPath + File.separator + srcRel);
boolean doCopy = !(dest.exists() && dest.lastModified() > src.lastModified()) boolean doCopy = !(dest.exists() && dest.lastModified() > src.lastModified())
if (doCopy) { if (doCopy) {
println("Copy "+src+" "+dest); println("Copy " + src + " " + dest);
dest.getParentFile().mkdirs(); dest.getParentFile().mkdirs();
Files.copy(src.toPath(), dest.toPath(), StandardCopyOption.REPLACE_EXISTING); Files.copy(src.toPath(), dest.toPath(), StandardCopyOption.REPLACE_EXISTING);
} }
} }
} }
} }
build.dependsOn extractPrebuiltNatives
assemble.dependsOn extractPrebuiltNatives
} }
} }
//class IncrementalReverseTask extends DefaultTask { //class IncrementalReverseTask extends DefaultTask {
// @InputDirectory // @InputDirectory
// def File inputDir // def File inputDir

Loading…
Cancel
Save