Skip to content

Commit a012d81

Browse files
authored
fix build error and filter target arch (#443)
1 parent 57f0434 commit a012d81

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed

build.gradle.kts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ subprojects {
5252
resValue("string", "release_name", "v$versionName")
5353
resValue("integer", "release_code", "$versionCode")
5454

55+
ndk {
56+
abiFilters += listOf("arm64-v8a", "armeabi-v7a", "x86", "x86_64")
57+
}
58+
5559
externalNativeBuild {
5660
cmake {
5761
abiFilters("arm64-v8a", "armeabi-v7a", "x86", "x86_64")
@@ -164,6 +168,8 @@ subprojects {
164168
abi {
165169
isEnable = true
166170
isUniversalApk = true
171+
reset()
172+
include("arm64-v8a", "armeabi-v7a", "x86", "x86_64")
167173
}
168174
}
169175
}
@@ -189,4 +195,4 @@ tasks.wrapper {
189195
file("gradle/wrapper/gradle-wrapper.properties")
190196
.appendText("distributionSha256Sum=$sha256")
191197
}
192-
}
198+
}

core/build.gradle.kts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,17 @@ afterEvaluate {
6262
}
6363
}
6464

65-
val abis = listOf("armeabi-v7a" to "ArmeabiV7a", "arm64-v8a" to "Arm64V8a", "x86_64" to "X8664", "x86" to "X86")
65+
val abis = listOf("arm64-v8a" to "Arm64V8a", "armeabi-v7a" to "ArmeabiV7a", "x86" to "X86", "x86_64" to "X8664")
6666

6767
androidComponents.onVariants { variant ->
68-
afterEvaluate {
69-
for ((abi, goAbi) in abis) {
70-
val cmakeName = if (variant.buildType == "debug") "Debug" else "RelWithDebInfo"
71-
tasks.getByName("buildCMake$cmakeName[$abi]").dependsOn(tasks.getByName("externalGolangBuild${variant.name.capitalizeUS()}$goAbi"))
68+
val cmakeName = if (variant.buildType == "debug") "Debug" else "RelWithDebInfo"
69+
70+
abis.forEach { (abi, goAbi) ->
71+
tasks.configureEach {
72+
if (name.startsWith("buildCMake$cmakeName[$abi]")) {
73+
dependsOn("externalGolangBuild${variant.name.capitalizeUS()}$goAbi")
74+
println("Set up dependency: $name -> externalGolangBuild${variant.name.capitalizeUS()}$goAbi")
75+
}
7276
}
7377
}
74-
}
78+
}

0 commit comments

Comments
 (0)