File tree 2 files changed +17
-1
lines changed
main/java/com/google/devtools/build/lib/bazel/bzlmod/modcommand
2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -305,7 +305,7 @@ public ImmutableSet<ModuleKey> resolveToModuleKeys(
305
305
throws InvalidArgumentException {
306
306
Optional <AugmentedModule > mod =
307
307
depGraph .values ().stream ()
308
- .filter (m -> moduleKeyToCanonicalNames .get (m .getKey ()). equals ( repoName ( )))
308
+ .filter (m -> repoName (). equals ( moduleKeyToCanonicalNames .get (m .getKey ())))
309
309
.findAny ();
310
310
if (mod .isPresent () && !includeUnused && warnUnused && !mod .get ().isUsed ()) {
311
311
// Warn the user when unused modules are allowed and the specified version exists, but the
Original file line number Diff line number Diff line change @@ -365,6 +365,22 @@ def testShowExtensionSomeExtensionsSomeUsages(self):
365
365
'Wrong output in the show with some extensions and some usages query.' ,
366
366
)
367
367
368
+ def testShowExtensionWithUnknownRepo (self ):
369
+ _ , _ , stderr = self .RunBazel (
370
+ [
371
+ 'mod' ,
372
+ 'show_extension' ,
373
+ '@@unknown//foo:bar.bzl%x' ,
374
+ ],
375
+ allow_failure = True ,
376
+ rstrip = True ,
377
+ )
378
+ self .assertIn (
379
+ 'ERROR: In extension argument @@unknown//foo:bar.bzl%x: No module with '
380
+ 'the canonical repo name @@unknown exists in the dependency graph.' ,
381
+ '\n ' .join (stderr ),
382
+ )
383
+
368
384
def testShowModuleAndExtensionReposFromBaseModule (self ):
369
385
_ , stdout , _ = self .RunBazel (
370
386
[
You can’t perform that action at this time.
0 commit comments