Skip to content

Commit ec49157

Browse files
committed
Fixes Bullet-Native Artifacts not containing natives when not building from cpp source and not using the build target.
1 parent 77c521f commit ec49157

File tree

1 file changed

+17
-19
lines changed

1 file changed

+17
-19
lines changed

build.gradle

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -158,29 +158,29 @@ task configureAndroidNDK {
158158

159159
gradle.rootProject.ext.set("usePrebuildNatives", buildNativeProjects!="true");
160160

161-
if(skipPrebuildLibraries!="true"&&buildNativeProjects!="true"){
161+
if (skipPrebuildLibraries != "true" && buildNativeProjects != "true") {
162162
String rootPath = rootProject.projectDir.absolutePath
163163

164164
Properties nativesSnasphotProp = new Properties()
165-
File nativesSnasphotPropF=new File("${rootPath}/natives-snapshot.properties");
166-
167-
if(nativesSnasphotPropF.exists()){
165+
File nativesSnasphotPropF = new File("${rootPath}/natives-snapshot.properties");
166+
167+
if (nativesSnasphotPropF.exists()) {
168168

169169
nativesSnasphotPropF.withInputStream { nativesSnasphotProp.load(it) }
170170

171-
String nativesSnasphot=nativesSnasphotProp.getProperty("natives.snapshot");
172-
String nativesUrl=PREBUILD_NATIVES_URL.replace('${natives.snapshot}',nativesSnasphot)
173-
println "Use natives snapshot: "+nativesUrl
171+
String nativesSnasphot = nativesSnasphotProp.getProperty("natives.snapshot");
172+
String nativesUrl = PREBUILD_NATIVES_URL.replace('${natives.snapshot}', nativesSnasphot)
173+
println "Use natives snapshot: " + nativesUrl
174174

175-
String nativesZipFile="${rootPath}" + File.separator + "build"+ File.separator +nativesSnasphot+"-natives.zip"
176-
String nativesPath="${rootPath}" + File.separator + "build"+ File.separator +"native"
175+
String nativesZipFile = "${rootPath}" + File.separator + "build" + File.separator + nativesSnasphot + "-natives.zip"
176+
String nativesPath = "${rootPath}" + File.separator + "build" + File.separator + "native"
177177

178178

179179
task getNativesZipFile {
180180
outputs.file nativesZipFile
181181
doFirst {
182182
File target = file(nativesZipFile);
183-
println("Download natives from "+nativesUrl+" to "+nativesZipFile);
183+
println("Download natives from " + nativesUrl + " to " + nativesZipFile);
184184
target.getParentFile().mkdirs();
185185
ant.get(src: nativesUrl, dest: target);
186186
}
@@ -192,28 +192,26 @@ if(skipPrebuildLibraries!="true"&&buildNativeProjects!="true"){
192192
dependsOn getNativesZipFile
193193

194194
doFirst {
195-
for(File src : zipTree(nativesZipFile)){
196-
String srcRel=src.getAbsolutePath().substring((int)(nativesZipFile.length()+1));
197-
srcRel=srcRel.substring(srcRel.indexOf( File.separator)+1);
195+
for (File src : zipTree(nativesZipFile)) {
196+
String srcRel = src.getAbsolutePath().substring((int) (nativesZipFile.length() + 1));
197+
srcRel = srcRel.substring(srcRel.indexOf(File.separator) + 1);
198198

199-
File dest=new File(nativesPath+File.separator+srcRel);
199+
File dest = new File(nativesPath + File.separator + srcRel);
200200
boolean doCopy = !(dest.exists() && dest.lastModified() > src.lastModified())
201201
if (doCopy) {
202-
println("Copy "+src+" "+dest);
202+
println("Copy " + src + " " + dest);
203203
dest.getParentFile().mkdirs();
204204
Files.copy(src.toPath(), dest.toPath(), StandardCopyOption.REPLACE_EXISTING);
205205
}
206206
}
207207
}
208208
}
209-
build.dependsOn extractPrebuiltNatives
209+
210+
assemble.dependsOn extractPrebuiltNatives
210211
}
211212
}
212213

213214

214-
215-
216-
217215
//class IncrementalReverseTask extends DefaultTask {
218216
// @InputDirectory
219217
// def File inputDir

0 commit comments

Comments
 (0)