From 3b16a284b202e410d3b1bc9b14a578773e530b18 Mon Sep 17 00:00:00 2001 From: Googler Date: Tue, 26 Jul 2016 15:07:43 +0000 Subject: Moves exports_manifest attribute to AndroidLibraryBaseRule instead of AndroidResourceSupportRule. This removes the exports_manifest attribute from AndroidBinaryBaseRule and its children. RELNOTES: Removes exports_manifest attribute from android_binary rule. -- MOS_MIGRATED_REVID=128472120 --- .../build/lib/rules/android/AndroidLibraryBaseRule.java | 5 +++++ .../lib/rules/android/AndroidResourceContainerBuilder.java | 11 +++++++++-- .../devtools/build/lib/rules/android/AndroidRuleClasses.java | 5 ----- 3 files changed, 14 insertions(+), 7 deletions(-) (limited to 'src/main/java/com') diff --git a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidLibraryBaseRule.java b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidLibraryBaseRule.java index 778ff8d579..14a13d6cf8 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidLibraryBaseRule.java +++ b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidLibraryBaseRule.java @@ -95,6 +95,11 @@ public final class AndroidLibraryBaseRule implements RuleDefinition { .allowedFileTypes(/*May not have files in exports!*/) .aspect(jackAspect) .aspect(androidNeverlinkAspect)) + /* + Whether to export manifest entries to android_binary targets + that depend on this target. uses-permissions attributes are never exported. + */ + .add(attr("exports_manifest", BOOLEAN).value(false)) .add(attr("alwayslink", BOOLEAN).undocumented("purely informational for now")) /* Only use this library for compilation and not at runtime. diff --git a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidResourceContainerBuilder.java b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidResourceContainerBuilder.java index c1011d90ac..47dd0c3090 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidResourceContainerBuilder.java +++ b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidResourceContainerBuilder.java @@ -73,7 +73,7 @@ public final class AndroidResourceContainerBuilder { data.getResources(), data.getAssetRoots(), data.getResourceRoots(), - ruleContext.attributes().get("exports_manifest", Type.BOOLEAN), + getExportsManifest(ruleContext), rOutput, symbolsFile); } @@ -96,6 +96,13 @@ public final class AndroidResourceContainerBuilder { return ruleContext.attributes().isAttributeValueExplicitlySpecified("custom_package"); } + private boolean getExportsManifest(RuleContext ruleContext) { + // AndroidLibraryBaseRule has exports_manifest but AndroidBinaryBaseRule does not. + // ResourceContainers are built for both, so we must check if exports_manifest is present. + return ruleContext.attributes().has("exports_manifest", Type.BOOLEAN) + && ruleContext.attributes().get("exports_manifest", Type.BOOLEAN); + } + @Nullable private String getRenameManifestPackage(RuleContext ruleContext) { return ruleContext.attributes().isAttributeValueExplicitlySpecified("rename_manifest_package") @@ -107,4 +114,4 @@ public final class AndroidResourceContainerBuilder { this.symbolsFile = symbolsFile; return this; } -} \ No newline at end of file +} diff --git a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidRuleClasses.java b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidRuleClasses.java index 197c1552fd..1c2eb2b72c 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidRuleClasses.java +++ b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidRuleClasses.java @@ -435,11 +435,6 @@ public final class AndroidRuleClasses { Must be defined if resource_files or assets are defined. */ .add(attr("manifest", LABEL).legacyAllowAnyFileType()) - /* - Whether to export manifest entries to android_binary targets - that depend on this target. uses-permissions attributes are never exported. - */ - .add(attr("exports_manifest", BOOLEAN).value(false)) /* The list of resources to be packaged. This is typically a glob of all files under the -- cgit v1.2.3