Avoid possible AIOOBE on bad input
[zxing.git] / zxingorg / build.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!--
3  Copyright 2008 ZXing authors
4
5  Licensed under the Apache License, Version 2.0 (the "License");
6  you may not use this file except in compliance with the License.
7  You may obtain a copy of the License at
8
9       http://www.apache.org/licenses/LICENSE-2.0
10
11  Unless required by applicable law or agreed to in writing, software
12  distributed under the License is distributed on an "AS IS" BASIS,
13  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  See the License for the specific language governing permissions and
15  limitations under the License.
16  -->
17 <project name="zxingorg" basedir="." default="build">
18
19   <property file="../build.properties"/>
20   <!--<property file="secrets.properties"/>-->
21
22   <target name="init">
23     <tstamp/>
24     <fail message="Please build 'core' first">
25       <condition>
26         <not>
27           <available file="../core/core.jar" type="file"/>
28         </not>
29       </condition>
30     </fail>
31     <fail message="Please build 'javase' first">
32       <condition>
33         <not>
34           <available file="../javase/javase.jar" type="file"/>
35         </not>
36       </condition>
37     </fail>
38     <fail message="Please build project javadoc first">
39       <condition>
40         <not>
41           <available file="../docs/javadoc" type="dir"/>
42         </not>
43       </condition>
44     </fail>
45     <fail message="Please set 'tomcat-home' in build.properties">
46       <condition>
47         <not>
48           <available file="${tomcat-home}" type="dir"/>
49         </not>
50       </condition>
51     </fail>
52   </target>
53
54   <target name="build" depends="init">
55     <mkdir dir="web/WEB-INF/classes"/>
56     <copy file="../core/core.jar" todir="web/WEB-INF/lib" overwrite="true"/>
57     <copy file="../javase/javase.jar" todir="web/WEB-INF/lib" overwrite="true"/>
58     <javac srcdir="src"
59            destdir="web/WEB-INF/classes"
60            source="1.5"
61            target="1.5"
62            optimize="true"
63            debug="true"
64            deprecation="true">
65       <classpath>
66         <fileset dir="web/WEB-INF/lib">
67           <include name="*.jar"/>
68         </fileset>
69         <pathelement location="${tomcat-home}/lib/servlet-api.jar"/>
70       </classpath>
71     </javac>
72     <!--
73     <copy file="web/WEB-INF/web.xml" tofile="web/WEB-INF/web.xml" overwrite="true">
74       <filterset>
75         <filter token="EMAIL_PASSWORD" value="${emailPassword}"/>
76       </filterset>
77     </copy>
78     -->
79     <war warfile="w.war" webxml="web/WEB-INF/web.xml">
80       <lib dir="web/WEB-INF/lib">
81         <include name="*.jar"/>
82       </lib>
83       <classes dir="web/WEB-INF/classes"/>
84       <fileset dir="web">
85         <include name="*.jspx"/>
86         <include name="*.png"/>
87         <include name="*.css"/>        
88         <include name="**/*.jad"/>
89         <include name="**/*.jar"/>
90       </fileset>
91       <fileset dir="..">
92         <include name="docs/**"/>
93       </fileset>
94     </war>
95   </target>
96
97   <target name="clean">
98     <delete dir="web/WEB-INF/classes"/>
99     <delete file="web/WEB-INF/lib/core.jar"/>
100     <delete file="web/WEB-INF/lib/javase.jar"/>
101     <delete file="w.war"/>
102   </target>
103
104 </project>