aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/rules/android/AndroidBinaryOnlyRule.java
diff options
context:
space:
mode:
authorGravatar Andrew Pellegrini <apell@google.com>2016-06-22 20:46:21 +0000
committerGravatar Lukacs Berki <lberki@google.com>2016-06-23 11:10:23 +0000
commite1a4a812971f604d51bdf098b6117d9ba03da1c8 (patch)
treed53b64a6f80fb82cfa43d65c9b3f2f73b9084cdf /src/main/java/com/google/devtools/build/lib/rules/android/AndroidBinaryOnlyRule.java
parent6105e2415faa0f36ec6ae3399d90e1a173ef7f58 (diff)
Adds the Android manifest merger as an option for android_binary rules. The merger that is used (legacy or android) is controlled by the manifest_merger attribute on android_binary and the default is controlled by the --android_manifest_merger flag.
RELNOTES: The Android manifest merger is now available as an option for android_binary rules. The merger will honor tools annotations in AndroidManifest.xml and will perform placeholder substitutions using the values specified in android_binary.manifest_values. The merger may be selected by setting the manifest_merger attribute on android_binary. -- MOS_MIGRATED_REVID=125603954
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules/android/AndroidBinaryOnlyRule.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/android/AndroidBinaryOnlyRule.java44
1 files changed, 35 insertions, 9 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidBinaryOnlyRule.java b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidBinaryOnlyRule.java
index a558b05664..e6e116d888 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidBinaryOnlyRule.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidBinaryOnlyRule.java
@@ -26,6 +26,7 @@ import com.google.devtools.build.lib.analysis.RuleDefinitionEnvironment;
import com.google.devtools.build.lib.packages.Attribute.AllowedValueSet;
import com.google.devtools.build.lib.packages.RuleClass;
import com.google.devtools.build.lib.packages.RuleClass.Builder.RuleClassType;
+import com.google.devtools.build.lib.rules.android.AndroidConfiguration.AndroidManifestMerger;
import com.google.devtools.build.lib.rules.android.AndroidRuleClasses.MultidexMode;
/**
@@ -35,15 +36,40 @@ public final class AndroidBinaryOnlyRule implements RuleDefinition {
@Override
public RuleClass build(RuleClass.Builder builder, final RuleDefinitionEnvironment env) {
return builder
-// /* <!-- #BLAZE_RULE(android_binary).ATTRIBUTE(manifest_values) -->
-// A dictionary of values to be overridden in the manifest. Any instance of ${name} in the
-// manifest will be replaced with the value corresponding to name in this dictionary.
-// applicationId, versionCode, versionName, minSdkVersion, targetSdkVersion and
-// maxSdkVersion will also override the corresponding attributes of the manifest and
-// uses-sdk tags. packageName will be ignored and will be set from either applicationId if
-// specified or the package in manifest.
-// <!-- #END_BLAZE_RULE.ATTRIBUTE --> */
- .add(attr("manifest_values", STRING_DICT).undocumented("not ready for production use"))
+ /* <!-- #BLAZE_RULE(android_binary).ATTRIBUTE(manifest_merger) -->
+ Select the manifest merger to use for this rule.<br/>
+ Possible values:
+ <ul>
+ <li><code>manifest_merger = "legacy"</code>: Use the legacy manifest merger. Does not
+ allow features of the android merger like placeholder substitution and tools
+ attributes for defining merge behavior. Removes all
+ <code>&lt;uses-permission&gt;</code> and <code>&lt;uses-permission-sdk-23&gt;</code>
+ tags. Performs a tag-level merge.</li>
+ <li><code>manifest_merger = "android"</code>: Use the android manifest merger. Allows
+ features like placeholder substitution and tools attributes for defining merge
+ behavior. Follows the semantics from
+ <a href="http://tools.android.com/tech-docs/new-build-system/user-guide/manifest-merger">
+ the documentation</a> except it has been modified to also remove all
+ <code>&lt;uses-permission&gt;</code> and <code>&lt;uses-permission-sdk-23&gt;</code>
+ tags. Performs an attribute-level merge.</li>
+ <li><code>manifest_merger = "auto"</code>: Merger is controlled by the
+ <a href="../blaze-user-manual.html#flag--android_manifest_merger">
+ --android_manifest_merger</a> flag.</li>
+ </ul>
+ <!-- #END_BLAZE_RULE.ATTRIBUTE --> */
+ .add(attr("manifest_merger", STRING)
+ .allowedValues(new AllowedValueSet(AndroidManifestMerger.getAttributeValues()))
+ .value(AndroidManifestMerger.getRuleAttributeDefault()))
+ /* <!-- #BLAZE_RULE(android_binary).ATTRIBUTE(manifest_values) -->
+ A dictionary of values to be overridden in the manifest. Any instance of ${name} in the
+ manifest will be replaced with the value corresponding to name in this dictionary.
+ applicationId, versionCode, versionName, minSdkVersion, targetSdkVersion and
+ maxSdkVersion will also override the corresponding attributes of the manifest and
+ uses-sdk tags. packageName will be ignored and will be set from either applicationId if
+ specified or the package in manifest. When manifest_merger is set to legacy, only
+ applicationId, versionCode and versionName will have any effect.
+ <!-- #END_BLAZE_RULE.ATTRIBUTE --> */
+ .add(attr("manifest_values", STRING_DICT))
/* <!-- #BLAZE_RULE(android_binary).ATTRIBUTE(nocompress_extensions) -->
A list of file extension to leave uncompressed in apk.
<!-- #END_BLAZE_RULE.ATTRIBUTE --> */