Typo fix
[zxing.git] / javame / build.xml
index 240dc7f..8e0788f 100644 (file)
@@ -1,4 +1,21 @@
 <?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ Copyright 2007 Google Inc.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
 <project name="javame" default="build">
 
   <property file="../build.properties"/>
     </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">
+    <fail message="Please set 'WTK-home' in build.properties">
       <condition>
         <not>
-          <available file="${JDK1.4-classes}" type="file"/>
+          <available file="${WTK-home}" type="dir"/>
         </not>
       </condition>
     </fail>
-    <fail message="Please set 'WTK-home' in build.properties">
+    <fail message="Please put proguard.jar in 'bin' under the WTK install directory">
       <condition>
         <not>
-          <available file="${WTK-home}" type="dir"/>
+          <available file="${WTK-home}/bin/proguard.jar" type="file"/>
         </not>
       </condition>
     </fail>
@@ -36,9 +62,9 @@
     <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"
@@ -53,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"
@@ -64,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"
     <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>
     <copy file="src/com/google/zxing/client/j2me/MANIFEST.MF.template" tofile="src/com/google/zxing/client/j2me/MANIFEST.MF" overwrite="true">
       <filterset>
         <filter token="APP_NAME" value="${jar-name}"/>
+        <filter token="VERSION" value="${version}"/>
       </filterset>
     </copy>
 
-    <jar jarfile="${jar-name}.jar" basedir="build-j2me" manifest="src/com/google/zxing/client/j2me/MANIFEST.MF"/>
+    <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.detector.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"/>
       <filterset>
         <filter token="JAR_SIZE" value="${jar-size}"/>
         <filter token="APP_NAME" value="${jar-name}"/>
+        <filter token="VERSION" value="${version}"/>
       </filterset>
     </copy>