From 6c570ff8cec539913e0eb8dc8320acd7733ca40e Mon Sep 17 00:00:00 2001 From: 5ec1cff Date: Tue, 14 Jan 2025 21:07:42 +0800 Subject: [PATCH] fix go build task dependencies --- core/build.gradle.kts | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/core/build.gradle.kts b/core/build.gradle.kts index 465edb57..3a0bca6c 100644 --- a/core/build.gradle.kts +++ b/core/build.gradle.kts @@ -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) } -} \ No newline at end of file +} + +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")) + } + } +}