From a980b5d18f51549ac461f7eaf514b5ee0347fd2d Mon Sep 17 00:00:00 2001 From: Nicolas Nobelis Date: Thu, 26 Sep 2024 08:42:14 +0200 Subject: [PATCH] fix(bazel): Force the generation of a `MODULE.bazel.lock` file Some projects can explicitly disable the lock file generation by putting 'common --lockfile_mode=off' in their '.bazelrc'. In such projects, running 'bazel mod graph' does not generate a lock file anymore if it is missing. Since ORT requires a lock file to be present, this commit adds a flag to force the (re)generation of the lock file. See [1]. [1]: https://bazel.build/versions/7.1.0/external/lockfile Signed-off-by: Nicolas Nobelis --- .../package-managers/bazel/src/main/kotlin/Bazel.kt | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/plugins/package-managers/bazel/src/main/kotlin/Bazel.kt b/plugins/package-managers/bazel/src/main/kotlin/Bazel.kt index ba492f820252..41c1cfb81d56 100644 --- a/plugins/package-managers/bazel/src/main/kotlin/Bazel.kt +++ b/plugins/package-managers/bazel/src/main/kotlin/Bazel.kt @@ -388,7 +388,15 @@ class Bazel( depDirectives: Map, archiveOverrides: Map ): Set { - val process = run("mod", "graph", "--output", "json", "--disk_cache=", workingDir = projectDir) + val process = run( + "mod", + "graph", + "--output", + "json", + "--disk_cache=", + "--lockfile_mode=update", + workingDir = projectDir + ) val mainModule = process.stdout.parseBazelModule() val (mainDeps, devDeps) = mainModule.dependencies.map { module -> val name = module.name ?: module.key.substringBefore("@", "")