summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Ying Wang <wangying@google.com> 2010-01-12 16:37:31 -0800
committer Android Git Automerger <android-git-automerger@android.com> 2010-01-12 16:37:31 -0800
commitffebd7c2cc267ee0c33378e0c3b3b0ff260ba150 (patch)
treeaa19199bfc924052239a209e8ff694db0ed254cc
parent4a4b6e0d4646a0a4bc3cfa76cb37b4c6876dedbf (diff)
parentb4f41119044e5ec7f7b76ed4ac02b5cfbaeb474d (diff)
am b4f41119: am a1d08886: Merge "Only output proguard keep for nonempty attribute name in the AndroidManifest.xml." into eclair
Merge commit 'b4f41119044e5ec7f7b76ed4ac02b5cfbaeb474d' * commit 'b4f41119044e5ec7f7b76ed4ac02b5cfbaeb474d': Only output proguard keep for nonempty attribute name in the AndroidManifest.xml.
-rw-r--r--tools/aapt/Resource.cpp48
1 files changed, 25 insertions, 23 deletions
diff --git a/tools/aapt/Resource.cpp b/tools/aapt/Resource.cpp
index de6ff14af41a..ae8f2423e91f 100644
--- a/tools/aapt/Resource.cpp
+++ b/tools/aapt/Resource.cpp
@@ -1768,31 +1768,33 @@ writeProguardForAndroidManifest(ProguardKeepSet* keep, const sp<AaptAssets>& ass
fprintf(stderr, "ERROR: %s\n", error.string());
return -1;
}
- // asdf --> package.asdf
- // .asdf .a.b --> package.asdf package.a.b
- // asdf.adsf --> asdf.asdf
- String8 rule("-keep class ");
- const char* p = name.string();
- const char* q = strchr(p, '.');
- if (p == q) {
- rule += pkg;
- rule += name;
- } else if (q == NULL) {
- rule += pkg;
- rule += ".";
- rule += name;
- } else {
- rule += name;
- }
+ if (name.length() > 0) {
+ // asdf --> package.asdf
+ // .asdf .a.b --> package.asdf package.a.b
+ // asdf.adsf --> asdf.asdf
+ String8 rule("-keep class ");
+ const char* p = name.string();
+ const char* q = strchr(p, '.');
+ if (p == q) {
+ rule += pkg;
+ rule += name;
+ } else if (q == NULL) {
+ rule += pkg;
+ rule += ".";
+ rule += name;
+ } else {
+ rule += name;
+ }
- String8 location = tag;
- location += " ";
- location += assFile->getSourceFile();
- char lineno[20];
- sprintf(lineno, ":%d", tree.getLineNumber());
- location += lineno;
+ String8 location = tag;
+ location += " ";
+ location += assFile->getSourceFile();
+ char lineno[20];
+ sprintf(lineno, ":%d", tree.getLineNumber());
+ location += lineno;
- keep->add(rule, location);
+ keep->add(rule, location);
+ }
}
}
}