Skip to content

Commit

Permalink
fix build error and filter target arch (#443)
Browse files Browse the repository at this point in the history
  • Loading branch information
ForestL18 authored Feb 10, 2025
1 parent 57f0434 commit a012d81
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
8 changes: 7 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ subprojects {
resValue("string", "release_name", "v$versionName")
resValue("integer", "release_code", "$versionCode")

ndk {
abiFilters += listOf("arm64-v8a", "armeabi-v7a", "x86", "x86_64")
}

externalNativeBuild {
cmake {
abiFilters("arm64-v8a", "armeabi-v7a", "x86", "x86_64")
Expand Down Expand Up @@ -164,6 +168,8 @@ subprojects {
abi {
isEnable = true
isUniversalApk = true
reset()
include("arm64-v8a", "armeabi-v7a", "x86", "x86_64")
}
}
}
Expand All @@ -189,4 +195,4 @@ tasks.wrapper {
file("gradle/wrapper/gradle-wrapper.properties")
.appendText("distributionSha256Sum=$sha256")
}
}
}
16 changes: 10 additions & 6 deletions core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,17 @@ afterEvaluate {
}
}

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

androidComponents.onVariants { variant ->
afterEvaluate {
for ((abi, goAbi) in abis) {
val cmakeName = if (variant.buildType == "debug") "Debug" else "RelWithDebInfo"
tasks.getByName("buildCMake$cmakeName[$abi]").dependsOn(tasks.getByName("externalGolangBuild${variant.name.capitalizeUS()}$goAbi"))
val cmakeName = if (variant.buildType == "debug") "Debug" else "RelWithDebInfo"

abis.forEach { (abi, goAbi) ->
tasks.configureEach {
if (name.startsWith("buildCMake$cmakeName[$abi]")) {
dependsOn("externalGolangBuild${variant.name.capitalizeUS()}$goAbi")
println("Set up dependency: $name -> externalGolangBuild${variant.name.capitalizeUS()}$goAbi")
}
}
}
}
}

0 comments on commit a012d81

Please sign in to comment.