Automated rollback of commit
*** Reason for rollback ***
Breaking nightlies -- will roll forward when unknown commit goes in.
*** Original change description ***
Allow the --android_aapt flag to override attribute values.
RELNOTES: None
@@ -232,8 +232,7 @@ public class AndroidConfiguration extends BuildConfiguration.Fragment
ruleContext,
ruleContext.attributes().get("aapt_version", STRING));
} else {
- // On rules that can't choose, assume aapt2 if aapt2 is present in the sdk.
- // This ensures that non-leaf nodes (e.g. android_library) will generate aapt2 actions.
+ // On rules can't choose, assume aapt2 if aapt2 is present in the sdk.
return AndroidSdkProvider.fromRuleContext(ruleContext).getAapt2() != null ? AAPT2 : AAPT;
}
}
@@ -244,20 +243,20 @@ public class AndroidConfiguration extends BuildConfiguration.Fragment
public static AndroidAaptVersion chooseTargetAaptVersion(
AndroidDataContext dataContext,
RuleErrorConsumer errorConsumer,
- @Nullable String attributeString)
+ @Nullable String versionString)
throws RuleErrorException {
boolean hasAapt2 = dataContext.getSdk().getAapt2() != null;
AndroidAaptVersion flag = dataContext.getAndroidConfig().getAndroidAaptVersion();
- AndroidAaptVersion attribute = AndroidAaptVersion.fromString(attributeString);
- AndroidAaptVersion version = flag == AndroidAaptVersion.AUTO ? attribute : flag;
+ AndroidAaptVersion version = fromString(versionString);
+ // version is null if the value is "auto"
+ version = version == AndroidAaptVersion.AUTO ? flag : version;
if (version == AAPT2 && !hasAapt2) {
throw errorConsumer.throwWithRuleError(
"aapt2 processing requested but not available on the android_sdk");
}
- // If version is auto, assume aapt.
return version == AndroidAaptVersion.AUTO ? AAPT : version;
}
}
@@ -655,7 +654,7 @@ public class AndroidConfiguration extends BuildConfiguration.Fragment
@Option(
name = "android_aapt",
- defaultValue = "auto",
+ defaultValue = "aapt",
documentationCategory = OptionDocumentationCategory.TOOLCHAIN,
effectTags = {
OptionEffectTag.AFFECTS_OUTPUTS,
@@ -665,8 +664,7 @@ public class AndroidConfiguration extends BuildConfiguration.Fragment
converter = AndroidAaptConverter.class,
help =
"Selects the version of androidAaptVersion to use for android_binary rules."
- + "Flag to help the test and transition to aapt2."
- )
+ + "Flag to help the test and transition to aapt2.")
public AndroidAaptVersion androidAaptVersion;
@Option(
