@@ -289,6 +289,8 @@ public void setup() throws Exception {
289
289
RepositoryDelegatorFunction .IS_VENDOR_COMMAND .set (differencer , false );
290
290
RepositoryDelegatorFunction .VENDOR_DIRECTORY .set (differencer , Optional .empty ());
291
291
292
+ registry .addModule (
293
+ createModuleKey ("platforms" , "0.0.9" ), "module(name='platforms', version = '0.0.9')" );
292
294
// Set up a simple repo rule.
293
295
registry .addModule (
294
296
createModuleKey ("data_repo" , "1.0" ), "module(name='data_repo',version='1.0')" );
@@ -1399,10 +1401,9 @@ public void nonVisibleLabelInLabelAttr() throws Exception {
1399
1401
reporter .removeHandler (failFastHandler );
1400
1402
evaluator .evaluate (ImmutableList .of (skyKey ), evaluationContext );
1401
1403
assertContainsEvent (
1402
- "Error in repository_rule: no repository visible as '@other_repo', but referenced by label"
1403
- + " '@other_repo//:foo' in attribute data of data_repo 'ext'. Only repositories"
1404
- + " visible to the root module can be referenced here, are you missing a bazel_dep or"
1405
- + " use_repo(..., \" other_repo\" )?" );
1404
+ "Error in repository_rule: no repository visible as '@other_repo' to the main repository,"
1405
+ + " but referenced by label '@other_repo//:foo' in attribute 'data' of data_repo 'ext'."
1406
+ + " Is the root module missing a bazel_dep or use_repo(..., \" other_repo\" )?" );
1406
1407
}
1407
1408
1408
1409
@ Test
@@ -1423,6 +1424,7 @@ public void nonVisibleLabelInLabelAttrNonRootModule() throws Exception {
1423
1424
" data_repo(name='other_repo')" ,
1424
1425
" data_repo(name='ext',data='@other_repo//:foo')" ,
1425
1426
"ext = module_extension(implementation=_ext_impl)" );
1427
+
1426
1428
scratch .file (
1427
1429
workspaceRoot .getRelative ("MODULE.bazel" ).getPathString (),
1428
1430
"bazel_dep(name = 'ext_module', version = '1.0')" ,
@@ -1438,10 +1440,10 @@ public void nonVisibleLabelInLabelAttrNonRootModule() throws Exception {
1438
1440
reporter .removeHandler (failFastHandler );
1439
1441
evaluator .evaluate (ImmutableList .of (skyKey ), evaluationContext );
1440
1442
assertContainsEvent (
1441
- "Error in repository_rule: no repository visible as '@other_repo', but referenced by label "
1442
- + " '@other_repo//:foo' in attribute data of data_repo 'ext'. Only repositories "
1443
- + " visible to the module 'ext_module' can be referenced here, are you missing a "
1444
- + " bazel_dep or use_repo(..., \" other_repo\" )?" );
1443
+ "Error in repository_rule: no repository visible as '@other_repo' to the repository "
1444
+ + " '@@ext_module~', but referenced by label '@ other_repo//:foo' in attribute ' data' of "
1445
+ + " data_repo 'ext'. Is the module 'ext_module' missing a bazel_dep or use_repo(..., "
1446
+ + " \" other_repo\" )?" );
1445
1447
}
1446
1448
1447
1449
@ Test
@@ -1475,12 +1477,16 @@ public void nonVisibleLabelInLabelAttrForwardedFromTag() throws Exception {
1475
1477
1476
1478
SkyKey skyKey = BzlLoadValue .keyForBuild (Label .parseCanonical ("//:data.bzl" ));
1477
1479
reporter .removeHandler (failFastHandler );
1478
- evaluator .evaluate (ImmutableList .of (skyKey ), evaluationContext );
1479
- assertContainsEvent (
1480
- "Error in repository_rule: no repository visible as '@other_repo', but referenced by label"
1481
- + " '@other_repo//:foo' in attribute data of data_repo 'ext'. Only repositories"
1482
- + " visible to the root module can be referenced here, are you missing a bazel_dep or"
1483
- + " use_repo(..., \" other_repo\" )?" );
1480
+ var result = evaluator .evaluate (ImmutableList .of (skyKey ), evaluationContext );
1481
+
1482
+ assertThat (result .hasError ()).isTrue ();
1483
+ assertThat (result .getError ().getException ())
1484
+ .hasMessageThat ()
1485
+ .isEqualTo (
1486
+ "in tag at /ws/MODULE.bazel:2:10: no repository visible as '@other_repo' to the main"
1487
+ + " repository, but referenced by label '@other_repo//:foo' in attribute 'label' of"
1488
+ + " tag 'label'. Is the root module missing a bazel_dep or use_repo(...,"
1489
+ + " \" other_repo\" )?" );
1484
1490
}
1485
1491
1486
1492
@ Test
@@ -1511,10 +1517,9 @@ public void nonVisibleLabelInLabelListAttr() throws Exception {
1511
1517
reporter .removeHandler (failFastHandler );
1512
1518
evaluator .evaluate (ImmutableList .of (skyKey ), evaluationContext );
1513
1519
assertContainsEvent (
1514
- "Error in repository_rule: no repository visible as '@other_repo', but referenced by label"
1515
- + " '@other_repo//:foo' in attribute data of data_repo 'ext'. Only repositories"
1516
- + " visible to the root module can be referenced here, are you missing a bazel_dep or"
1517
- + " use_repo(..., \" other_repo\" )?" );
1520
+ "Error in repository_rule: no repository visible as '@other_repo' to the main repository,"
1521
+ + " but referenced by label '@other_repo//:foo' in attribute 'data' of data_repo 'ext'."
1522
+ + " Is the root module missing a bazel_dep or use_repo(..., \" other_repo\" )?" );
1518
1523
}
1519
1524
1520
1525
@ Test
@@ -1545,10 +1550,9 @@ public void nonVisibleLabelInLabelKeyedStringDictAttr() throws Exception {
1545
1550
reporter .removeHandler (failFastHandler );
1546
1551
evaluator .evaluate (ImmutableList .of (skyKey ), evaluationContext );
1547
1552
assertContainsEvent (
1548
- "Error in repository_rule: no repository visible as '@other_repo', but referenced by label"
1549
- + " '@other_repo//:foo' in attribute data of data_repo 'ext'. Only repositories"
1550
- + " visible to the root module can be referenced here, are you missing a bazel_dep or"
1551
- + " use_repo(..., \" other_repo\" )?" );
1553
+ "Error in repository_rule: no repository visible as '@other_repo' to the main repository,"
1554
+ + " but referenced by label '@other_repo//:foo' in attribute 'data' of data_repo 'ext'."
1555
+ + " Is the root module missing a bazel_dep or use_repo(..., \" other_repo\" )?" );
1552
1556
}
1553
1557
1554
1558
@ Test
0 commit comments