Remove Skylark calls to ctx.fragments.cpp fields that depend on CToolchain. This is an intermediate step in migrating to the new Skylark API for the C++ toolchain.
RELNOTES: None.
@@ -1477,14 +1477,14 @@ public class SkylarkDefinedAspectsTest extends AnalysisTestCase {
@Test
public void aspectFragmentAccessSuccess() throws Exception {
getConfiguredTargetForAspectFragment(
- "ctx.fragments.cpp.compiler", "'cpp'", "", "", "");
+ "ctx.fragments.java.strict_java_deps", "'java'", "", "", "");
assertNoEvents();
}
@Test
public void aspectHostFragmentAccessSuccess() throws Exception {
getConfiguredTargetForAspectFragment(
- "ctx.host_fragments.cpp.compiler", "", "'cpp'", "", "");
+ "ctx.host_fragments.java.strict_java_deps", "", "'java'", "", "");
assertNoEvents();
}
@@ -1493,16 +1493,16 @@ public class SkylarkDefinedAspectsTest extends AnalysisTestCase {
reporter.removeHandler(failFastHandler);
try {
getConfiguredTargetForAspectFragment(
- "ctx.fragments.cpp.compiler", "'java'", "'cpp'", "'cpp'", "");
+ "ctx.fragments.java.strict_java_deps", "'cpp'", "'java'", "'java'", "");
fail("update() should have failed");
} catch (ViewCreationFailedException e) {
// expected
}
assertContainsEvent(
- "//test:aspect.bzl%MyAspect aspect on my_rule has to declare 'cpp' as a "
+ "//test:aspect.bzl%MyAspect aspect on my_rule has to declare 'java' as a "
+ "required fragment in target configuration in order to access it. Please update the "
+ "'fragments' argument of the rule definition "
- + "(for example: fragments = [\"cpp\"])");
+ + "(for example: fragments = [\"java\"])");
}
@Test
@@ -1510,16 +1510,16 @@ public class SkylarkDefinedAspectsTest extends AnalysisTestCase {
reporter.removeHandler(failFastHandler);
try {
getConfiguredTargetForAspectFragment(
- "ctx.host_fragments.cpp.compiler", "'cpp'", "'java'", "", "'cpp'");
+ "ctx.host_fragments.java.java_strict_deps", "'java'", "'cpp'", "", "'java'");
fail("update() should have failed");
} catch (ViewCreationFailedException e) {
// expected
}
assertContainsEvent(
- "//test:aspect.bzl%MyAspect aspect on my_rule has to declare 'cpp' as a "
+ "//test:aspect.bzl%MyAspect aspect on my_rule has to declare 'java' as a "
+ "required fragment in host configuration in order to access it. Please update the "
+ "'host_fragments' argument of the rule definition "
- + "(for example: host_fragments = [\"cpp\"])");
+ + "(for example: host_fragments = [\"java\"])");
}
private ConfiguredTarget getConfiguredTargetForAspectFragment(
