@@ -8,36 +8,40 @@ android {
88 ndkVersion " 26.3.11579264"
99}
1010
11- task conanProfile {
12- file(" build" ). mkdirs()
13-
14- copy {
15- from " conanprofile.txt"
16- into " build"
11+ tasks. register(' conanProfile' , Copy ) {
12+ from " conanprofile.txt"
13+ into " build/"
14+
15+ doLast {
16+ def file = file(" build/conanprofile.txt" )
17+ def content = file. text
18+ content = content. replace(" <NDK_PATH>" , android. ndkDirectory. toString())
19+ file. write(content)
1720 }
18-
19- def file = file(" build/conanprofile.txt" )
20- def content = file. text
21- content = content. replace(" <NDK_PATH>" , android. ndkDirectory. toString())
22- file. write(content)
2321}
2422
25- task conanInstall {
26- [" armv7" , " armv8" , " x86" , " x86_64" ]. each { String arch ->
27- exec {
28- commandLine(
29- " conan" , " install" , " ." ,
30- " --output-folder=build/conan/" + arch,
31- " --build=missing" ,
32- " --profile:host=build/conanprofile.txt" ,
33- " -s" , " arch=" + arch,
34- " -s" , " build_type=Release" ,
35- " -s" , " &:build_type=RelWithDebInfo" ,
36- " -s" , " odrcore/*:build_type=RelWithDebInfo" ,
37- )
23+ tasks. register(' conanInstall' ) {
24+ dependsOn(tasks. named(" conanProfile" ))
25+ doFirst {
26+ [" armv7" , " armv8" , " x86" , " x86_64" ]. each { String arch ->
27+ exec {
28+ commandLine(
29+ " conan" , " install" , " ." ,
30+ " --output-folder=build/conan/" + arch,
31+ " --build=missing" ,
32+ " --profile:host=build/conanprofile.txt" ,
33+ " -s" , " arch=" + arch,
34+ " -s" , " build_type=Release" ,
35+ " -s" , " &:build_type=RelWithDebInfo" ,
36+ " -s" , " odrcore/*:build_type=RelWithDebInfo" ,
37+ )
38+ }
3839 }
3940 }
4041}
42+ tasks. named(" preBuild" ). configure { preBuildTask ->
43+ preBuildTask. dependsOn(tasks. named(" conanInstall" ))
44+ }
4145
4246android {
4347 defaultConfig {
@@ -168,3 +172,11 @@ dependencies {
168172 implementation ' androidx.test.espresso:espresso-idling-resource:3.5.1'
169173 implementation ' androidx.annotation:annotation:1.8.0'
170174}
175+
176+ // Without removing .cxx dir on cleanup, double gradle clean is erroring out.
177+ // Before removing this workaround, check if "./gradlew assembleDebug; ./gradlew clean; ./gradlew clean" works
178+ tasks. named(" clean" ) {
179+ doFirst {
180+ delete getLayout(). getProjectDirectory(). dir(" .cxx" )
181+ }
182+ }
0 commit comments