Update all attributes which use the host transition to use the host transition
factory.
This will help ensure that calls to TransitionFactory.isHost will always be
correct.
Part of #7814.
PiperOrigin-RevId: 240977747
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 2211e573..b0320d2 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
@@ -98,10 +98,12 @@
@Test
public void testDoublePropertySet() {
- Attribute.Builder<String> builder = attr("x", STRING).mandatory()
- .cfg(HostTransition.INSTANCE)
- .undocumented("")
- .value("y");
+ Attribute.Builder<String> builder =
+ attr("x", STRING)
+ .mandatory()
+ .cfg(HostTransition.createFactory())
+ .undocumented("")
+ .value("y");
try {
builder.mandatory();
fail();
@@ -109,7 +111,7 @@
// expected
}
try {
- builder.cfg(HostTransition.INSTANCE);
+ builder.cfg(HostTransition.createFactory());
fail();
} catch (IllegalStateException expected) {
// expected
@@ -298,7 +300,8 @@
@Test
public void testHostTransition() throws Exception {
- Attribute attr = attr("foo", LABEL).cfg(HostTransition.INSTANCE).allowedFileTypes().build();
+ Attribute attr =
+ attr("foo", LABEL).cfg(HostTransition.createFactory()).allowedFileTypes().build();
assertThat(attr.hasHostConfigurationTransition()).isTrue();
assertThat(attr.hasSplitConfigurationTransition()).isFalse();
}