summaryrefslogtreecommitdiff
path: root/tools/aapt2/configuration/ConfigurationParser.cpp
diff options
context:
space:
mode:
authorShane Farmer <safarmer@google.com>2017-08-21 14:39:28 -0700
committerShane Farmer <safarmer@google.com>2017-08-31 16:30:38 -0700
commitefe45392c300f922e8328281a0aab8260c1d171d (patch)
treea747038c898f6fd25680054bb328bcd9674d58e2 /tools/aapt2/configuration/ConfigurationParser.cpp
parent44bc284d96eb551117564ca004a6f2f7bc6aeddd (diff)
AAPT2: Multi APK generator by version
- Added an additional axis for generating a multi-apk split by minimum Android SDK version. This removes any resources that will not be used for the desired minimum SDK version. If there are multiple resources that would be valid for any version newer than the requested minimum, then all would be kept so that the best match can be found. - Added a context wrapper to set the appropriate Android SDK version for each generated artifact. - Split out the FilterTable method to allow it to be directly tested without the need to mock the APK writing steps. Test: Unit tests Test: manually run optimize command Change-Id: I7e6018df081af9ed5d9e8aaf40ed216c1275f138
Diffstat (limited to 'tools/aapt2/configuration/ConfigurationParser.cpp')
-rw-r--r--tools/aapt2/configuration/ConfigurationParser.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/tools/aapt2/configuration/ConfigurationParser.cpp b/tools/aapt2/configuration/ConfigurationParser.cpp
index 1735a504e553..9d6d3286f0ef 100644
--- a/tools/aapt2/configuration/ConfigurationParser.cpp
+++ b/tools/aapt2/configuration/ConfigurationParser.cpp
@@ -488,8 +488,8 @@ ConfigurationParser::ActionHandler ConfigurationParser::android_sdk_group_handle
return false;
}
- auto& group = config->android_sdk_groups[label];
bool valid = true;
+ bool found = false;
for (auto* child : root_element->GetChildElements()) {
if (child->name != "android-sdk") {
@@ -520,7 +520,11 @@ ConfigurationParser::ActionHandler ConfigurationParser::android_sdk_group_handle
}
}
- group.push_back(entry);
+ config->android_sdk_groups[label] = entry;
+ if (found) {
+ valid = false;
+ }
+ found = true;
}
}