diff options
author | Shane Farmer <safarmer@google.com> | 2017-08-24 11:04:35 -0700 |
---|---|---|
committer | Shane Farmer <safarmer@google.com> | 2017-08-24 11:35:09 -0700 |
commit | 3d66afe208a3285fd868be90459a78fa64730789 (patch) | |
tree | 80cf2d656c0e0ee0394700c08033c6c50ee02f6a /tools/aapt2/optimize | |
parent | 612e67323feadfe2baea8181c0ad4c7cdf98ef1a (diff) |
AAPT2: Fix multi APK output
- Ensure that the output directory exists before generating APKs
- Only use the file name (and not the path) for creating output
file names
Test: manually ran optimize command
Change-Id: I5f5ecb5dcec4d17cdbca5709f2dd17e6d53df986
Diffstat (limited to 'tools/aapt2/optimize')
-rw-r--r-- | tools/aapt2/optimize/MultiApkGenerator.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/tools/aapt2/optimize/MultiApkGenerator.cpp b/tools/aapt2/optimize/MultiApkGenerator.cpp index f413ee960264..83162640a5d9 100644 --- a/tools/aapt2/optimize/MultiApkGenerator.cpp +++ b/tools/aapt2/optimize/MultiApkGenerator.cpp @@ -46,7 +46,7 @@ bool MultiApkGenerator::FromBaseApk(const std::string& out_dir, // TODO(safarmer): Handle APK version codes for the generated APKs. // TODO(safarmer): Handle explicit outputs/generating an output file list for other tools. - const std::string& apk_path = apk_->GetSource().path; + const std::string& apk_path = file::GetFilename(apk_->GetSource().path).to_string(); const StringPiece ext = file::GetExtension(apk_path); const std::string base_name = apk_path.substr(0, apk_path.rfind(ext.to_string())); @@ -122,10 +122,14 @@ bool MultiApkGenerator::FromBaseApk(const std::string& out_dir, std::unique_ptr<ResourceTable> table = apk_->GetResourceTable()->Clone(); + TableSplitter splitter{{}, splits}; splitter.SplitTable(table.get()); std::string out = out_dir; + if (!file::mkdirs(out)) { + context_->GetDiagnostics()->Warn(DiagMessage() << "could not create out dir: " << out); + } file::AppendPath(&out, artifact_name.value()); std::unique_ptr<IArchiveWriter> writer = |