]> WPIA git - gigi.git/blob - build.xml
Merge "fix: advanced options on create certificate don't collapse "
[gigi.git] / build.xml
1 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2 <project basedir="." default="develop" name="cacert-gigi" xmlns:jacoco="antlib:org.jacoco.ant">
3
4         <taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml">
5                 <classpath path="/usr/share/java/jacocoant.jar" />
6         </taskdef>
7
8         <property environment="env" />
9         <property name="PACKAGE" value="cacert-gigi" />
10         <property name="junit.output.dir" value="junit" />
11         <property name="debuglevel" value="source,lines,vars" />
12         <property name="target" value="1.8" />
13         <property name="source" value="1.8" />
14         <property name="sqlconnector" value="/usr/share/java/postgresql-jdbc4.jar" />
15         <property name="juintexec" value="/usr/share/java" />
16         <path id="JUnit 4.libraryclasspath">
17                 <pathelement location="${juintexec}/junit4.jar" />
18                 <pathelement location="${juintexec}/hamcrest-core.jar" />
19         </path>
20         <path id="cacert-gigi.classpath">
21                 <pathelement location="bin" />
22                 <pathelement location="binutil" />
23                 <pathelement location="${sqlconnector}" />
24         </path>
25         <path id="cacert-gigi.test.classpath">
26                 <pathelement location="bintest" />
27                 <pathelement location="bin" />
28                 <pathelement location="binutil" />
29                 <pathelement location="binutil-testing" />
30                 <path refid="JUnit 4.libraryclasspath" />
31                 <pathelement location="${sqlconnector}" />
32         </path>
33         <path id="cacert-gigi.test.classpath.jdt">
34                 <pathelement location="${jdt}" />
35         </path>
36         <target name="init">
37                 <mkdir dir="bin" />
38                 <mkdir dir="binutil" />
39                 <mkdir dir="binutil-testing" />
40                 <mkdir dir="bintest" />
41
42                 <copy includeemptydirs="false" todir="bin">
43                         <fileset dir="lib/servlet-api">
44                                 <exclude name="**/*.launch" />
45                                 <exclude name="**/*.java" />
46                         </fileset>
47                         <fileset dir="lib/jetty">
48                                 <exclude name="**/*.launch" />
49                                 <exclude name="**/*.java" />
50                         </fileset>
51                         <fileset dir="src">
52                                 <exclude name="**/*.launch" />
53                                 <exclude name="**/*.java" />
54                         </fileset>
55                         <fileset dir="util">
56                                 <exclude name="**/*.launch" />
57                                 <exclude name="**/*.java" />
58                         </fileset>
59                 </copy>
60                 <copy includeemptydirs="false" todir="binutil-testing">
61                         <fileset dir="util-testing">
62                                 <exclude name="**/*.launch" />
63                                 <exclude name="**/*.java" />
64                         </fileset>
65                 </copy>
66                 <copy includeemptydirs="false" todir="bintest">
67                         <fileset dir="tests">
68                                 <exclude name="**/*.launch" />
69                                 <exclude name="**/*.java" />
70                         </fileset>
71                 </copy>
72         </target>
73         <target name="clean">
74                 <delete dir="bin" />
75         </target>
76         <target name="clean-test">
77                 <delete dir="bintest" />
78                 <delete dir="cocoReport" failonerror="false"/>
79
80         </target>
81         <target depends="clean,clean-test" name="cleanall" />
82         <target depends="build-project, build-testing, native" name="build" />
83         <target depends="init" name="build-project">
84                 <echo message="${ant.project.name}: ${ant.file}" />
85                 <javac encoding="UTF-8" debug="true" debuglevel="${debuglevel}" destdir="bin"
86                         includeantruntime="false" source="${source}" target="${target}">
87                         <compilerarg value="-XDignore.symbol.file"/>
88                         <src path="lib/servlet-api" />
89                         <src path="lib/jetty" />
90                         <src path="lib/jtar" />
91                         <src path="lib/scrypt" />
92                         <src path="src" />
93                         <classpath refid="cacert-gigi.classpath" />
94                 </javac>
95                 <javac encoding="UTF-8" debug="true" debuglevel="${debuglevel}" destdir="binutil"
96                         includeantruntime="false" source="${source}" target="${target}">
97                         <compilerarg value="-XDignore.symbol.file"/>
98                         <src path="util" />
99                         <classpath refid="cacert-gigi.classpath" />
100                 </javac>
101         </target>
102         <target depends="init, build-project" name="build-testing">
103                 <javac encoding="UTF-8" debug="true" debuglevel="${debuglevel}" destdir="binutil-testing"
104                         includeantruntime="false" source="${source}" target="${target}">
105                         <compilerarg value="-XDignore.symbol.file"/>
106                         <src path="util-testing" />
107                         <exclude name="org/cacert/gigi/localisation/**"/>
108                         <classpath refid="cacert-gigi.classpath" />
109                 </javac>
110         </target>
111         <target depends="init, build-project" name="build-testing-l10n">
112                 <javac encoding="UTF-8" debug="true" debuglevel="${debuglevel}" destdir="binutil-testing"
113                         includeantruntime="false" source="${source}" target="${target}">
114                         <compilerarg value="-XDignore.symbol.file"/>
115                         <src path="util-testing" />
116                         <include name="org/cacert/gigi/localisation/**"/>
117                         <classpath refid="cacert-gigi.classpath" />
118                         <classpath refid="cacert-gigi.test.classpath.jdt" />
119                 </javac>
120                 <java classname="org.cacert.gigi.localisation.TranslationCollector">
121                         <arg value="util-testing/org/cacert/gigi/localisation/conf.txt"/>
122                         <arg value="."/>
123                         <arg value="messages.po"/>
124                         <classpath refid="cacert-gigi.test.classpath" />
125                         <classpath refid="cacert-gigi.test.classpath.jdt" />
126                 </java>
127         </target>
128
129         <target name="native">
130                 <exec executable="make" dir="natives"/>
131         </target>
132
133         <target depends="build-project, update-effective-tlds" name="pack">
134                 <jar destfile="gigi.jar" basedir="bin" manifest="Gigi.MF" update="false"/>
135                 <jar destfile="gigi.jar" basedir="binutil" update="on"/>
136         </target>
137
138         <target depends="build-testing,update-effective-tlds" name="pack-testing">
139                 <jar destfile="gigi-testing.jar" basedir="bin" manifest="Gigi.MF" update="false"/>
140                 <jar destfile="gigi-testing.jar" basedir="binutil" update="on"/>
141                 <jar destfile="gigi-testing.jar" basedir="binutil-testing" update="on"/>
142         </target>
143
144         <target depends="test,native" name="bundle">
145                 <zip destfile="gigi-linux_amd64.zip" basedir="."
146                         includes="gigi.jar,native/*.so,src/org/cacert/gigi/database/tableStructure.sql,static/**,templates/**" />
147         </target>
148         <target name="static-bundle">
149                 <mkdir dir="work"/>
150                 <mkdir dir="work/static"/>
151                 <copy todir="work/static">
152                         <fileset dir="static"/>
153                 </copy>
154                 <move file="work/static/static/images/cacert4-test.png" tofile="work/static/static/images/cacert4.png"/>
155                 <delete file="work/static/static/image/cacert4-test.png"/>
156                 <tar destfile="static.tar.gz" compression="gzip" basedir="work"
157                         includes="../src/org/cacert/gigi/database/tableStructure.sql,**,templates/**" />
158         </target>
159
160         <target name="static-bundle-release">
161                 <mkdir dir="work"/>
162                 <mkdir dir="work/static"/>
163                 <copy todir="work/static">
164                         <fileset dir="static"/>
165                 </copy>
166                 <delete file="work/static/static/image/cacert4-test.png"/>
167                 <tar destfile="static.tar.gz" compression="gzip" basedir="work"
168                         includes="../src/org/cacert/gigi/database/tableStructure.sql,**,templates/**" />
169         </target>
170
171         <target name="develop" depends="bundle,static-bundle" />
172
173         <target name="release" depends="bundle,static-bundle-release" />
174
175         <target depends="init,build-testing,update-effective-tlds" name="build-project-test">
176                 <echo message="${ant.project.name}: ${ant.file}" />
177                 <javac encoding="UTF-8" debug="true" debuglevel="${debuglevel}" destdir="bintest"
178                         includeantruntime="false" source="${source}" target="${target}">
179                         <compilerarg value="-XDignore.symbol.file"/>
180                         <src path="tests" />
181                         <classpath refid="cacert-gigi.test.classpath" />
182                 </javac>
183                 <concat destfile="bintest/org/cacert/gigi/util/effective_tld_names.dat">
184                         <path path="bin/org/cacert/gigi/util/effective_tld_names.dat"/>
185                         <path path="publicSuffixFooter.dat"/>
186                 </concat>
187         </target>
188         <target name="check-locale">
189                 <available file="locale/de.xml" property="locale.present" />
190         </target>
191         <target name="FetchLocales" depends="check-locale" unless="locale.present">
192                 <java classname="org.cacert.gigi.util.FetchLocales" failonerror="true"
193                         fork="yes">
194                         <classpath refid="cacert-gigi.classpath" />
195                         <arg value="${localePath}"/>
196                 </java>
197         </target>
198         <target name="check-generateKeys">
199                 <available file="config/keystore.pkcs12" property="keystore.present" />
200         </target>
201         <target name="generateKeys" depends="check-generateKeys" unless="keystore.present">
202                 <exec executable="./generateKeys.sh" dir="keys" />
203                 <exec executable="./generateTruststore.sh" dir="keys">
204                         <arg value="-noprompt" />
205                 </exec>
206         </target>
207         <target name="reset-db" depends="build-project">
208                 <copy file="config/test.properties" tofile="config/gigi.properties"/>
209                 <java classname="org.cacert.gigi.util.DatabaseManager">
210                         <arg value="--test"/>
211                         <classpath refid="cacert-gigi.test.classpath" />
212                 </java>
213         </target>
214         <target name="test" depends="build-project-test,FetchLocales,pack-testing,pack,reset-db">
215                 <delete failonerror="false">
216                         <fileset dir=".">
217                                 <include name="jacoco.exec"/>
218                                 <include name="tester.exec"/>
219                         </fileset>
220                 </delete>
221                 <mkdir dir="${junit.output.dir}" />
222                 <junit maxmemory="2g" fork="yes" printsummary="withOutAndErr">
223                         <jvmarg value="-javaagent:/usr/share/java/jacocoagent.jar=destfile=tester.exec"/>
224                         <jvmarg value="-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=0.0.0.0:50001"/>
225                         <formatter type="xml" />
226                         <batchtest fork="yes" todir="${junit.output.dir}">
227                                 <fileset dir="tests">
228                                         <include name="**/*.java" />
229                                         <exclude name="**/testUtils/**" />
230                                         <exclude name="**/com/lambdaworks/crypto/test/CryptoTestUtil.java"/>
231                                 </fileset>
232                         </batchtest>
233                         <classpath refid="cacert-gigi.test.classpath" />
234                 </junit>
235         </target>
236         <target name="junitreport">
237                 <junitreport todir="${junit.output.dir}">
238                         <fileset dir="${junit.output.dir}">
239                                 <include name="TEST-*.xml" />
240                         </fileset>
241                         <report format="frames" todir="${junit.output.dir}" />
242                 </junitreport>
243         </target>
244         <target name="generatecoco">
245                 <delete file="merged.exec"/>
246
247                 <jacoco:merge destfile="merged.exec">
248                         <fileset dir="." includes="*.exec"/>
249                 </jacoco:merge>
250                 <jacoco:report>
251                         <executiondata>
252                                 <file file="merged.exec" />
253                         </executiondata>
254
255                         <structure name="CAcert gigi">
256                                 <group name="Server">
257                                         <classfiles>
258                                                 <fileset dir="bin">
259                                                         <include name="org/cacert/gigi/**"/>
260                                                 </fileset>
261                                         </classfiles>
262                                         <sourcefiles encoding="UTF-8">
263                                                 <fileset dir="src">
264                                                         <include name="org/cacert/gigi/**"/>
265                                                 </fileset>
266                                         </sourcefiles>
267                                 </group>
268                                 <group name="Testcases">
269                                         <classfiles>
270                                                 <fileset dir="bintest">
271                                                         <include name="org/cacert/gigi/**"/>
272                                                 </fileset>
273                                         </classfiles>
274                                         <sourcefiles encoding="UTF-8">
275                                                 <fileset dir="tests">
276                                                         <include name="org/cacert/gigi/**"/>
277                                                 </fileset>
278                                         </sourcefiles>
279                                 </group>
280                         </structure>
281
282                         <html destdir="cocoReport"/>
283
284                 </jacoco:report>
285         </target>
286         <target name="install-native" depends="native">
287                 <mkdir dir="${env.DESTDIR}/usr/lib/jni"/>
288                 <copy file="natives/libsetuid.so" todir="${env.DESTDIR}/usr/lib/jni"/>
289         </target>
290         <target name="install" depends="install-common">
291                 <mkdir dir="${env.DESTDIR}/usr/share/cacert-gigi/static" />
292                 <copy todir="${env.DESTDIR}/usr/share/cacert-gigi/static">
293                         <fileset dir="static" />
294                 </copy>
295                 <delete file="${env.DESTDIR}/usr/share/cacert-gigi/static/static/images/cacert4-test.png" />
296                 <copy file="gigi.jar" tofile="${env.DESTDIR}/usr/share/java/gigi.jar"/>
297         </target>
298         <target name="install-testing" depends="install-common">
299                 <mkdir dir="${env.DESTDIR}/usr/share/cacert-gigi/static" />
300                 <copy todir="${env.DESTDIR}/usr/share/cacert-gigi/static">
301                         <fileset dir="static" />
302                 </copy>
303                 <move file="${env.DESTDIR}/usr/share/cacert-gigi/static/static/images/cacert4-test.png" tofile="${env.DESTDIR}/usr/share/cacert-gigi/static/static/images/cacert4.png" />
304                 <delete file="${env.DESTDIR}/usr/share/cacert-gigi/static/static/images/cacert4-test.png" />
305                 <copy file="gigi-testing.jar" tofile="${env.DESTDIR}/usr/share/java/gigi.jar"/>
306         </target>
307
308         <target name="install-common" depends="pack">
309                 <mkdir dir="${env.DESTDIR}/usr/share/java" />
310
311                 <mkdir dir="${env.DESTDIR}/usr/bin"/>
312                 <copy file="doc/scripts/gigi" tofile="${env.DESTDIR}/usr/bin/gigi"/>
313
314                 <chmod file="${env.DESTDIR}/usr/bin/gigi" perm="+x"/>
315                 <mkdir dir="${env.DESTDIR}/usr/share/dbconfig-common/data/${PACKAGE}/install/"/>
316                 <copy file="src/org/cacert/gigi/database/tableStructure.sql" tofile="${env.DESTDIR}/usr/share/dbconfig-common/data/${PACKAGE}/install/mysql.sql"/>
317
318                 <mkdir dir="${env.DESTDIR}/var/lib/cacert-gigi/doc"/>
319                 <exec executable="ln">
320                         <arg value="-s"/>
321                         <arg value="/usr/share/dbconfig-common/data/${PACKAGE}/install/mysql.sql"/>
322                         <arg value="${env.DESTDIR}/var/lib/cacert-gigi/doc/tableStructure.sql"/>
323                 </exec>
324                 <mkdir dir="${env.DESTDIR}/var/lib/cacert-gigi/natives"/>
325                 <delete failonerror="false" file="${env.DESTDIR}/var/lib/cacert-gigi/static"/>
326                 <exec executable="ln">
327                         <arg value="-s"/>
328                         <arg value="/usr/share/cacert-gigi/static"/>
329                         <arg value="${env.DESTDIR}/var/lib/cacert-gigi/static"/>
330                 </exec>
331                 <exec executable="ln">
332                         <arg value="-s"/>
333                         <arg value="/usr/lib/jni/libsetuid.so"/>
334                         <arg value="${env.DESTDIR}/var/lib/cacert-gigi/natives/libsetuid.so"/>
335                 </exec>
336
337                 <mkdir dir="${env.DESTDIR}/etc/cacert/gigi"/>
338                 <!--<copy todir="${env.DESTDIR}/DEBIAN">
339                         <fileset dir="debian">
340                         </fileset>
341                 </copy>-->
342         </target>
343         <target name="update-effective-tlds">
344                 <mkdir dir="bin/org/cacert/gigi/util"/>
345                 <exec executable="wget" dir="bin/org/cacert/gigi/util">
346                         <arg value="-N"/>
347                         <arg value="-q"/>
348                         <arg value="https://publicsuffix.org/list/effective_tld_names.dat"/>
349                 </exec>
350         </target>
351 </project>