Skip to content

Commit

Permalink
Polish lockfile error message
Browse files Browse the repository at this point in the history
Changed "Lock file" to "MODULE.bazel.lock" so that it's more specific.

RELNOTES: None
PiperOrigin-RevId: 581976554
Change-Id: Ib29d9f0ef0e9fd5535ce90d36dc2b89cdc159429
  • Loading branch information
meteorcloudy authored and copybara-github committed Nov 13, 2023
1 parent 560327f commit 65f847a
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public SkyValue compute(SkyKey skyKey, Environment env)
throw new BazelDepGraphFunctionException(
ExternalDepsException.withMessage(
Code.BAD_MODULE,
"Lock file is no longer up-to-date because: %s. "
"MODULE.bazel.lock is no longer up-to-date because: %s. "
+ "Please run `bazel mod deps --lockfile_mode=update` to update your lockfile.",
String.join(", ", diffLockfile)),
Transience.PERSISTENT);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ private SingleExtensionEvalValue tryGettingValueFromLockFile(
throw new SingleExtensionEvalFunctionException(
ExternalDepsException.withMessage(
Code.BAD_MODULE,
"Lock file is no longer up-to-date because: %s. "
"MODULE.bazel.lock is no longer up-to-date because: %s. "
+ "Please run `bazel mod deps --lockfile_mode=update` to update your lockfile.",
String.join(", ", extDiff)),
Transience.PERSISTENT);
Expand Down
29 changes: 15 additions & 14 deletions src/test/py/bazel/bzlmod/bazel_lockfile_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,10 +203,10 @@ def testLockfileErrorMode(self):
self.AssertExitCode(exit_code, 48, stderr)
self.assertIn(
(
'ERROR: Error computing the main repository mapping: Lock file is'
' no longer up-to-date because: the root MODULE.bazel has been'
' modified, the value of --check_direct_dependencies flag has'
' been modified. Please run'
'ERROR: Error computing the main repository mapping:'
' MODULE.bazel.lock is no longer up-to-date because: the root'
' MODULE.bazel has been modified, the value of'
' --check_direct_dependencies flag has been modified. Please run'
' `bazel mod deps --lockfile_mode=update` to update your lockfile.'
),
stderr,
Expand Down Expand Up @@ -248,10 +248,11 @@ def testLocalOverrideWithErrorMode(self):
self.AssertExitCode(exit_code, 48, stderr)
self.assertIn(
(
'ERROR: Error computing the main repository mapping: Lock file is'
' no longer up-to-date because: The MODULE.bazel file has changed'
' for the overriden module: bar. Please run'
' `bazel mod deps --lockfile_mode=update` to update your lockfile.'
'ERROR: Error computing the main repository mapping:'
' MODULE.bazel.lock is no longer up-to-date because: The'
' MODULE.bazel file has changed for the overriden module: bar.'
' Please run `bazel mod deps --lockfile_mode=update` to update your'
' lockfile.'
),
stderr,
)
Expand Down Expand Up @@ -575,7 +576,7 @@ def testUpdateModuleExtensionErrorMode(self):
self.AssertExitCode(exit_code, 48, stderr)
self.assertIn(
(
'ERROR: Lock file is no longer up-to-date because: The '
'ERROR: MODULE.bazel.lock is no longer up-to-date because: The '
'implementation of the extension '
"'ModuleExtensionId{bzlFileLabel=//:extension.bzl, "
"extensionName=lockfile_ext, isolationKey=Optional.empty}' or one "
Expand Down Expand Up @@ -762,8 +763,8 @@ def testChangeEnvVariableInErrorMode(self):
self.AssertExitCode(exit_code, 48, stderr)
self.assertIn(
(
'ERROR: Lock file is no longer up-to-date because: The environment'
' variables the extension'
'ERROR: MODULE.bazel.lock is no longer up-to-date because: The'
' environment variables the extension'
" 'ModuleExtensionId{bzlFileLabel=//:extension.bzl,"
" extensionName=lockfile_ext, isolationKey=Optional.empty}' depends"
' on (or their values) have changed. Please run'
Expand Down Expand Up @@ -842,9 +843,9 @@ def testOldVersion(self):
self.AssertExitCode(exit_code, 48, stderr)
self.assertIn(
(
'ERROR: Error computing the main repository mapping: Lock file is'
' no longer up-to-date because: the version of the lockfile is not'
' compatible with the current Bazel. Please run'
'ERROR: Error computing the main repository mapping:'
' MODULE.bazel.lock is no longer up-to-date because: the version of'
' the lockfile is not compatible with the current Bazel. Please run'
' `bazel mod deps --lockfile_mode=update` to update your lockfile.'
),
stderr,
Expand Down

0 comments on commit 65f847a

Please sign in to comment.