summaryrefslogtreecommitdiff
path: root/tools/aapt2/java/ProguardRules.h
diff options
context:
space:
mode:
Diffstat (limited to 'tools/aapt2/java/ProguardRules.h')
-rw-r--r--tools/aapt2/java/ProguardRules.h27
1 files changed, 23 insertions, 4 deletions
diff --git a/tools/aapt2/java/ProguardRules.h b/tools/aapt2/java/ProguardRules.h
index 46827ee7cf93..acaceac41237 100644
--- a/tools/aapt2/java/ProguardRules.h
+++ b/tools/aapt2/java/ProguardRules.h
@@ -40,6 +40,11 @@ struct UsageLocation {
Source source;
};
+struct NameAndSignature {
+ std::string name;
+ std::string signature;
+};
+
class KeepSet {
public:
KeepSet() = default;
@@ -55,8 +60,8 @@ class KeepSet {
conditional_class_set_[class_name].insert(file);
}
- inline void AddMethod(const UsageLocation& file, const std::string& method_name) {
- method_set_[method_name].insert(file);
+ inline void AddMethod(const UsageLocation& file, const NameAndSignature& name_and_signature) {
+ method_set_[name_and_signature].insert(file);
}
inline void AddReference(const UsageLocation& file, const ResourceName& resource_name) {
@@ -71,7 +76,7 @@ class KeepSet {
bool conditional_keep_rules_ = false;
std::map<std::string, std::set<UsageLocation>> manifest_class_set_;
- std::map<std::string, std::set<UsageLocation>> method_set_;
+ std::map<NameAndSignature, std::set<UsageLocation>> method_set_;
std::map<std::string, std::set<UsageLocation>> conditional_class_set_;
std::map<ResourceName, std::set<UsageLocation>> reference_set_;
};
@@ -79,7 +84,7 @@ class KeepSet {
bool CollectProguardRulesForManifest(xml::XmlResource* res, KeepSet* keep_set,
bool main_dex_only = false);
-bool CollectProguardRules(xml::XmlResource* res, KeepSet* keep_set);
+bool CollectProguardRules(IAaptContext* context, xml::XmlResource* res, KeepSet* keep_set);
bool CollectResourceReferences(IAaptContext* context, ResourceTable* table, KeepSet* keep_set);
@@ -100,6 +105,20 @@ inline int operator<(const UsageLocation& lhs, const UsageLocation& rhs) {
return lhs.name.compare(rhs.name);
}
+//
+// NameAndSignature implementation.
+//
+
+inline bool operator<(const NameAndSignature& lhs, const NameAndSignature& rhs) {
+ if (lhs.name < rhs.name) {
+ return true;
+ }
+ if (lhs.name == rhs.name) {
+ return lhs.signature < rhs.signature;
+ }
+ return false;
+}
+
} // namespace proguard
} // namespace aapt