-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Closed
Labels
P2We'll consider working on this in future. (Assignee optional)We'll consider working on this in future. (Assignee optional)team-AndroidIssues for Android teamIssues for Android teamtype: feature request
Description
Description of the problem / feature request:
As per the documentation, uses-permissions attributes are never exported to the main app. What is the rationale behind this decision?
Is there any way to have an android_library export its permissions to an app that includes it ?
Thanks!
What operating system are you running Bazel on?
macOS
What's the output of bazel info release?
release 0.14.1-homebrew
Have you found anything relevant by searching the web?
They are manually removed here:
bazel/src/tools/android/java/com/google/devtools/build/android/ManifestMergerAction.java
Lines 157 to 185 in bb4ffd6
| private static final String[] PERMISSION_TAGS = | |
| new String[] {"uses-permission", "uses-permission-sdk-23"}; | |
| private static final StdLogger stdLogger = new StdLogger(StdLogger.Level.WARNING); | |
| private static final Logger logger = Logger.getLogger(ManifestMergerAction.class.getName()); | |
| private static Options options; | |
| private static Path removePermissions(Path manifest, Path outputDir) | |
| throws IOException, ParserConfigurationException, TransformerConfigurationException, | |
| TransformerException, TransformerFactoryConfigurationError, SAXException { | |
| DocumentBuilder docBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); | |
| Document doc = docBuilder.parse(manifest.toFile()); | |
| for (String tag : PERMISSION_TAGS) { | |
| NodeList permissions = doc.getElementsByTagName(tag); | |
| if (permissions != null) { | |
| for (int i = permissions.getLength() - 1; i >= 0; i--) { | |
| Node permission = permissions.item(i); | |
| permission.getParentNode().removeChild(permission); | |
| } | |
| } | |
| } | |
| // Write resulting manifest to the output directory, maintaining full path to prevent collisions | |
| Path output = outputDir.resolve(manifest.toString().replaceFirst("^/", "")); | |
| Files.createDirectories(output.getParent()); | |
| TransformerFactory.newInstance() | |
| .newTransformer() | |
| .transform(new DOMSource(doc), new StreamResult(output.toFile())); | |
| return output; | |
| } |
Metadata
Metadata
Assignees
Labels
P2We'll consider working on this in future. (Assignee optional)We'll consider working on this in future. (Assignee optional)team-AndroidIssues for Android teamIssues for Android teamtype: feature request