fix go build task dependencies

This commit is contained in:
5ec1cff 2025-01-14 21:07:42 +08:00
parent 0bb6e9df23
commit 6c570ff8ce
No known key found for this signature in database
GPG key ID: 609C383297F6FEBF

View file

@ -1,8 +1,6 @@
import android.databinding.tool.ext.capitalizeUS
import com.github.kr328.golang.GolangBuildTask
import com.github.kr328.golang.GolangPlugin
import java.io.FileOutputStream
import java.net.URL
import java.time.Duration
plugins {
kotlin("android")
@ -62,4 +60,15 @@ afterEvaluate {
tasks.withType(GolangBuildTask::class.java).forEach {
it.inputs.dir(golangSource)
}
}
}
val abis = listOf("armeabi-v7a" to "ArmeabiV7a", "arm64-v8a" to "Arm64V8a", "x86_64" to "X8664", "x86" to "X86")
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"))
}
}
}