diff options
author | Adam Koski <adamkoski@google.com> | 2017-11-10 11:15:55 -0800 |
---|---|---|
committer | Adam Koski <adamkoski@google.com> | 2017-11-10 11:30:56 -0800 |
commit | 09ef94e918870a55907b20f35348cc7b77bdc148 (patch) | |
tree | f1078d6bf7c7d1200c5c0981a16477576d0b6461 /tools/aapt2/java/ProguardRules.cpp | |
parent | 5d8150092ddd0e33849664d9b5f9abd260c3d408 (diff) |
Change conditional keep rule syntax
Google's ProGuard fork is migrating to a new syntax that upstream
ProGuard 6.0 will also support.
Test: unit tests
Bug: 69162105
Change-Id: I3b6d7e82eb99c2e2af6c4d851a4f97ec3e471b55
Diffstat (limited to 'tools/aapt2/java/ProguardRules.cpp')
-rw-r--r-- | tools/aapt2/java/ProguardRules.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/tools/aapt2/java/ProguardRules.cpp b/tools/aapt2/java/ProguardRules.cpp index b9ae654a0ba6..b214d2169f50 100644 --- a/tools/aapt2/java/ProguardRules.cpp +++ b/tools/aapt2/java/ProguardRules.cpp @@ -345,15 +345,14 @@ bool WriteKeepSet(std::ostream* out, const KeepSet& keep_set) { *out << "# Referenced at " << location.source << "\n"; } if (keep_set.conditional_keep_rules_ && can_be_conditional) { - *out << "-keep class " << entry.first << " {\n ifused class **.R$layout {\n"; + *out << "-if class **.R$layout {\n"; for (const UsageLocation& location : locations) { auto transformed_name = JavaClassGenerator::TransformToFieldName(location.name.entry); - *out << " int " << transformed_name << ";\n"; + *out << " int " << transformed_name << ";\n"; } - *out << " };\n <init>(...);\n}\n" << std::endl; - } else { - *out << "-keep class " << entry.first << " { <init>(...); }\n" << std::endl; + *out << "}\n"; } + *out << "-keep class " << entry.first << " { <init>(...); }\n" << std::endl; } for (const auto& entry : keep_set.method_set_) { |