From 07ff81f4db4b480fdf2bcb2069c5304d6aa55ac7 Mon Sep 17 00:00:00 2001 From: kr328 Date: Sun, 12 Sep 2021 00:43:32 +0800 Subject: [PATCH] Fix: should add main golang source as input --- core/build.gradle.kts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/core/build.gradle.kts b/core/build.gradle.kts index deb30171..c9d42f86 100644 --- a/core/build.gradle.kts +++ b/core/build.gradle.kts @@ -1,3 +1,4 @@ +import com.github.kr328.golang.GolangBuildTask import com.github.kr328.golang.GolangPlugin import java.io.FileOutputStream import java.net.URL @@ -14,6 +15,7 @@ val geoipDatabaseUrl = "https://github.com/Dreamacro/maxmind-geoip/releases/latest/download/Country.mmdb" val geoipInvalidate = Duration.ofDays(7)!! val geoipOutput = buildDir.resolve("intermediates/golang_blob") +val golangSource = file("src/main/golang/native") golang { sourceSets { @@ -37,7 +39,7 @@ android { all { externalNativeBuild { cmake { - arguments("-DGO_SOURCE:STRING=${file("src/main/golang/native")}") + arguments("-DGO_SOURCE:STRING=${golangSource}") arguments("-DGO_OUTPUT:STRING=${GolangPlugin.outputDirOf(project, null, null)}") arguments("-DFLAVOR_NAME:STRING=$name") } @@ -65,6 +67,12 @@ repositories { mavenCentral() } +afterEvaluate { + tasks.withType(GolangBuildTask::class.java).forEach { + it.inputs.file(golangSource) + } +} + task("downloadGeoipDatabase") { val databaseFile = geoipOutput.resolve("Country.mmdb") val moduleFile = geoipOutput.resolve("go.mod")