Updated Spanish translations
[debian/openrocket] / build.xml
1 <project name="OpenRocket" basedir=".">
2
3         <property file="build.properties" />
4         
5         <property name="src.dir"        value="src"/>           <!-- Source directory -->
6         <property name="src-test.dir"   value="test"/>          <!-- Test directory -->
7         <property name="build.dir"      value="build"/>         <!-- Build directory -->
8         <property name="build-test.dir" value="build/test"/><!-- Build directory -->
9                 
10         <!-- Distribution directory, from which stuff is jar'ed -->
11         <property name="dist.dir"       value="${build.dir}/dist"/> 
12         <property name="dist-test.dir"  value="${build.dir}/dist-test"/>
13         
14         <property name="classes.dir" value="${dist.dir}"/>      <!-- Directory for classes -->
15         <property name="jar.dir"     value="${build.dir}/jar"/> <!-- Directory for built jar's -->
16         <property name="lib.dir"     value="lib"/>                              <!-- Library source directory -->
17
18         <property name="pkgname"     value="${ant.project.name}-${build.version}"/>
19         
20         <property name="jar.file"    value="${jar.dir}/${ant.project.name}.jar"/>
21         <property name="dist.bin"    value="${jar.dir}/${pkgname}.jar"/>
22         <property name="dist.src"    value="${jar.dir}/${pkgname}-src.zip"/>
23         
24         <!-- The main class of the application -->
25         <property name="main-class"  value="net.sf.openrocket.startup.Startup"/>
26
27         
28         <!-- Classpath definitions -->
29         <path id="classpath">
30                 <fileset dir="${lib.dir}" includes="**/*.jar"/>
31         </path>
32         
33         <path id="test-classpath">
34                 <path refid="classpath"/>
35                 <pathelement location="${basedir}"/>
36                 <pathelement location="${build-test.dir}"/>
37                 <pathelement location="${classes.dir}"/>
38                 <pathelement location="${src-test.dir}"/>
39                 <fileset dir="lib-test/" includes="*.jar"/>
40         </path>
41         
42
43         
44         <!-- CLEAN -->
45         <target name="clean">
46                 <delete dir="${build.dir}"/>
47                 <delete dir="tmp/"/>
48         </target>
49                 
50         
51         <!-- BUILD -->
52         <target name="build">
53                 <mkdir dir="${classes.dir}"/>
54                 <echo level="info">Compiling main classes</echo>
55                 <javac debug="true" srcdir="${src.dir}" destdir="${classes.dir}" classpathref="classpath"/>
56                 <echo level="info">Copying build.properties</echo>
57                 <copy file="build.properties" todir="${dist.dir}"/>
58         </target>
59         
60         
61         <!-- JAR -->
62         <target name="jar" depends="build">
63                 <copy todir="${dist.dir}/">
64                         <fileset dir="." includes="LICENSE.TXT README.TXT ChangeLog ReleaseNotes build.properties fileformat.txt" />
65                         <fileset dir="." includes="datafiles/ pix/ l10n/" />
66                 </copy>
67                 <mkdir dir="${jar.dir}"/>
68                 <jar destfile="${jar.file}" basedir="${dist.dir}">
69                         <manifest>
70                                 <attribute name="Main-Class" value="${main-class}"/>
71                                 <attribute name="SplashScreen-Image" value="pix/splashscreen.png"/>
72                         </manifest>
73                         <zipfileset src="lib/miglayout15-swing.jar" />
74                         <zipfileset src="lib/jcommon-1.0.16.jar" />
75                         <zipfileset src="lib/jfreechart-1.0.13.jar" />
76                         <zipfileset src="lib/iText-5.0.2.jar" />
77                 </jar>
78         </target>
79         
80         
81         <!-- DIST-SRC -->
82         <target name="dist-src">
83                 <echo>                  
84                 Building source distribution
85                 </echo>
86                 <mkdir dir="${build.dir}/${pkgname}"/>
87                 <mkdir dir="${jar.dir}"/>
88                 <copy todir="${build.dir}/${pkgname}">
89                         <fileset dir="." includes="*">
90                                 <type type="file"/>
91                         </fileset>
92                         <fileset dir="." includes="datafiles/ lib/ lib-test/ pix/ src/ test/"/>
93                 </copy>
94                 <zip destfile="${dist.src}" basedir="${build.dir}" includes="${pkgname}/"/>
95                 <delete dir="${build.dir}/${pkgname}"/>
96         </target>
97         
98         
99         <!-- DIST-SRC-TEST -->
100         <target name="dist-src-test" depends="dist-src">
101                 <echo>
102                 Testing source distribution
103                 </echo>
104                 <delete dir="${dist-test.dir}"/>
105                 <mkdir dir="${dist-test.dir}"/>
106                 <unzip dest="${dist-test.dir}" src="${dist.src}"/>
107                 <ant dir="${dist-test.dir}/${pkgname}" antfile="build.xml" target="jar"/>
108                 <ant dir="${dist-test.dir}/${pkgname}" antfile="build.xml" target="unittest"/>
109                 <delete dir="${dist-test.dir}"/>
110                 <echo>
111                 Source distribution test successful
112                 </echo>
113         </target>       
114         
115         
116         <!-- DIST-BIN -->
117         <target name="dist-bin" depends="check,clean,unittest,jar">
118                 <move file="${jar.file}" tofile="${dist.bin}"/>
119         </target>
120
121         
122         <!-- DIST -->
123         <target name="dist" depends="dist-bin,dist-src,dist-src-test">
124                 <echo>Distribution ${build.version} (${build.source}) built into directory ${jar.dir}</echo>
125         </target>
126         
127         
128         <!-- CHECK -->
129         <target name="check" depends="checktodo,checkascii"/>
130         
131         <!-- CHECK TODOs -->
132         <target name="todo" depends="checktodo"/>
133         <target name="checktodo">
134                 <tempfile property="todo.file" prefix="checktodo-"/>
135                 <echo>Checking project for critical TODOs.</echo>
136                 <concat destfile="${todo.file}">
137                         <fileset dir="${src.dir}">
138                             <include name="**/*.java"/>
139                         </fileset>
140                         <fileset dir="${src-test.dir}">
141                             <include name="**/*.java"/>
142                         </fileset>
143                         <filterchain>
144                                 <linecontainsregexp>
145                                         <regexp pattern="TODO:.*CRITICAL"/>
146                                 </linecontainsregexp>
147                         </filterchain>
148                 </concat>
149                 <loadfile srcfile="${todo.file}" property="criticaltodos"/>
150                 <delete file="${todo.file}"/>
151                 <fail if="criticaltodos">CRITICAL TODOs exist in project:
152 ${criticaltodos}</fail>
153                 <echo>No critical TODOs in project.</echo>
154         </target>
155         
156         
157         <!-- CHECK TODOs -->
158         <target name="ascii" depends="checkascii"/>
159         <target name="checkascii">
160                 <tempfile property="ascii.file" prefix="checkascii-"/>
161                 <echo>Checking project for non-ASCII characters.</echo>
162                 <concat destfile="${ascii.file}">
163                         <fileset dir="${src.dir}">
164                             <include name="**/*.java"/>
165                         </fileset>
166                         <fileset dir="${src-test.dir}">
167                             <include name="**/*.java"/>
168                         </fileset>
169                         <filterchain>
170                                 <linecontainsregexp>
171                                         <regexp pattern="\P{ASCII}"/>
172                                 </linecontainsregexp>
173                         </filterchain>
174                 </concat>
175                 <loadfile srcfile="${ascii.file}" property="nonascii"/>
176                 <delete file="${ascii.file}"/>
177                 <fail if="nonascii">Non-ASCII characters exist in project:
178 ${nonascii}</fail>
179                 <echo>No non-ASCII characters in project.</echo>
180         </target>
181         
182         
183         <!--  Unit tests  -->
184         <target name="unittest" description="Execute unit tests" depends="build">
185                 <echo>Building unit tests</echo>
186                 <mkdir dir="${build-test.dir}"/>
187                 <javac debug="true" srcdir="${src-test.dir}" destdir="${build-test.dir}" classpathref="test-classpath"/>
188                 
189                 <echo>Running unit tests</echo>
190                 <mkdir dir="tmp/rawtestoutput"/>
191                 <junit fork="yes" forkmode="once" printsummary="false" failureproperty="junit.failure">
192                         <classpath>
193                                 <path refid="test-classpath"/>
194                                 <path location="${basedir}"/>
195                         </classpath>
196                         <batchtest todir="tmp/rawtestoutput">
197                                 <fileset dir="${build-test.dir}">
198                                         <include name="**/Test*.class" />
199                                         <include name="**/*Test.class" />
200                                         <exclude name="**/*$*.class" />
201                                         <exclude name="Test.class" />
202                                 </fileset>
203                                 <formatter type="xml"/>
204                         </batchtest>
205                 </junit>
206                 <junitreport todir="tmp">
207                         <fileset dir="tmp/rawtestoutput"/>
208                         <report todir="tmp/test-reports"/>
209                 </junitreport>
210                 <fail if="junit.failure" message="Unit test(s) failed.  See report in ${basedir}/tmp/test-reports/index.html"/>
211                 <echo>
212         Unit tests passed successfully.
213                 </echo>
214         </target>
215     
216 </project>