diff options
Diffstat (limited to 'src/test/java/com/google')
5 files changed, 20 insertions, 12 deletions
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 15bc2ccb44..d39547a1f8 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 @@ -16,7 +16,6 @@ package com.google.devtools.build.lib.analysis; import static com.google.common.truth.Truth.assertThat; import static com.google.devtools.build.lib.analysis.BaseRuleClasses.ACTION_LISTENER; import static com.google.devtools.build.lib.analysis.configuredtargets.RuleConfiguredTarget.Mode.TARGET; -import static com.google.devtools.build.lib.packages.Attribute.ConfigurationTransition.HOST; import static com.google.devtools.build.lib.packages.Attribute.attr; import static com.google.devtools.build.lib.packages.BuildType.LABEL; import static com.google.devtools.build.lib.packages.BuildType.LABEL_LIST; @@ -28,6 +27,7 @@ import com.google.common.eventbus.EventBus; import com.google.devtools.build.lib.actions.Artifact; import com.google.devtools.build.lib.actions.util.ActionsTestUtil.NullAction; import com.google.devtools.build.lib.analysis.BuildView.AnalysisResult; +import com.google.devtools.build.lib.analysis.config.HostTransition; import com.google.devtools.build.lib.analysis.util.AnalysisTestCase; import com.google.devtools.build.lib.analysis.util.MockRule; import com.google.devtools.build.lib.analysis.util.TestAspects; @@ -467,7 +467,9 @@ public class AspectTest extends AnalysisTestCase { builder .add(attr("foo", LABEL_LIST).legacyAllowAnyFileType() .aspect(new AspectThatRegistersAction())) - .add(attr(":action_listener", LABEL_LIST).cfg(HOST).value(ACTION_LISTENER))); + .add(attr(":action_listener", LABEL_LIST) + .cfg(HostTransition.INSTANCE) + .value(ACTION_LISTENER))); public static class AspectThatRegistersAction extends NativeAspectClass implements ConfiguredAspectFactory { diff --git a/src/test/java/com/google/devtools/build/lib/analysis/ConfiguredAttributeMapperTest.java b/src/test/java/com/google/devtools/build/lib/analysis/ConfiguredAttributeMapperTest.java index 6ec9372031..0d519566cb 100644 --- a/src/test/java/com/google/devtools/build/lib/analysis/ConfiguredAttributeMapperTest.java +++ b/src/test/java/com/google/devtools/build/lib/analysis/ConfiguredAttributeMapperTest.java @@ -179,8 +179,9 @@ public class ConfiguredAttributeMapperTest extends BuildViewTestCase { .getAssociatedRule() .getRuleClassObject() .getAttributeByName("tools") - .getConfigurationTransition()) - .isEqualTo(Attribute.ConfigurationTransition.HOST); + .getConfigurationTransition() + .isHostTransition()) + .isTrue(); assertThat(getHostConfiguration().getCompilationMode()).isEqualTo(CompilationMode.OPT); } diff --git a/src/test/java/com/google/devtools/build/lib/analysis/util/MockRuleDefaults.java b/src/test/java/com/google/devtools/build/lib/analysis/util/MockRuleDefaults.java index db07c140cd..1bba9b1284 100644 --- a/src/test/java/com/google/devtools/build/lib/analysis/util/MockRuleDefaults.java +++ b/src/test/java/com/google/devtools/build/lib/analysis/util/MockRuleDefaults.java @@ -13,7 +13,6 @@ // limitations under the License. package com.google.devtools.build.lib.analysis.util; -import static com.google.devtools.build.lib.packages.Attribute.ConfigurationTransition.HOST; import static com.google.devtools.build.lib.packages.Attribute.attr; import static com.google.devtools.build.lib.packages.BuildType.LABEL_LIST; import static com.google.devtools.build.lib.packages.BuildType.NODEP_LABEL_LIST; @@ -30,6 +29,7 @@ import com.google.devtools.build.lib.analysis.RuleContext; import com.google.devtools.build.lib.analysis.Runfiles; import com.google.devtools.build.lib.analysis.RunfilesProvider; import com.google.devtools.build.lib.analysis.actions.FileWriteAction; +import com.google.devtools.build.lib.analysis.config.HostTransition; 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; @@ -60,7 +60,10 @@ public class MockRuleDefaults { attr("testonly", BOOLEAN).nonconfigurable("test").value(false), attr("deprecation", STRING).nonconfigurable("test").value((String) null), attr("tags", STRING_LIST).nonconfigurable("test"), - attr("visibility", NODEP_LABEL_LIST).orderIndependent().cfg(HOST).nonconfigurable("test"), + attr("visibility", NODEP_LABEL_LIST) + .orderIndependent() + .cfg(HostTransition.INSTANCE) + .nonconfigurable("test"), attr(RuleClass.COMPATIBLE_ENVIRONMENT_ATTR, LABEL_LIST) .allowedFileTypes(FileTypeSet.NO_FILE) .dontCheckConstraints(), diff --git a/src/test/java/com/google/devtools/build/lib/packages/AttributeTest.java b/src/test/java/com/google/devtools/build/lib/packages/AttributeTest.java index 96eb366e86..4adef68f79 100644 --- a/src/test/java/com/google/devtools/build/lib/packages/AttributeTest.java +++ b/src/test/java/com/google/devtools/build/lib/packages/AttributeTest.java @@ -14,7 +14,6 @@ package com.google.devtools.build.lib.packages; import static com.google.common.truth.Truth.assertThat; -import static com.google.devtools.build.lib.packages.Attribute.ConfigurationTransition.HOST; import static com.google.devtools.build.lib.packages.Attribute.ConfigurationTransition.SPLIT; import static com.google.devtools.build.lib.packages.Attribute.attr; import static com.google.devtools.build.lib.packages.BuildType.LABEL; @@ -27,6 +26,7 @@ import static org.junit.Assert.fail; import com.google.common.base.Predicates; import com.google.common.collect.ImmutableList; import com.google.devtools.build.lib.analysis.config.BuildOptions; +import com.google.devtools.build.lib.analysis.config.HostTransition; import com.google.devtools.build.lib.analysis.util.TestAspects; import com.google.devtools.build.lib.cmdline.Label; import com.google.devtools.build.lib.packages.Attribute.SplitTransition; @@ -96,7 +96,9 @@ public class AttributeTest { @Test public void testDoublePropertySet() { - Attribute.Builder<String> builder = attr("x", STRING).mandatory().cfg(HOST).undocumented("") + Attribute.Builder<String> builder = attr("x", STRING).mandatory() + .cfg(HostTransition.INSTANCE) + .undocumented("") .value("y"); try { builder.mandatory(); @@ -105,7 +107,7 @@ public class AttributeTest { // expected } try { - builder.cfg(HOST); + builder.cfg(HostTransition.INSTANCE); fail(); } catch (IllegalStateException expected) { // expected @@ -288,8 +290,8 @@ public class AttributeTest { @Test public void testHostTransition() throws Exception { - Attribute attr = attr("foo", LABEL).cfg(HOST).allowedFileTypes().build(); - assertThat(attr.getConfigurationTransition()).isEqualTo(HOST); + Attribute attr = attr("foo", LABEL).cfg(HostTransition.INSTANCE).allowedFileTypes().build(); + assertThat(attr.getConfigurationTransition().isHostTransition()).isTrue(); assertThat(attr.hasSplitConfigurationTransition()).isFalse(); } diff --git a/src/test/java/com/google/devtools/build/lib/skylark/SkylarkRuleClassFunctionsTest.java b/src/test/java/com/google/devtools/build/lib/skylark/SkylarkRuleClassFunctionsTest.java index 202e28925b..87561bd3b7 100644 --- a/src/test/java/com/google/devtools/build/lib/skylark/SkylarkRuleClassFunctionsTest.java +++ b/src/test/java/com/google/devtools/build/lib/skylark/SkylarkRuleClassFunctionsTest.java @@ -543,7 +543,7 @@ public class SkylarkRuleClassFunctionsTest extends SkylarkTestCase { @Test public void testAttrCfg() throws Exception { Attribute attr = buildAttribute("a1", "attr.label(cfg = 'host', allow_files = True)"); - assertThat(attr.getConfigurationTransition()).isEqualTo(ConfigurationTransition.HOST); + assertThat(attr.getConfigurationTransition().isHostTransition()).isTrue(); } @Test |