Fixed a few little typos
[zxing.git] / javame / build.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2
3 <!--
4  Copyright 2007 Google Inc.
5
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
9
10       http://www.apache.org/licenses/LICENSE-2.0
11
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.
17 -->
18
19 <project name="javame" default="build">
20
21   <property file="../build.properties"/>
22
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"/>
30     </fileset>
31     <pathelement location="../core/core.jar"/>
32   </path>
33   <property name="preverify-classpath" refid="wtk-build-path"/>
34
35   <path id="javame-compile-bootclasspath">
36     <fileset dir="${WTK-home}/lib">
37       <include name="cldcapi11.jar"/>
38       <include name="midpapi20.jar"/>
39     </fileset>
40   </path>
41   <property name="javame-compile-bootclasspath-path" refid="javame-compile-bootclasspath"/>
42
43   <target name="init">
44     <tstamp/>
45     <fail message="Please set 'WTK-home' in build.properties">
46       <condition>
47         <not>
48           <available file="${WTK-home}" type="dir"/>
49         </not>
50       </condition>
51     </fail>
52     <fail message="Please put proguard.jar in 'bin' under the WTK install directory">
53       <condition>
54         <not>
55           <available file="${WTK-home}/bin/proguard.jar" type="file"/>
56         </not>
57       </condition>
58     </fail>
59   </target>
60
61   <target name="compile" depends="init">
62     <mkdir dir="build"/>
63     <javac srcdir="src"
64            destdir="build"
65            source="1.2"
66            target="1.2"
67            bootclasspath="${javame-compile-bootclasspath-path}"
68            optimize="true"
69            debug="true"
70            deprecation="true"
71            fork="true">
72       <classpath refid="wtk-build-path"/>
73     </javac>
74   </target>
75
76   <target name="compile-basic" depends="init">
77     <mkdir dir="build"/>
78     <!-- For an explanation of this odd build command, see javadoc in
79          src/com/google/zxing/client/j2me/AdvancedMultimediaManager.java -->
80     <javac srcdir="src-basic"
81            destdir="build"
82            source="1.2"
83            target="1.2"
84            bootclasspath="${javame-compile-bootclasspath-path}"
85            optimize="true"
86            debug="true"
87            deprecation="true"
88            fork="true">
89        <classpath refid="wtk-build-path"/>
90     </javac>
91     <javac srcdir="src"
92            destdir="build"
93            source="1.2"
94            target="1.2"
95            bootclasspath="${javame-compile-bootclasspath-path}"
96            optimize="true"
97            debug="true"
98            deprecation="true"
99            fork="true">
100       <classpath refid="wtk-build-path"/>
101       <exclude name="com/google/zxing/client/j2me/AdvancedMultimediaManager.java"/>
102     </javac>
103   </target>
104
105   <target name="package">
106     <unzip src="../core/core.jar" dest="build"/>
107
108     <mkdir dir="build-j2me"/>
109     <exec executable="${WTK-home}/bin/preverify1.1">
110       <arg line="-classpath ${preverify-classpath} -d build-j2me build"/>
111     </exec>
112
113     <copy todir="build-j2me">
114       <fileset dir=".">
115         <include name="res/**"/>
116       </fileset>
117     </copy>
118
119     <copy file="src/com/google/zxing/client/j2me/MANIFEST.MF.template" tofile="src/com/google/zxing/client/j2me/MANIFEST.MF" overwrite="true">
120       <filterset>
121         <filter token="APP_NAME" value="${jar-name}"/>
122         <filter token="VERSION" value="${version}"/>
123       </filterset>
124     </copy>
125
126     <jar jarfile="${jar-name}.jar" basedir="build-j2me" manifest="src/com/google/zxing/client/j2me/MANIFEST.MF" level="9"/>
127
128     <move file="${jar-name}.jar" tofile="temp.jar"/>
129     <java jar="${WTK-home}/bin/proguard.jar" fork="true">
130       <arg value="-injars temp.jar"/>
131       <arg value="-outjars ${jar-name}.jar"/>
132       <arg value="-libraryjars ${preverify-classpath}"/>
133       <arg value="-microedition"/>
134       <arg value="-keep public class com.google.zxing.client.j2me.ZXingMIDlet"/>
135       <arg value="-keep public class com.google.zxing.qrcode.detector.DefaultGridSampler"/>
136       <arg value="-keep public class com.google.zxing.qrcode.detector.GridSampler"/>
137       <arg value="-optimizationpasses 5"/>
138       <arg value="-verbose"/>
139     </java>
140     <delete file="temp.jar"/>
141
142     <!-- get .jar size to include it in the .jad file -->
143     <length file="${jar-name}.jar" property="jar-size"/>
144
145     <copy file="ZXingReader.jad.template" tofile="${jar-name}.jad" overwrite="true">
146       <filterset>
147         <filter token="JAR_SIZE" value="${jar-size}"/>
148         <filter token="APP_NAME" value="${jar-name}"/>
149         <filter token="VERSION" value="${version}"/>
150       </filterset>
151     </copy>
152
153   </target>
154
155   <target name="build">
156     <description>Builds the main reader .jar file</description>
157     <property name="jar-name" value="ZXingReader"/>
158     <antcall target="clean"/>
159     <antcall target="compile"/>
160     <antcall target="package"/>
161   </target>
162
163   <target name="build-basic">
164     <description>Builds the basic reader .jar file</description>
165     <property name="jar-name" value="ZXingReaderBasic"/>
166     <antcall target="clean"/>
167     <antcall target="compile-basic"/>
168     <antcall target="package"/>
169   </target>
170
171   <target name="clean">
172     <delete dir="build"/>
173     <delete dir="build-j2me"/>
174     <delete dir="." includes="*.jar"/>
175     <delete dir="." includes="*.jad"/>
176     <delete file="src/com/google/zxing/client/j2me/MANIFEST.MF"/>
177   </target>
178
179 </project>