The great Skylark -> Starlark class migration: SkylarkModules SkylarkRuleClassFunctions SkylarkRuleContext SkylarkAspect SkylarkDefinedAspect SkylarkExportable SkylarkNativeAspect SkylarkNativeModule SkylarkAspectApi SkylarkNativeModuleApi SkylarkRuleContextApi SkylarkRuleFunctionsApi SkylarkAspectStub FakeSkylarkAspect FakeSkylarkNativeModuleApi FakeSkylarkRuleFunctionsApi SkylarkDefinedAspectsTest SkylarkRuleClassFunctionsTest SkylarkRuleContextTest SkylarkRuleImplementationFunctionsTest SkylarkStringRepresentationsTest SkylarkTestCase PiperOrigin-RevId: 310967362
diff --git a/src/test/java/com/google/devtools/build/docgen/StarlarkDocumentationTest.java b/src/test/java/com/google/devtools/build/docgen/StarlarkDocumentationTest.java index 283ecab..2f87a29 100644 --- a/src/test/java/com/google/devtools/build/docgen/StarlarkDocumentationTest.java +++ b/src/test/java/com/google/devtools/build/docgen/StarlarkDocumentationTest.java
@@ -21,8 +21,8 @@ import com.google.devtools.build.docgen.starlark.StarlarkBuiltinDoc; import com.google.devtools.build.docgen.starlark.StarlarkConstructorMethodDoc; import com.google.devtools.build.docgen.starlark.StarlarkMethodDoc; -import com.google.devtools.build.lib.analysis.skylark.SkylarkModules; -import com.google.devtools.build.lib.analysis.skylark.SkylarkRuleContext; +import com.google.devtools.build.lib.analysis.skylark.StarlarkModules; +import com.google.devtools.build.lib.analysis.skylark.StarlarkRuleContext; import com.google.devtools.build.lib.collect.nestedset.Depset; import com.google.devtools.build.lib.skylarkinterface.Param; import com.google.devtools.build.lib.skylarkinterface.SkylarkCallable; @@ -55,7 +55,7 @@ @Test public void testSkylarkRuleClassBuiltInItemsAreDocumented() throws Exception { ImmutableMap.Builder<String, Object> env = ImmutableMap.builder(); - SkylarkModules.addSkylarkGlobalsToBuilder(env); + StarlarkModules.addStarlarkGlobalsToBuilder(env); checkSkylarkTopLevelEnvItemsAreDocumented(env.build()); } @@ -101,7 +101,7 @@ // TODO(bazel-team): come up with better Starlark specific tests. @Test public void testDirectJavaMethodsAreGenerated() throws Exception { - assertThat(collect(SkylarkRuleContext.class)).isNotEmpty(); + assertThat(collect(StarlarkRuleContext.class)).isNotEmpty(); } /** MockClassA */
diff --git a/src/test/java/com/google/devtools/build/lib/analysis/StarlarkExecGroupTest.java b/src/test/java/com/google/devtools/build/lib/analysis/StarlarkExecGroupTest.java index 2bdcf58..9ded060 100644 --- a/src/test/java/com/google/devtools/build/lib/analysis/StarlarkExecGroupTest.java +++ b/src/test/java/com/google/devtools/build/lib/analysis/StarlarkExecGroupTest.java
@@ -31,7 +31,7 @@ /** * Test for exec groups. Functionality related to rule context tested in {@link - * com.google.devtools.build.lib.skylark.SkylarkRuleContextTest}. + * com.google.devtools.build.lib.skylark.StarlarkRuleContextTest}. */ @RunWith(JUnit4.class) public class StarlarkExecGroupTest extends BuildViewTestCase {
diff --git a/src/test/java/com/google/devtools/build/lib/rules/config/ConfigFeatureFlagTest.java b/src/test/java/com/google/devtools/build/lib/rules/config/ConfigFeatureFlagTest.java index 16d1108..4d1eddb 100644 --- a/src/test/java/com/google/devtools/build/lib/rules/config/ConfigFeatureFlagTest.java +++ b/src/test/java/com/google/devtools/build/lib/rules/config/ConfigFeatureFlagTest.java
@@ -21,11 +21,11 @@ import com.google.common.testing.EqualsTester; import com.google.devtools.build.lib.analysis.ConfiguredRuleClassProvider; import com.google.devtools.build.lib.analysis.ConfiguredTarget; -import com.google.devtools.build.lib.analysis.skylark.SkylarkRuleContext; +import com.google.devtools.build.lib.analysis.skylark.StarlarkRuleContext; import com.google.devtools.build.lib.packages.ConfiguredAttributeMapper; import com.google.devtools.build.lib.packages.Type; import com.google.devtools.build.lib.skyframe.ConfiguredTargetAndData; -import com.google.devtools.build.lib.skylark.util.SkylarkTestCase; +import com.google.devtools.build.lib.skylark.util.StarlarkTestCase; import com.google.devtools.build.lib.testutil.TestRuleClassProvider; import org.junit.Before; import org.junit.Test; @@ -34,7 +34,7 @@ /** Tests for the config_feature_flag rule. */ @RunWith(JUnit4.class) -public final class ConfigFeatureFlagTest extends SkylarkTestCase { +public final class ConfigFeatureFlagTest extends StarlarkTestCase { @Before public void useTrimmedConfigurations() throws Exception { @@ -178,8 +178,8 @@ ConfiguredTarget top = getConfiguredTarget("//test:top"); ConfiguredTarget wrapper = (ConfiguredTarget) Iterables.getOnlyElement(getPrerequisites(top, "deps")); - SkylarkRuleContext ctx = - new SkylarkRuleContext(getRuleContextForStarlark(wrapper), null, getStarlarkSemantics()); + StarlarkRuleContext ctx = + new StarlarkRuleContext(getRuleContextForStarlark(wrapper), null, getStarlarkSemantics()); update("ruleContext", ctx); update("config_common", new ConfigSkylarkCommon()); String value = (String) eval("ruleContext.attr.flag[config_common.FeatureFlagInfo].value"); @@ -230,7 +230,7 @@ " allowed_values = ['default', 'configured', 'other'],", " default_value = 'default',", ")"); - SkylarkRuleContext ctx = createRuleContext("//test:wrapper"); + StarlarkRuleContext ctx = createRuleContext("//test:wrapper"); update("ruleContext", ctx); update("config_common", new ConfigSkylarkCommon()); String provider = "ruleContext.attr.flag[config_common.FeatureFlagInfo]";
diff --git a/src/test/java/com/google/devtools/build/lib/rules/python/PyInfoTest.java b/src/test/java/com/google/devtools/build/lib/rules/python/PyInfoTest.java index 7318fd7..1330c1b 100644 --- a/src/test/java/com/google/devtools/build/lib/rules/python/PyInfoTest.java +++ b/src/test/java/com/google/devtools/build/lib/rules/python/PyInfoTest.java
@@ -20,7 +20,7 @@ import com.google.devtools.build.lib.collect.nestedset.NestedSet; import com.google.devtools.build.lib.collect.nestedset.NestedSetBuilder; import com.google.devtools.build.lib.collect.nestedset.Order; -import com.google.devtools.build.lib.skylark.util.SkylarkTestCase; +import com.google.devtools.build.lib.skylark.util.StarlarkTestCase; import com.google.devtools.build.lib.syntax.Location; import org.junit.Before; import org.junit.Test; @@ -29,7 +29,7 @@ /** Tests for {@link PyInfo}. */ @RunWith(JUnit4.class) -public class PyInfoTest extends SkylarkTestCase { +public class PyInfoTest extends StarlarkTestCase { private Artifact dummyArtifact;
diff --git a/src/test/java/com/google/devtools/build/lib/rules/python/PyRuntimeInfoTest.java b/src/test/java/com/google/devtools/build/lib/rules/python/PyRuntimeInfoTest.java index f2108e1..e9157d0 100644 --- a/src/test/java/com/google/devtools/build/lib/rules/python/PyRuntimeInfoTest.java +++ b/src/test/java/com/google/devtools/build/lib/rules/python/PyRuntimeInfoTest.java
@@ -20,7 +20,7 @@ import com.google.devtools.build.lib.collect.nestedset.NestedSet; import com.google.devtools.build.lib.collect.nestedset.NestedSetBuilder; import com.google.devtools.build.lib.collect.nestedset.Order; -import com.google.devtools.build.lib.skylark.util.SkylarkTestCase; +import com.google.devtools.build.lib.skylark.util.StarlarkTestCase; import com.google.devtools.build.lib.syntax.Location; import com.google.devtools.build.lib.vfs.PathFragment; import org.junit.Before; @@ -30,7 +30,7 @@ /** Tests for {@link PyRuntimeInfo}. */ @RunWith(JUnit4.class) -public class PyRuntimeInfoTest extends SkylarkTestCase { +public class PyRuntimeInfoTest extends StarlarkTestCase { private Artifact dummyInterpreter; private Artifact dummyFile;
diff --git a/src/test/java/com/google/devtools/build/lib/skylark/SkylarkDefinedAspectsTest.java b/src/test/java/com/google/devtools/build/lib/skylark/StarlarkDefinedAspectsTest.java similarity index 99% rename from src/test/java/com/google/devtools/build/lib/skylark/SkylarkDefinedAspectsTest.java rename to src/test/java/com/google/devtools/build/lib/skylark/StarlarkDefinedAspectsTest.java index fa87b2d..f320367 100644 --- a/src/test/java/com/google/devtools/build/lib/skylark/SkylarkDefinedAspectsTest.java +++ b/src/test/java/com/google/devtools/build/lib/skylark/StarlarkDefinedAspectsTest.java
@@ -55,7 +55,7 @@ /** Tests for Starlark aspects */ @RunWith(JUnit4.class) -public class SkylarkDefinedAspectsTest extends AnalysisTestCase { +public class StarlarkDefinedAspectsTest extends AnalysisTestCase { protected boolean keepGoing() { return false; } @@ -468,7 +468,7 @@ } @Test - public void aspectsFromSkylarkRules() throws Exception { + public void aspectsFromStarlarkRules() throws Exception { scratch.file( "test/aspect.bzl", "def _aspect_impl(target, ctx):", @@ -1088,7 +1088,7 @@ } @Test - public void duplicateSkylarkProviders() throws Exception { + public void duplicateStarlarkProviders() throws Exception { scratch.file( "test/aspect.bzl", "def _impl(target, ctx):", @@ -2503,10 +2503,10 @@ } @Test - // This test verifies that aspects which are defined natively and exported for use in skylark + // This test verifies that aspects which are defined natively and exported for use in Starlark // can be referenced at the top level using the --aspects flag. For ease of testing, // apple_common.objc_proto_aspect is used as an example. - public void testTopLevelSkylarkObjcProtoAspect() throws Exception { + public void testTopLevelStarlarkObjcProtoAspect() throws Exception { MockObjcSupport.setupObjcProtoLibrary(scratch); scratch.file("test_skylark/BUILD"); scratch.file("x/data_filter.pbascii"); @@ -3005,9 +3005,9 @@ Label.parseAbsolute("//test:charlie", ImmutableMap.of())); } - /** SkylarkAspectTest with "keep going" flag */ + /** StarlarkAspectTest with "keep going" flag */ @RunWith(JUnit4.class) - public static final class WithKeepGoing extends SkylarkDefinedAspectsTest { + public static final class WithKeepGoing extends StarlarkDefinedAspectsTest { @Override protected FlagBuilder defaultFlags() { return super.defaultFlags().with(Flag.KEEP_GOING);
diff --git a/src/test/java/com/google/devtools/build/lib/skylark/SkylarkRuleClassFunctionsTest.java b/src/test/java/com/google/devtools/build/lib/skylark/StarlarkRuleClassFunctionsTest.java similarity index 96% rename from src/test/java/com/google/devtools/build/lib/skylark/SkylarkRuleClassFunctionsTest.java rename to src/test/java/com/google/devtools/build/lib/skylark/StarlarkRuleClassFunctionsTest.java index db7a8da..ab0ddab 100644 --- a/src/test/java/com/google/devtools/build/lib/skylark/SkylarkRuleClassFunctionsTest.java +++ b/src/test/java/com/google/devtools/build/lib/skylark/StarlarkRuleClassFunctionsTest.java
@@ -23,9 +23,9 @@ import com.google.common.collect.ImmutableMap; import com.google.common.collect.Iterables; import com.google.devtools.build.lib.analysis.config.transitions.NoTransition; -import com.google.devtools.build.lib.analysis.skylark.SkylarkRuleClassFunctions.SkylarkRuleFunction; -import com.google.devtools.build.lib.analysis.skylark.SkylarkRuleContext; import com.google.devtools.build.lib.analysis.skylark.StarlarkAttrModule; +import com.google.devtools.build.lib.analysis.skylark.StarlarkRuleClassFunctions.StarlarkRuleFunction; +import com.google.devtools.build.lib.analysis.skylark.StarlarkRuleContext; import com.google.devtools.build.lib.cmdline.Label; import com.google.devtools.build.lib.collect.nestedset.Depset; import com.google.devtools.build.lib.events.Event; @@ -41,15 +41,15 @@ import com.google.devtools.build.lib.packages.RuleClass; import com.google.devtools.build.lib.packages.RuleClass.Builder.RuleClassType; import com.google.devtools.build.lib.packages.SkylarkAspectClass; -import com.google.devtools.build.lib.packages.SkylarkDefinedAspect; import com.google.devtools.build.lib.packages.SkylarkInfo; +import com.google.devtools.build.lib.packages.StarlarkDefinedAspect; import com.google.devtools.build.lib.packages.StarlarkProvider; import com.google.devtools.build.lib.packages.StarlarkProviderIdentifier; import com.google.devtools.build.lib.packages.StructImpl; import com.google.devtools.build.lib.packages.StructProvider; import com.google.devtools.build.lib.packages.Type; import com.google.devtools.build.lib.skyframe.StarlarkImportLookupFunction; -import com.google.devtools.build.lib.skylark.util.SkylarkTestCase; +import com.google.devtools.build.lib.skylark.util.StarlarkTestCase; import com.google.devtools.build.lib.syntax.ClassObject; import com.google.devtools.build.lib.syntax.Dict; import com.google.devtools.build.lib.syntax.EvalException; @@ -75,7 +75,7 @@ /** Tests for SkylarkRuleClassFunctions. */ @RunWith(JUnit4.class) -public final class SkylarkRuleClassFunctionsTest extends SkylarkTestCase { +public final class StarlarkRuleClassFunctionsTest extends StarlarkTestCase { @Rule public ExpectedException thrown = ExpectedException.none(); @Before @@ -136,7 +136,7 @@ } private RuleClass getRuleClass(String name) throws Exception { - return ((SkylarkRuleFunction) lookup(name)).getRuleClass(); + return ((StarlarkRuleFunction) lookup(name)).getRuleClass(); } private void registerDummyStarlarkFunction() throws Exception { @@ -377,7 +377,7 @@ "my_aspect = aspect(implementation = _impl)", "a = attr.label_list(aspects = [my_aspect])"); StarlarkAttrModule.Descriptor attr = (StarlarkAttrModule.Descriptor) lookup("a"); - SkylarkDefinedAspect aspect = (SkylarkDefinedAspect) lookup("my_aspect"); + StarlarkDefinedAspect aspect = (StarlarkDefinedAspect) lookup("my_aspect"); assertThat(aspect).isNotNull(); assertThat(attr.build("xxx").getAspectClasses()).containsExactly(aspect.getAspectClass()); } @@ -390,7 +390,7 @@ "my_aspect = aspect(implementation = _impl)", "a = attr.label(aspects = [my_aspect])"); StarlarkAttrModule.Descriptor attr = (StarlarkAttrModule.Descriptor) lookup("a"); - SkylarkDefinedAspect aspect = (SkylarkDefinedAspect) lookup("my_aspect"); + StarlarkDefinedAspect aspect = (StarlarkDefinedAspect) lookup("my_aspect"); assertThat(aspect).isNotNull(); assertThat(attr.build("xxx").getAspectClasses()).containsExactly(aspect.getAspectClass()); } @@ -413,7 +413,7 @@ "my_aspect = aspect(_impl,", " attrs = { '_extra_deps' : attr.label(default = Label('//foo/bar:baz')) }", ")"); - SkylarkDefinedAspect aspect = (SkylarkDefinedAspect) lookup("my_aspect"); + StarlarkDefinedAspect aspect = (StarlarkDefinedAspect) lookup("my_aspect"); Attribute attribute = Iterables.getOnlyElement(aspect.getAttributes()); assertThat(attribute.getName()).isEqualTo("$extra_deps"); assertThat(attribute.getDefaultValue(null)) @@ -432,7 +432,7 @@ "my_aspect = aspect(_impl,", " attrs = { 'param' : attr.string(values=['a', 'b']) }", ")"); - SkylarkDefinedAspect aspect = (SkylarkDefinedAspect) lookup("my_aspect"); + StarlarkDefinedAspect aspect = (StarlarkDefinedAspect) lookup("my_aspect"); Attribute attribute = Iterables.getOnlyElement(aspect.getAttributes()); assertThat(attribute.getName()).isEqualTo("param"); } @@ -470,7 +470,7 @@ " attrs = { 'param' : attr.string(values=['a', 'b']),", " '_extra' : attr.label(default = Label('//foo/bar:baz')) }", ")"); - SkylarkDefinedAspect aspect = (SkylarkDefinedAspect) lookup("my_aspect"); + StarlarkDefinedAspect aspect = (StarlarkDefinedAspect) lookup("my_aspect"); assertThat(aspect.getAttributes()).hasSize(2); assertThat(aspect.getParamAttributes()).containsExactly("param"); } @@ -491,7 +491,7 @@ scratch.file("test/BUILD", "toolchain_type(name = 'my_toolchain_type')"); evalAndExport( "def _impl(ctx): pass", "a1 = aspect(_impl, toolchains=['//test:my_toolchain_type'])"); - SkylarkDefinedAspect a = (SkylarkDefinedAspect) lookup("a1"); + StarlarkDefinedAspect a = (StarlarkDefinedAspect) lookup("a1"); assertThat(a.getRequiredToolchains()).containsExactly(makeLabel("//test:my_toolchain_type")); } @@ -686,7 +686,7 @@ @Test public void testRuleImplementation() throws Exception { evalAndExport("def impl(ctx): return None", "rule1 = rule(impl)"); - RuleClass c = ((SkylarkRuleFunction) lookup("rule1")).getRuleClass(); + RuleClass c = ((StarlarkRuleFunction) lookup("rule1")).getRuleClass(); assertThat(c.getConfiguredTargetFunction().getName()).isEqualTo("impl"); } @@ -741,7 +741,7 @@ @Test public void testRuleAddAttribute() throws Exception { evalAndExport("def impl(ctx): return None", "r1 = rule(impl, attrs={'a1': attr.string()})"); - RuleClass c = ((SkylarkRuleFunction) lookup("r1")).getRuleClass(); + RuleClass c = ((StarlarkRuleFunction) lookup("r1")).getRuleClass(); assertThat(c.hasAttr("a1", Type.STRING)).isTrue(); } @@ -776,8 +776,8 @@ "x = d", "y = d", "z = d"); - String dName = ((SkylarkRuleFunction) lookup("d")).getRuleClass().getName(); - String fooName = ((SkylarkRuleFunction) lookup("foo")).getRuleClass().getName(); + String dName = ((StarlarkRuleFunction) lookup("d")).getRuleClass().getName(); + String fooName = ((StarlarkRuleFunction) lookup("foo")).getRuleClass().getName(); assertThat(dName).isEqualTo("d"); assertThat(fooName).isEqualTo("d"); } @@ -785,7 +785,7 @@ @Test public void testOutputToGenfiles() throws Exception { evalAndExport("def impl(ctx): pass", "r1 = rule(impl, output_to_genfiles=True)"); - RuleClass c = ((SkylarkRuleFunction) lookup("r1")).getRuleClass(); + RuleClass c = ((StarlarkRuleFunction) lookup("r1")).getRuleClass(); assertThat(c.hasBinaryOutput()).isFalse(); } @@ -798,7 +798,7 @@ " 'a1': attr.label_list(allow_files=True),", " 'a2': attr.int()", "})"); - RuleClass c = ((SkylarkRuleFunction) lookup("r1")).getRuleClass(); + RuleClass c = ((StarlarkRuleFunction) lookup("r1")).getRuleClass(); assertThat(c.hasAttr("a1", BuildType.LABEL_LIST)).isTrue(); assertThat(c.hasAttr("a2", Type.INTEGER)).isTrue(); } @@ -808,7 +808,7 @@ evalAndExport( "def impl(ctx): return None", "r1 = rule(impl, attrs = {'a1': attr.string(mandatory=True)})"); - RuleClass c = ((SkylarkRuleFunction) lookup("r1")).getRuleClass(); + RuleClass c = ((StarlarkRuleFunction) lookup("r1")).getRuleClass(); assertThat(c.getAttributeByName("a1").isMandatory()).isTrue(); } @@ -817,7 +817,7 @@ evalAndExport( "def impl(ctx): return None", "r1 = rule(impl, outputs = {'a': 'a.txt'})"); - RuleClass c = ((SkylarkRuleFunction) lookup("r1")).getRuleClass(); + RuleClass c = ((StarlarkRuleFunction) lookup("r1")).getRuleClass(); ImplicitOutputsFunction function = c.getDefaultImplicitOutputsFunction(); assertThat(function.getImplicitOutputs(ev.getEventHandler(), null)).containsExactly("a.txt"); } @@ -887,7 +887,7 @@ "def impl(ctx): return None\n" + "r1 = rule(impl, attrs = {'a1': " + "attr.label(default = Label('//foo:foo'), allow_files=True)})"); - RuleClass c = ((SkylarkRuleFunction) lookup("r1")).getRuleClass(); + RuleClass c = ((StarlarkRuleFunction) lookup("r1")).getRuleClass(); Attribute a = c.getAttributeByName("a1"); assertThat(a.getDefaultValueUnchecked()).isInstanceOf(Label.class); assertThat(a.getDefaultValueUnchecked().toString()).isEqualTo("//foo:foo"); @@ -898,7 +898,7 @@ evalAndExport( "def impl(ctx): return None", "r1 = rule(impl, attrs = {'a1': attr.int(default = 40+2)})"); - RuleClass c = ((SkylarkRuleFunction) lookup("r1")).getRuleClass(); + RuleClass c = ((StarlarkRuleFunction) lookup("r1")).getRuleClass(); Attribute a = c.getAttributeByName("a1"); assertThat(a.getDefaultValueUnchecked()).isEqualTo(42); } @@ -906,7 +906,7 @@ @Test public void testRuleInheritsBaseRuleAttributes() throws Exception { evalAndExport("def impl(ctx): return None", "r1 = rule(impl)"); - RuleClass c = ((SkylarkRuleFunction) lookup("r1")).getRuleClass(); + RuleClass c = ((StarlarkRuleFunction) lookup("r1")).getRuleClass(); assertThat(c.hasAttr("tags", Type.STRING_LIST)).isTrue(); assertThat(c.hasAttr("visibility", BuildType.NODEP_LABEL_LIST)).isTrue(); assertThat(c.hasAttr("deprecation", Type.STRING)).isTrue(); @@ -1166,7 +1166,7 @@ } @Test - public void testStructAccessingFieldsFromSkylark() throws Exception { + public void testStructAccessingFieldsFromStarlark() throws Exception { exec("x = struct(a = 1, b = 2)", "x1 = x.a", "x2 = x.b"); assertThat(lookup("x1")).isEqualTo(1); assertThat(lookup("x2")).isEqualTo(2); @@ -1469,7 +1469,7 @@ " pass", "my_aspect = aspect(_impl, attr_aspects=['*'])"); - SkylarkDefinedAspect myAspect = (SkylarkDefinedAspect) lookup("my_aspect"); + StarlarkDefinedAspect myAspect = (StarlarkDefinedAspect) lookup("my_aspect"); assertThat(myAspect.getDefinition(AspectParameters.EMPTY).propagateAlong("foo")).isTrue(); } @@ -1481,7 +1481,7 @@ "cc = provider()", "my_aspect = aspect(_impl, required_aspect_providers=['java', cc])" ); - SkylarkDefinedAspect myAspect = (SkylarkDefinedAspect) lookup("my_aspect"); + StarlarkDefinedAspect myAspect = (StarlarkDefinedAspect) lookup("my_aspect"); RequiredProviders requiredProviders = myAspect.getDefinition(AspectParameters.EMPTY) .getRequiredProvidersForAspects(); assertThat(requiredProviders.isSatisfiedBy(AdvertisedProviderSet.ANY)).isTrue(); @@ -1507,7 +1507,7 @@ "cc = provider()", "my_aspect = aspect(_impl, required_aspect_providers=[['java'], [cc]])" ); - SkylarkDefinedAspect myAspect = (SkylarkDefinedAspect) lookup("my_aspect"); + StarlarkDefinedAspect myAspect = (StarlarkDefinedAspect) lookup("my_aspect"); RequiredProviders requiredProviders = myAspect.getDefinition(AspectParameters.EMPTY) .getRequiredProvidersForAspects(); assertThat(requiredProviders.isSatisfiedBy(AdvertisedProviderSet.ANY)).isTrue(); @@ -1536,7 +1536,7 @@ " pass", "my_aspect = aspect(_impl, required_aspect_providers=[])" ); - SkylarkDefinedAspect myAspect = (SkylarkDefinedAspect) lookup("my_aspect"); + StarlarkDefinedAspect myAspect = (StarlarkDefinedAspect) lookup("my_aspect"); RequiredProviders requiredProviders = myAspect.getDefinition(AspectParameters.EMPTY) .getRequiredProvidersForAspects(); assertThat(requiredProviders.isSatisfiedBy(AdvertisedProviderSet.ANY)).isFalse(); @@ -1550,7 +1550,7 @@ " pass", "my_aspect = aspect(_impl)" ); - SkylarkDefinedAspect myAspect = (SkylarkDefinedAspect) lookup("my_aspect"); + StarlarkDefinedAspect myAspect = (StarlarkDefinedAspect) lookup("my_aspect"); RequiredProviders requiredProviders = myAspect.getDefinition(AspectParameters.EMPTY) .getRequiredProvidersForAspects(); assertThat(requiredProviders.isSatisfiedBy(AdvertisedProviderSet.ANY)).isFalse(); @@ -1565,7 +1565,7 @@ "y = provider()", "my_aspect = aspect(_impl, provides = ['x', y])" ); - SkylarkDefinedAspect myAspect = (SkylarkDefinedAspect) lookup("my_aspect"); + StarlarkDefinedAspect myAspect = (StarlarkDefinedAspect) lookup("my_aspect"); AdvertisedProviderSet advertisedProviders = myAspect.getDefinition(AspectParameters.EMPTY) .getAdvertisedProviders(); assertThat(advertisedProviders.canHaveAnyProvider()).isFalse(); @@ -1612,7 +1612,7 @@ "]" ); StarlarkProvider p = (StarlarkProvider) lookup("p"); - SkylarkDefinedAspect a = (SkylarkDefinedAspect) lookup("a"); + StarlarkDefinedAspect a = (StarlarkDefinedAspect) lookup("a"); StarlarkProvider p1 = (StarlarkProvider) lookup("p1"); assertThat(p.getPrintableName()).isEqualTo("p"); assertThat(p.getKey()).isEqualTo(new StarlarkProvider.Key(FAKE_LABEL, "p")); @@ -1761,7 +1761,7 @@ scratch.file("test/BUILD", "toolchain_type(name = 'my_toolchain_type')"); evalAndExport( "def impl(ctx): return None", "r1 = rule(impl, toolchains=['//test:my_toolchain_type'])"); - RuleClass c = ((SkylarkRuleFunction) lookup("r1")).getRuleClass(); + RuleClass c = ((StarlarkRuleFunction) lookup("r1")).getRuleClass(); assertThat(c.getRequiredToolchains()).containsExactly(makeLabel("//test:my_toolchain_type")); } @@ -1775,7 +1775,7 @@ " toolchains=['//test:my_toolchain_type'],", " exec_compatible_with=['//constraint:cv1', '//constraint:cv2'],", ")"); - RuleClass c = ((SkylarkRuleFunction) lookup("r1")).getRuleClass(); + RuleClass c = ((StarlarkRuleFunction) lookup("r1")).getRuleClass(); assertThat(c.getExecutionPlatformConstraints()) .containsExactly(makeLabel("//constraint:cv1"), makeLabel("//constraint:cv2")); } @@ -1797,7 +1797,7 @@ " ),", " },", ")"); - RuleClass plum = ((SkylarkRuleFunction) lookup("plum")).getRuleClass(); + RuleClass plum = ((StarlarkRuleFunction) lookup("plum")).getRuleClass(); assertThat(plum.getRequiredToolchains()).isEmpty(); assertThat(plum.getExecGroups().get("group").getRequiredToolchains()) .containsExactly(makeLabel("//test:my_toolchain_type")); @@ -1825,7 +1825,7 @@ " params = [type(r), type(c)]", ")"); invalidatePackages(); - SkylarkRuleContext context = createRuleContext("//test:check"); + StarlarkRuleContext context = createRuleContext("//test:check"); @SuppressWarnings("unchecked") StarlarkList<Object> params = (StarlarkList<Object>) context.getAttr().getValue("params"); assertThat(params.get(0)).isEqualTo("NoneType");
diff --git a/src/test/java/com/google/devtools/build/lib/skylark/SkylarkRuleContextTest.java b/src/test/java/com/google/devtools/build/lib/skylark/StarlarkRuleContextTest.java similarity index 97% rename from src/test/java/com/google/devtools/build/lib/skylark/SkylarkRuleContextTest.java rename to src/test/java/com/google/devtools/build/lib/skylark/StarlarkRuleContextTest.java index 1d1ff4f..001026e 100644 --- a/src/test/java/com/google/devtools/build/lib/skylark/SkylarkRuleContextTest.java +++ b/src/test/java/com/google/devtools/build/lib/skylark/StarlarkRuleContextTest.java
@@ -38,7 +38,7 @@ import com.google.devtools.build.lib.analysis.actions.FileWriteAction; import com.google.devtools.build.lib.analysis.actions.StarlarkAction; import com.google.devtools.build.lib.analysis.configuredtargets.FileConfiguredTarget; -import com.google.devtools.build.lib.analysis.skylark.SkylarkRuleContext; +import com.google.devtools.build.lib.analysis.skylark.StarlarkRuleContext; import com.google.devtools.build.lib.analysis.util.MockRule; import com.google.devtools.build.lib.cmdline.Label; import com.google.devtools.build.lib.collect.nestedset.Depset; @@ -50,7 +50,7 @@ import com.google.devtools.build.lib.rules.java.JavaInfo; import com.google.devtools.build.lib.rules.java.JavaSourceJarsProvider; import com.google.devtools.build.lib.rules.python.PyProviderUtils; -import com.google.devtools.build.lib.skylark.util.SkylarkTestCase; +import com.google.devtools.build.lib.skylark.util.StarlarkTestCase; import com.google.devtools.build.lib.syntax.Dict; import com.google.devtools.build.lib.syntax.EvalException; import com.google.devtools.build.lib.syntax.Mutability; @@ -70,10 +70,10 @@ import org.junit.runners.JUnit4; /** - * Tests for SkylarkRuleContext. + * Tests for {@link StarlarkRuleContext}. */ @RunWith(JUnit4.class) -public class SkylarkRuleContextTest extends SkylarkTestCase { +public class StarlarkRuleContextTest extends StarlarkTestCase { /** A test rule that exercises the semantics of mandatory providers. */ private static final MockRule TESTING_RULE_FOR_MANDATORY_PROVIDERS = @@ -143,7 +143,7 @@ ); } - private void setRuleContext(SkylarkRuleContext ctx) throws Exception { + private void setRuleContext(StarlarkRuleContext ctx) throws Exception { update("ruleContext", ctx); } @@ -191,7 +191,7 @@ } @Test - public void hasCorrectLocationForRuleAttributeError_SkylarkRuleWithMacro() throws Exception { + public void hasCorrectLocationForRuleAttributeError_StarlarkRuleWithMacro() throws Exception { setUpAttributeErrorTest(); assertThrows(Exception.class, () -> createRuleContext("//test:m_skylark")); assertContainsEvent( @@ -213,7 +213,7 @@ } @Test - public void hasCorrectLocationForRuleAttributeError_SkylarkRule() throws Exception { + public void hasCorrectLocationForRuleAttributeError_StarlarkRule() throws Exception { setUpAttributeErrorTest(); assertThrows(Exception.class, () -> createRuleContext("//test:skyrule")); assertContainsEvent( @@ -223,7 +223,7 @@ } @Test - public void testMandatoryProvidersListWithSkylark() throws Exception { + public void testMandatoryProvidersListWithStarlark() throws Exception { setStarlarkSemanticsOptions("--incompatible_disallow_struct_provider_syntax=false"); scratch.file("test/BUILD", "load('//test:rules.bzl', 'skylark_rule', 'my_rule', 'my_other_rule')", @@ -311,7 +311,7 @@ } @Test - public void testPackageBoundaryError_SkylarkRule() throws Exception { + public void testPackageBoundaryError_StarlarkRule() throws Exception { scratch.file("test/BUILD", "load('//test:macros.bzl', 'skylark_rule')", "skylark_rule(name = 'skyrule',", @@ -336,7 +336,7 @@ } @Test - public void testPackageBoundaryError_SkylarkMacro() throws Exception { + public void testPackageBoundaryError_StarlarkMacro() throws Exception { scratch.file("test/BUILD", "load('//test:macros.bzl', 'macro_skylark_rule')", "macro_skylark_rule(name = 'm_skylark',", @@ -413,7 +413,7 @@ * with it. */ @Test - public void testPackageBoundaryError_SkylarkMacroWithErrorInBzlFile() throws Exception { + public void testPackageBoundaryError_StarlarkMacroWithErrorInBzlFile() throws Exception { scratch.file("test/BUILD", "load('//test:macros.bzl', 'macro_skylark_rule')", "macro_skylark_rule(name = 'm_skylark')"); @@ -457,7 +457,7 @@ @Test public void shouldGetPrerequisiteArtifacts() throws Exception { - SkylarkRuleContext ruleContext = createRuleContext("//foo:foo"); + StarlarkRuleContext ruleContext = createRuleContext("//foo:foo"); setRuleContext(ruleContext); Object result = eval("ruleContext.files.srcs"); assertArtifactList(result, ImmutableList.of("a.txt", "b.img")); @@ -475,7 +475,7 @@ @Test public void shouldGetPrerequisites() throws Exception { - SkylarkRuleContext ruleContext = createRuleContext("//foo:bar"); + StarlarkRuleContext ruleContext = createRuleContext("//foo:bar"); setRuleContext(ruleContext); Object result = eval("ruleContext.attr.srcs"); // Check for a known provider @@ -487,7 +487,7 @@ @Test public void shouldGetPrerequisite() throws Exception { - SkylarkRuleContext ruleContext = createRuleContext("//foo:asr"); + StarlarkRuleContext ruleContext = createRuleContext("//foo:asr"); setRuleContext(ruleContext); Object result = eval("ruleContext.attr.srcjar"); TransitiveInfoCollection tic = (TransitiveInfoCollection) result; @@ -497,7 +497,7 @@ @Test public void testGetRuleAttributeListType() throws Exception { - SkylarkRuleContext ruleContext = createRuleContext("//foo:foo"); + StarlarkRuleContext ruleContext = createRuleContext("//foo:foo"); setRuleContext(ruleContext); Object result = eval("ruleContext.attr.outs"); assertThat(result).isInstanceOf(Sequence.class); @@ -589,7 +589,7 @@ " s = adict.keys())", "consume_rule(name = 'c_str', s = [cdict['kind'], cdict['name'], cdict['x']])"); - SkylarkRuleContext allContext = createRuleContext("//test/getrule:all_str"); + StarlarkRuleContext allContext = createRuleContext("//test/getrule:all_str"); setRuleContext(allContext); List<?> result = (List) eval("ruleContext.attr.s"); assertThat(result).containsExactly("genrule", "a", "nop_rule", "c"); @@ -649,7 +649,7 @@ @Test public void testGetRuleAttributeListValue() throws Exception { - SkylarkRuleContext ruleContext = createRuleContext("//foo:foo"); + StarlarkRuleContext ruleContext = createRuleContext("//foo:foo"); setRuleContext(ruleContext); Object result = eval("ruleContext.attr.outs"); assertThat(((Sequence) result)).hasSize(1); @@ -657,7 +657,7 @@ @Test public void testGetRuleAttributeListValueNoGet() throws Exception { - SkylarkRuleContext ruleContext = createRuleContext("//foo:foo"); + StarlarkRuleContext ruleContext = createRuleContext("//foo:foo"); setRuleContext(ruleContext); Object result = eval("ruleContext.attr.outs"); assertThat(((Sequence) result)).hasSize(1); @@ -665,7 +665,7 @@ @Test public void testGetRuleAttributeStringTypeValue() throws Exception { - SkylarkRuleContext ruleContext = createRuleContext("//foo:foo"); + StarlarkRuleContext ruleContext = createRuleContext("//foo:foo"); setRuleContext(ruleContext); Object result = eval("ruleContext.attr.cmd"); assertThat((String) result).isEqualTo("dummy_cmd"); @@ -673,7 +673,7 @@ @Test public void testGetRuleAttributeStringTypeValueNoGet() throws Exception { - SkylarkRuleContext ruleContext = createRuleContext("//foo:foo"); + StarlarkRuleContext ruleContext = createRuleContext("//foo:foo"); setRuleContext(ruleContext); Object result = eval("ruleContext.attr.cmd"); assertThat((String) result).isEqualTo("dummy_cmd"); @@ -713,7 +713,7 @@ @Test public void testCreateSpawnActionArgumentsWithExecutableFilesToRunProvider() throws Exception { - SkylarkRuleContext ruleContext = createRuleContext("//foo:androidlib"); + StarlarkRuleContext ruleContext = createRuleContext("//foo:androidlib"); setRuleContext(ruleContext); exec( "ruleContext.actions.run(", @@ -730,7 +730,7 @@ @Test public void testCreateStarlarkActionArgumentsWithUnusedInputsList() throws Exception { - SkylarkRuleContext ruleContext = createRuleContext("//foo:foo"); + StarlarkRuleContext ruleContext = createRuleContext("//foo:foo"); setRuleContext(ruleContext); exec( "ruleContext.actions.run(", @@ -750,7 +750,7 @@ @Test public void testCreateStarlarkActionArgumentsWithoutUnusedInputsList() throws Exception { - SkylarkRuleContext ruleContext = createRuleContext("//foo:foo"); + StarlarkRuleContext ruleContext = createRuleContext("//foo:foo"); setRuleContext(ruleContext); exec( "ruleContext.actions.run(", @@ -774,7 +774,7 @@ } @Test - public void testSkylarkRuleContextGetDefaultShellEnv() throws Exception { + public void testStarlarkRuleContextGetDefaultShellEnv() throws Exception { setRuleContext(createRuleContext("//foo:foo")); Object result = eval("ruleContext.configuration.default_shell_env"); assertThat(result).isInstanceOf(Dict.class); @@ -861,7 +861,7 @@ @Test public void testConfiguration() throws Exception { - SkylarkRuleContext ruleContext = createRuleContext("//foo:foo"); + StarlarkRuleContext ruleContext = createRuleContext("//foo:foo"); setRuleContext(ruleContext); Object result = eval("ruleContext.configuration"); assertThat(ruleContext.getRuleContext().getConfiguration()).isSameInstanceAs(result); @@ -883,7 +883,7 @@ @Test public void testHostConfiguration() throws Exception { - SkylarkRuleContext ruleContext = createRuleContext("//foo:foo"); + StarlarkRuleContext ruleContext = createRuleContext("//foo:foo"); setRuleContext(ruleContext); Object result = eval("ruleContext.host_configuration"); assertThat(ruleContext.getRuleContext().getHostConfiguration()).isSameInstanceAs(result); @@ -1797,7 +1797,7 @@ " executable = 1,", ")"); invalidatePackages(); - SkylarkRuleContext ruleContext = createRuleContext("//test:lib"); + StarlarkRuleContext ruleContext = createRuleContext("//test:lib"); setRuleContext(ruleContext); String filename = eval("ruleContext.files.srcs[0].short_path").toString(); assertThat(filename).isEqualTo("../foo/bar.txt"); @@ -1817,7 +1817,7 @@ // a testing rule, where the rule under test has one output and one caller-supplied action. private static String getSimpleUnderTestDefinition( - boolean withSkylarkTestable, String[] actionLines) { + boolean withStarlarkTestable, String[] actionLines) { return linesAsString( // TODO(b/153667498): Just passing fail to map_each parameter of Args.add_all does not work. "def fail_with_message(s):", @@ -1829,7 +1829,7 @@ "undertest_rule = rule(", " implementation = _undertest_impl,", " outputs = {'out': '%{name}.txt'},", - withSkylarkTestable ? " _skylark_testable = True," : "", + withStarlarkTestable ? " _skylark_testable = True," : "", ")"); } @@ -1869,7 +1869,7 @@ testingRuleDefinition); scratch.file("test/BUILD", simpleBuildDefinition); - SkylarkRuleContext ruleContext = createRuleContext("//test:testing"); + StarlarkRuleContext ruleContext = createRuleContext("//test:testing"); setRuleContext(ruleContext); Object provider = eval("ruleContext.attr.dep[Actions]"); @@ -1885,7 +1885,7 @@ } @Test - public void testNoAccessToDependencyActionsWithoutSkylarkTest() throws Exception { + public void testNoAccessToDependencyActionsWithoutStarlarkTest() throws Exception { reporter.removeHandler(failFastHandler); scratch.file("test/rules.bzl", getSimpleNontestableUnderTestDefinition( @@ -1893,7 +1893,7 @@ testingRuleDefinition); scratch.file("test/BUILD", simpleBuildDefinition); - SkylarkRuleContext ruleContext = createRuleContext("//test:testing"); + StarlarkRuleContext ruleContext = createRuleContext("//test:testing"); setRuleContext(ruleContext); Exception e = assertThrows(Exception.class, () -> eval("ruleContext.attr.dep[Actions]")); @@ -1926,7 +1926,7 @@ testingRuleDefinition); scratch.file("test/BUILD", simpleBuildDefinition); - SkylarkRuleContext ruleContext = createRuleContext("//test:testing"); + StarlarkRuleContext ruleContext = createRuleContext("//test:testing"); setRuleContext(ruleContext); update("file1", eval("ruleContext.attr.dep.out1")); update("file2", eval("ruleContext.attr.dep.out2")); @@ -1977,7 +1977,7 @@ ); scratch.file("test/BUILD", simpleBuildDefinition); - SkylarkRuleContext ruleContext = createRuleContext("//test:testing"); + StarlarkRuleContext ruleContext = createRuleContext("//test:testing"); setRuleContext(ruleContext); Object mapUnchecked = eval("ruleContext.attr.dep.v"); @@ -1994,7 +1994,7 @@ } @Test - public void testNoAccessToCreatedActionsWithoutSkylarkTest() throws Exception { + public void testNoAccessToCreatedActionsWithoutStarlarkTest() throws Exception { scratch.file("test/rules.bzl", getSimpleNontestableUnderTestDefinition( "ctx.actions.run_shell(outputs=[out], command='echo foo123 > ' + out.path)") @@ -2004,7 +2004,7 @@ "undertest_rule(", " name = 'undertest',", ")"); - SkylarkRuleContext ruleContext = createRuleContext("//test:undertest"); + StarlarkRuleContext ruleContext = createRuleContext("//test:undertest"); setRuleContext(ruleContext); Object result = eval("ruleContext.created_actions()"); @@ -2019,7 +2019,7 @@ testingRuleDefinition); scratch.file("test/BUILD", simpleBuildDefinition); - SkylarkRuleContext ruleContext = createRuleContext("//test:testing"); + StarlarkRuleContext ruleContext = createRuleContext("//test:testing"); setRuleContext(ruleContext); update("file", eval("ruleContext.attr.dep.files.to_list()[0]")); update("action", eval("ruleContext.attr.dep[Actions].by_file[file]")); @@ -2075,7 +2075,7 @@ ")", testingRuleDefinition); scratch.file("test/BUILD", simpleBuildDefinition); - SkylarkRuleContext ruleContext = createRuleContext("//test:testing"); + StarlarkRuleContext ruleContext = createRuleContext("//test:testing"); setRuleContext(ruleContext); Object mapUnchecked = eval("ruleContext.attr.dep.v"); @@ -2135,7 +2135,7 @@ testingRuleDefinition); scratch.file("test/BUILD", simpleBuildDefinition); - SkylarkRuleContext ruleContext = createRuleContext("//test:testing"); + StarlarkRuleContext ruleContext = createRuleContext("//test:testing"); setRuleContext(ruleContext); update("file", eval("ruleContext.attr.dep.files.to_list()[0]")); update("action", eval("ruleContext.attr.dep[Actions].by_file[file]")); @@ -2157,7 +2157,7 @@ "ctx.actions.write(output=out, content=args)"), testingRuleDefinition); scratch.file("test/BUILD", simpleBuildDefinition); - SkylarkRuleContext ruleContext = createRuleContext("//test:testing"); + StarlarkRuleContext ruleContext = createRuleContext("//test:testing"); setRuleContext(ruleContext); update("file", eval("ruleContext.attr.dep.files.to_list()[0]")); update("action", eval("ruleContext.attr.dep[Actions].by_file[file]")); @@ -2185,7 +2185,7 @@ "ctx.actions.write(output=out, content=args)"), testingRuleDefinition); scratch.file("test/BUILD", simpleBuildDefinition); - SkylarkRuleContext ruleContext = createRuleContext("//test:testing"); + StarlarkRuleContext ruleContext = createRuleContext("//test:testing"); setRuleContext(ruleContext); update("file", eval("ruleContext.attr.dep.files.to_list()[0]")); update("action", eval("ruleContext.attr.dep[Actions].by_file[file]")); @@ -2208,7 +2208,7 @@ "ctx.actions.write(output=out, content=args)"), testingRuleDefinition); scratch.file("test/BUILD", simpleBuildDefinition); - SkylarkRuleContext ruleContext = createRuleContext("//test:testing"); + StarlarkRuleContext ruleContext = createRuleContext("//test:testing"); setRuleContext(ruleContext); update("file", eval("ruleContext.attr.dep.files.to_list()[0]")); update("action", eval("ruleContext.attr.dep[Actions].by_file[file]")); @@ -2255,7 +2255,7 @@ " name = 'testing',", " dep = ':undertest',", ")"); - SkylarkRuleContext ruleContext = createRuleContext("//test:testing"); + StarlarkRuleContext ruleContext = createRuleContext("//test:testing"); setRuleContext(ruleContext); update("file", eval("ruleContext.attr.dep.files.to_list()[0]")); update("action", eval("ruleContext.attr.dep[Actions].by_file[file]")); @@ -2288,7 +2288,7 @@ public void testCoverageInstrumentedCoverageDisabled() throws Exception { setUpCoverageInstrumentedTest(); useConfiguration("--nocollect_code_coverage", "--instrumentation_filter=."); - SkylarkRuleContext ruleContext = createRuleContext("//test:foo"); + StarlarkRuleContext ruleContext = createRuleContext("//test:foo"); setRuleContext(ruleContext); Object result = eval("ruleContext.coverage_instrumented()"); assertThat((Boolean) result).isFalse();
diff --git a/src/test/java/com/google/devtools/build/lib/skylark/SkylarkRuleImplementationFunctionsTest.java b/src/test/java/com/google/devtools/build/lib/skylark/StarlarkRuleImplementationFunctionsTest.java similarity index 97% rename from src/test/java/com/google/devtools/build/lib/skylark/SkylarkRuleImplementationFunctionsTest.java rename to src/test/java/com/google/devtools/build/lib/skylark/StarlarkRuleImplementationFunctionsTest.java index 64e465c..b24439d 100644 --- a/src/test/java/com/google/devtools/build/lib/skylark/SkylarkRuleImplementationFunctionsTest.java +++ b/src/test/java/com/google/devtools/build/lib/skylark/StarlarkRuleImplementationFunctionsTest.java
@@ -47,14 +47,14 @@ import com.google.devtools.build.lib.analysis.actions.TemplateExpansionAction; import com.google.devtools.build.lib.analysis.configuredtargets.RuleConfiguredTarget; import com.google.devtools.build.lib.analysis.skylark.Args; -import com.google.devtools.build.lib.analysis.skylark.SkylarkRuleContext; +import com.google.devtools.build.lib.analysis.skylark.StarlarkRuleContext; import com.google.devtools.build.lib.cmdline.Label; import com.google.devtools.build.lib.collect.nestedset.Depset; import com.google.devtools.build.lib.events.Event; import com.google.devtools.build.lib.packages.Provider; import com.google.devtools.build.lib.packages.StarlarkProvider; import com.google.devtools.build.lib.packages.StructImpl; -import com.google.devtools.build.lib.skylark.util.SkylarkTestCase; +import com.google.devtools.build.lib.skylark.util.StarlarkTestCase; import com.google.devtools.build.lib.skylarkinterface.Param; import com.google.devtools.build.lib.skylarkinterface.SkylarkCallable; import com.google.devtools.build.lib.skylarkinterface.SkylarkGlobalLibrary; @@ -84,7 +84,7 @@ /** Tests for Starlark functions relating to rule implementation. */ @RunWith(JUnit4.class) @SkylarkGlobalLibrary // needed for CallUtils.getBuiltinCallable, sadly -public class SkylarkRuleImplementationFunctionsTest extends SkylarkTestCase { +public class StarlarkRuleImplementationFunctionsTest extends StarlarkTestCase { @Rule public ExpectedException thrown = ExpectedException.none(); @@ -160,7 +160,7 @@ ")"); } - private void setRuleContext(SkylarkRuleContext ctx) throws Exception { + private void setRuleContext(StarlarkRuleContext ctx) throws Exception { update("ruleContext", ctx); } @@ -179,7 +179,7 @@ return (StructImpl) configuredTarget.get(key); } - // Defines all @SkylarkCallable-annotated methods (mock, throw, ...) in the environment. + // Defines all @StarlarkCallable-annotated methods (mock, throw, ...) in the environment. private void defineTestMethods() throws Exception { ImmutableMap.Builder<String, Object> env = ImmutableMap.builder(); Starlark.addMethods(env, this); @@ -188,7 +188,7 @@ } } - private void checkSkylarkFunctionError(String errorSubstring, String line) throws Exception { + private void checkStarlarkFunctionError(String errorSubstring, String line) throws Exception { defineTestMethods(); EvalException e = assertThrows(EvalException.class, () -> exec(line)); assertThat(e).hasMessageThat().contains(errorSubstring); @@ -197,7 +197,7 @@ // TODO(adonovan): move these tests of the interpreter core into lib.syntax. @Test - public void testSkylarkFunctionPosArgs() throws Exception { + public void testStarlarkFunctionPosArgs() throws Exception { defineTestMethods(); exec("a = mock('a', 'b', mandatory_key='c')"); Map<?, ?> params = (Map<?, ?>) lookup("a"); @@ -208,7 +208,7 @@ } @Test - public void testSkylarkFunctionKwArgs() throws Exception { + public void testStarlarkFunctionKwArgs() throws Exception { defineTestMethods(); exec("a = mock(optional='b', mandatory='a', mandatory_key='c')"); Map<?, ?> params = (Map<?, ?>) lookup("a"); @@ -219,28 +219,28 @@ } @Test - public void testSkylarkFunctionTooFewArguments() throws Exception { - checkSkylarkFunctionError( + public void testStarlarkFunctionTooFewArguments() throws Exception { + checkStarlarkFunctionError( "missing 1 required positional argument: mandatory", "mock(mandatory_key='y')"); } @Test - public void testSkylarkFunctionTooManyArguments() throws Exception { - checkSkylarkFunctionError( + public void testStarlarkFunctionTooManyArguments() throws Exception { + checkStarlarkFunctionError( "mock() accepts no more than 2 positional arguments but got 3", "mock('a', 'b', 'c', mandatory_key='y')"); } @Test - public void testSkylarkFunctionAmbiguousArguments() throws Exception { - checkSkylarkFunctionError( + public void testStarlarkFunctionAmbiguousArguments() throws Exception { + checkStarlarkFunctionError( "mock() got multiple values for argument 'mandatory'", "mock('by position', mandatory='by_key', mandatory_key='c')"); } @Test public void testCreateSpawnActionCreatesSpawnAction() throws Exception { - SkylarkRuleContext ruleContext = createRuleContext("//foo:foo"); + StarlarkRuleContext ruleContext = createRuleContext("//foo:foo"); setRuleContext(ruleContext); createTestSpawnAction(ruleContext); ActionAnalysisMetadata action = @@ -265,7 +265,7 @@ @Test public void testCreateSpawnActionArgumentsWithCommand() throws Exception { - SkylarkRuleContext ruleContext = createRuleContext("//foo:foo"); + StarlarkRuleContext ruleContext = createRuleContext("//foo:foo"); setRuleContext(ruleContext); createTestSpawnAction(ruleContext); SpawnAction action = @@ -284,7 +284,7 @@ @Test public void testCreateSpawnActionArgumentsWithExecutable() throws Exception { - SkylarkRuleContext ruleContext = createRuleContext("//foo:foo"); + StarlarkRuleContext ruleContext = createRuleContext("//foo:foo"); setRuleContext(ruleContext); exec( "ruleContext.actions.run(", @@ -304,7 +304,7 @@ @Test public void testCreateActionWithDepsetInput() throws Exception { // Same test as above, with depset as inputs. - SkylarkRuleContext ruleContext = createRuleContext("//foo:foo"); + StarlarkRuleContext ruleContext = createRuleContext("//foo:foo"); setRuleContext(ruleContext); exec( "ruleContext.actions.run(", @@ -335,7 +335,7 @@ @Test public void testCreateSpawnActionShellCommandList() throws Exception { - SkylarkRuleContext ruleContext = createRuleContext("//foo:foo"); + StarlarkRuleContext ruleContext = createRuleContext("//foo:foo"); setRuleContext(ruleContext); exec( "ruleContext.actions.run_shell(", @@ -355,7 +355,7 @@ @Test public void testCreateSpawnActionEnvAndExecInfo() throws Exception { - SkylarkRuleContext ruleContext = createRuleContext("//foo:foo"); + StarlarkRuleContext ruleContext = createRuleContext("//foo:foo"); setRuleContext(ruleContext); exec( "ruleContext.actions.run_shell(", @@ -384,7 +384,7 @@ "ruleContext.actions.run(outputs=[], bad_param = 'some text', executable = f)"); } - private Object createTestSpawnAction(SkylarkRuleContext ruleContext) throws Exception { + private Object createTestSpawnAction(StarlarkRuleContext ruleContext) throws Exception { setRuleContext(ruleContext); return eval( "ruleContext.actions.run_shell(", @@ -515,7 +515,7 @@ @Test public void testCreateFileAction() throws Exception { - SkylarkRuleContext ruleContext = createRuleContext("//foo:foo"); + StarlarkRuleContext ruleContext = createRuleContext("//foo:foo"); setRuleContext(ruleContext); exec( "ruleContext.actions.write(", @@ -581,7 +581,7 @@ @Test public void testExpandLocation() throws Exception { - SkylarkRuleContext ruleContext = createRuleContext("//foo:bar"); + StarlarkRuleContext ruleContext = createRuleContext("//foo:bar"); setRuleContext(ruleContext); // If there is only a single target, both "location" and "locations" should work @@ -614,7 +614,7 @@ /** Regression test to check that expand_location allows ${var} and $$. */ @Test public void testExpandLocationWithDollarSignsAndCurlys() throws Exception { - SkylarkRuleContext ruleContext = createRuleContext("//foo:bar"); + StarlarkRuleContext ruleContext = createRuleContext("//foo:bar"); setRuleContext(ruleContext); assertThat((String) eval("ruleContext.expand_location('${abc} $(echo) $$ $')")) .isEqualTo("${abc} $(echo) $$ $"); @@ -732,7 +732,7 @@ @Test public void testResolveTools() throws Exception { - SkylarkRuleContext ruleContext = createRuleContext("//foo:resolve_me"); + StarlarkRuleContext ruleContext = createRuleContext("//foo:resolve_me"); setRuleContext(ruleContext); exec( "inputs, input_manifests = ruleContext.resolve_tools(tools=ruleContext.attr.tools)", @@ -778,7 +778,7 @@ @Test public void testCreateTemplateAction() throws Exception { - SkylarkRuleContext ruleContext = createRuleContext("//foo:foo"); + StarlarkRuleContext ruleContext = createRuleContext("//foo:foo"); setRuleContext(ruleContext); exec( "ruleContext.actions.expand_template(", @@ -814,7 +814,7 @@ byte[] bytesToDecode = {(byte) 0xC2, (byte) 0xA2, (byte) 0xC2, (byte) 0xA2}; Charset latin1 = StandardCharsets.ISO_8859_1; Charset utf8 = StandardCharsets.UTF_8; - SkylarkRuleContext ruleContext = createRuleContext("//foo:foo"); + StarlarkRuleContext ruleContext = createRuleContext("//foo:foo"); setRuleContext(ruleContext); exec( "ruleContext.actions.expand_template(", @@ -1805,7 +1805,7 @@ @Test public void testBinDirPath() throws Exception { - SkylarkRuleContext ctx = createRuleContext("//foo:bar"); + StarlarkRuleContext ctx = createRuleContext("//foo:bar"); setRuleContext(ctx); Object result = eval("ruleContext.bin_dir.path"); assertThat(result).isEqualTo(ctx.getConfiguration().getBinFragment().getPathString()); @@ -1828,7 +1828,7 @@ @Test public void testCodeCoverageConfigurationAccess() throws Exception { - SkylarkRuleContext ctx = createRuleContext("//foo:baz"); + StarlarkRuleContext ctx = createRuleContext("//foo:baz"); setRuleContext(ctx); boolean coverage = (Boolean) eval("ruleContext.configuration.coverage_enabled"); assertThat(ctx.getRuleContext().getConfiguration().isCodeCoverageEnabled()).isEqualTo(coverage); @@ -1893,7 +1893,7 @@ public void testStackTraceWithoutOriginalMessage() throws Exception { defineTestMethods(); checkEvalErrorContains( - "There Is No Message: SkylarkRuleImplementationFunctionsTest", "throw1()"); + "There Is No Message: StarlarkRuleImplementationFunctionsTest", "throw1()"); } @SkylarkCallable(name = "throw2", documented = false) @@ -2006,7 +2006,7 @@ @Test public void testArgsScalarAdd() throws Exception { - SkylarkRuleContext ruleContext = createRuleContext("//foo:foo"); + StarlarkRuleContext ruleContext = createRuleContext("//foo:foo"); setRuleContext(ruleContext); exec( "args = ruleContext.actions.args()", @@ -2047,7 +2047,7 @@ @Test public void testArgsAddAll() throws Exception { - SkylarkRuleContext ruleContext = createRuleContext("//foo:foo"); + StarlarkRuleContext ruleContext = createRuleContext("//foo:foo"); setRuleContext(ruleContext); exec( "args = ruleContext.actions.args()", @@ -2106,7 +2106,7 @@ @Test public void testArgsAddAllWithMapEach() throws Exception { - SkylarkRuleContext ruleContext = createRuleContext("//foo:foo"); + StarlarkRuleContext ruleContext = createRuleContext("//foo:foo"); setRuleContext(ruleContext); exec( "def add_one(val): return str(val + 1)", @@ -2132,7 +2132,7 @@ @Test public void testOmitIfEmpty() throws Exception { - SkylarkRuleContext ruleContext = createRuleContext("//foo:foo"); + StarlarkRuleContext ruleContext = createRuleContext("//foo:foo"); setRuleContext(ruleContext); exec( "def add_one(val): return str(val + 1)", @@ -2175,7 +2175,7 @@ @Test public void testUniquify() throws Exception { - SkylarkRuleContext ruleContext = createRuleContext("//foo:foo"); + StarlarkRuleContext ruleContext = createRuleContext("//foo:foo"); setRuleContext(ruleContext); exec( "def add_one(val): return str(val + 1)", @@ -2200,7 +2200,7 @@ @Test public void testArgsAddJoined() throws Exception { - SkylarkRuleContext ruleContext = createRuleContext("//foo:foo"); + StarlarkRuleContext ruleContext = createRuleContext("//foo:foo"); setRuleContext(ruleContext); exec( "def add_one(val): return str(val + 1)", @@ -2245,7 +2245,7 @@ @Test public void testMultipleLazyArgsMixedWithStrings() throws Exception { - SkylarkRuleContext ruleContext = createRuleContext("//foo:foo"); + StarlarkRuleContext ruleContext = createRuleContext("//foo:foo"); setRuleContext(ruleContext); exec( "foo_args = ruleContext.actions.args()", @@ -2293,7 +2293,7 @@ @Test public void testWriteArgsToParamFile() throws Exception { - SkylarkRuleContext ruleContext = createRuleContext("//foo:foo"); + StarlarkRuleContext ruleContext = createRuleContext("//foo:foo"); setRuleContext(ruleContext); exec( "args = ruleContext.actions.args()", @@ -2371,7 +2371,7 @@ @Test public void testMapEachAcceptsBuiltinFunction() throws Exception { - SkylarkRuleContext ruleContext = createRuleContext("//foo:foo"); + StarlarkRuleContext ruleContext = createRuleContext("//foo:foo"); setRuleContext(ruleContext); // map_each accepts a non-Starlark built-in function such as str. exec("ruleContext.actions.args().add_all(['foo'], map_each = str)"); @@ -2379,7 +2379,7 @@ @Test public void testLazyArgMapEachThrowsError() throws Exception { - SkylarkRuleContext ruleContext = createRuleContext("//foo:foo"); + StarlarkRuleContext ruleContext = createRuleContext("//foo:foo"); setRuleContext(ruleContext); exec( "args = ruleContext.actions.args()", @@ -2402,7 +2402,7 @@ @Test public void testLazyArgMapEachReturnsNone() throws Exception { - SkylarkRuleContext ruleContext = createRuleContext("//foo:foo"); + StarlarkRuleContext ruleContext = createRuleContext("//foo:foo"); setRuleContext(ruleContext); exec( "args = ruleContext.actions.args()", @@ -2423,7 +2423,7 @@ @Test public void testLazyArgMapEachReturnsWrongType() throws Exception { - SkylarkRuleContext ruleContext = createRuleContext("//foo:foo"); + StarlarkRuleContext ruleContext = createRuleContext("//foo:foo"); setRuleContext(ruleContext); exec( "args = ruleContext.actions.args()", @@ -2447,7 +2447,7 @@ @Test public void createShellWithLazyArgs() throws Exception { - SkylarkRuleContext ruleContext = createRuleContext("//foo:foo"); + StarlarkRuleContext ruleContext = createRuleContext("//foo:foo"); setRuleContext(ruleContext); exec( "args = ruleContext.actions.args()", @@ -2501,7 +2501,7 @@ } @Test - public void testConfigurationField_SkylarkSplitTransitionProhibited() throws Exception { + public void testConfigurationField_StarlarkSplitTransitionProhibited() throws Exception { scratch.file( "tools/whitelists/function_transition_whitelist/BUILD", "package_group(", @@ -2765,7 +2765,7 @@ } @Test - public void testSkylarkCustomCommandLineKeyComputation() throws Exception { + public void testStarlarkCustomCommandLineKeyComputation() throws Exception { setRuleContext(createRuleContext("//foo:foo")); ImmutableList.Builder<CommandLine> commandLines = ImmutableList.builder(); @@ -2934,7 +2934,7 @@ @Test public void testParamFileHasDirectoryAsInput() throws Exception { - SkylarkRuleContext ctx = createRuleContext("//foo:foo"); + StarlarkRuleContext ctx = createRuleContext("//foo:foo"); setRuleContext(ctx); exec( "args = ruleContext.actions.args()",
diff --git a/src/test/java/com/google/devtools/build/lib/skylark/SkylarkStringRepresentationsTest.java b/src/test/java/com/google/devtools/build/lib/skylark/StarlarkStringRepresentationsTest.java similarity index 87% rename from src/test/java/com/google/devtools/build/lib/skylark/SkylarkStringRepresentationsTest.java rename to src/test/java/com/google/devtools/build/lib/skylark/StarlarkStringRepresentationsTest.java index 0b1eb59..2225579 100644 --- a/src/test/java/com/google/devtools/build/lib/skylark/SkylarkStringRepresentationsTest.java +++ b/src/test/java/com/google/devtools/build/lib/skylark/StarlarkStringRepresentationsTest.java
@@ -27,14 +27,14 @@ /** Tests for string representations of Starlark objects. */ @RunWith(JUnit4.class) -public class SkylarkStringRepresentationsTest extends BuildViewTestCase { +public class StarlarkStringRepresentationsTest extends BuildViewTestCase { // Different ways to format objects, these suffixes are used in the `prepare_params` function private static final ImmutableList<String> SUFFIXES = ImmutableList.of("_str", "_repr", "_format", "_str_perc", "_repr_perc"); - private Object skylarkLoadingEval(String code) throws Exception { - return skylarkLoadingEval(code, ""); + private Object starlarkLoadingEval(String code) throws Exception { + return starlarkLoadingEval(code, ""); } /** @@ -43,7 +43,7 @@ * @param code The code to execute * @param definition Additional code to define necessary variables */ - private Object skylarkLoadingEval(String code, String definition) throws Exception { + private Object starlarkLoadingEval(String code, String definition) throws Exception { scratch.overwriteFile("eval/BUILD", "load(':eval.bzl', 'eval')", "eval(name='eval')"); scratch.overwriteFile( "eval/eval.bzl", @@ -69,7 +69,7 @@ * * @param code The code to execute */ - private Object skylarkLoadingEvalInBuildFile(String code) throws Exception { + private Object starlarkLoadingEvalInBuildFile(String code) throws Exception { scratch.overwriteFile("eval/BUILD", "load(':eval.bzl', 'eval')", String.format("eval(name='eval', param = %s)", code)); @@ -101,15 +101,15 @@ */ private void assertStringRepresentationInBuildFile( String expression, String representation) throws Exception { - assertThat(skylarkLoadingEvalInBuildFile(String.format("str(%s)", expression))) + assertThat(starlarkLoadingEvalInBuildFile(String.format("str(%s)", expression))) .isEqualTo(representation); - assertThat(skylarkLoadingEvalInBuildFile(String.format("repr(%s)", expression))) + assertThat(starlarkLoadingEvalInBuildFile(String.format("repr(%s)", expression))) .isEqualTo(representation); - assertThat(skylarkLoadingEvalInBuildFile(String.format("'%%s' %% (%s,)", expression))) + assertThat(starlarkLoadingEvalInBuildFile(String.format("'%%s' %% (%s,)", expression))) .isEqualTo(representation); - assertThat(skylarkLoadingEvalInBuildFile(String.format("'%%r' %% (%s,)", expression))) + assertThat(starlarkLoadingEvalInBuildFile(String.format("'%%r' %% (%s,)", expression))) .isEqualTo(representation); - assertThat(skylarkLoadingEvalInBuildFile(String.format("'{}'.format(%s)", expression))) + assertThat(starlarkLoadingEvalInBuildFile(String.format("'{}'.format(%s)", expression))) .isEqualTo(representation); } @@ -125,15 +125,15 @@ */ private void assertStringRepresentation( String definition, String expression, String representation) throws Exception { - assertThat(skylarkLoadingEval(String.format("str(%s)", expression), definition)) + assertThat(starlarkLoadingEval(String.format("str(%s)", expression), definition)) .isEqualTo(representation); - assertThat(skylarkLoadingEval(String.format("repr(%s)", expression), definition)) + assertThat(starlarkLoadingEval(String.format("repr(%s)", expression), definition)) .isEqualTo(representation); - assertThat(skylarkLoadingEval(String.format("'%%s' %% (%s,)", expression), definition)) + assertThat(starlarkLoadingEval(String.format("'%%s' %% (%s,)", expression), definition)) .isEqualTo(representation); - assertThat(skylarkLoadingEval(String.format("'%%r' %% (%s,)", expression), definition)) + assertThat(starlarkLoadingEval(String.format("'%%r' %% (%s,)", expression), definition)) .isEqualTo(representation); - assertThat(skylarkLoadingEval(String.format("'{}'.format(%s)", expression), definition)) + assertThat(starlarkLoadingEval(String.format("'{}'.format(%s)", expression), definition)) .isEqualTo(representation); } @@ -224,22 +224,22 @@ @Test public void testStringRepresentations_Strings() throws Exception { - assertThat(skylarkLoadingEval("str('foo')")).isEqualTo("foo"); - assertThat(skylarkLoadingEval("'%s' % 'foo'")).isEqualTo("foo"); - assertThat(skylarkLoadingEval("'{}'.format('foo')")).isEqualTo("foo"); - assertThat(skylarkLoadingEval("repr('foo')")).isEqualTo("\"foo\""); - assertThat(skylarkLoadingEval("'%r' % 'foo'")).isEqualTo("\"foo\""); + assertThat(starlarkLoadingEval("str('foo')")).isEqualTo("foo"); + assertThat(starlarkLoadingEval("'%s' % 'foo'")).isEqualTo("foo"); + assertThat(starlarkLoadingEval("'{}'.format('foo')")).isEqualTo("foo"); + assertThat(starlarkLoadingEval("repr('foo')")).isEqualTo("\"foo\""); + assertThat(starlarkLoadingEval("'%r' % 'foo'")).isEqualTo("\"foo\""); } @Test public void testStringRepresentations_Labels() throws Exception { - assertThat(skylarkLoadingEval("str(Label('//foo:bar'))")).isEqualTo("//foo:bar"); - assertThat(skylarkLoadingEval("'%s' % Label('//foo:bar')")).isEqualTo("//foo:bar"); - assertThat(skylarkLoadingEval("'{}'.format(Label('//foo:bar'))")).isEqualTo("//foo:bar"); - assertThat(skylarkLoadingEval("repr(Label('//foo:bar'))")).isEqualTo("Label(\"//foo:bar\")"); - assertThat(skylarkLoadingEval("'%r' % Label('//foo:bar')")).isEqualTo("Label(\"//foo:bar\")"); + assertThat(starlarkLoadingEval("str(Label('//foo:bar'))")).isEqualTo("//foo:bar"); + assertThat(starlarkLoadingEval("'%s' % Label('//foo:bar')")).isEqualTo("//foo:bar"); + assertThat(starlarkLoadingEval("'{}'.format(Label('//foo:bar'))")).isEqualTo("//foo:bar"); + assertThat(starlarkLoadingEval("repr(Label('//foo:bar'))")).isEqualTo("Label(\"//foo:bar\")"); + assertThat(starlarkLoadingEval("'%r' % Label('//foo:bar')")).isEqualTo("Label(\"//foo:bar\")"); - assertThat(skylarkLoadingEval("'{}'.format([Label('//foo:bar')])")) + assertThat(starlarkLoadingEval("'{}'.format([Label('//foo:bar')])")) .isEqualTo("[Label(\"//foo:bar\")]"); }
diff --git a/src/test/java/com/google/devtools/build/lib/skylark/util/SkylarkTestCase.java b/src/test/java/com/google/devtools/build/lib/skylark/util/StarlarkTestCase.java similarity index 88% rename from src/test/java/com/google/devtools/build/lib/skylark/util/SkylarkTestCase.java rename to src/test/java/com/google/devtools/build/lib/skylark/util/StarlarkTestCase.java index e9913bf..81fe6eb 100644 --- a/src/test/java/com/google/devtools/build/lib/skylark/util/SkylarkTestCase.java +++ b/src/test/java/com/google/devtools/build/lib/skylark/util/StarlarkTestCase.java
@@ -16,8 +16,8 @@ import com.google.common.collect.ImmutableMap; -import com.google.devtools.build.lib.analysis.skylark.SkylarkModules; -import com.google.devtools.build.lib.analysis.skylark.SkylarkRuleContext; +import com.google.devtools.build.lib.analysis.skylark.StarlarkModules; +import com.google.devtools.build.lib.analysis.skylark.StarlarkRuleContext; import com.google.devtools.build.lib.analysis.util.BuildViewTestCase; import com.google.devtools.build.lib.cmdline.Label; import com.google.devtools.build.lib.events.Event; @@ -36,11 +36,11 @@ * A class to contain the common functionality for analysis-phase Starlark tests. The less stuff * here, the better. */ -public abstract class SkylarkTestCase extends BuildViewTestCase { +public abstract class StarlarkTestCase extends BuildViewTestCase { protected EvaluationTestCase ev; - // Subclasses must call this method after change SkylarkSemantics (among other things). + // Subclasses must call this method after change StarlarkSemantics (among other things). @Before public final void reset() throws Exception { ev = createEvaluationTestCase(); @@ -49,7 +49,7 @@ private EvaluationTestCase createEvaluationTestCase() throws Exception { // Set up globals. ImmutableMap.Builder<String, Object> env = ImmutableMap.builder(); - SkylarkModules.addSkylarkGlobalsToBuilder(env); + StarlarkModules.addStarlarkGlobalsToBuilder(env); Starlark.addModule(env, new PlatformCommon()); Module globals = Module.createForBuiltins(env.build()); @@ -68,7 +68,7 @@ thread.setPrintHandler(Event.makeDebugPrintHandler(getEventHandler())); // This StarlarkThread has no PackageContext, so attempts to create a rule will fail. - // Rule creation is tested by SkylarkIntegrationTest. + // Rule creation is tested by StarlarkIntegrationTest. new BazelStarlarkContext( BazelStarlarkContext.Phase.LOADING, @@ -107,8 +107,8 @@ ev.checkEvalErrorContains(msg, input); } - protected final SkylarkRuleContext createRuleContext(String label) throws Exception { - return new SkylarkRuleContext( + protected final StarlarkRuleContext createRuleContext(String label) throws Exception { + return new StarlarkRuleContext( getRuleContextForStarlark(getConfiguredTarget(label)), null, getStarlarkSemantics()); }
diff --git a/src/test/java/com/google/devtools/build/lib/syntax/util/EvaluationTestCase.java b/src/test/java/com/google/devtools/build/lib/syntax/util/EvaluationTestCase.java index 52680ca..9896f18 100644 --- a/src/test/java/com/google/devtools/build/lib/syntax/util/EvaluationTestCase.java +++ b/src/test/java/com/google/devtools/build/lib/syntax/util/EvaluationTestCase.java
@@ -17,7 +17,7 @@ import static org.junit.Assert.fail; import com.google.common.collect.ImmutableMap; -import com.google.devtools.build.lib.analysis.skylark.SkylarkModules; // a bad dependency +import com.google.devtools.build.lib.analysis.skylark.StarlarkModules; // a bad dependency import com.google.devtools.build.lib.events.Event; import com.google.devtools.build.lib.events.EventCollector; import com.google.devtools.build.lib.events.EventKind; @@ -68,12 +68,12 @@ /** * Returns a new thread using the semantics set by setSemantics(), the predeclared environment of - * SkylarkModules and prior calls to predeclared(), and a new mutability. Overridden by + * StarlarkModules and prior calls to predeclared(), and a new mutability. Overridden by * subclasses. */ public StarlarkThread newStarlarkThread() { ImmutableMap.Builder<String, Object> envBuilder = ImmutableMap.builder(); - SkylarkModules.addSkylarkGlobalsToBuilder(envBuilder); // TODO(adonovan): break bad dependency + StarlarkModules.addStarlarkGlobalsToBuilder(envBuilder); // TODO(adonovan): break bad dependency envBuilder.putAll(extraPredeclared); StarlarkThread thread = @@ -207,14 +207,14 @@ */ public final class Scenario { private final SetupActions setup = new SetupActions(); - private final String[] skylarkOptions; + private final String[] starlarkOptions; - public Scenario(String... skylarkOptions) { - this.skylarkOptions = skylarkOptions; + public Scenario(String... starlarkOptions) { + this.starlarkOptions = starlarkOptions; } private void run(Testable testable) throws Exception { - setSemantics(skylarkOptions); + setSemantics(starlarkOptions); testable.run(); }