0f9102ff0b24aa80034b303d9f2fe402823ca338
[zxing.git] / core / build.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2
3 <!--
4  Copyright 2007 ZXing authors
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="core" default="build">
20
21   <property file="../build.properties"/>
22
23   <path id="javame-compile-bootclasspath">
24     <fileset dir="${WTK-home}/lib">
25       <include name="cldcapi11.jar"/>
26     </fileset>
27   </path>
28   <property name="javame-compile-bootclasspath-path" refid="javame-compile-bootclasspath"/>
29
30   <target name="init">
31     <tstamp/>
32   </target>
33
34   <target name="compile" depends="init">
35     <mkdir dir="build"/>
36     <javac srcdir="src"
37            destdir="build"
38            source="1.2"
39            target="1.2"
40            bootclasspath="${javame-compile-bootclasspath-path}"
41            optimize="true"
42            debug="${generate-debug}"
43            deprecation="true"
44            fork="true">
45       <!-- TODO re-add this package -->
46       <exclude name="com/google/zxing/qrcode/encoder/**"/>
47     </javac>
48     <jar jarfile="core.jar" basedir="build">
49       <!-- These entries allow core.jar to function as an OSGi bundle, and also specifices
50            additional attributes for compatibility with BugLabs's BUG platform.
51            Thanks to David Albert for this change. -->
52       <manifest>
53         <attribute name="Bundle-Name" value="ZXing"/>
54         <attribute name="Bundle-Vendor" value="ZXing Project"/>
55         <attribute name="Bundle-SymbolicName" value="ZXing"/>
56         <attribute name="Bundle-Version" value="${version}"/>        
57         <attribute name="Export-Package" value="com.google.zxing,com.google.zxing.common,com.google.zxing.client.result"/>
58         <attribute name="Bug-Bundle-Type" value="Application"/>
59       </manifest>
60     </jar>
61   </target>
62
63   <target name="build" depends="clean">
64     <antcall target="compile">
65       <param name="generate-debug" value="true"/>
66     </antcall>
67   </target>
68
69   <!-- This target is needed for building a core.jar which the Android client can use and run
70        ProGuard on successfully, because dx doesn't like debugging info. -->
71   <target name="build-no-debug" depends="clean">
72     <antcall target="compile">
73       <param name="generate-debug" value="false"/>
74     </antcall>
75   </target>
76
77   <target name="build-test" depends="init,build">
78     <fail message="Please build 'javase' first">
79       <condition>
80         <not>
81           <available file="../javase/javase.jar" type="file"/>
82         </not>
83       </condition>
84     </fail>
85     <mkdir dir="build-test"/>
86     <javac srcdir="test/src"
87            destdir="build-test"
88            debug="true"
89            deprecation="true">
90       <classpath>
91         <pathelement location="core.jar"/>
92         <pathelement location="../javase/javase.jar"/>
93         <pathelement location="lib/junit.jar"/>
94       </classpath>
95     </javac>
96   </target>
97
98   <target name="test-blackbox" depends="build-test">
99     <parallel failonany="true">
100       <antcall target="test-blackbox-subset">
101         <param name="subdir" value="datamatrix"/>
102       </antcall>
103       <antcall target="test-blackbox-subset">
104         <param name="subdir" value="negative"/>
105       </antcall>
106       <antcall target="test-blackbox-subset">
107         <param name="subdir" value="oned"/>
108       </antcall>
109       <antcall target="test-blackbox-subset">
110         <param name="subdir" value="qrcode"/>
111       </antcall>
112     </parallel>
113   </target>
114
115   <target name="test-blackbox-subset">
116     <junit printsummary="on" haltonfailure="on" haltonerror="on" fork="true" dir=".">
117       <formatter type="plain" usefile="false"/>
118       <classpath>
119         <pathelement location="core.jar"/>
120         <pathelement location="build-test"/>
121         <pathelement location="../javase/javase.jar"/>
122         <pathelement location="lib/junit.jar"/>
123       </classpath>
124       <assertions>
125         <enable/>
126       </assertions>
127       <batchtest>
128         <fileset dir="test/src">
129           <include name="**/${subdir}/*BlackBox*TestCase.java"/>
130         </fileset>
131       </batchtest>
132     </junit>
133   </target>
134
135   <target name="test-unit" depends="build-test">
136     <junit printsummary="on" haltonfailure="on" haltonerror="on" fork="true" dir=".">
137       <formatter type="plain" usefile="false"/>
138       <classpath>
139         <pathelement location="core.jar"/>
140         <pathelement location="build-test"/>
141         <pathelement location="../javase/javase.jar"/>
142         <pathelement location="lib/junit.jar"/>
143       </classpath>
144       <assertions>
145         <enable/>
146       </assertions>
147       <batchtest>
148         <fileset dir="test/src">
149           <include name="**/*TestCase.java"/>          
150           <exclude name="**/*BlackBox*TestCase.java"/>
151         </fileset>
152       </batchtest>
153     </junit>
154   </target>
155
156   <target name="test" depends="test-unit,test-blackbox"/>
157
158   <target name="clean">
159     <delete dir="build"/>
160     <delete dir="build-test"/>
161     <delete file="core.jar"/>
162     <delete file="ZXingReader.*"/>
163     <delete file="proguard-dump.txt"/>
164   </target>
165
166 </project>