AAPT2: Add version collapsing
When an app specifies (or imports) resources with various
configurations for different SDK versions, specifying
a minSdk will make many of those resources unreachable.
Version collapsing will prune out the resources specified
for SDK versions less than the minSdk.
If, however, there is no exact matching resource for the
minSdk version, the next smallest SDK version is kept.
Change-Id: Ic7bcab6c59d65c97c67c8767358abb57cdec60a4
diff --git a/tools/aapt2/link/Linkers.h b/tools/aapt2/link/Linkers.h
index ec532ab..43b8fb4 100644
--- a/tools/aapt2/link/Linkers.h
+++ b/tools/aapt2/link/Linkers.h
@@ -44,14 +44,21 @@
bool shouldGenerateVersionedResource(const ResourceEntry* entry, const ConfigDescription& config,
const int sdkVersionToGenerate);
-struct AutoVersioner : public IResourceTableConsumer {
+class AutoVersioner : public IResourceTableConsumer {
+public:
bool consume(IAaptContext* context, ResourceTable* table) override;
};
-struct XmlAutoVersioner : public IXmlResourceConsumer {
+class XmlAutoVersioner : public IXmlResourceConsumer {
+public:
bool consume(IAaptContext* context, xml::XmlResource* resource) override;
};
+class VersionCollapser : public IResourceTableConsumer {
+public:
+ bool consume(IAaptContext* context, ResourceTable* table) override;
+};
+
/**
* If any attribute resource values are defined as public, this consumer will move all private
* attribute resource values to a private ^private-attr type, avoiding backwards compatibility