summaryrefslogtreecommitdiff
path: root/tools/aapt2/Main.cpp
diff options
context:
space:
mode:
author Adam Lesinski <adamlesinski@google.com> 2015-04-10 15:52:36 -0700
committer Adam Lesinski <adamlesinski@google.com> 2015-04-10 19:07:51 -0700
commitc7e2432dec68431d4dd9a8466f47a5761197d00a (patch)
tree3062d4a67b87aae8ad5c83cf0b228a9e5211d53b /tools/aapt2/Main.cpp
parent4d3a987694f6f6b95d8a0f1542618223ce253e6d (diff)
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
Diffstat (limited to 'tools/aapt2/Main.cpp')
-rw-r--r--tools/aapt2/Main.cpp18
1 files changed, 14 insertions, 4 deletions
diff --git a/tools/aapt2/Main.cpp b/tools/aapt2/Main.cpp
index 0215a2b5ddcb..87127fd3a75b 100644
--- a/tools/aapt2/Main.cpp
+++ b/tools/aapt2/Main.cpp
@@ -456,6 +456,7 @@ struct AaptOptions {
Collect,
Link,
Compile,
+ Manifest
};
// The phase to process.
@@ -584,6 +585,9 @@ static AaptOptions prepareArgs(int argc, char** argv) {
} 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 @@ static AaptOptions prepareArgs(int argc, char** argv) {
});
} 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 @@ static AaptOptions prepareArgs(int argc, char** argv) {
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;
}