AAPT2: Create Makefile

Makefile that uses zip for assembling the final APK. This is temporary and
helps speed up the rest of development.

Has to add a new 'manifest' phase that simply compiles the AndroidManifest.xml.
Manifests are handled differently and must be validated.

Change-Id: I0d8255b3ad0d0b0a322683077e3331ca93e37fa0
diff --git a/tools/aapt2/Main.cpp b/tools/aapt2/Main.cpp
index 0215a2b..87127fd 100644
--- a/tools/aapt2/Main.cpp
+++ b/tools/aapt2/Main.cpp
@@ -456,6 +456,7 @@
         Collect,
         Link,
         Compile,
+        Manifest
     };
 
     // The phase to process.
@@ -584,6 +585,9 @@
     } else if (command == "compile") {
         options.phase = AaptOptions::Phase::Compile;
         outputDescription = "place output in directory";
+    } else if (command == "manifest") {
+        options.phase = AaptOptions::Phase::Manifest;
+        outputDescription = "place AndroidManifest.xml in directory";
     } else {
         std::cerr << "invalid command '" << command << "'." << std::endl;
         exit(1);
@@ -611,10 +615,12 @@
                 });
 
     } else {
-        flag::requiredFlag("--package", "Android package name",
-                [&options](const StringPiece& arg) {
-                    options.appInfo.package = util::utf8ToUtf16(arg);
-                });
+        if (options.phase != AaptOptions::Phase::Manifest) {
+            flag::requiredFlag("--package", "Android package name",
+                    [&options](const StringPiece& arg) {
+                        options.appInfo.package = util::utf8ToUtf16(arg);
+                    });
+        }
 
         if (options.phase != AaptOptions::Phase::Collect) {
             flag::optionalFlag("-I", "add an Android APK to link against",
@@ -658,6 +664,10 @@
         for (const std::string& arg : flag::getArgs()) {
             options.linkFiles.push_back(Source{ arg });
         }
+    } else if (options.phase == AaptOptions::Phase::Manifest) {
+        if (!flag::getArgs().empty()) {
+            options.manifest = Source{ flag::getArgs()[0] };
+        }
     }
     return options;
 }