From d3f59fac8aa7792e87a812c51c39039d397909a8 Mon Sep 17 00:00:00 2001 From: Xiaodong Wang Date: Sat, 29 Apr 2023 12:23:41 -0700 Subject: [PATCH] build: fix the task buildPlugin that not compatible with build configuration cache. --- buildSrc/src/main/kotlin/build/Plugin.kt | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/buildSrc/src/main/kotlin/build/Plugin.kt b/buildSrc/src/main/kotlin/build/Plugin.kt index 39e8a5e..c37f086 100644 --- a/buildSrc/src/main/kotlin/build/Plugin.kt +++ b/buildSrc/src/main/kotlin/build/Plugin.kt @@ -9,6 +9,7 @@ import com.google.protobuf.gradle.* import org.gradle.api.plugins.JavaPluginExtension import org.gradle.api.publish.PublishingExtension import org.gradle.api.publish.maven.MavenPublication +import org.gradle.api.tasks.Exec import org.gradle.api.tasks.SourceSetContainer import org.gradle.plugins.signing.SigningExtension import org.gradle.kotlin.dsl.* @@ -49,14 +50,10 @@ fun Project.configureGrpcPlugin(pluginName: String) { val pluginPath = "$buildDir/exe/$pluginName${exeSuffix}" val artifactStagingPath: File = file("$buildDir/artifacts") - tasks.register("buildPlugin") { - doLast { - exec { - workingDir = file("src/main/go") - environment = environment + mapOf("GOOS" to goOs(os), "GOARCH" to goArch(arch)) - commandLine = listOf("go", "build", "-o", pluginPath, "main.go") - } - } + tasks.register("buildPlugin", Exec::class) { + workingDir = file("src/main/go") + environment = environment + mapOf("GOOS" to goOs(os), "GOARCH" to goArch(arch)) + commandLine = listOf("go", "build", "-o", pluginPath, "main.go") } tasks.register("buildArtifacts", Copy::class) {