]> git.saurik.com Git - android/aapt.git/commitdiff
am b4f41119: am a1d08886: Merge "Only output proguard keep for nonempty attribute...
authorYing Wang <wangying@google.com>
Wed, 13 Jan 2010 00:37:31 +0000 (16:37 -0800)
committerAndroid Git Automerger <android-git-automerger@android.com>
Wed, 13 Jan 2010 00:37:31 +0000 (16:37 -0800)
Merge commit 'b4f41119044e5ec7f7b76ed4ac02b5cfbaeb474d'

* commit 'b4f41119044e5ec7f7b76ed4ac02b5cfbaeb474d':
  Only output proguard keep for nonempty attribute name in the AndroidManifest.xml.

Resource.cpp

index de6ff14af41a45a1e9ed968a9ae4f47db45f1f82..ae8f2423e91fd6b6a8b9666921f852e7c5969a3c 100644 (file)
@@ -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);
+                }
             }
         }
     }