Skip to content

Commit 3097787

Browse files
bazel-iofmeum
andauthored
[7.2.1] Treat missing repo boundary files as transient errors (#22707)
Fixes #22687 Closes #22700. PiperOrigin-RevId: 642340825 Change-Id: I96f496b309c4740ae561f69098eca54a12a574f0 Commit b868a59 Co-authored-by: Fabian Meumertzheim <[email protected]>
1 parent 1419013 commit 3097787

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

src/main/java/com/google/devtools/build/lib/rules/repository/RepositoryDelegatorFunction.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,7 @@ public static RepositoryDirectoryValue.Builder symlinkRepoRoot(
549549
if (!WorkspaceFileHelper.isValidRepoRoot(destination)) {
550550
throw new RepositoryFunctionException(
551551
new IOException("No MODULE.bazel, REPO.bazel, or WORKSPACE file found in " + destination),
552-
Transience.PERSISTENT);
552+
Transience.TRANSIENT);
553553
}
554554
return RepositoryDirectoryValue.builder().setExcludeFromVendoring(true).setPath(source);
555555
}

src/test/py/bazel/bzlmod/bazel_overrides_test.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -513,6 +513,28 @@ def testCmdWorkspaceRelativeModuleOverride(self):
513513
'Target @@ss~//:choose_me up-to-date (nothing to build)', stderr
514514
)
515515

516+
def testLocalPathOverrideErrorResolved(self):
517+
self.ScratchFile(
518+
'MODULE.bazel',
519+
[
520+
'bazel_dep(name = "module")',
521+
'local_path_override(',
522+
' module_name = "module",',
523+
' path = "module",',
524+
')',
525+
],
526+
)
527+
self.ScratchFile('module/BUILD')
528+
529+
# MODULE.bazel file is missing
530+
stderr, _, exit_code = self.RunBazel(
531+
['build', '@module//:all'], allow_failure=True
532+
)
533+
self.AssertNotExitCode(exit_code, 0, stderr)
534+
535+
self.ScratchFile('module/MODULE.bazel', ["module(name = 'module')"])
536+
_, _, _ = self.RunBazel(['build', '@module//:all'])
537+
516538

517539
if __name__ == '__main__':
518540
absltest.main()

0 commit comments

Comments
 (0)