diff options
author | Xavier Ducrohet <xav@android.com> | 2012-05-25 16:27:34 -0700 |
---|---|---|
committer | Xavier Ducrohet <xav@android.com> | 2012-05-29 15:02:12 -0700 |
commit | 249dc0127b12679441013dd78208706feb632c59 (patch) | |
tree | c852dfaa89f4f0c140323069b701795ac537b5b4 /anttasks | |
parent | eaa58fb5b20b4fe9a1b7354391d8afe49de65104 (diff) | |
download | sdk-249dc0127b12679441013dd78208706feb632c59.zip sdk-249dc0127b12679441013dd78208706feb632c59.tar.gz sdk-249dc0127b12679441013dd78208706feb632c59.tar.bz2 |
Use aapt output to feed proguard's keep list.
This allows us to only keep classes that are really used either
through code or through XML. Also tweak the default rules for
better control of animated properties.
Added a test of a custom property animation and fixed some other
misc test files.
Change-Id: I7cc5839a764881d8d3c7bfce0a3f12ea7cba660e
Diffstat (limited to 'anttasks')
-rw-r--r-- | anttasks/src/com/android/ant/AaptExecTask.java | 38 |
1 files changed, 18 insertions, 20 deletions
diff --git a/anttasks/src/com/android/ant/AaptExecTask.java b/anttasks/src/com/android/ant/AaptExecTask.java index 2b57277..c96f7d0 100644 --- a/anttasks/src/com/android/ant/AaptExecTask.java +++ b/anttasks/src/com/android/ant/AaptExecTask.java @@ -97,6 +97,7 @@ public final class AaptExecTask extends SingleDependencyTask { private String mLibraryPackagesRefid; private boolean mNonConstantId; private String mIgnoreAssets; + private String mProguardFile; /** * Input path that ignores the same folders/files that aapt does. @@ -321,6 +322,10 @@ public final class AaptExecTask extends SingleDependencyTask { mLibraryPackagesRefid = libraryPackagesRefid; } + public void setProguardFile(Path proguardFile) { + mProguardFile = TaskHelper.checkSinglePath("proguardFile", proguardFile); + } + /** * Returns an object representing a nested <var>nocompress</var> element. */ @@ -344,6 +349,11 @@ public final class AaptExecTask extends SingleDependencyTask { return path; } + @Override + protected String getExecTaskName() { + return "aapt"; + } + /* * (non-Javadoc) * @@ -375,24 +385,6 @@ public final class AaptExecTask extends SingleDependencyTask { libPkgProp = libPkgProp.replace(';', ':'); } } - // Call aapt. If there are libraries, we'll pass a non-null string of libs. - callAapt(libPkgProp); - } - - @Override - protected String getExecTaskName() { - return "aapt"; - } - - /** - * Calls aapt with the given parameters. - * @param resourceFilter the resource configuration filter to pass to aapt (if configName is - * non null) - * @param extraPackages an optional list of colon-separated packages. Can be null - * Ex: com.foo.one:com.foo.two:com.foo.lib - */ - private void callAapt(String extraPackages) { - Project taskProject = getProject(); final boolean generateRClass = mRFolder != null && new File(mRFolder).isDirectory(); @@ -538,9 +530,9 @@ public final class AaptExecTask extends SingleDependencyTask { } } - if (mNonConstantId == false && extraPackages != null && extraPackages.length() > 0) { + if (mNonConstantId == false && libPkgProp != null && libPkgProp.length() > 0) { task.createArg().setValue("--extra-packages"); - task.createArg().setValue(extraPackages); + task.createArg().setValue(libPkgProp); } // if the project contains libraries, force auto-add-overlay @@ -635,6 +627,12 @@ public final class AaptExecTask extends SingleDependencyTask { // Use dependency generation task.createArg().setValue("--generate-dependencies"); + // use the proguard file + if (mProguardFile != null && mProguardFile.length() > 0) { + task.createArg().setValue("-G"); + task.createArg().setValue(mProguardFile); + } + // final setup of the task task.setProject(taskProject); task.setOwningTarget(getOwningTarget()); |