AAPT2: Implement density stripping and initial Split support
When a preferred density is supplied, the closest matching densities
will be selected, the rest stripped from the APK.
Split support will be enabled in a later CL. Command line support is still
needed, but the foundation is ready.
Bug:25958912
Change-Id: I56d599806b4ec4ffa24e17aad48d47130ca05c08
diff --git a/tools/aapt2/dump/Dump.cpp b/tools/aapt2/dump/Dump.cpp
index 915fae8..ad7de0a 100644
--- a/tools/aapt2/dump/Dump.cpp
+++ b/tools/aapt2/dump/Dump.cpp
@@ -103,21 +103,32 @@
return nullptr;
}
+ bool verbose() override {
+ return mVerbose;
+ }
+
+ void setVerbose(bool val) {
+ mVerbose = val;
+ }
+
private:
StdErrDiagnostics mDiagnostics;
+ bool mVerbose = false;
};
/**
* Entry point for dump command.
*/
int dump(const std::vector<StringPiece>& args) {
- //DumpOptions options;
- Flags flags = Flags();
+ bool verbose = false;
+ Flags flags = Flags()
+ .optionalSwitch("-v", "increase verbosity of output", &verbose);
if (!flags.parse("aapt2 dump", args, &std::cerr)) {
return 1;
}
DumpContext context;
+ context.setVerbose(verbose);
for (const std::string& arg : flags.getArgs()) {
tryDumpFile(&context, arg);