File tree Expand file tree Collapse file tree
gradle-modules/src/main/kotlin
org/sonarsource/cloudnative/gradle Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ import org.sonarsource.cloudnative.gradle.allGoSourcesAndMakeScripts
2121import org.sonarsource.cloudnative.gradle.callMake
2222import org.sonarsource.cloudnative.gradle.getArchitecture
2323import org.sonarsource.cloudnative.gradle.getPlatform
24+ import org.sonarsource.cloudnative.gradle.goLangCiLintVersion
2425import org.sonarsource.cloudnative.gradle.goSources
2526import org.sonarsource.cloudnative.gradle.goVersion
2627import org.sonarsource.cloudnative.gradle.isCi
@@ -77,6 +78,7 @@ if (isCi()) {
7778 val reportPath = layout.buildDirectory.file(" reports/golangci-lint-report.xml" )
7879 inputs.files(goSources())
7980 inputs.property(" goVersion" , goVersion)
81+ inputs.property(" goLangCiLintVersion" , goLangCiLintVersion)
8082
8183 outputs.files(reportPath)
8284 outputs.cacheIf { true }
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform
1818import org.sonarsource.cloudnative.gradle.GO_BINARY_OUTPUT_DIR
1919import org.sonarsource.cloudnative.gradle.GoBuild
2020import org.sonarsource.cloudnative.gradle.allGoSourcesAndMakeScripts
21+ import org.sonarsource.cloudnative.gradle.goLangCiLintVersion
2122import org.sonarsource.cloudnative.gradle.goVersion
2223import org.sonarsource.cloudnative.gradle.isCi
2324import org.sonarsource.cloudnative.gradle.isCrossCompile
@@ -66,6 +67,8 @@ val buildDockerImage by tasks.registering(Exec::class) {
6667 }
6768 add(" --build-arg" )
6869 add(" GO_VERSION=$goVersion " )
70+ add(" --build-arg" )
71+ add(" GOLANG_CI_LINT_VERSION=$goLangCiLintVersion " )
6972 add(" --build-context" )
7073 add(" root=${project.rootDir.absolutePath} " )
7174 add(" --platform" )
@@ -109,6 +112,8 @@ val dockerTasks = goBuildExtension.dockerCommands.map { tasksToCommands ->
109112 " GO_CROSS_COMPILE=${inputs.properties[" goCrossCompile" ]} " ,
110113 " --env" ,
111114 " GO_VERSION=$goVersion " ,
115+ " --env" ,
116+ " GOLANG_CI_LINT_VERSION=$goLangCiLintVersion " ,
112117 " ${project.name} -builder" ,
113118 " bash" ,
114119 " -c" ,
Original file line number Diff line number Diff line change @@ -48,6 +48,10 @@ val Project.goVersion get() = providers.environmentVariable("GO_VERSION")
4848 .orElse(providers.gradleProperty(" goVersion" ))
4949 .orNull ? : error(" Either `GO_VERSION` env variable or `goVersion` Gradle property must be set" )
5050
51+ val Project .goLangCiLintVersion get() = providers.environmentVariable(" GOLANG_CI_LINT_VERSION" )
52+ .orElse(providers.gradleProperty(" goLangCiLintVersion" ))
53+ .orNull ? : error(" Either `GOLANG_CI_LINT_VERSION` env variable or `goLangCiLintVersion` Gradle property must be set" )
54+
5155val Project .isCrossCompile: Provider <String > get() = providers.environmentVariable(" GO_CROSS_COMPILE" ).orElse(" 0" )
5256
5357fun Project.allGoSourcesAndMakeScripts (): FileTree =
You can’t perform that action at this time.
0 commit comments