]> WPIA git - gigi.git/blob - build.xml
(small format) + added clean all target to make. It's not much code,
[gigi.git] / build.xml
1 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2 <project basedir="." default="all" name="cacert-gigi">
3         <property environment="env" />
4         <property name="junit.output.dir" value="junit" />
5         <property name="debuglevel" value="source,lines,vars" />
6         <property name="target" value="1.8" />
7         <property name="source" value="1.8" />
8         <property name="mysqlconnector" value="mysql-connector-java-5.1.31-bin.jar" />
9         <property name="juintexec" value="." />
10         <path id="JUnit 4.libraryclasspath">
11                 <pathelement location="${juintexec}/junit.jar" />
12                 <pathelement location="${juintexec}/org.hamcrest.core.jar" />
13         </path>
14         <path id="cacert-gigi.classpath">
15                 <pathelement location="bin" />
16                 <pathelement location="${mysqlconnector}" />
17         </path>
18         <path id="cacert-gigi.test.classpath">
19                 <pathelement location="bin" />
20                 <pathelement location="bintest" />
21                 <path refid="JUnit 4.libraryclasspath" />
22                 <pathelement location="${mysqlconnector}" />
23         </path>
24         <target name="init">
25                 <mkdir dir="bin" />
26                 <mkdir dir="bintest" />
27
28                 <copy includeemptydirs="false" todir="bin">
29                         <fileset dir="lib/servlet-api">
30                                 <exclude name="**/*.launch" />
31                                 <exclude name="**/*.java" />
32                         </fileset>
33                 </copy>
34                 <copy includeemptydirs="false" todir="bin">
35                         <fileset dir="lib/jetty">
36                                 <exclude name="**/*.launch" />
37                                 <exclude name="**/*.java" />
38                         </fileset>
39                 </copy>
40                 <copy includeemptydirs="false" todir="bin">
41                         <fileset dir="src">
42                                 <exclude name="**/*.launch" />
43                                 <exclude name="**/*.java" />
44                         </fileset>
45                 </copy>
46                 <copy includeemptydirs="false" todir="bin">
47                         <fileset dir="util">
48                                 <exclude name="**/*.launch" />
49                                 <exclude name="**/*.java" />
50                         </fileset>
51                 </copy>
52                 <copy includeemptydirs="false" todir="bintest">
53                         <fileset dir="tests">
54                                 <exclude name="**/*.launch" />
55                                 <exclude name="**/*.java" />
56                         </fileset>
57                 </copy>
58         </target>
59         <target name="clean">
60                 <delete dir="bin" />
61         </target>
62         <target depends="clean" name="cleanall" />
63         <target depends="build-project, native" name="build" />
64         <target depends="init" name="build-project">
65                 <echo message="${ant.project.name}: ${ant.file}" />
66                 <javac debug="true" debuglevel="${debuglevel}" destdir="bin"
67                         includeantruntime="false" source="${source}" target="${target}">
68                         <src path="lib/servlet-api" />
69                         <src path="lib/jetty" />
70                         <src path="lib/jtar" />
71                         <src path="src" />
72                         <src path="util" />
73                         <classpath refid="cacert-gigi.classpath" />
74                 </javac>
75         </target>
76
77         <target name="native">
78                 <exec executable="make" dir="natives">
79                         <arg value="clean" />
80                         <arg value="all" />
81                 </exec>
82         </target>
83
84         <target depends="build" name="pack">
85                 <jar destfile="gigi.jar" basedir="bin" manifest="Gigi.MF" />
86         </target>
87
88         <target depends="test,native" name="bundle">
89                 <zip destfile="gigi-linux_amd64.zip" basedir="."
90                         includes="gigi.jar,native/*.so,doc/tableStructure.sql,static/**,templates/**" />
91         </target>
92         <target name="static-bundle">
93                 <tar destfile="static.tar.gz" compression="gzip" basedir="."
94                         includes="doc/tableStructure.sql,static/**,templates/**" />
95         </target>
96
97         <target name="all" depends="bundle,static-bundle" />
98
99
100         <target depends="init,build-project" name="build-project-test">
101                 <echo message="${ant.project.name}: ${ant.file}" />
102                 <javac debug="true" debuglevel="${debuglevel}" destdir="bintest"
103                         includeantruntime="false" source="${source}" target="${target}">
104                         <src path="tests" />
105                         <classpath refid="cacert-gigi.test.classpath" />
106                 </javac>
107         </target>
108         <target name="check-locale">
109                 <available file="locale/de.xml" property="locale.present" />
110         </target>
111         <target name="FetchLocales" depends="check-locale" unless="locale.present">
112                 <java classname="org.cacert.gigi.util.FetchLocales" failonerror="true"
113                         fork="yes">
114                         <classpath refid="cacert-gigi.classpath" />
115                 </java>
116         </target>
117         <target name="check-generateKeys">
118                 <available file="config/keystore.pkcs12" property="keystore.present" />
119         </target>
120         <target name="generateKeys" depends="check-generateKeys" unless="keystore.present">
121                 <exec executable="./generateKeys.sh" dir="keys" />
122                 <exec executable="./generateTruststore.sh" dir="keys">
123                         <arg value="-noprompt" />
124                 </exec>
125         </target>
126         <target name="test" depends="build-project-test,generateKeys,FetchLocales,pack">
127                 <mkdir dir="${junit.output.dir}" />
128                 <junit fork="yes" printsummary="withOutAndErr">
129                         <formatter type="xml" />
130                         <batchtest fork="yes" todir="${junit.output.dir}">
131                                 <fileset dir="tests">
132                                         <include name="**/*.java" />
133                                         <exclude name="**/testUtils/**" />
134                                 </fileset>
135                         </batchtest>
136                         <classpath refid="cacert-gigi.test.classpath" />
137                 </junit>
138         </target>
139         <target name="junitreport">
140                 <junitreport todir="${junit.output.dir}">
141                         <fileset dir="${junit.output.dir}">
142                                 <include name="TEST-*.xml" />
143                         </fileset>
144                         <report format="frames" todir="${junit.output.dir}" />
145                 </junitreport>
146         </target>
147 </project>