diff options
author | Ying Wang <wangying@google.com> | 2013-11-14 17:12:10 -0800 |
---|---|---|
committer | Adam Lesinski <adamlesinski@google.com> | 2014-01-27 10:31:09 -0800 |
commit | cd28bd37ea2d88dd72930f032ca73daaad5744b4 (patch) | |
tree | 3fda41d9360e2d127b47cbe31ebd176c8a900588 /tools/aapt/ResourceTable.cpp | |
parent | 24dffd0b0beb58d900bf232448596064f3c7d483 (diff) |
Add new aapt flag --error-on-missing-config-entry
It forces aapt to return an error if aapt fails to find an resource
entry for a configuration.
Bug: 11259444
Change-Id: Ie5674a29dff5d4455e7d7c94f6b25560fb1305b7
Diffstat (limited to 'tools/aapt/ResourceTable.cpp')
-rw-r--r-- | tools/aapt/ResourceTable.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/tools/aapt/ResourceTable.cpp b/tools/aapt/ResourceTable.cpp index f2e525481399..5c3019dcf328 100644 --- a/tools/aapt/ResourceTable.cpp +++ b/tools/aapt/ResourceTable.cpp @@ -2971,13 +2971,21 @@ status_t ResourceTable::flatten(Bundle* bundle, const sp<AaptFile>& dest) tHeader->header.size = htodl(data->getSize()-typeStart); } + bool missing_entry = false; + const char* log_prefix = bundle->getErrorOnMissingConfigEntry() ? + "error" : "warning"; for (size_t i = 0; i < N; ++i) { if (!validResources[i]) { sp<ConfigList> c = t->getOrderedConfigs().itemAt(i); - fprintf(stderr, "warning: no entries written for %s/%s\n", + fprintf(stderr, "%s: no entries written for %s/%s\n", log_prefix, String8(typeName).string(), String8(c->getName()).string()); + missing_entry = true; } } + if (bundle->getErrorOnMissingConfigEntry() && missing_entry) { + fprintf(stderr, "Error: Missing entries, quit!\n"); + return NOT_ENOUGH_DATA; + } } // Fill in the rest of the package information. |