Add proguard optimizer support. Switch to compile against WTK class files and target version 1.2 class file output, to possibly fix compatibility issues.

git-svn-id: https://zxing.googlecode.com/svn/trunk@84 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
srowen 2007-11-29 19:44:05 +00:00
parent 958edca745
commit 5ee60cd4e2
3 changed files with 54 additions and 46 deletions

View file

@ -8,21 +8,6 @@ version=0.1.2
WTK-home=/usr/local/WTK2.5.2
#WTK-home=C:\\WTK2.5.2
# Set this to a location where the platform classes included with Java version 1.4 (not later)
# have been installed. If you installed a full JDK, this is typically at 'jre/lib/rt.jar'
# under the JDK installation directory. If you just installed a JRE, it is typically at
# 'lib/rt.jar' under the JRE installation directory.
#
# Windows users: typically Java will be installed in a subdirectory of C:\Program Files\Java
#
# Linux users: installation directory varies, but is typically under /usr/local or /usr/lib
#
# Mac users, the Java 1.4 classes are at:
# /System/Library/Frameworks/JavaVM.framework/Versions/1.4/Classes/classes.jar
JDK1.4-classes=/usr/lib/jvm/j2sdk1.4.2_16/jre/lib/rt.jar
#JDK1.4-classes=C:\\Program Files\\Java\\j2re1.4.2_16\\lib\\rt.jar
#JDK1.4-classes=/System/Library/Frameworks/JavaVM.framework/Versions/1.4/Classes/classes.jar
# Set this to the location where you have installed RIM's BlackBerry JDE in order to
# create the 'rim' client. There is no Mac or Linux version, but, these platforms can still
# build by obtaining a copy of net_rim_api.jar and rapc.jar from a Windows installation,

View file

@ -20,24 +20,25 @@
<property file="../build.properties"/>
<path id="javame-compile-bootclasspath">
<fileset dir="${WTK-home}/lib">
<include name="cldcapi11.jar"/>
<include name="midpapi20.jar"/>
</fileset>
</path>
<property name="javame-compile-bootclasspath-path" refid="javame-compile-bootclasspath"/>
<target name="init">
<tstamp/>
<fail message="Please set 'JDK1.4-classes' in build.properties">
<condition>
<not>
<available file="${JDK1.4-classes}" type="file"/>
</not>
</condition>
</fail>
</target>
<target name="build" depends="init">
<mkdir dir="build"/>
<javac srcdir="src"
destdir="build"
source="1.4"
target="1.4"
bootclasspath="${JDK1.4-classes}"
source="1.2"
target="1.2"
bootclasspath="${javame-compile-bootclasspath-path}"
optimize="true"
debug="true"
deprecation="true"

View file

@ -30,16 +30,18 @@
</fileset>
<pathelement location="../core/core.jar"/>
</path>
<property name="preverify-classpath" refid="wtk-build-path"/>
<path id="javame-compile-bootclasspath">
<fileset dir="${WTK-home}/lib">
<include name="cldcapi11.jar"/>
<include name="midpapi20.jar"/>
</fileset>
</path>
<property name="javame-compile-bootclasspath-path" refid="javame-compile-bootclasspath"/>
<target name="init">
<tstamp/>
<fail message="Please set 'JDK1.4-classes' in build.properties">
<condition>
<not>
<available file="${JDK1.4-classes}" type="file"/>
</not>
</condition>
</fail>
<fail message="Please set 'WTK-home' in build.properties">
<condition>
<not>
@ -47,15 +49,22 @@
</not>
</condition>
</fail>
<fail message="Please put proguard.jar in 'bin' under the WTK install directory">
<condition>
<not>
<available file="${WTK-home}/bin/proguard.jar" type="file"/>
</not>
</condition>
</fail>
</target>
<target name="compile" depends="init">
<mkdir dir="build"/>
<javac srcdir="src"
destdir="build"
source="1.4"
target="1.4"
bootclasspath="${JDK1.4-classes}"
source="1.2"
target="1.2"
bootclasspath="${javame-compile-bootclasspath-path}"
optimize="true"
debug="true"
deprecation="true"
@ -70,9 +79,9 @@
src/com/google/zxing/client/j2me/AdvancedMultimediaManager.java -->
<javac srcdir="src-basic"
destdir="build"
source="1.4"
target="1.4"
bootclasspath="${JDK1.4-classes}"
source="1.2"
target="1.2"
bootclasspath="${javame-compile-bootclasspath-path}"
optimize="true"
debug="true"
deprecation="true"
@ -81,9 +90,9 @@
</javac>
<javac srcdir="src"
destdir="build"
source="1.4"
target="1.4"
bootclasspath="${JDK1.4-classes}"
source="1.2"
target="1.2"
bootclasspath="${javame-compile-bootclasspath-path}"
optimize="true"
debug="true"
deprecation="true"
@ -97,7 +106,6 @@
<unzip src="../core/core.jar" dest="build"/>
<mkdir dir="build-j2me"/>
<property name="preverify-classpath" refid="wtk-build-path"/>
<exec executable="${WTK-home}/bin/preverify1.1">
<arg line="-classpath ${preverify-classpath} -d build-j2me build"/>
</exec>
@ -117,6 +125,20 @@
<jar jarfile="${jar-name}.jar" basedir="build-j2me" manifest="src/com/google/zxing/client/j2me/MANIFEST.MF" level="9"/>
<move file="${jar-name}.jar" tofile="temp.jar"/>
<java jar="${WTK-home}/bin/proguard.jar" fork="true">
<arg value="-injars temp.jar"/>
<arg value="-outjars ${jar-name}.jar"/>
<arg value="-libraryjars ${preverify-classpath}"/>
<arg value="-microedition"/>
<arg value="-keep public class com.google.zxing.client.j2me.ZXingMIDlet"/>
<arg value="-keep public class com.google.zxing.qrcode.deteor.DefaultGridSampler"/>
<arg value="-keep public class com.google.zxing.qrcode.detector.GridSampler"/>
<arg value="-optimizationpasses 5"/>
<arg value="-verbose"/>
</java>
<delete file="temp.jar"/>
<!-- get .jar size to include it in the .jad file -->
<length file="${jar-name}.jar" property="jar-size"/>