AAPT2: Fix product support
Previously the default product wasn't tried if 'default' wasn't specified on the command line.
Also adds support for multiple products.
Change-Id: I1e4872b34bb8d609b6444841a4e7e4dbb3bbb76b
diff --git a/tools/aapt2/ResourceParser.h b/tools/aapt2/ResourceParser.h
index 29b1bc1..9ad749e 100644
--- a/tools/aapt2/ResourceParser.h
+++ b/tools/aapt2/ResourceParser.h
@@ -34,11 +34,11 @@
struct ResourceParserOptions {
/**
- * Optional product name by which to filter resources.
+ * Optional product names by which to filter resources.
* This is like a preprocessor definition in that we strip out resources
* that don't match before we compile them.
*/
- Maybe<std::u16string> product;
+ std::vector<std::u16string> products;
/**
* Whether the default setting for this parser is to allow translation.
@@ -101,6 +101,9 @@
bool parseArrayImpl(xml::XmlPullParser* parser, ParsedResource* outResource, uint32_t typeMask);
bool parsePlural(xml::XmlPullParser* parser, ParsedResource* outResource);
+ bool shouldStripResource(const ResourceNameRef& name,
+ const Maybe<std::u16string>& product) const;
+
IDiagnostics* mDiag;
ResourceTable* mTable;
Source mSource;