Automated rollback of commit 3c115a0944a81cec632c5493a3d84ff8ecb50f80.
*** Reason for rollback ***
Roll forward with fix.
PiperOrigin-RevId: 285447110
diff --git a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidBinary.java b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidBinary.java
index 91ffb5c..965308e 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidBinary.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidBinary.java
@@ -160,6 +160,10 @@
"'proguard_apply_dictionary' can only be used when 'proguard_specs' is also set");
}
}
+ if (ruleContext.attributes().isAttributeValueExplicitlySpecified("shrink_resources")
+ && dataContext.throwOnShrinkResources()) {
+ ruleContext.throwWithAttributeError("shrink_resources", "This attribute is not supported");
+ }
if (AndroidCommon.getAndroidConfig(ruleContext).desugarJava8Libs()
&& getMultidexMode(ruleContext) == MultidexMode.OFF) {
diff --git a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidDataContext.java b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidDataContext.java
index 63110c4..6379eb3 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidDataContext.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidDataContext.java
@@ -64,7 +64,7 @@
private final boolean persistentBusyboxToolsEnabled;
private final boolean optOutOfResourcePathShortening;
private final boolean optOutOfResourceNameObfuscation;
- private final boolean optOutOfResourceShrinking;
+ private final boolean throwOnShrinkResources;
private final boolean throwOnProguardApplyDictionary;
private final boolean throwOnProguardApplyMapping;
private final boolean throwOnResourceConflict;
@@ -85,9 +85,7 @@
AndroidSdkProvider.fromRuleContext(ruleContext),
hasExemption(ruleContext, "allow_raw_access_to_resource_paths", false),
hasExemption(ruleContext, "allow_resource_name_obfuscation_opt_out", false),
- // TODO(bcsf): In a subsequent CL this will be changed to allow_shrink_resources
- // including a semantic change.
- hasExemption(ruleContext, "allow_resource_shrinking_opt_out", false),
+ !hasExemption(ruleContext, "allow_shrink_resources_attribute", true),
!hasExemption(ruleContext, "allow_proguard_apply_dictionary", true),
!hasExemption(ruleContext, "allow_proguard_apply_mapping", true),
!hasExemption(ruleContext, "allow_resource_conflicts", true),
@@ -108,7 +106,7 @@
AndroidSdkProvider sdk,
boolean optOutOfResourcePathShortening,
boolean optOutOfResourceNameObfuscation,
- boolean optOutOfResourceShrinking,
+ boolean throwOnShrinkResources,
boolean throwOnProguardApplyDictionary,
boolean throwOnProguardApplyMapping,
boolean throwOnResourceConflict,
@@ -119,7 +117,7 @@
this.sdk = sdk;
this.optOutOfResourcePathShortening = optOutOfResourcePathShortening;
this.optOutOfResourceNameObfuscation = optOutOfResourceNameObfuscation;
- this.optOutOfResourceShrinking = optOutOfResourceShrinking;
+ this.throwOnShrinkResources = throwOnShrinkResources;
this.throwOnProguardApplyDictionary = throwOnProguardApplyDictionary;
this.throwOnProguardApplyMapping = throwOnProguardApplyMapping;
this.throwOnResourceConflict = throwOnResourceConflict;
@@ -206,10 +204,8 @@
return optOutOfResourceNameObfuscation;
}
- // TODO(bcsf): In a subsequent CL this will be changed to throwOnShrinkResources() including
- // a semantic change.
- public boolean optOutOfResourceShrinking() {
- return optOutOfResourceShrinking;
+ public boolean throwOnShrinkResources() {
+ return throwOnShrinkResources;
}
public boolean throwOnProguardApplyDictionary() {
@@ -256,7 +252,7 @@
state = getAndroidConfig().useAndroidResourceShrinking() ? TriState.YES : TriState.NO;
}
- return state == TriState.YES && !optOutOfResourceShrinking;
+ return state == TriState.YES;
}
boolean useResourcePathShortening() {