Skip to content

Commit

Permalink
Use merge node markers to remove Android manifest tags (#229)
Browse files Browse the repository at this point in the history
* Remove tool declarations

* Added test
  • Loading branch information
britzl committed May 11, 2022
1 parent 7c91b11 commit fd86609
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ private static void mergeAndroid(File main, File[] libraries, File out) throws R

ManifestMerger2.Invoker invoker = ManifestMerger2.newMerger(main, ManifestMergeTool.androidLogger, ManifestMerger2.MergeType.APPLICATION);
invoker.addLibraryManifests(libraries);
invoker.withFeatures(ManifestMerger2.Invoker.Feature.REMOVE_TOOLS_DECLARATIONS);

try {
MergingReport report = invoker.merge();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ protected void createDefaultFiles() throws IOException {
+ " <application android:label=\"Test Project\" android:hasCode=\"true\">"
+ " </application>"
+ " <uses-permission android:name=\"android.permission.VIBRATE\" />"
+ " <uses-permission android:name=\"android.permission.CAMERA\" />"
+ "</manifest>";

createFile(contentRoot, "builtins/manifests/android/AndroidManifest.xml", androidManifest);
Expand Down Expand Up @@ -156,7 +157,7 @@ public void testMergeAndroid() throws IOException {

String manifest = ""
+ "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
+ "<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\" package=\"com.defold.testmerge\">"
+ "<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\" xmlns:tools=\"http://schemas.android.com/tools\" package=\"com.defold.testmerge\">"
+ " <uses-feature android:required=\"true\" android:glEsVersion=\"0x00030000\" />"
+ " <application>"
+ " <meta-data android:name=\"com.facebook.sdk.ApplicationName\""
Expand All @@ -166,6 +167,7 @@ public void testMergeAndroid() throws IOException {
+ " android:configChanges=\"keyboard|keyboardHidden|screenLayout|screenSize|orientation\""
+ " android:label=\"Test Project\" />"
+ " </application>"
+ " <uses-permission android:name=\"android.permission.CAMERA\" tools:node=\"remove\"/>"
+ "</manifest>";
createFile(contentRoot, "builtins/manifests/android/AndroidManifestLib.xml", manifest);

Expand Down

0 comments on commit fd86609

Please sign in to comment.