Add --incompatible_disable_native_android_rules flag.
RELNOTES: Introduce --incompatible_disable_native_android_rules flag
@@ -854,9 +854,26 @@ public class AndroidConfiguration extends BuildConfiguration.Fragment
OptionEffectTag.EAGERNESS_TO_EXIT,
},
help =
- "If enabled, strict usage of the Starlark migration tag is enabled for android rules.")
+ "If enabled, strict usage of the Starlark migration tag is enabled for android rules. "
+ + "Prefer using --incompatible_disable_native_android_rules.")
public boolean checkForMigrationTag;
+ @Option(
+ name = "incompatible_disable_native_android_rules",
+ defaultValue = "false",
+ documentationCategory = OptionDocumentationCategory.INPUT_STRICTNESS,
+ effectTags = {
+ OptionEffectTag.EAGERNESS_TO_EXIT,
+ },
+ metadataTags = {
+ OptionMetadataTag.INCOMPATIBLE_CHANGE,
+ OptionMetadataTag.TRIGGERED_BY_ALL_INCOMPATIBLE_CHANGES
+ },
+ help =
+ "If enabled, direct usage of the native Android rules is disabled. Please use the"
+ + " Starlark Android rules from https://github.com/bazelbuild/rules_android")
+ public boolean disableNativeAndroidRules;
+
@Option(
name = "experimental_filter_r_jars_from_android_test",
defaultValue = "false",
@@ -1106,7 +1123,9 @@ public class AndroidConfiguration extends BuildConfiguration.Fragment
this.skipParsingAction = options.skipParsingAction;
this.fixedResourceNeverlinking = options.fixedResourceNeverlinking;
this.robolectricTestDeprecationLevel = options.robolectricTestDeprecationLevel;
- this.checkForMigrationTag = options.checkForMigrationTag;
+ // use --incompatible_disable_native_android_rules, and also the old flag for backwards
+ // compatibility
+ this.checkForMigrationTag = options.checkForMigrationTag || options.disableNativeAndroidRules;
this.oneVersionEnforcementUseTransitiveJarsForBinaryUnderTest =
options.oneVersionEnforcementUseTransitiveJarsForBinaryUnderTest;
this.dataBindingV2 = options.dataBindingV2;
