forked from bazelbuild/bazel
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge ManifestMergerAction-related commits into release-5.3.0 (bazelb…
…uild#15824) * Support uses-permission merging in manifest merger Adding support for conditionally merging `uses-permissions`. bazelbuild#10628 bazelbuild#5411 Closes bazelbuild#13445. RELNOTES: Enable merging permissions during Android manifest merging with the --merge_android_manifest_permissions flag. PiperOrigin-RevId: 439613035 * Make ManifestMergerAction worker compatible Calling `System#exit` kills the worker during the build. Passing the exception up to the worker should be enough for it to end up in the worker or local execution output. Closes bazelbuild#14427. PiperOrigin-RevId: 447808701 * Fix ManifestMergerAction test case on windows `manifest.toString().replaceFirst("^/", "")` silently fails on windows machines causing `removePermissions` to write to the original test file. This pull request creates a new temp file that `removePermissions` can write the modified manifest to. Pulling this change out of another PR so that it's easier to merge. Original PR here https://github.com/bazelbuild/bazel/pull/13445/files#r631575251 Closes bazelbuild#13760. PiperOrigin-RevId: 438643774 Co-authored-by: Ben Lee <ben@ben.cm>
- Loading branch information
Showing
10 changed files
with
377 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
src/main/java/com/google/devtools/build/lib/rules/android/BazelAndroidConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
// Copyright 2022 The Bazel Authors. All rights reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package com.google.devtools.build.lib.rules.android; | ||
|
||
import com.google.devtools.build.lib.analysis.config.BuildOptions; | ||
import com.google.devtools.build.lib.analysis.config.Fragment; | ||
import com.google.devtools.build.lib.analysis.config.FragmentOptions; | ||
import com.google.devtools.build.lib.analysis.config.RequiresOptions; | ||
import com.google.devtools.build.lib.concurrent.ThreadSafety.Immutable; | ||
import com.google.devtools.common.options.Option; | ||
import com.google.devtools.common.options.OptionDocumentationCategory; | ||
import com.google.devtools.common.options.OptionEffectTag; | ||
import com.google.errorprone.annotations.CheckReturnValue; | ||
|
||
/** Configuration fragment for Android rules that is specific to Bazel. */ | ||
@Immutable | ||
@RequiresOptions(options = {BazelAndroidConfiguration.Options.class}) | ||
@CheckReturnValue | ||
public class BazelAndroidConfiguration extends Fragment { | ||
|
||
@Override | ||
public boolean isImmutable() { | ||
return true; // immutable and Starlark-hashable | ||
} | ||
|
||
/** Android configuration options that are specific to Bazel. */ | ||
public static class Options extends FragmentOptions { | ||
|
||
@Option( | ||
name = "merge_android_manifest_permissions", | ||
defaultValue = "false", | ||
documentationCategory = OptionDocumentationCategory.UNDOCUMENTED, | ||
effectTags = {OptionEffectTag.AFFECTS_OUTPUTS}, | ||
help = | ||
"If enabled, the manifest merger will merge uses-permission and " | ||
+ "uses-permission-sdk-23 attributes.") | ||
public boolean mergeAndroidManifestPermissions; | ||
} | ||
|
||
private final boolean mergeAndroidManifestPermissions; | ||
|
||
public BazelAndroidConfiguration(BuildOptions buildOptions) { | ||
Options options = buildOptions.get(BazelAndroidConfiguration.Options.class); | ||
this.mergeAndroidManifestPermissions = options.mergeAndroidManifestPermissions; | ||
} | ||
|
||
public boolean getMergeAndroidManifestPermissions() { | ||
return this.mergeAndroidManifestPermissions; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
...om/google/devtools/build/android/testing/manifestmerge/brokenManifest/AndroidManifest.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.example.bazel" | ||
android:versionCode="1" | ||
android:versionName="1.0"/> | ||
|
||
<uses-sdk | ||
android:minSdkVersion="21" | ||
android:targetSdkVersion="26"/> | ||
|
||
</manifest> |
Oops, something went wrong.