From f848b06f3419366252dbb72f45382c098b23d582 Mon Sep 17 00:00:00 2001 From: Googler Date: Mon, 19 Aug 2024 10:47:01 -0700 Subject: [PATCH] Enable Bzlmod in AnalysisTestCase.java Working towards: https://github.com/bazelbuild/bazel/issues/19824 Related: https://github.com/bazelbuild/bazel/issues/23023 Part of: https://github.com/bazelbuild/bazel/pull/23253 PiperOrigin-RevId: 664876902 Change-Id: I8386b13fd12f5d4fb0599c0142df668b0c4a7f74 --- .../AnalysisWithIOExceptionsTest.java | 2 +- .../build/lib/analysis/AspectTest.java | 3 + .../build/lib/analysis/BuildViewTest.java | 2 +- .../lib/analysis/util/AnalysisTestCase.java | 13 +- .../testutil/PostAnalysisQueryHelper.java | 5 - .../toolchains/ToolchainsForTargetsTest.java | 4 +- ...arlarkAspectsToolchainPropagationTest.java | 26 +- .../starlark/StarlarkDefinedAspectsTest.java | 386 +++++++++--------- 8 files changed, 218 insertions(+), 223 deletions(-) diff --git a/src/test/java/com/google/devtools/build/lib/analysis/AnalysisWithIOExceptionsTest.java b/src/test/java/com/google/devtools/build/lib/analysis/AnalysisWithIOExceptionsTest.java index 9f3f8e1554789a..3c84834321e23a 100644 --- a/src/test/java/com/google/devtools/build/lib/analysis/AnalysisWithIOExceptionsTest.java +++ b/src/test/java/com/google/devtools/build/lib/analysis/AnalysisWithIOExceptionsTest.java @@ -82,7 +82,7 @@ public void testIncrementalGlobIOException() throws Exception { @Test public void testWorkspaceError() throws IOException { scratch.file("a/BUILD"); - crashMessage = path -> path.toString().contains("WORKSPACE") ? "bork" : null; + crashMessage = path -> path.toString().contains("MODULE.bazel") ? "bork" : null; reporter.removeHandler(failFastHandler); assertThrows( TargetParsingException.class, diff --git a/src/test/java/com/google/devtools/build/lib/analysis/AspectTest.java b/src/test/java/com/google/devtools/build/lib/analysis/AspectTest.java index e28262a7341fb6..bc7837e8d8c2fc 100644 --- a/src/test/java/com/google/devtools/build/lib/analysis/AspectTest.java +++ b/src/test/java/com/google/devtools/build/lib/analysis/AspectTest.java @@ -202,6 +202,9 @@ public void aspectCreationWorksThroughBind() throws Exception { .add("bind(name='b', actual='//a:b')") .build()); + useConfiguration("--enable_workspace"); + update(); + skyframeExecutor.invalidateFilesUnderPathForTesting( reporter, ModifiedFileSet.EVERYTHING_MODIFIED, Root.fromPath(rootDirectory)); diff --git a/src/test/java/com/google/devtools/build/lib/analysis/BuildViewTest.java b/src/test/java/com/google/devtools/build/lib/analysis/BuildViewTest.java index df517502d3c0f9..3a05a433fa5524 100644 --- a/src/test/java/com/google/devtools/build/lib/analysis/BuildViewTest.java +++ b/src/test/java/com/google/devtools/build/lib/analysis/BuildViewTest.java @@ -193,7 +193,7 @@ def _impl(ctx): """); update("//foo:a"); - assertContainsEvent("DEBUG /workspace/foo/rule.bzl:3:8: f owner is @//foo:a"); + assertContainsEvent("DEBUG /workspace/foo/rule.bzl:3:8: f owner is @@//foo:a"); } @Test diff --git a/src/test/java/com/google/devtools/build/lib/analysis/util/AnalysisTestCase.java b/src/test/java/com/google/devtools/build/lib/analysis/util/AnalysisTestCase.java index f64710c9be5b15..1d62f4cf80efa2 100644 --- a/src/test/java/com/google/devtools/build/lib/analysis/util/AnalysisTestCase.java +++ b/src/test/java/com/google/devtools/build/lib/analysis/util/AnalysisTestCase.java @@ -131,8 +131,6 @@ public enum Flag { CPU_K8, // Flags from TestConstants.PRODUCT_SPECIFIC_FLAGS. PRODUCT_SPECIFIC_FLAGS, - // The --enable_bzlmod flags. - ENABLE_BZLMOD, // The --nolegacy_external_runfiles flag. NO_LEGACY_EXTERNAL_RUNFILES } @@ -245,6 +243,11 @@ protected void useRuleClassProvider(ConfiguredRuleClassProvider ruleClassProvide RepositoryDelegatorFunction.DISABLE_NATIVE_REPO_RULES, false), PrecomputedValue.injected( ModuleFileFunction.MODULE_OVERRIDES, ImmutableMap.of()), + PrecomputedValue.injected( + RepositoryDelegatorFunction.REPOSITORY_OVERRIDES, ImmutableMap.of()), + PrecomputedValue.injected( + RepositoryDelegatorFunction.FORCE_FETCH, + RepositoryDelegatorFunction.FORCE_FETCH_DISABLED), PrecomputedValue.injected( BazelModuleResolutionFunction.CHECK_DIRECT_DEPENDENCIES, CheckDirectDepsMode.WARNING), @@ -272,7 +275,6 @@ private void reinitializeSkyframeExecutor() { packageOptions.showLoadingProgress = true; packageOptions.globbingThreads = 3; BuildLanguageOptions buildLanguageOptions = Options.getDefaults(BuildLanguageOptions.class); - buildLanguageOptions.enableBzlmod = true; skyframeExecutor.preparePackageLoading( pkgLocator, packageOptions, @@ -352,11 +354,6 @@ public void useConfiguration(String... args) throws Exception { if (defaultFlags().contains(Flag.PRODUCT_SPECIFIC_FLAGS)) { optionsParser.parse(TestConstants.PRODUCT_SPECIFIC_FLAGS); } - if (defaultFlags().contains(Flag.ENABLE_BZLMOD)) { - optionsParser.parse("--enable_bzlmod"); - } else { - optionsParser.parse("--noenable_bzlmod"); - } if (defaultFlags().contains(Flag.NO_LEGACY_EXTERNAL_RUNFILES)) { optionsParser.parse("--nolegacy_external_runfiles"); } diff --git a/src/test/java/com/google/devtools/build/lib/query2/testutil/PostAnalysisQueryHelper.java b/src/test/java/com/google/devtools/build/lib/query2/testutil/PostAnalysisQueryHelper.java index 0667188e42d38a..8b4ecc6d98a256 100644 --- a/src/test/java/com/google/devtools/build/lib/query2/testutil/PostAnalysisQueryHelper.java +++ b/src/test/java/com/google/devtools/build/lib/query2/testutil/PostAnalysisQueryHelper.java @@ -328,11 +328,6 @@ protected AnalysisResult update(String... labels) throws Exception { return super.update(labels); } - @Override - protected FlagBuilder defaultFlags() { - return super.defaultFlags().with(Flag.ENABLE_BZLMOD); - } - protected SkyframeExecutor getSkyframeExecutor() { return skyframeExecutor; } diff --git a/src/test/java/com/google/devtools/build/lib/skyframe/toolchains/ToolchainsForTargetsTest.java b/src/test/java/com/google/devtools/build/lib/skyframe/toolchains/ToolchainsForTargetsTest.java index 1078f88a03ae34..58a2303faefdce 100644 --- a/src/test/java/com/google/devtools/build/lib/skyframe/toolchains/ToolchainsForTargetsTest.java +++ b/src/test/java/com/google/devtools/build/lib/skyframe/toolchains/ToolchainsForTargetsTest.java @@ -239,7 +239,7 @@ public ToolchainCollection getToolchainCollection(Stri @Before public void createToolchains() throws Exception { - scratch.appendFile("WORKSPACE", "register_toolchains('//toolchains:all')"); + scratch.appendFile("MODULE.bazel", "register_toolchains('//toolchains:all')"); scratch.file( "toolchain/toolchain_def.bzl", @@ -783,7 +783,7 @@ public void targetCompatibleWith_matchesExecCompatibleWith() throws Exception { .setupCcToolchainConfig( mockToolsConfig, CcToolchainConfig.builder() - .withToolchainTargetConstraints("@//platforms:local_value_a") + .withToolchainTargetConstraints("@@//platforms:local_value_a") .withToolchainExecConstraints() .withCpu("fake")); scratch.file( diff --git a/src/test/java/com/google/devtools/build/lib/starlark/StarlarkAspectsToolchainPropagationTest.java b/src/test/java/com/google/devtools/build/lib/starlark/StarlarkAspectsToolchainPropagationTest.java index 5837df6f8ac329..254c30f64d5540 100644 --- a/src/test/java/com/google/devtools/build/lib/starlark/StarlarkAspectsToolchainPropagationTest.java +++ b/src/test/java/com/google/devtools/build/lib/starlark/StarlarkAspectsToolchainPropagationTest.java @@ -1103,8 +1103,8 @@ def _rule_impl(ctx): var value = ((StarlarkInfo) configuredAspect.get(providerKey)).getValue("value"); assertThat((Iterable) value) .containsExactly( - "toolchain_aspect has param = xxx on @//test:t1", - "toolchain_aspect has param = xxx on @//toolchain:foo with tool in ToolchainInfo =" + "toolchain_aspect has param = xxx on @@//test:t1", + "toolchain_aspect has param = xxx on @@//toolchain:foo with tool in ToolchainInfo =" + " "); } @@ -1172,8 +1172,8 @@ def _rule_impl(ctx): var value = ((StarlarkInfo) configuredAspect.get(providerKey)).getValue("value"); assertThat((Iterable) value) .containsExactly( - "toolchain_aspect has param = xxx on @//test:t1", - "toolchain_aspect has param = xxx on @//toolchain:foo with tool in" + "toolchain_aspect has param = xxx on @@//test:t1", + "toolchain_aspect has param = xxx on @@//toolchain:foo with tool in" + " ToolchainInfo = "); } @@ -1243,8 +1243,8 @@ def _rule_impl(ctx): var value = ((StarlarkInfo) configuredAspect.get(providerKey)).getValue("value"); assertThat((Iterable) value) .containsExactly( - "toolchain_aspect has param = xxx on @//test:t1", - "toolchain_aspect has param = xxx on @//toolchain:foo with tool in ToolchainInfo =" + "toolchain_aspect has param = xxx on @@//test:t1", + "toolchain_aspect has param = xxx on @@//toolchain:foo with tool in ToolchainInfo =" + " "); } @@ -1395,10 +1395,10 @@ def _rule_impl(ctx): var value = ((StarlarkInfo) configuredAspect.get(providerKey)).getValue("value"); assertThat((Iterable) value) .containsExactly( - "toolchain_aspect on @//test:t1 can see required_aspect (required_aspect on" - + " @//test:t1)", - "toolchain_aspect on @//toolchain:foo can see required_aspect (required_aspect on" - + " @//toolchain:foo with tool in ToolchainInfo = )"); } @@ -1467,9 +1467,9 @@ def _rule_2_impl(ctx): var value = ((StarlarkInfo) configuredTarget.get(providerKey)).getValue("value"); assertThat((Iterable) value) .containsExactly( - "toolchain_aspect on @//test:t2", - "toolchain_aspect on @//toolchain:foo_with_dep", - "toolchain_aspect on @//toolchain:toolchain_dep"); + "toolchain_aspect on @@//test:t2", + "toolchain_aspect on @@//toolchain:foo_with_dep", + "toolchain_aspect on @@//toolchain:toolchain_dep"); } private ImmutableList getAspectKeys(String targetLabel, String aspectLabel) { diff --git a/src/test/java/com/google/devtools/build/lib/starlark/StarlarkDefinedAspectsTest.java b/src/test/java/com/google/devtools/build/lib/starlark/StarlarkDefinedAspectsTest.java index 4006079f183429..afdeb7bc07e5cb 100644 --- a/src/test/java/com/google/devtools/build/lib/starlark/StarlarkDefinedAspectsTest.java +++ b/src/test/java/com/google/devtools/build/lib/starlark/StarlarkDefinedAspectsTest.java @@ -62,7 +62,6 @@ import com.google.devtools.build.lib.skyframe.SkyframeExecutor; import com.google.devtools.build.lib.skyframe.serialization.testutils.RoundTripping; import com.google.devtools.build.lib.testutil.TestRuleClassProvider; -import com.google.devtools.build.lib.vfs.FileSystemUtils; import com.google.devtools.build.lib.vfs.Path; import com.google.devtools.build.skyframe.SkyKey; import com.google.devtools.build.skyframe.SkyValue; @@ -220,10 +219,10 @@ def _impl(target, ctx): @Test public void aspectCommandLineRepoLabel() throws Exception { scratch.overwriteFile( - "WORKSPACE", - scratch.readFile("WORKSPACE"), - "local_repository(name='local', path='local/repo')"); - scratch.file("local/repo/WORKSPACE"); + "MODULE.bazel", + "bazel_dep(name='local')", + "local_path_override(module_name='local', path='local/repo')"); + scratch.file("local/repo/MODULE.bazel", "module(name='local')"); scratch.file( "local/repo/aspect.bzl", """ @@ -240,7 +239,7 @@ def _impl(target, ctx): update(ImmutableList.of("@local//:aspect.bzl%MyAspect"), "//test:xxx"); assertThat(getLabelsToBuild(analysisResult)).containsExactly("//test:xxx"); assertThat(getAspectDescriptions(analysisResult)) - .containsExactly("@@local//:aspect.bzl%MyAspect(//test:xxx)"); + .containsExactly("@@local+//:aspect.bzl%MyAspect(//test:xxx)"); } private static Iterable getLabelsToBuild(AnalysisResult analysisResult) { @@ -783,8 +782,6 @@ def _rule_impl(ctx): @Test public void aspectsDoNotAttachToFiles() throws Exception { - FileSystemUtils.appendIsoLatin1( - scratch.resolve("WORKSPACE"), "bind(name = 'yyy', actual = '//test:zzz.jar')"); scratch.file( "test/aspect.bzl", """ @@ -804,7 +801,7 @@ def _impl(target, ctx): java_library( name = 'xxx', srcs = ['A.java'], - deps = ['//external:yyy'], + deps = ['//test:zzz.jar'], ) """); @@ -814,8 +811,6 @@ def _impl(target, ctx): @Test public void aspectsDoNotAttachToTopLevelFiles() throws Exception { - FileSystemUtils.appendIsoLatin1( - scratch.resolve("WORKSPACE"), "bind(name = 'yyy', actual = '//test:zzz.jar')"); scratch.file( "test/aspect.bzl", """ @@ -836,7 +831,7 @@ def _impl(target, ctx): java_library( name = 'xxx', srcs = ['A.java'], - deps = ['//external:yyy'], + deps = ['//test:zzz.jar'], ) """); @@ -2057,13 +2052,13 @@ public void invalidateAspectOnBzlFileChange() throws Exception { repro_no_aspect(name = 'r1', deps = [':r0']) repro(name = 'r2', deps = [':r1']) """); - buildTargetAndCheckRuleInfo("@//test:r0", "@//test:r1"); + buildTargetAndCheckRuleInfo("@@//test:r0", "@@//test:r1"); // Make aspect propagation list empty. scratch.overwriteFile("test/build_defs.bzl", aspectBzlFile("")); // The aspect should not propagate to //test:r0 anymore. - buildTargetAndCheckRuleInfo("@//test:r1"); + buildTargetAndCheckRuleInfo("@@//test:r1"); } private void buildTargetAndCheckRuleInfo(String... expectedLabels) throws Exception { @@ -2415,8 +2410,8 @@ def _r2_impl(ctx): // "yes" means that aspect a2 sees a1's providers. assertThat(result) .containsExactly( - "@//test:r0[\"//test:aspect.bzl%a1\", \"//test:aspect.bzl%a2\"]=yes", - "@//test:r1[\"//test:aspect.bzl%a2\"]=no"); + "@@//test:r0[\"//test:aspect.bzl%a1\", \"//test:aspect.bzl%a2\"]=yes", + "@@//test:r1[\"//test:aspect.bzl%a2\"]=no"); } /** @@ -2486,10 +2481,10 @@ def _rcollect_impl(ctx): (Sequence) getStarlarkProvider(target, "RCollectInfo").getValue("result"); assertThat(result) .containsExactly( - "@//test:r0[\"//test:aspect.bzl%a1\", \"//test:aspect.bzl%a3\"]=a1p", - "@//test:r1[\"//test:aspect.bzl%a3\"]=", - "@//test:r0[\"//test:aspect.bzl%a2\", \"//test:aspect.bzl%a3\"]=a2p", - "@//test:r2[\"//test:aspect.bzl%a3\"]="); + "@@//test:r0[\"//test:aspect.bzl%a1\", \"//test:aspect.bzl%a3\"]=a1p", + "@@//test:r1[\"//test:aspect.bzl%a3\"]=", + "@@//test:r0[\"//test:aspect.bzl%a2\", \"//test:aspect.bzl%a3\"]=a2p", + "@@//test:r2[\"//test:aspect.bzl%a3\"]="); } /** @@ -2542,8 +2537,9 @@ def _r2_impl(ctx): // "yes" means that aspect a2 sees a1's providers. assertThat(result) .containsExactly( - "@//test:r0[\"//test:aspect.bzl%a2\"]=no", - "@//test:r1[\"//test:aspect.bzl%a2\"]=no", "@//test:r2_1[\"//test:aspect.bzl%a2\"]=no"); + "@@//test:r0[\"//test:aspect.bzl%a2\"]=no", + "@@//test:r1[\"//test:aspect.bzl%a2\"]=no", + "@@//test:r2_1[\"//test:aspect.bzl%a2\"]=no"); } /** Linear aspects-on-aspects with alias rule. */ @@ -2591,8 +2587,8 @@ def _r2_impl(ctx): // "yes" means that aspect a2 sees a1's providers. assertThat(result) .containsExactly( - "@//test:r0[\"//test:aspect.bzl%a1\", \"//test:aspect.bzl%a2\"]=yes", - "@//test:r1[\"//test:aspect.bzl%a2\"]=no"); + "@@//test:r0[\"//test:aspect.bzl%a1\", \"//test:aspect.bzl%a2\"]=yes", + "@@//test:r1[\"//test:aspect.bzl%a2\"]=no"); } @Test @@ -2635,8 +2631,8 @@ def _r_impl(ctx): assertThat(result) .containsExactly( - "@//test:r0[\"//test:aspect.bzl%a\"]=None", - "@//test:r1[\"//test:aspect.bzl%a\"]=@//test:r0[\"//test:aspect.bzl%a\"],True"); + "@@//test:r0[\"//test:aspect.bzl%a\"]=None", + "@@//test:r1[\"//test:aspect.bzl%a\"]=@@//test:r0[\"//test:aspect.bzl%a\"],True"); } @Test @@ -2859,11 +2855,11 @@ def _r2_impl(ctx): StructImpl p3Provider = (StructImpl) configuredAspect.get(p3); assertThat((Sequence) p3Provider.getValue("value")) .containsExactly( - "@//test:r0_1=True", - "@//test:r0_2=True", - "@//test:r0_3=True", - "@//test:r1_1=False", - "@//test:r2_1=False"); + "@@//test:r0_1=True", + "@@//test:r0_2=True", + "@@//test:r0_3=True", + "@@//test:r1_1=False", + "@@//test:r2_1=False"); } /** @@ -2926,7 +2922,7 @@ def _rcollect_impl(ctx): keyForBuild(Label.parseCanonical("//test:aspect.bzl")), "PCollector"); StructImpl pCollectorProvider = (StructImpl) configuredTarget.get(pCollector); assertThat((Sequence) pCollectorProvider.getValue("result")) - .containsExactly("@//test:r1", "@//test:r0", "@//test:r0+PAspect"); + .containsExactly("@@//test:r1", "@@//test:r0", "@@//test:r0+PAspect"); } @Test @@ -3225,7 +3221,7 @@ def _rule_impl(ctx): StarlarkProvider.Key myInfoKey = new StarlarkProvider.Key(keyForBuild(Label.parseCanonical("//test:aspect.bzl")), "MyInfo"); StructImpl myInfo = (StructImpl) configuredAspect.get(myInfoKey); - assertThat(myInfo.getValue("hidden_attr_label")).isEqualTo("@//test:zzz"); + assertThat(myInfo.getValue("hidden_attr_label")).isEqualTo("@@//test:zzz"); } /** Simple straightforward linear aspects-on-aspects. */ @@ -3274,7 +3270,7 @@ def _r2_impl(ctx): ConfiguredTarget target = Iterables.getOnlyElement(analysisResult.getTargetsToBuild()); String result = getStarlarkProvider(target, "RuleInfo").getValue("result", String.class); - assertThat(result).isEqualTo("@//test:zzz"); + assertThat(result).isEqualTo("@@//test:zzz"); } @Test @@ -3732,10 +3728,10 @@ def _rule_with_providers_impl(ctx): // my_aspect does not require any providers so it will be applied to all the dependencies of // main target List expected = new ArrayList<>(); - expected.add("//test:defs.bzl%my_aspect(@//test:target_without_providers)"); - expected.add("//test:defs.bzl%my_aspect(@//test:target_with_providers)"); - expected.add("//test:defs.bzl%my_aspect(@//test:target_with_providers_not_advertised)"); - expected.add("//test:defs.bzl%my_aspect(@//test:target_with_providers_indeps)"); + expected.add("//test:defs.bzl%my_aspect(@@//test:target_without_providers)"); + expected.add("//test:defs.bzl%my_aspect(@@//test:target_with_providers)"); + expected.add("//test:defs.bzl%my_aspect(@@//test:target_with_providers_not_advertised)"); + expected.add("//test:defs.bzl%my_aspect(@@//test:target_with_providers_indeps)"); assertThat(getLabelsToBuild(analysisResult)).containsExactly("//test:main"); ConfiguredTarget target = analysisResult.getTargetsToBuild().iterator().next(); Object ruleDepsUnchecked = getStarlarkProvider(target, "RuleInfo").getValue("rule_deps"); @@ -3851,8 +3847,8 @@ def _rule_with_ab_impl(ctx): // However, my_aspect cannot be propagated to target_with_ab_indeps_not_reached because it was // not applied to its parent (target_with_a) List expected = new ArrayList<>(); - expected.add("//test:defs.bzl%my_aspect(@//test:target_with_ab)"); - expected.add("//test:defs.bzl%my_aspect(@//test:target_with_ab_indeps_reached)"); + expected.add("//test:defs.bzl%my_aspect(@@//test:target_with_ab)"); + expected.add("//test:defs.bzl%my_aspect(@@//test:target_with_ab_indeps_reached)"); assertThat(getLabelsToBuild(analysisResult)).containsExactly("//test:main"); ConfiguredTarget target = analysisResult.getTargetsToBuild().iterator().next(); Object ruleDepsUnchecked = getStarlarkProvider(target, "RuleInfo").getValue("rule_deps"); @@ -3983,9 +3979,9 @@ def _rule_with_ab_impl(ctx): // However, my_aspect cannot be propagated to target_with_c_indeps_not_reached because it was // not applied to its parent (target_with_a) List expected = new ArrayList<>(); - expected.add("//test:defs.bzl%my_aspect(@//test:target_with_ab)"); - expected.add("//test:defs.bzl%my_aspect(@//test:target_with_c)"); - expected.add("//test:defs.bzl%my_aspect(@//test:target_with_c_indeps_reached)"); + expected.add("//test:defs.bzl%my_aspect(@@//test:target_with_ab)"); + expected.add("//test:defs.bzl%my_aspect(@@//test:target_with_c)"); + expected.add("//test:defs.bzl%my_aspect(@@//test:target_with_c_indeps_reached)"); assertThat(getLabelsToBuild(analysisResult)).containsExactly("//test:main"); ConfiguredTarget target = analysisResult.getTargetsToBuild().iterator().next(); Object ruleDepsUnchecked = getStarlarkProvider(target, "RuleInfo").getValue("rule_deps"); @@ -4079,10 +4075,10 @@ def _my_rule_impl(ctx): StructImpl aResultProvider = (StructImpl) aspectA.get(aResult); assertThat((Sequence) aResultProvider.getValue("val")) .containsExactly( - "aspect_c runs on target @//test:dep_target_a", - "aspect_a runs on target @//test:dep_target_a", - "aspect_c runs on target @//test:main_target", - "aspect_a runs on target @//test:main_target"); + "aspect_c runs on target @@//test:dep_target_a", + "aspect_a runs on target @@//test:dep_target_a", + "aspect_c runs on target @@//test:main_target", + "aspect_a runs on target @@//test:main_target"); // aspect_b should run on main_target and dep_target_b and can retrieve aspect_c provider value // on both of them @@ -4093,10 +4089,10 @@ def _my_rule_impl(ctx): StructImpl bResultProvider = (StructImpl) aspectB.get(bResult); assertThat((Sequence) bResultProvider.getValue("val")) .containsExactly( - "aspect_c runs on target @//test:dep_target_b", - "aspect_b runs on target @//test:dep_target_b", - "aspect_c runs on target @//test:main_target", - "aspect_b runs on target @//test:main_target"); + "aspect_c runs on target @@//test:dep_target_b", + "aspect_b runs on target @@//test:dep_target_b", + "aspect_c runs on target @@//test:main_target", + "aspect_b runs on target @@//test:main_target"); } @Test @@ -4234,10 +4230,10 @@ def _rule_with_prov_c_impl(ctx): StructImpl aResultProvider = (StructImpl) aspectA.get(aResult); assertThat((Sequence) aResultProvider.getValue("val")) .containsExactly( - "aspect_c runs on target @//test:dep_target_with_prov_c", - "aspect_a runs on target @//test:dep_target_with_prov_c", - "aspect_a runs on target @//test:dep_target_with_prov_a", - "aspect_a runs on target @//test:main_target"); + "aspect_c runs on target @@//test:dep_target_with_prov_c", + "aspect_a runs on target @@//test:dep_target_with_prov_c", + "aspect_a runs on target @@//test:dep_target_with_prov_a", + "aspect_a runs on target @@//test:main_target"); // aspect_b runs on main_target, dep_target_with_prov_b and dep_target_with_prov_c and it can // only retrieve aspect_c provider value on dep_target_with_prov_c @@ -4249,10 +4245,10 @@ def _rule_with_prov_c_impl(ctx): StructImpl bResultProvider = (StructImpl) aspectB.get(bResult); assertThat((Sequence) bResultProvider.getValue("val")) .containsExactly( - "aspect_c runs on target @//test:dep_target_with_prov_c", - "aspect_b runs on target @//test:dep_target_with_prov_c", - "aspect_b runs on target @//test:dep_target_with_prov_b", - "aspect_b runs on target @//test:main_target"); + "aspect_c runs on target @@//test:dep_target_with_prov_c", + "aspect_b runs on target @@//test:dep_target_with_prov_c", + "aspect_b runs on target @@//test:dep_target_with_prov_b", + "aspect_b runs on target @@//test:main_target"); } @Test @@ -4370,10 +4366,10 @@ def _rule_3_impl(ctx): StructImpl provA = (StructImpl) target1.get(provAkey); assertThat((Sequence) provA.getValue("val")) .containsExactly( - "aspect_c runs on target @//test:dep_1 and param = rule_1_val", - "aspect_a runs on target @//test:dep_1", - "aspect_c runs on target @//test:dep_3 and param = rule_1_val", - "aspect_a runs on target @//test:dep_3"); + "aspect_c runs on target @@//test:dep_1 and param = rule_1_val", + "aspect_a runs on target @@//test:dep_1", + "aspect_c runs on target @@//test:dep_3 and param = rule_1_val", + "aspect_a runs on target @@//test:dep_3"); // aspect_b runs on dep_2 and dep_3 and it can retrieve aspect_c provider value on them. // aspect_c here should get its parameter value from rule_2 @@ -4383,10 +4379,10 @@ def _rule_3_impl(ctx): StructImpl provB = (StructImpl) target2.get(provBkey); assertThat((Sequence) provB.getValue("val")) .containsExactly( - "aspect_c runs on target @//test:dep_2 and param = rule_2_val", - "aspect_b runs on target @//test:dep_2", - "aspect_c runs on target @//test:dep_3 and param = rule_2_val", - "aspect_b runs on target @//test:dep_3"); + "aspect_c runs on target @@//test:dep_2 and param = rule_2_val", + "aspect_b runs on target @@//test:dep_2", + "aspect_c runs on target @@//test:dep_3 and param = rule_2_val", + "aspect_b runs on target @@//test:dep_3"); } @Test @@ -4445,9 +4441,9 @@ def _my_rule_impl(ctx): StructImpl aResultProvider = (StructImpl) aspectA.get(aResult); assertThat((Sequence) aResultProvider.getValue("val")) .containsExactly( - "aspect_a on target @//test:main_target cannot see native aspect provider", - "aspect_a on target @//test:dep_1 cannot see native aspect provider", - "aspect_a on target @//test:dep_2 can see native aspect provider"); + "aspect_a on target @@//test:main_target cannot see native aspect provider", + "aspect_a on target @@//test:dep_1 cannot see native aspect provider", + "aspect_a on target @@//test:dep_2 can see native aspect provider"); } @Test @@ -4526,18 +4522,18 @@ def _dep_rule_impl(ctx): keyForBuild(Label.parseCanonical("//test:defs.bzl")), "RequiredAspectProv"); StructImpl requiredAspectProvider = (StructImpl) configuredTarget.get(requiredAspectProv); assertThat(requiredAspectProvider.getValue("p1_val")) - .isEqualTo("In required_aspect, p1 = p1_v1 on target @//test:dep_target"); + .isEqualTo("In required_aspect, p1 = p1_v1 on target @@//test:dep_target"); assertThat(requiredAspectProvider.getValue("p2_val")) - .isEqualTo("In required_aspect, p2 not found on target @//test:dep_target"); + .isEqualTo("In required_aspect, p2 not found on target @@//test:dep_target"); StarlarkProvider.Key baseAspectProv = new StarlarkProvider.Key( keyForBuild(Label.parseCanonical("//test:defs.bzl")), "BaseAspectProv"); StructImpl baseAspectProvider = (StructImpl) configuredTarget.get(baseAspectProv); assertThat(baseAspectProvider.getValue("p1_val")) - .isEqualTo("In base_aspect, p1 not found on target @//test:dep_target"); + .isEqualTo("In base_aspect, p1 not found on target @@//test:dep_target"); assertThat(baseAspectProvider.getValue("p2_val")) - .isEqualTo("In base_aspect, p2 = p2_v1 on target @//test:dep_target"); + .isEqualTo("In base_aspect, p2 = p2_v1 on target @@//test:dep_target"); } @Test @@ -4607,14 +4603,14 @@ def _dep_rule_impl(ctx): keyForBuild(Label.parseCanonical("//test:defs.bzl")), "RequiredAspectProv"); StructImpl requiredAspectProvider = (StructImpl) configuredTarget.get(requiredAspectProv); assertThat(requiredAspectProvider.getValue("p_val")) - .isEqualTo("In required_aspect, p = p_v2 on target @//test:dep_target"); + .isEqualTo("In required_aspect, p = p_v2 on target @@//test:dep_target"); StarlarkProvider.Key baseAspectProv = new StarlarkProvider.Key( keyForBuild(Label.parseCanonical("//test:defs.bzl")), "BaseAspectProv"); StructImpl baseAspectProvider = (StructImpl) configuredTarget.get(baseAspectProv); assertThat(baseAspectProvider.getValue("p_val")) - .isEqualTo("In base_aspect, p = p_v2 on target @//test:dep_target"); + .isEqualTo("In base_aspect, p = p_v2 on target @@//test:dep_target"); } @Test @@ -4725,15 +4721,15 @@ def _dep_rule_impl(ctx): StructImpl baseAspectProvider = (StructImpl) configuredTarget.get(baseAspectProv); assertThat((Sequence) baseAspectProvider.getValue("result")) .containsExactly( - "second_required_aspect run on target @//test:second_dep_target", - "second_required_aspect run on target @//test:dep_target", - "second_required_aspect run on target @//test:first_dep_target", - "first_required_aspect run on target @//test:first_dep_target", - "first_required_aspect run on target @//test:dep_target", - "second_required_aspect run on target @//test:base_dep_target", - "first_required_aspect run on target @//test:base_dep_target", - "base_aspect run on target @//test:base_dep_target", - "base_aspect run on target @//test:dep_target"); + "second_required_aspect run on target @@//test:second_dep_target", + "second_required_aspect run on target @@//test:dep_target", + "second_required_aspect run on target @@//test:first_dep_target", + "first_required_aspect run on target @@//test:first_dep_target", + "first_required_aspect run on target @@//test:dep_target", + "second_required_aspect run on target @@//test:base_dep_target", + "first_required_aspect run on target @@//test:base_dep_target", + "base_aspect run on target @@//test:base_dep_target", + "base_aspect run on target @@//test:dep_target"); } @Test @@ -4853,9 +4849,9 @@ public void testAspectRequiresAspect_inheritRequiredProviders() throws Exception StructImpl collectorProvider = (StructImpl) configuredTarget.get(collectorProv); assertThat((Sequence) collectorProvider.getValue("result")) .containsExactly( - "aspect_c run on target @//test:target_with_prov_c and value of Prov_C = val_c", - "aspect_b run on target @//test:target_with_prov_b and value of Prov_B = val_b", - "aspect_a run on target @//test:target_with_prov_a and value of Prov_A = val_a") + "aspect_c run on target @@//test:target_with_prov_c and value of Prov_C = val_c", + "aspect_b run on target @@//test:target_with_prov_b and value of Prov_B = val_b", + "aspect_a run on target @@//test:target_with_prov_a and value of Prov_A = val_a") .inOrder(); } @@ -5083,10 +5079,11 @@ def _dep_rule_impl(ctx): StarlarkInfo targetInfo = getStarlarkProvider(configuredTarget, "RuleInfo"); String aspectAResult = targetInfo.getValue("aspect_a_result", String.class); assertThat(aspectAResult) - .isEqualTo("aspect_a on target @//test:dep_target found prov_a = a1 and found prov_b = b1"); + .isEqualTo( + "aspect_a on target @@//test:dep_target found prov_a = a1 and found prov_b = b1"); String aspectBResult = targetInfo.getValue("aspect_b_result", String.class); - assertThat(aspectBResult).isEqualTo("aspect_b on target @//test:dep_target found prov_b = b1"); + assertThat(aspectBResult).isEqualTo("aspect_b on target @@//test:dep_target found prov_b = b1"); } @Test @@ -5169,10 +5166,11 @@ def _dep_rule_impl(ctx): Iterables.getOnlyElement(analysisResult.getTargetsToBuild()); StarlarkInfo ruleInfo = getStarlarkProvider(configuredTarget, "RuleInfo"); String aspectAResult = ruleInfo.getValue("aspect_a_result", String.class); - assertThat(aspectAResult).isEqualTo("aspect_a on target @//test:dep_target found prov_a = a1"); + assertThat(aspectAResult).isEqualTo("aspect_a on target @@//test:dep_target found prov_a = a1"); String aspectBResult = ruleInfo.getValue("aspect_b_result", String.class); - assertThat(aspectBResult).isEqualTo("aspect_b on target @//test:dep_target cannot find prov_b"); + assertThat(aspectBResult) + .isEqualTo("aspect_b on target @@//test:dep_target cannot find prov_b"); } /** @@ -5293,8 +5291,8 @@ def _simple_rule_impl(ctx): StructImpl a3ResultProvider = (StructImpl) a3.get(a3Result); assertThat((Sequence) a3ResultProvider.getValue("value")) .containsExactly( - "aspect a3 on target @//test:dep_target cannot see a1p and cannot see a2p", - "aspect a3 on target @//test:main cannot see a1p and cannot see a2p"); + "aspect a3 on target @@//test:dep_target cannot see a1p and cannot see a2p", + "aspect a3 on target @@//test:main cannot see a1p and cannot see a2p"); ConfiguredAspect a2 = getConfiguredAspect(configuredAspects, "a2"); assertThat(a2).isNotNull(); @@ -5303,8 +5301,8 @@ def _simple_rule_impl(ctx): StructImpl a2ResultProvider = (StructImpl) a2.get(a2Result); assertThat((Sequence) a2ResultProvider.getValue("value")) .containsExactly( - "aspect a2 on target @//test:dep_target cannot see a1p and sees a2p = a2p_val", - "aspect a2 on target @//test:main cannot see a1p and sees a2p = a2p_val"); + "aspect a2 on target @@//test:dep_target cannot see a1p and sees a2p = a2p_val", + "aspect a2 on target @@//test:main cannot see a1p and sees a2p = a2p_val"); ConfiguredAspect a1 = getConfiguredAspect(configuredAspects, "a1"); assertThat(a1).isNotNull(); @@ -5313,8 +5311,8 @@ def _simple_rule_impl(ctx): StructImpl a1ResultProvider = (StructImpl) a1.get(a1Result); assertThat((Sequence) a1ResultProvider.getValue("value")) .containsExactly( - "aspect a1 on target @//test:dep_target sees a1p = a1p_val and cannot see a2p", - "aspect a1 on target @//test:main sees a1p = a1p_val and cannot see a2p"); + "aspect a1 on target @@//test:dep_target sees a1p = a1p_val and cannot see a2p", + "aspect a1 on target @@//test:main sees a1p = a1p_val and cannot see a2p"); } /** @@ -5486,8 +5484,8 @@ def _simple_rule_impl(ctx): StructImpl a1ResultProvider = (StructImpl) a1.get(a1Result); assertThat((Sequence) a1ResultProvider.getValue("value")) .containsExactly( - "aspect a1 on target @//test:dep_target sees a1p = a1p_a3_val", - "aspect a1 on target @//test:main sees a1p = a1p_a3_val"); + "aspect a1 on target @@//test:dep_target sees a1p = a1p_a3_val", + "aspect a1 on target @@//test:main sees a1p = a1p_a3_val"); } @Test @@ -5558,8 +5556,8 @@ def _simple_rule_impl(ctx): StructImpl a1ResultProvider = (StructImpl) a1.get(a1Result); assertThat((Sequence) a1ResultProvider.getValue("value")) .containsExactly( - "aspect a1 on target @//test:dep_target cannot see a1p", - "aspect a1 on target @//test:main cannot see a1p"); + "aspect a1 on target @@//test:dep_target cannot see a1p", + "aspect a1 on target @@//test:main cannot see a1p"); } /** @@ -5633,8 +5631,8 @@ def _simple_rule_impl(ctx): StructImpl a1ResultProvider = (StructImpl) a1.get(a1Result); assertThat((Sequence) a1ResultProvider.getValue("value")) .containsExactly( - "aspect a1 on target @//test:dep_target cannot see a1p", - "aspect a1 on target @//test:main cannot see a1p"); + "aspect a1 on target @@//test:dep_target cannot see a1p", + "aspect a1 on target @@//test:main cannot see a1p"); } /** @@ -5714,9 +5712,9 @@ def _simple_rule_impl(ctx): StructImpl a1ResultProvider = (StructImpl) a1.get(a1Result); assertThat((Sequence) a1ResultProvider.getValue("value")) .containsExactly( - "aspect a1 on target @//test:dep_target sees a1p = a1p_val", - "aspect a1 on target @//test:extra_dep_target cannot see a1p", - "aspect a1 on target @//test:main sees a1p = a1p_val"); + "aspect a1 on target @@//test:dep_target sees a1p = a1p_val", + "aspect a1 on target @@//test:extra_dep_target cannot see a1p", + "aspect a1 on target @@//test:main sees a1p = a1p_val"); } /** @@ -5812,9 +5810,9 @@ def _rule_with_prov_b_impl(ctx): StructImpl a1ResultProvider = (StructImpl) a1.get(a1Result); assertThat((Sequence) a1ResultProvider.getValue("value")) .containsExactly( - "aspect a1 on target @//test:target_with_prov_a sees a1p = a1p_val", - "aspect a1 on target @//test:target_with_prov_b cannot see a1p", - "aspect a1 on target @//test:main sees a1p = a1p_val"); + "aspect a1 on target @@//test:target_with_prov_a sees a1p = a1p_val", + "aspect a1 on target @@//test:target_with_prov_b cannot see a1p", + "aspect a1 on target @@//test:main sees a1p = a1p_val"); } /** @@ -5909,8 +5907,8 @@ def _simple_rule_impl(ctx): StructImpl a2ResultProvider = (StructImpl) a2.get(a2Result); assertThat((Sequence) a2ResultProvider.getValue("value")) .containsExactly( - "aspect a2 on target @//test:dep_target sees a3p = a3p_val", - "aspect a2 on target @//test:main sees a3p = a3p_val"); + "aspect a2 on target @@//test:dep_target sees a3p = a3p_val", + "aspect a2 on target @@//test:main sees a3p = a3p_val"); ConfiguredAspect a1 = getConfiguredAspect(configuredAspects, "a1"); assertThat(a1).isNotNull(); @@ -5919,8 +5917,8 @@ def _simple_rule_impl(ctx): StructImpl a1ResultProvider = (StructImpl) a1.get(a1Result); assertThat((Sequence) a1ResultProvider.getValue("value")) .containsExactly( - "aspect a1 on target @//test:dep_target sees a3p = a3p_val", - "aspect a1 on target @//test:main sees a3p = a3p_val"); + "aspect a1 on target @@//test:dep_target sees a3p = a3p_val", + "aspect a1 on target @@//test:main sees a3p = a3p_val"); } /** @@ -6044,11 +6042,11 @@ def _r2_impl(ctx): StructImpl a3ResultProvider = (StructImpl) a3.get(a3Result); assertThat((Sequence) a3ResultProvider.getValue("value")) .containsExactly( - "aspect a3 on target @//test:t0 sees a1p = a1p_val and cannot see a2p", - "aspect a3 on target @//test:t0 cannot see a1p and sees a2p = a2p_val", - "aspect a3 on target @//test:t1 sees a1p = a1p_val and cannot see a2p", - "aspect a3 on target @//test:t2 cannot see a1p and sees a2p = a2p_val", - "aspect a3 on target @//test:main sees a1p = a1p_val and sees a2p = a2p_val"); + "aspect a3 on target @@//test:t0 sees a1p = a1p_val and cannot see a2p", + "aspect a3 on target @@//test:t0 cannot see a1p and sees a2p = a2p_val", + "aspect a3 on target @@//test:t1 sees a1p = a1p_val and cannot see a2p", + "aspect a3 on target @@//test:t2 cannot see a1p and sees a2p = a2p_val", + "aspect a3 on target @@//test:main sees a1p = a1p_val and sees a2p = a2p_val"); } @Test @@ -6199,8 +6197,8 @@ def _simple_rule_impl(ctx): StructImpl a1ResultProvider = (StructImpl) a1.get(a1Result); assertThat((Sequence) a1ResultProvider.getValue("value")) .containsExactly( - "aspect a1 on target @//test:dep_target sees a2p = a2p_val", - "aspect a1 on target @//test:main cannot see a2p"); + "aspect a1 on target @@//test:dep_target sees a2p = a2p_val", + "aspect a1 on target @@//test:main cannot see a2p"); } @Test @@ -6268,13 +6266,13 @@ def _simple_rule_impl(ctx): new StarlarkProvider.Key(keyForBuild(Label.parseCanonical("//test:defs.bzl")), "a1_result"); StructImpl a1ResultProvider = (StructImpl) a1Ont1.get(a1Result); assertThat((Sequence) a1ResultProvider.getValue("value")) - .containsExactly("aspect a1 on target @//test:t1 sees a2p = a2p_val"); + .containsExactly("aspect a1 on target @@//test:t1 sees a2p = a2p_val"); ConfiguredAspect a1Ont2 = getConfiguredAspect(configuredAspects, "a1", "t2"); assertThat(a1Ont2).isNotNull(); a1ResultProvider = (StructImpl) a1Ont2.get(a1Result); assertThat((Sequence) a1ResultProvider.getValue("value")) - .containsExactly("aspect a1 on target @//test:t2 sees a2p = a2p_val"); + .containsExactly("aspect a1 on target @@//test:t2 sees a2p = a2p_val"); } @Test @@ -6359,8 +6357,8 @@ def _simple_rule_impl(ctx): StructImpl a1ResultProvider = (StructImpl) a1.get(a1Result); assertThat((Sequence) a1ResultProvider.getValue("value")) .containsExactly( - "aspect a1 on target @//test:dep_target sees a2p = a2p_val and sees a3p = a3p_val", - "aspect a1 on target @//test:main sees a2p = a2p_val and sees a3p = a3p_val"); + "aspect a1 on target @@//test:dep_target sees a2p = a2p_val and sees a3p = a3p_val", + "aspect a1 on target @@//test:main sees a2p = a2p_val and sees a3p = a3p_val"); } @Test @@ -6457,8 +6455,8 @@ def _simple_rule_impl(ctx): StructImpl a1ResultProvider = (StructImpl) a1.get(a1Result); assertThat((Sequence) a1ResultProvider.getValue("value")) .containsExactly( - "aspect a1 on target @//test:dep_target sees a2p = a2p_val and sees a3p = a3p_val", - "aspect a1 on target @//test:main sees a2p = a2p_val and sees a3p = a3p_val"); + "aspect a1 on target @@//test:dep_target sees a2p = a2p_val and sees a3p = a3p_val", + "aspect a1 on target @@//test:main sees a2p = a2p_val and sees a3p = a3p_val"); ConfiguredAspect a2 = getConfiguredAspect(configuredAspects, "a2"); assertThat(a2).isNotNull(); @@ -6467,8 +6465,8 @@ def _simple_rule_impl(ctx): StructImpl a2ResultProvider = (StructImpl) a2.get(a2Result); assertThat((Sequence) a2ResultProvider.getValue("value")) .containsExactly( - "aspect a2 on target @//test:dep_target sees a3p = a3p_val", - "aspect a2 on target @//test:main sees a3p = a3p_val"); + "aspect a2 on target @@//test:dep_target sees a3p = a3p_val", + "aspect a2 on target @@//test:main sees a3p = a3p_val"); } /** @@ -6734,7 +6732,7 @@ def _rule_impl(ctx): keyForBuild(Label.parseCanonical("//test:defs.bzl")), "RequiredAspectProv"); StructImpl requiredAspectProvider = (StructImpl) requiredAspect.get(requiredAspectProv); assertThat((Sequence) requiredAspectProvider.getValue("p_val")) - .containsExactly("In required_aspect, p = main_val on target @//test:main_target"); + .containsExactly("In required_aspect, p = main_val on target @@//test:main_target"); // base_aspect can run on main_target and dep_target and it can also see the providers created // by running required_target on them. @@ -6746,10 +6744,10 @@ def _rule_impl(ctx): StructImpl baseAspectProvider = (StructImpl) baseAspect.get(baseAspectProv); assertThat((Sequence) baseAspectProvider.getValue("p_val")) .containsExactly( - "In base_aspect, p = dep_val on target @//test:dep_target", - "In base_aspect, p = main_val on target @//test:main_target", - "In required_aspect, p = dep_val on target @//test:dep_target", - "In required_aspect, p = main_val on target @//test:main_target"); + "In base_aspect, p = dep_val on target @@//test:dep_target", + "In base_aspect, p = main_val on target @@//test:main_target", + "In required_aspect, p = dep_val on target @@//test:dep_target", + "In required_aspect, p = main_val on target @@//test:main_target"); } @Test @@ -6849,15 +6847,15 @@ def _my_rule_impl(ctx): StructImpl baseAspectProvider = (StructImpl) baseAspect.get(baseAspectProv); assertThat((Sequence) baseAspectProvider.getValue("result")) .containsExactly( - "second_required_aspect run on target @//test:second_dep_target", - "second_required_aspect run on target @//test:main_target", - "second_required_aspect run on target @//test:first_dep_target", - "second_required_aspect run on target @//test:base_dep_target", - "first_required_aspect run on target @//test:first_dep_target", - "first_required_aspect run on target @//test:main_target", - "first_required_aspect run on target @//test:base_dep_target", - "base_aspect run on target @//test:base_dep_target", - "base_aspect run on target @//test:main_target"); + "second_required_aspect run on target @@//test:second_dep_target", + "second_required_aspect run on target @@//test:main_target", + "second_required_aspect run on target @@//test:first_dep_target", + "second_required_aspect run on target @@//test:base_dep_target", + "first_required_aspect run on target @@//test:first_dep_target", + "first_required_aspect run on target @@//test:main_target", + "first_required_aspect run on target @@//test:base_dep_target", + "base_aspect run on target @@//test:base_dep_target", + "base_aspect run on target @@//test:main_target"); } @Test @@ -6982,10 +6980,10 @@ def _rule_with_prov_c_impl(ctx): StructImpl collectorProvider = (StructImpl) aspectA.get(collectorProv); assertThat((Sequence) collectorProvider.getValue("result")) .containsExactly( - "aspect_c run on target @//test:target_with_prov_c and value of Prov_C = val_c", - "aspect_b run on target @//test:target_with_prov_b and value of Prov_B = val_b", - "aspect_a run on target @//test:target_with_prov_a and value of Prov_A = val_a", - "aspect_a run on target @//test:main_target and value of Prov_A = main_val_a") + "aspect_c run on target @@//test:target_with_prov_c and value of Prov_C = val_c", + "aspect_b run on target @@//test:target_with_prov_b and value of Prov_B = val_b", + "aspect_a run on target @@//test:target_with_prov_a and value of Prov_A = val_a", + "aspect_a run on target @@//test:main_target and value of Prov_A = main_val_a") .inOrder(); } @@ -7189,12 +7187,13 @@ def _my_rule_impl(ctx): String aspectAResult = (String) aspectA.get("aspect_a_result"); assertThat(aspectAResult) .isEqualTo( - "aspect_a on target @//test:main_target found prov_a = a1 and found prov_b = b1"); + "aspect_a on target @@//test:main_target found prov_a = a1 and found prov_b = b1"); ConfiguredAspect aspectB = getConfiguredAspect(configuredAspects, "aspect_b"); assertThat(aspectB).isNotNull(); String aspectBResult = (String) aspectB.get("aspect_b_result"); - assertThat(aspectBResult).isEqualTo("aspect_b on target @//test:main_target found prov_b = b1"); + assertThat(aspectBResult) + .isEqualTo("aspect_b on target @@//test:main_target found prov_b = b1"); } @Test @@ -7265,13 +7264,14 @@ def _my_rule_impl(ctx): ConfiguredAspect aspectA = getConfiguredAspect(configuredAspects, "aspect_a"); assertThat(aspectA).isNotNull(); String aspectAResult = (String) aspectA.get("aspect_a_result"); - assertThat(aspectAResult).isEqualTo("aspect_a on target @//test:main_target found prov_a = a1"); + assertThat(aspectAResult) + .isEqualTo("aspect_a on target @@//test:main_target found prov_a = a1"); ConfiguredAspect aspectB = getConfiguredAspect(configuredAspects, "aspect_b"); assertThat(aspectB).isNotNull(); String aspectBResult = (String) aspectB.get("aspect_b_result"); assertThat(aspectBResult) - .isEqualTo("aspect_b on target @//test:main_target cannot find prov_b"); + .isEqualTo("aspect_b on target @@//test:main_target cannot find prov_b"); } @Test @@ -7327,7 +7327,7 @@ public void testDependentAspectWithNonExecutableTool_doesNotCrash() throws Excep StarlarkProvider.Key provA = new StarlarkProvider.Key(keyForBuild(Label.parseCanonical("//test:defs.bzl")), "AInfo"); - assertThat(((StructImpl) aspectA.get(provA)).getValue("value")).isEqualTo("@//test:lib"); + assertThat(((StructImpl) aspectA.get(provA)).getValue("value")).isEqualTo("@@//test:lib"); } @Test @@ -7399,18 +7399,18 @@ def _my_rule_impl(ctx): StarlarkList aspectAResult = (StarlarkList) aspectA.get("aspect_a_result"); assertThat(Starlark.toIterable(aspectAResult)) .containsExactly( - "aspect_a on target @//test:main_target, p1 = p1_v1 and a_p = a_p_v1", - "aspect_a on target @//test:dep_target_1, p1 = p1_v1 and a_p = a_p_v1", - "aspect_a on target @//test:dep_target_2, p1 = p1_v1 and a_p = a_p_v1"); + "aspect_a on target @@//test:main_target, p1 = p1_v1 and a_p = a_p_v1", + "aspect_a on target @@//test:dep_target_1, p1 = p1_v1 and a_p = a_p_v1", + "aspect_a on target @@//test:dep_target_2, p1 = p1_v1 and a_p = a_p_v1"); ConfiguredAspect aspectB = getConfiguredAspect(configuredAspects, "aspect_b"); assertThat(aspectB).isNotNull(); StarlarkList aspectBResult = (StarlarkList) aspectB.get("aspect_b_result"); assertThat(Starlark.toIterable(aspectBResult)) .containsExactly( - "aspect_b on target @//test:main_target, p1 = p1_v1 and b_p = b_p_v1", - "aspect_b on target @//test:dep_target_1, p1 = p1_v1 and b_p = b_p_v1", - "aspect_b on target @//test:dep_target_2, p1 = p1_v1 and b_p = b_p_v1"); + "aspect_b on target @@//test:main_target, p1 = p1_v1 and b_p = b_p_v1", + "aspect_b on target @@//test:dep_target_1, p1 = p1_v1 and b_p = b_p_v1", + "aspect_b on target @@//test:dep_target_2, p1 = p1_v1 and b_p = b_p_v1"); } @Test @@ -7547,9 +7547,9 @@ def _my_rule_impl(ctx): StarlarkList aspectAResult = (StarlarkList) aspectA.get("aspect_a_result"); assertThat(Starlark.toIterable(aspectAResult)) .containsExactly( - "aspect_a on target @//test:main_target, p1 = p1_v2 and p2 = p2_v1", - "aspect_a on target @//test:dep_target_1, p1 = p1_v2 and p2 = p2_v1", - "aspect_a on target @//test:dep_target_2, p1 = p1_v2 and p2 = p2_v1"); + "aspect_a on target @@//test:main_target, p1 = p1_v2 and p2 = p2_v1", + "aspect_a on target @@//test:dep_target_1, p1 = p1_v2 and p2 = p2_v1", + "aspect_a on target @@//test:dep_target_2, p1 = p1_v2 and p2 = p2_v1"); } @Test @@ -7622,18 +7622,18 @@ def _my_rule_impl(ctx): StarlarkList aspectAResult = (StarlarkList) aspectA.get("aspect_a_result"); assertThat(Starlark.toIterable(aspectAResult)) .containsExactly( - "aspect_a on target @//test:main_target, p1 = p1_v1 and p2 = p2_v2", - "aspect_a on target @//test:dep_target_1, p1 = p1_v1 and p2 = p2_v2", - "aspect_a on target @//test:dep_target_2, p1 = p1_v1 and p2 = p2_v2"); + "aspect_a on target @@//test:main_target, p1 = p1_v1 and p2 = p2_v2", + "aspect_a on target @@//test:dep_target_1, p1 = p1_v1 and p2 = p2_v2", + "aspect_a on target @@//test:dep_target_2, p1 = p1_v1 and p2 = p2_v2"); ConfiguredAspect aspectB = getConfiguredAspect(configuredAspects, "aspect_b"); assertThat(aspectB).isNotNull(); StarlarkList aspectBResult = (StarlarkList) aspectB.get("aspect_b_result"); assertThat(Starlark.toIterable(aspectBResult)) .containsExactly( - "aspect_b on target @//test:main_target, p1 = p1_v1 and p3 = p3_v3", - "aspect_b on target @//test:dep_target_1, p1 = p1_v1 and p3 = p3_v3", - "aspect_b on target @//test:dep_target_2, p1 = p1_v1 and p3 = p3_v3"); + "aspect_b on target @@//test:main_target, p1 = p1_v1 and p3 = p3_v3", + "aspect_b on target @@//test:dep_target_1, p1 = p1_v1 and p3 = p3_v3", + "aspect_b on target @@//test:dep_target_2, p1 = p1_v1 and p3 = p3_v3"); } @Test @@ -7964,9 +7964,9 @@ def _my_rule_impl(ctx): StarlarkList aspectAResult = (StarlarkList) aspectA.get("aspect_a_result"); assertThat(Starlark.toIterable(aspectAResult)) .containsExactly( - "aspect_a on target @//test:main_target, p = p_v", - "aspect_a on target @//test:dep_target_1, p = p_v", - "aspect_a on target @//test:dep_target_2, p = p_v"); + "aspect_a on target @@//test:main_target, p = p_v", + "aspect_a on target @@//test:dep_target_1, p = p_v", + "aspect_a on target @@//test:dep_target_2, p = p_v"); } /** @@ -8338,7 +8338,7 @@ def _rule_impl(ctx): StarlarkList ruleResult = (StarlarkList) getStarlarkProvider(configuredTarget, "RuleInfo").getValue("my_rule_result"); assertThat(Starlark.toIterable(ruleResult)) - .containsExactly("my_aspect on target @//test:dep_target, my_attr = 1"); + .containsExactly("my_aspect on target @@//test:dep_target, my_attr = 1"); } @Test @@ -8388,7 +8388,7 @@ def _rule_impl(ctx): StarlarkList ruleResult = (StarlarkList) getStarlarkProvider(configuredTarget, "RuleInfo").getValue("my_rule_result"); assertThat(Starlark.toIterable(ruleResult)) - .containsExactly("my_aspect on target @//test:dep_target, my_attr = 2"); + .containsExactly("my_aspect on target @@//test:dep_target, my_attr = 2"); } @Test @@ -8439,7 +8439,7 @@ def _rule_impl(ctx): StarlarkList ruleResult = (StarlarkList) getStarlarkProvider(configuredTarget, "RuleInfo").getValue("my_rule_result"); assertThat(Starlark.toIterable(ruleResult)) - .containsExactly("my_aspect on target @//test:dep_target, my_attr = 3"); + .containsExactly("my_aspect on target @@//test:dep_target, my_attr = 3"); } @Test @@ -8562,9 +8562,9 @@ def _my_rule_impl(ctx): StarlarkList aspectAResult = (StarlarkList) aspectA.get("aspect_a_result"); assertThat(Starlark.toIterable(aspectAResult)) .containsExactly( - "aspect_a on target @//test:main_target, p = 2", - "aspect_a on target @//test:dep_target_1, p = 2", - "aspect_a on target @//test:dep_target_2, p = 2"); + "aspect_a on target @@//test:main_target, p = 2", + "aspect_a on target @@//test:dep_target_1, p = 2", + "aspect_a on target @@//test:dep_target_2, p = 2"); } @Test @@ -8618,9 +8618,9 @@ def _my_rule_impl(ctx): StarlarkList aspectAResult = (StarlarkList) aspectA.get("aspect_a_result"); assertThat(Starlark.toIterable(aspectAResult)) .containsExactly( - "aspect_a on target @//test:main_target, p = 1", - "aspect_a on target @//test:dep_target_1, p = 1", - "aspect_a on target @//test:dep_target_2, p = 1"); + "aspect_a on target @@//test:main_target, p = 1", + "aspect_a on target @@//test:dep_target_1, p = 1", + "aspect_a on target @@//test:dep_target_2, p = 1"); } @Test @@ -8832,7 +8832,7 @@ def _rule_impl(ctx): getStarlarkProvider(configuredTarget, "RuleInfo") .getValue("my_rule_result", StarlarkList.class); assertThat(Starlark.toIterable(ruleResult)) - .containsExactly("my_aspect on target @//test:dep_target, my_attr = True"); + .containsExactly("my_aspect on target @@//test:dep_target, my_attr = True"); } @Test @@ -8882,7 +8882,7 @@ def _rule_impl(ctx): StarlarkList ruleResult = (StarlarkList) getStarlarkProvider(configuredTarget, "RuleInfo").getValue("my_rule_result"); assertThat(Starlark.toIterable(ruleResult)) - .containsExactly("my_aspect on target @//test:dep_target, my_attr = False"); + .containsExactly("my_aspect on target @@//test:dep_target, my_attr = False"); } @Test @@ -8933,7 +8933,7 @@ def _rule_impl(ctx): StarlarkList ruleResult = (StarlarkList) getStarlarkProvider(configuredTarget, "RuleInfo").getValue("my_rule_result"); assertThat(Starlark.toIterable(ruleResult)) - .containsExactly("my_aspect on target @//test:dep_target, my_attr = False"); + .containsExactly("my_aspect on target @@//test:dep_target, my_attr = False"); } @Test @@ -8990,9 +8990,9 @@ def _my_rule_impl(ctx): StarlarkList aspectAResult = (StarlarkList) aspectA.get("aspect_a_result"); assertThat(Starlark.toIterable(aspectAResult)) .containsExactly( - "aspect_a on target @//test:main_target, p = True", - "aspect_a on target @//test:dep_target_1, p = True", - "aspect_a on target @//test:dep_target_2, p = True"); + "aspect_a on target @@//test:main_target, p = True", + "aspect_a on target @@//test:dep_target_1, p = True", + "aspect_a on target @@//test:dep_target_2, p = True"); } @Test @@ -9046,9 +9046,9 @@ def _my_rule_impl(ctx): StarlarkList aspectAResult = (StarlarkList) aspectA.get("aspect_a_result"); assertThat(Starlark.toIterable(aspectAResult)) .containsExactly( - "aspect_a on target @//test:main_target, p = False", - "aspect_a on target @//test:dep_target_1, p = False", - "aspect_a on target @//test:dep_target_2, p = False"); + "aspect_a on target @@//test:main_target, p = False", + "aspect_a on target @@//test:dep_target_1, p = False", + "aspect_a on target @@//test:dep_target_2, p = False"); } @Test @@ -9278,7 +9278,7 @@ def _main_rule_impl(ctx): Iterables.getOnlyElement(analysisResult.getTargetsToBuild()); String aspectAResult = getStarlarkProvider(configuredTarget, "RuleInfo").getValue("aspect_a_result", String.class); - assertThat(aspectAResult).isEqualTo("aspect_a on target @//test:dep_target, p = p_v2"); + assertThat(aspectAResult).isEqualTo("aspect_a on target @@//test:dep_target, p = p_v2"); } @Test @@ -9332,12 +9332,12 @@ def _main_rule_impl(ctx): Iterables.getOnlyElement(analysisResult.getTargetsToBuild()); String aspectAResult = (String) getStarlarkProvider(configuredTarget, "RuleInfo").getValue("aspect_a_result"); - assertThat(aspectAResult).isEqualTo("aspect_a on target @//test:dep_target, p = p_v1"); + assertThat(aspectAResult).isEqualTo("aspect_a on target @@//test:dep_target, p = p_v1"); } @Test public void testAspectLabelIsRepoMapped() throws Exception { - scratch.appendFile("WORKSPACE", "workspace(name = 'my_repo')"); + scratch.overwriteFile("MODULE.bazel", "module(name = 'my_repo')"); scratch.file( "test/aspect.bzl", """ @@ -9579,8 +9579,8 @@ def _r3_impl(ctx): getStarlarkProvider(configuredTarget, "RuleInfo").getValue("aspect_a_collected_result"); assertThat(Starlark.toIterable(aspectAResult)) .containsExactly( - "aspect a on @//test:t4 sees b_provider = aspect b can see c_provider", - "aspect a on @//test:t4 sees b_provider = aspect b cannot see c_provider"); + "aspect a on @@//test:t4 sees b_provider = aspect b can see c_provider", + "aspect a on @@//test:t4 sees b_provider = aspect b cannot see c_provider"); } @Test