summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Brian Duff <bduff@fb.com> 2019-11-12 16:16:31 -0800
committer android-build-merger <android-build-merger@google.com> 2019-11-12 16:16:31 -0800
commit65e3a342c4a8b3bdd89f35c696f3fd2c7d40f924 (patch)
tree19775baef2bebbf40202b06d08c868f1dde783ee
parentcab7ff3400297fe370f6e72fafa7214a2430d73d (diff)
parent1f44c03058ae82f813be9e25c6e159e3fa4a02fe (diff)
Merge "Speed up WriteKeepSet when generate_conditional_proguard_rules is off." am: a9ee3aaa5f
am: 1f44c03058 Change-Id: I955541f8d56c0b6b341833e6ba4ff9aa7b8c34c4
-rw-r--r--tools/aapt2/java/ProguardRules.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/tools/aapt2/java/ProguardRules.cpp b/tools/aapt2/java/ProguardRules.cpp
index 05ba8f05ec67..806f4e37e22a 100644
--- a/tools/aapt2/java/ProguardRules.cpp
+++ b/tools/aapt2/java/ProguardRules.cpp
@@ -404,12 +404,15 @@ void WriteKeepSet(const KeepSet& keep_set, OutputStream* out, bool minimal_keep)
for (const auto& entry : keep_set.conditional_class_set_) {
std::set<UsageLocation> locations;
- bool can_be_conditional = true;
- for (const UsageLocation& location : entry.second) {
- can_be_conditional &= CollectLocations(location, keep_set, &locations);
+ bool can_be_conditional = false;
+ if (keep_set.conditional_keep_rules_) {
+ can_be_conditional = true;
+ for (const UsageLocation& location : entry.second) {
+ can_be_conditional &= CollectLocations(location, keep_set, &locations);
+ }
}
- if (keep_set.conditional_keep_rules_ && can_be_conditional) {
+ if (can_be_conditional) {
for (const UsageLocation& location : locations) {
printer.Print("# Referenced at ").Println(location.source.to_string());
printer.Print("-if class **.R$layout { int ")