From 08e7375c2cb2f7fb3e768935278afd935b4b0adc Mon Sep 17 00:00:00 2001 From: Sean Owen Date: Tue, 4 Mar 2014 16:45:52 +0000 Subject: [PATCH] Experiment with building Android through Maven --- android/AndroidManifest.xml | 4 +- android/ant.properties | 23 ----- android/build.xml | 108 ---------------------- android/pom.xml | 47 ++-------- android/proguard-android-optimize.txt | 1 - android/proguard.cfg | 3 +- android/project.properties | 14 --- androidtest/AndroidManifest.xml | 4 +- androidtest/ant.properties | 23 ----- androidtest/build.xml | 108 ---------------------- androidtest/pom.xml | 49 +++------- androidtest/proguard-android-optimize.txt | 1 - androidtest/proguard.cfg | 3 +- androidtest/project.properties | 14 --- pom.xml | 76 +++++++++++++++ 15 files changed, 105 insertions(+), 373 deletions(-) delete mode 100644 android/ant.properties delete mode 100644 android/build.xml delete mode 120000 android/proguard-android-optimize.txt delete mode 100644 android/project.properties delete mode 100644 androidtest/ant.properties delete mode 100644 androidtest/build.xml delete mode 120000 androidtest/proguard-android-optimize.txt delete mode 100644 androidtest/project.properties diff --git a/android/AndroidManifest.xml b/android/AndroidManifest.xml index c619f12f3..c17aaefb7 100755 --- a/android/AndroidManifest.xml +++ b/android/AndroidManifest.xml @@ -16,8 +16,8 @@ --> diff --git a/android/ant.properties b/android/ant.properties deleted file mode 100644 index 623e74126..000000000 --- a/android/ant.properties +++ /dev/null @@ -1,23 +0,0 @@ -# This file is used to override default values used by the Ant build system. -# -# This file must be checked in Version Control Systems, as it is -# integral to the build system of your project. - -# This file is only used by the Ant script. - -# You can use this to override default values such as -# 'source.dir' for the location of your java source folder and -# 'out.dir' for the location of your output folder. - -# You can also use it define how the release builds are signed by declaring -# the following properties: -# 'key.store' for the location of your keystore and -# 'key.alias' for the name of the key to use. -# The password will be asked during the build when you use the 'release' target. - -application-package=com.google.zxing.client.android -external-libs-folder=libs -key.store=../private/ZXing.keystore -key.alias=zxing -java.source=7 -java.target=7 \ No newline at end of file diff --git a/android/build.xml b/android/build.xml deleted file mode 100644 index 9cf123d1f..000000000 --- a/android/build.xml +++ /dev/null @@ -1,108 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/android/pom.xml b/android/pom.xml index a3db02045..5c29207f6 100644 --- a/android/pom.xml +++ b/android/pom.xml @@ -18,60 +18,33 @@ 4.0.0 android - 3.0.0-SNAPSHOT - pom + 4.6.3 + apk com.google.zxing core - ${project.version} + ${project.parent.version} + + + com.google.android + android com.google.zxing zxing-parent - 3.0.0-SNAPSHOT + 3.0.1-SNAPSHOT src - org.apache.maven.plugins - maven-antrun-plugin - - - compile - - - - - - - - run - - - - - - org.codehaus.mojo - build-helper-maven-plugin - - - generate-sources - - add-source - - - - gen - - - - + com.jayway.maven.plugins.android.generation2 + android-maven-plugin diff --git a/android/proguard-android-optimize.txt b/android/proguard-android-optimize.txt deleted file mode 120000 index c8e96d649..000000000 --- a/android/proguard-android-optimize.txt +++ /dev/null @@ -1 +0,0 @@ -proguard.cfg \ No newline at end of file diff --git a/android/proguard.cfg b/android/proguard.cfg index 7a324d9ce..3dc25f17f 100644 --- a/android/proguard.cfg +++ b/android/proguard.cfg @@ -10,7 +10,7 @@ # be complete or up to date. (The "arithmetic" optimization can be # used if you are only targeting Android 2.0 or later.) Make sure you # test thoroughly if you go this route. --optimizations !code/simplification/cast,!field/*,!class/merging/*,!code/allocation/variable +-optimizations !code/simplification/cast,!field/*,!class/merging/*,!code/allocation/variable,!method/marking/private -optimizationpasses 5 -allowaccessmodification -dontpreverify @@ -24,6 +24,7 @@ -verbose # ADDED +-dontshrink -dontobfuscate -keepattributes *Annotation* diff --git a/android/project.properties b/android/project.properties deleted file mode 100644 index ff8fa0636..000000000 --- a/android/project.properties +++ /dev/null @@ -1,14 +0,0 @@ -# This file is automatically generated by Android Tools. -# Do not modify this file -- YOUR CHANGES WILL BE ERASED! -# -# This file must be checked in Version Control Systems. -# -# To customize properties used by the Ant build system edit -# "ant.properties", and override values to adapt the script to your -# project structure. -# -# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): -proguard.config=proguard-android-optimize.txt - -# Project target. -target=android-19 diff --git a/androidtest/AndroidManifest.xml b/androidtest/AndroidManifest.xml index f82d96e64..1e3112807 100755 --- a/androidtest/AndroidManifest.xml +++ b/androidtest/AndroidManifest.xml @@ -16,8 +16,8 @@ --> diff --git a/androidtest/ant.properties b/androidtest/ant.properties deleted file mode 100644 index 315008716..000000000 --- a/androidtest/ant.properties +++ /dev/null @@ -1,23 +0,0 @@ -# This file is used to override default values used by the Ant build system. -# -# This file must be checked in Version Control Systems, as it is -# integral to the build system of your project. - -# This file is only used by the Ant script. - -# You can use this to override default values such as -# 'source.dir' for the location of your java source folder and -# 'out.dir' for the location of your output folder. - -# You can also use it define how the release builds are signed by declaring -# the following properties: -# 'key.store' for the location of your keystore and -# 'key.alias' for the name of the key to use. -# The password will be asked during the build when you use the 'release' target. - -application-package=com.google.zxing.client.androidtest -external-libs-folder=libs -key.store=../private/ZXing.keystore -key.alias=zxing -java.source=7 -java.target=7 \ No newline at end of file diff --git a/androidtest/build.xml b/androidtest/build.xml deleted file mode 100644 index 85cee7162..000000000 --- a/androidtest/build.xml +++ /dev/null @@ -1,108 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/androidtest/pom.xml b/androidtest/pom.xml index 2d2740a10..52874111a 100644 --- a/androidtest/pom.xml +++ b/androidtest/pom.xml @@ -18,65 +18,38 @@ 4.0.0 androidtest - 3.0.0-SNAPSHOT - pom + 1.4.2 + apk com.google.zxing core - ${project.version} + ${project.parent.version} com.google.zxing android-integration - ${project.version} + ${project.parent.version} + + + com.google.android + android com.google.zxing zxing-parent - 3.0.0-SNAPSHOT + 3.0.1-SNAPSHOT src - org.apache.maven.plugins - maven-antrun-plugin - - - compile - - - - - - - - run - - - - - - org.codehaus.mojo - build-helper-maven-plugin - - - generate-sources - - add-source - - - - gen - - - - + com.jayway.maven.plugins.android.generation2 + android-maven-plugin diff --git a/androidtest/proguard-android-optimize.txt b/androidtest/proguard-android-optimize.txt deleted file mode 120000 index c8e96d649..000000000 --- a/androidtest/proguard-android-optimize.txt +++ /dev/null @@ -1 +0,0 @@ -proguard.cfg \ No newline at end of file diff --git a/androidtest/proguard.cfg b/androidtest/proguard.cfg index 7a324d9ce..3dc25f17f 100644 --- a/androidtest/proguard.cfg +++ b/androidtest/proguard.cfg @@ -10,7 +10,7 @@ # be complete or up to date. (The "arithmetic" optimization can be # used if you are only targeting Android 2.0 or later.) Make sure you # test thoroughly if you go this route. --optimizations !code/simplification/cast,!field/*,!class/merging/*,!code/allocation/variable +-optimizations !code/simplification/cast,!field/*,!class/merging/*,!code/allocation/variable,!method/marking/private -optimizationpasses 5 -allowaccessmodification -dontpreverify @@ -24,6 +24,7 @@ -verbose # ADDED +-dontshrink -dontobfuscate -keepattributes *Annotation* diff --git a/androidtest/project.properties b/androidtest/project.properties deleted file mode 100644 index ff8fa0636..000000000 --- a/androidtest/project.properties +++ /dev/null @@ -1,14 +0,0 @@ -# This file is automatically generated by Android Tools. -# Do not modify this file -- YOUR CHANGES WILL BE ERASED! -# -# This file must be checked in Version Control Systems. -# -# To customize properties used by the Ant build system edit -# "ant.properties", and override values to adapt the script to your -# project structure. -# -# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): -proguard.config=proguard-android-optimize.txt - -# Project target. -target=android-19 diff --git a/pom.xml b/pom.xml index e6193a9ac..79115f0f7 100644 --- a/pom.xml +++ b/pom.xml @@ -58,6 +58,12 @@ 6.0 provided + + com.google.android + android + 4.1.1.4 + provided + junit junit @@ -84,6 +90,7 @@ UTF-8 UTF-8 1.7.6 + /Applications/adt-bundle-mac-x86_64-20131030/sdk @@ -191,6 +198,11 @@ maven-jar-plugin 2.4 + + org.apache.maven.plugins + maven-jarsigner-plugin + 1.3.1 + org.apache.maven.plugins maven-release-plugin @@ -263,6 +275,24 @@ maven-war-plugin 2.4 + + com.jayway.maven.plugins.android.generation2 + android-maven-plugin + 3.9.0-rc.1 + true + + + 15 + + + + + net.sf.proguard + proguard-base + 4.10 + + + org.apache.maven.plugins maven-site-plugin @@ -480,6 +510,52 @@ + + android-release + + + + org.apache.maven.plugins + maven-jarsigner-plugin + + + signing + + sign + + package + + + target/*.apk + + ../private/ZXing.keystore + zxing + + -sigalg + MD5withRSA + -digestalg + SHA1 + + + + + + + com.jayway.maven.plugins.android.generation2 + android-maven-plugin + + + false + proguard.cfg + + + false + + + + + +