Skip to content

Commit

Permalink
Remove legacy manifest merging from Bazel.
Browse files Browse the repository at this point in the history
RELNOTES: android_binary.manifest_merger is no longer supported.
PiperOrigin-RevId: 191791177
  • Loading branch information
aj-michael authored and Copybara-Service committed Apr 5, 2018
1 parent 58fe737 commit 2660ffe
Show file tree
Hide file tree
Showing 9 changed files with 4 additions and 1,308 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -398,11 +398,11 @@ private ApplicationManifest getApplicationManifest(
if (AndroidResources.definesAndroidResources(ruleContext.attributes())) {
AndroidResources.validateRuleContext(ruleContext);
ApplicationManifest ruleManifest = androidSemantics.getManifestForRule(ruleContext);
applicationManifest = ruleManifest.mergeWith(ruleContext, resourceDependencies, false);
applicationManifest = ruleManifest.mergeWith(ruleContext, resourceDependencies);
} else {
// we don't have a manifest, merge like android_library with a stub manifest
ApplicationManifest dummyManifest = ApplicationManifest.generatedManifest(ruleContext);
applicationManifest = dummyManifest.mergeWith(ruleContext, resourceDependencies, false);
applicationManifest = dummyManifest.mergeWith(ruleContext, resourceDependencies);
}
return applicationManifest;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
import com.google.devtools.build.lib.packages.SkylarkProviderIdentifier;
import com.google.devtools.build.lib.packages.TriState;
import com.google.devtools.build.lib.rules.android.AndroidConfiguration.AndroidAaptVersion;
import com.google.devtools.build.lib.rules.android.AndroidConfiguration.AndroidManifestMerger;
import com.google.devtools.build.lib.rules.android.AndroidConfiguration.ConfigurationDistinguisher;
import com.google.devtools.build.lib.rules.config.ConfigFeatureFlagProvider;
import com.google.devtools.build.lib.rules.cpp.CppConfiguration;
Expand Down Expand Up @@ -173,7 +172,6 @@ public final class AndroidRuleClasses {
fromTemplates("%{name}_files/dexmanifest.txt");
public static final SafeImplicitOutputsFunction JAVA_RESOURCES_JAR =
fromTemplates("%{name}_files/java_resources.jar");
public static final String MANIFEST_MERGE_TOOL_LABEL = "//tools/android:merge_manifests";
public static final String BUILD_INCREMENTAL_DEXMANIFEST_LABEL =
"//tools/android:build_incremental_dexmanifest";
public static final String STUBIFY_MANIFEST_LABEL = "//tools/android:stubify_manifest";
Expand Down Expand Up @@ -541,12 +539,6 @@ Generated files (from genrules) can be referenced by
attr(DataBinding.DATABINDING_ANNOTATION_PROCESSOR_ATTR, LABEL)
.cfg(HostTransition.INSTANCE)
.value(env.getToolsLabel("//tools/android:databinding_annotation_processor")))
// TODO(b/30816740): Remove this once legacy manifest merging is no longer supported.
.add(
attr("$android_manifest_merge_tool", LABEL)
.cfg(HostTransition.INSTANCE)
.exec()
.value(env.getToolsLabel(AndroidRuleClasses.MANIFEST_MERGE_TOOL_LABEL)))
.advertiseSkylarkProvider(AndroidResourcesInfo.PROVIDER.id())
.advertiseSkylarkProvider(AndroidNativeLibsInfo.PROVIDER.id())
.build();
Expand Down Expand Up @@ -933,31 +925,6 @@ is exceeded. Assumes multidex classes are loaded through application code (i.e.
attr(":cc_toolchain_split", LABEL)
.cfg(AndroidRuleClasses.ANDROID_SPLIT_TRANSITION)
.value(CppRuleClasses.ccToolchainAttribute(env)))
/* <!-- #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="https://developer.android.com/studio/build/manifest-merge.html">
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="../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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ public ApplicationManifest mergeWith(RuleContext ruleContext, ResourceDependenci
return mergeWith(ruleContext, resourceDeps, legacy);
}

public ApplicationManifest mergeWith(
private ApplicationManifest mergeWith(
RuleContext ruleContext, ResourceDependencies resourceDeps, boolean legacy) {
Map<Artifact, Label> mergeeManifests = getMergeeManifests(resourceDeps.getResourceContainers());

Expand Down Expand Up @@ -234,7 +234,7 @@ public ApplicationManifest mergeWith(
}

private boolean useLegacyMerging(RuleContext ruleContext) {
boolean legacy = true;
boolean legacy = false;
if (ruleContext.isLegalFragment(AndroidConfiguration.class)
&& ruleContext.getRule().isAttrDefined("manifest_merger", STRING)) {
AndroidManifestMerger merger =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,6 @@ private ImmutableList<String> createAndroidBuildContents() {
.add("android_library(name = 'incremental_split_stub_application')")
.add("sh_binary(name = 'stubify_manifest', srcs = ['empty.sh'])")
.add("sh_binary(name = 'merge_dexzips', srcs = ['empty.sh'])")
.add("sh_binary(name = 'merge_manifests', srcs = ['empty.sh'])")
.add("sh_binary(name = 'build_split_manifest', srcs = ['empty.sh'])")
.add("filegroup(name = 'debug_keystore', srcs = ['fake.file'])")
.add("sh_binary(name = 'shuffle_jars', srcs = ['empty.sh'])")
Expand Down
17 changes: 0 additions & 17 deletions tools/android/BUILD
Original file line number Diff line number Diff line change
@@ -1,22 +1,5 @@
package(default_visibility = ["//tools:__pkg__"])

py_binary(
name = "merge_manifests",
srcs = [
"android_permissions.py",
"merge_manifests.py",
],
deps = [
"//third_party/py/gflags",
],
)

py_test(
name = "merge_manifests_test",
srcs = ["merge_manifests_test.py"],
deps = [":merge_manifests"],
)

py_binary(
name = "build_incremental_dexmanifest",
srcs = [":build_incremental_dexmanifest.py"],
Expand Down
11 changes: 0 additions & 11 deletions tools/android/BUILD.tools
Original file line number Diff line number Diff line change
Expand Up @@ -160,17 +160,6 @@ py_binary(
deps = ["//third_party/py/gflags"],
)

py_binary(
name = "merge_manifests",
srcs = [
"android_permissions.py",
"merge_manifests.py",
],
deps = [
"//third_party/py/gflags",
],
)

py_binary(
name = "build_incremental_dexmanifest",
srcs = [":build_incremental_dexmanifest.py"],
Expand Down
146 changes: 0 additions & 146 deletions tools/android/android_permissions.py

This file was deleted.

Loading

0 comments on commit 2660ffe

Please sign in to comment.