From 310470d305eeadc40308b3335ecf4dd66475f88e Mon Sep 17 00:00:00 2001 From: Frank Viernau Date: Wed, 3 Jul 2024 12:21:11 +0200 Subject: [PATCH] fix(bazel): Always disable the wrapper script Fixes #8828. Signed-off-by: Frank Viernau --- plugins/package-managers/bazel/src/main/kotlin/Bazel.kt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/plugins/package-managers/bazel/src/main/kotlin/Bazel.kt b/plugins/package-managers/bazel/src/main/kotlin/Bazel.kt index ef20644328108..49e8d7cf0a99a 100644 --- a/plugins/package-managers/bazel/src/main/kotlin/Bazel.kt +++ b/plugins/package-managers/bazel/src/main/kotlin/Bazel.kt @@ -50,6 +50,7 @@ import org.ossreviewtoolkit.model.config.AnalyzerConfiguration import org.ossreviewtoolkit.model.config.RepositoryConfiguration import org.ossreviewtoolkit.model.orEmpty import org.ossreviewtoolkit.utils.common.CommandLineTool +import org.ossreviewtoolkit.utils.common.ProcessCapture import org.ossreviewtoolkit.utils.common.collectMessages import org.ossreviewtoolkit.utils.common.encodeHex import org.ossreviewtoolkit.utils.common.withoutPrefix @@ -77,6 +78,14 @@ class Bazel( override fun command(workingDir: File?) = "bazel" + override fun run(vararg args: CharSequence, workingDir: File?, environment: Map): ProcessCapture = + super.run( + args = args, + workingDir = workingDir, + // Disable the optional wrapper script under `tools/bazel`, to ensure the --version option works. + environment = environment + mapOf("BAZELISK_SKIP_WRAPPER" to "true") + ) + override fun transformVersion(output: String) = output.removePrefix("bazel ") // Bazel 6.0 already supports bzlmod but it is not enabled by default.