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 /testapps/customViewTest | |
parent | eaa58fb5b20b4fe9a1b7354391d8afe49de65104 (diff) | |
download | replicant_sdk-249dc0127b12679441013dd78208706feb632c59.zip replicant_sdk-249dc0127b12679441013dd78208706feb632c59.tar.gz replicant_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 'testapps/customViewTest')
5 files changed, 48 insertions, 75 deletions
diff --git a/testapps/customViewTest/libWithCustomView/build.xml b/testapps/customViewTest/libWithCustomView/build.xml index 772f422..7d9e032 100644 --- a/testapps/customViewTest/libWithCustomView/build.xml +++ b/testapps/customViewTest/libWithCustomView/build.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<project name="basicLibWithSupport" default="help"> +<project name="libWithCustomView" default="help"> <!-- The local.properties file is created and updated by the 'android' tool. It contains the path to the SDK. It should *NOT* be checked into @@ -39,27 +39,32 @@ application and should be checked into Version Control Systems. --> <loadproperties srcFile="project.properties" /> + <!-- if sdk.dir was not set from one of the property file, then + get it from the ANDROID_HOME env var. --> + <property environment="env" /> + <condition property="sdk.dir" value="${env.ANDROID_HOME}"> + <isset property="env.ANDROID_HOME" /> + </condition> + <!-- quick check on sdk.dir --> <fail - message="sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through an env var" + message="sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through the ANDROID_HOME environment variable." unless="sdk.dir" /> - -<!-- extension targets. Uncomment the ones where you want to do custom work - in between standard targets --> -<!-- - <target name="-pre-build"> - </target> - <target name="-pre-compile"> - </target> - - /* This is typically used for code obfuscation. - Compiled code location: ${out.classes.absolute.dir} - If this is not done in place, override ${out.dex.input.absolute.dir} */ - <target name="-post-compile"> - </target> ---> + <!-- + Import per project custom build rules if present at the root of the project. + This is the place to put custom intermediary targets such as: + -pre-build + -pre-compile + -post-compile (This is typically used for code obfuscation. + Compiled code location: ${out.classes.absolute.dir} + If this is not done in place, override ${out.dex.input.absolute.dir}) + -post-package + -post-build + -pre-clean + --> + <import file="custom_rules.xml" optional="true" /> <!-- Import the actual build file. diff --git a/testapps/customViewTest/mainProject/build.xml b/testapps/customViewTest/mainProject/build.xml index f3a3d91..2f98bb5 100644 --- a/testapps/customViewTest/mainProject/build.xml +++ b/testapps/customViewTest/mainProject/build.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<project name="basicProjectWithSupport" default="help"> +<project name="customViewTest-mainProject" default="help"> <!-- The local.properties file is created and updated by the 'android' tool. It contains the path to the SDK. It should *NOT* be checked into @@ -39,27 +39,32 @@ application and should be checked into Version Control Systems. --> <loadproperties srcFile="project.properties" /> + <!-- if sdk.dir was not set from one of the property file, then + get it from the ANDROID_HOME env var. --> + <property environment="env" /> + <condition property="sdk.dir" value="${env.ANDROID_HOME}"> + <isset property="env.ANDROID_HOME" /> + </condition> + <!-- quick check on sdk.dir --> <fail - message="sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through an env var" + message="sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through the ANDROID_HOME environment variable." unless="sdk.dir" /> - -<!-- extension targets. Uncomment the ones where you want to do custom work - in between standard targets --> -<!-- - <target name="-pre-build"> - </target> - <target name="-pre-compile"> - </target> - - /* This is typically used for code obfuscation. - Compiled code location: ${out.classes.absolute.dir} - If this is not done in place, override ${out.dex.input.absolute.dir} */ - <target name="-post-compile"> - </target> ---> + <!-- + Import per project custom build rules if present at the root of the project. + This is the place to put custom intermediary targets such as: + -pre-build + -pre-compile + -post-compile (This is typically used for code obfuscation. + Compiled code location: ${out.classes.absolute.dir} + If this is not done in place, override ${out.dex.input.absolute.dir}) + -post-package + -post-build + -pre-clean + --> + <import file="custom_rules.xml" optional="true" /> <!-- Import the actual build file. diff --git a/testapps/customViewTest/mainProject/proguard.cfg b/testapps/customViewTest/mainProject/proguard.cfg deleted file mode 100644 index b1cdf17..0000000 --- a/testapps/customViewTest/mainProject/proguard.cfg +++ /dev/null @@ -1,40 +0,0 @@ --optimizationpasses 5 --dontusemixedcaseclassnames --dontskipnonpubliclibraryclasses --dontpreverify --verbose --optimizations !code/simplification/arithmetic,!field/*,!class/merging/* - --keep public class * extends android.app.Activity --keep public class * extends android.app.Application --keep public class * extends android.app.Service --keep public class * extends android.content.BroadcastReceiver --keep public class * extends android.content.ContentProvider --keep public class * extends android.app.backup.BackupAgentHelper --keep public class * extends android.preference.Preference --keep public class com.android.vending.licensing.ILicensingService - --keepclasseswithmembernames class * { - native <methods>; -} - --keepclasseswithmembers class * { - public <init>(android.content.Context, android.util.AttributeSet); -} - --keepclasseswithmembers class * { - public <init>(android.content.Context, android.util.AttributeSet, int); -} - --keepclassmembers class * extends android.app.Activity { - public void *(android.view.View); -} - --keepclassmembers enum * { - public static **[] values(); - public static ** valueOf(java.lang.String); -} - --keep class * implements android.os.Parcelable { - public static final android.os.Parcelable$Creator *; -} diff --git a/testapps/customViewTest/mainProject/project.properties b/testapps/customViewTest/mainProject/project.properties index b80c0cf..21d68c5 100644 --- a/testapps/customViewTest/mainProject/project.properties +++ b/testapps/customViewTest/mainProject/project.properties @@ -10,3 +10,6 @@ # Project target. target=android-15 android.library.reference.1=../libWithCustomView + +# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): +proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt diff --git a/testapps/customViewTest/mainProject/res/values/strings.xml b/testapps/customViewTest/mainProject/res/values/strings.xml index 3fa203a..e86ca41 100644 --- a/testapps/customViewTest/mainProject/res/values/strings.xml +++ b/testapps/customViewTest/mainProject/res/values/strings.xml @@ -1,4 +1,4 @@ <?xml version="1.0" encoding="utf-8"?> <resources> - <string name="app_name">MyActivity</string> + <string name="app_name">customViewTest</string> </resources> |