1 <?xml version="1.0" encoding="UTF-8"?>
4 Copyright 2007 Google Inc.
6 Licensed under the Apache License, Version 2.0 (the "License");
7 you may not use this file except in compliance with the License.
8 You may obtain a copy of the License at
10 http://www.apache.org/licenses/LICENSE-2.0
12 Unless required by applicable law or agreed to in writing, software
13 distributed under the License is distributed on an "AS IS" BASIS,
14 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 See the License for the specific language governing permissions and
16 limitations under the License.
19 <project name="javame" default="build">
21 <property file="../build.properties"/>
23 <path id="wtk-build-path">
24 <fileset dir="${WTK-home}/lib">
25 <include name="cldcapi11.jar"/>
26 <include name="midpapi20.jar"/>
27 <include name="mmapi.jar"/>
28 <include name="jsr234.jar"/>
29 <include name="satsa-apdu.jar"/>
31 <pathelement location="../core/core.jar"/>
33 <property name="preverify-classpath" refid="wtk-build-path"/>
35 <path id="javame-compile-bootclasspath">
36 <fileset dir="${WTK-home}/lib">
37 <include name="cldcapi11.jar"/>
38 <include name="midpapi20.jar"/>
41 <property name="javame-compile-bootclasspath-path" refid="javame-compile-bootclasspath"/>
45 <fail message="Please set 'WTK-home' in build.properties">
48 <available file="${WTK-home}" type="dir"/>
52 <fail message="Please put proguard.jar in 'bin' under the WTK install directory">
55 <available file="${WTK-home}/bin/proguard.jar" type="file"/>
59 <fail message="Please build 'core' first">
62 <available file="../core/core.jar" type="file"/>
68 <target name="compile" depends="init">
74 bootclasspath="${javame-compile-bootclasspath-path}"
79 <classpath refid="wtk-build-path"/>
81 <jar jarfile="javame.jar" basedir="build" level="9"/>
84 <target name="compile-basic" depends="init">
86 <!-- For an explanation of this odd build command, see javadoc in
87 src/com/google/zxing/client/j2me/AdvancedMultimediaManager.java -->
88 <javac srcdir="src-basic"
92 bootclasspath="${javame-compile-bootclasspath-path}"
97 <classpath refid="wtk-build-path"/>
103 bootclasspath="${javame-compile-bootclasspath-path}"
108 <classpath refid="wtk-build-path"/>
109 <exclude name="com/google/zxing/client/j2me/AdvancedMultimediaManager.java"/>
111 <jar jarfile="javame-basic.jar" basedir="build" level="9"/>
114 <target name="package">
115 <unzip src="../core/core.jar" dest="build"/>
117 <mkdir dir="build-j2me"/>
118 <exec executable="${WTK-home}/bin/preverify1.1" failonerror="true">
119 <arg line="-classpath ${preverify-classpath} -d build-j2me build"/>
122 <copy todir="build-j2me">
124 <include name="res/**"/>
128 <copy file="src/com/google/zxing/client/j2me/MANIFEST.MF.template"
129 tofile="src/com/google/zxing/client/j2me/MANIFEST.MF" overwrite="true">
131 <filter token="APP_NAME" value="${jar-name}"/>
132 <filter token="VERSION" value="${version}"/>
136 <jar jarfile="${jar-name}.jar" basedir="build-j2me" manifest="src/com/google/zxing/client/j2me/MANIFEST.MF"
139 <move file="${jar-name}.jar" tofile="temp.jar"/>
140 <java jar="${WTK-home}/bin/proguard.jar" fork="true" failonerror="true">
141 <arg value="-injars temp.jar"/>
142 <arg value="-outjars ${jar-name}.jar"/>
143 <arg value="-libraryjars ${WTK-home}/lib/cldcapi11.jar"/>
144 <arg value="-libraryjars ${WTK-home}/lib/midpapi20.jar"/>
145 <arg value="-libraryjars ${WTK-home}/lib/mmapi.jar"/>
146 <arg value="-libraryjars ${WTK-home}/lib/jsr234.jar"/>
147 <arg value="-libraryjars ../core/core.jar"/>
148 <arg value="-microedition"/>
149 <arg value="-keep public class com.google.zxing.client.j2me.ZXingMIDlet"/>
150 <arg value="-keep public class com.google.zxing.qrcode.detector.DefaultGridSampler"/>
151 <arg value="-keep public class com.google.zxing.qrcode.detector.GridSampler"/>
152 <arg value="-optimizationpasses 5"/>
153 <arg value="-verbose"/>
155 <delete file="temp.jar"/>
157 <!-- get .jar size to include it in the .jad file -->
158 <length file="${jar-name}.jar" property="jar-size"/>
160 <copy file="BarcodeReader.jad.template" tofile="${jar-name}.jad" overwrite="true">
162 <filter token="JAR_SIZE" value="${jar-size}"/>
163 <filter token="APP_NAME" value="${jar-name}"/>
164 <filter token="VERSION" value="${version}"/>
170 <target name="build">
171 <description>Builds the main reader .jar file</description>
172 <property name="jar-name" value="BarcodeReader"/>
173 <antcall target="clean"/>
174 <antcall target="compile"/>
175 <antcall target="package"/>
178 <target name="build-basic">
179 <description>Builds the basic reader .jar file</description>
180 <property name="jar-name" value="BarcodeReaderBasic"/>
181 <antcall target="clean"/>
182 <antcall target="compile-basic"/>
183 <antcall target="package"/>
186 <target name="clean">
187 <delete dir="build"/>
188 <delete dir="build-j2me"/>
189 <delete dir="." includes="*.jar"/>
190 <delete dir="." includes="*.jad"/>
191 <delete file="src/com/google/zxing/client/j2me/MANIFEST.MF"/>