diff --git a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidSplitTransition.java b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidSplitTransition.java index 6ed732b1033678..7f026778c7c96e 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidSplitTransition.java +++ b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidSplitTransition.java @@ -36,14 +36,15 @@ import net.starlark.java.eval.Printer; /** Android Split configuration transition for properly handling native dependencies */ -public final class AndroidSplitTransition implements SplitTransition, AndroidSplitTransitionApi { +public final class AndroidSplitTransition implements SplitTransition { public static final AndroidSplitTransition INSTANCE = new AndroidSplitTransition(); - public static final TransitionFactory FACTORY = new Factory(); + public static final Factory FACTORY = new Factory(); /** A {@link TransitionFactory} instance that returns the {@link AndroidSplitTransition}. */ - static final class Factory implements TransitionFactory { + static final class Factory + implements TransitionFactory, AndroidSplitTransitionApi { @Override public ConfigurationTransition create(AttributeTransitionData unused) { @@ -64,6 +65,16 @@ public boolean isTool() { public boolean isSplit() { return true; } + + @Override + public boolean isImmutable() { + return true; + } + + @Override + public void repr(Printer printer) { + printer.append("android_common.multi_cpu_configuration"); + } } @Override @@ -128,14 +139,4 @@ private void setCcFlagsFromAndroid( newOptions.get(AndroidConfiguration.Options.class).configurationDistinguisher = ConfigurationDistinguisher.ANDROID; } - - @Override - public boolean isImmutable() { - return true; - } - - @Override - public void repr(Printer printer) { - printer.append("android_common.multi_cpu_configuration"); - } } diff --git a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidStarlarkCommon.java b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidStarlarkCommon.java index 537a1f8557a4f0..28b3054546d8cc 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidStarlarkCommon.java +++ b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidStarlarkCommon.java @@ -44,7 +44,7 @@ public String getSourceDirectoryRelativePathFromResource(Artifact resource) { @Override public AndroidSplitTransitionApi getAndroidSplitTransition() { - return AndroidSplitTransition.INSTANCE; + return AndroidSplitTransition.FACTORY; } @Override diff --git a/src/main/java/com/google/devtools/build/lib/starlarkbuildapi/android/AndroidSplitTransitionApi.java b/src/main/java/com/google/devtools/build/lib/starlarkbuildapi/android/AndroidSplitTransitionApi.java index 9ccbe05e8f7087..0e6f4123da3e43 100644 --- a/src/main/java/com/google/devtools/build/lib/starlarkbuildapi/android/AndroidSplitTransitionApi.java +++ b/src/main/java/com/google/devtools/build/lib/starlarkbuildapi/android/AndroidSplitTransitionApi.java @@ -13,8 +13,8 @@ // limitations under the License. package com.google.devtools.build.lib.starlarkbuildapi.android; +import com.google.devtools.build.lib.starlarkbuildapi.config.ConfigurationTransitionApi; import net.starlark.java.annot.StarlarkBuiltin; -import net.starlark.java.eval.StarlarkValue; /** Android configuration for properly handling native dependencies */ @StarlarkBuiltin( @@ -23,4 +23,4 @@ "Do not use this module. It is intended for migration purposes only. If you depend on it, " + "you will be broken when it is removed.", documented = false) -public interface AndroidSplitTransitionApi extends StarlarkValue {} +public interface AndroidSplitTransitionApi extends ConfigurationTransitionApi {} diff --git a/src/main/java/com/google/devtools/build/lib/starlarkbuildapi/config/StarlarkConfigApi.java b/src/main/java/com/google/devtools/build/lib/starlarkbuildapi/config/StarlarkConfigApi.java index 84e35538a3ed29..697523446534be 100644 --- a/src/main/java/com/google/devtools/build/lib/starlarkbuildapi/config/StarlarkConfigApi.java +++ b/src/main/java/com/google/devtools/build/lib/starlarkbuildapi/config/StarlarkConfigApi.java @@ -171,5 +171,5 @@ interface BuildSettingApi extends StarlarkValue {} name = "ExecTransitionFactory", category = DocCategory.BUILTIN, doc = "an execution transition.") - interface ExecTransitionFactoryApi extends StarlarkValue {} + interface ExecTransitionFactoryApi extends ConfigurationTransitionApi {} }