fix: allow SSLPinger to process certs without EKU
[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                 <exec outputproperty="git-version" executable="git">
85                         <arg line="rev-parse"/>
86                         <arg line="HEAD"/>
87                 </exec>
88                 <manifest file="Gigi.MF">
89                         <attribute name="Main-Class" value="org.cacert.gigi.Launcher" />
90                         <attribute name="Implementation-Version" value="${git-version}" />
91                 </manifest>
92                 <echo message="${ant.project.name}: ${ant.file}" />
93                 <javac encoding="UTF-8" debug="true" debuglevel="${debuglevel}" destdir="bin"
94                         includeantruntime="false" source="${source}" target="${target}">
95                         <compilerarg value="-XDignore.symbol.file"/>
96                         <src path="lib/servlet-api" />
97                         <src path="lib/jetty" />
98                         <src path="lib/jtar" />
99                         <src path="lib/scrypt" />
100                         <src path="lib/json" />
101                         <src path="src" />
102                         <classpath refid="cacert-gigi.classpath" />
103                 </javac>
104                 <javac encoding="UTF-8" debug="true" debuglevel="${debuglevel}" destdir="binutil"
105                         includeantruntime="false" source="${source}" target="${target}">
106                         <compilerarg value="-XDignore.symbol.file"/>
107                         <src path="util" />
108                         <classpath refid="cacert-gigi.classpath" />
109                 </javac>
110         </target>
111         <target depends="init, build-project" name="build-testing">
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                         <exclude name="org/cacert/gigi/localisation/**"/>
117                         <classpath refid="cacert-gigi.classpath" />
118                 </javac>
119         </target>
120         <target depends="init, build-project" name="build-testing-l10n">
121                 <javac encoding="UTF-8" debug="true" debuglevel="${debuglevel}" destdir="binutil-testing"
122                         includeantruntime="false" source="${source}" target="${target}">
123                         <compilerarg value="-XDignore.symbol.file"/>
124                         <src path="util-testing" />
125                         <include name="org/cacert/gigi/localisation/**"/>
126                         <classpath refid="cacert-gigi.classpath" />
127                         <classpath refid="cacert-gigi.test.classpath.jdt" />
128                 </javac>
129                 <java classname="org.cacert.gigi.localisation.TranslationCollector" failonerror="true">
130                         <arg value="util-testing/org/cacert/gigi/localisation/conf.txt"/>
131                         <arg value="."/>
132                         <arg value="messages.po"/>
133                         <classpath refid="cacert-gigi.test.classpath" />
134                         <classpath refid="cacert-gigi.test.classpath.jdt" />
135                 </java>
136         </target>
137
138         <target name="native">
139                 <exec executable="make" dir="natives"/>
140         </target>
141
142         <target depends="build-project, update-effective-tlds" name="pack">
143                 <jar destfile="gigi.jar" basedir="bin" manifest="Gigi.MF" update="false"/>
144                 <jar destfile="gigi.jar" basedir="binutil" update="on"/>
145         </target>
146
147         <target depends="build-testing,update-effective-tlds" name="pack-testing">
148                 <jar destfile="gigi-testing.jar" basedir="bin" manifest="Gigi.MF" update="false"/>
149                 <jar destfile="gigi-testing.jar" basedir="binutil" update="on"/>
150                 <jar destfile="gigi-testing.jar" basedir="binutil-testing" update="on"/>
151         </target>
152
153         <target depends="test,native" name="bundle">
154                 <zip destfile="gigi-linux_amd64.zip" basedir="."
155                         includes="gigi.jar,native/*.so,src/org/cacert/gigi/database/tableStructure.sql,static/**,templates/**" />
156         </target>
157         <target name="static-bundle">
158                 <mkdir dir="work"/>
159                 <mkdir dir="work/static"/>
160                 <copy todir="work/static">
161                         <fileset dir="static"/>
162                 </copy>
163                 <move file="work/static/static/images/cacert4-test.png" tofile="work/static/static/images/cacert4.png"/>
164                 <delete file="work/static/static/image/cacert4-test.png"/>
165                 <tar destfile="static.tar.gz" compression="gzip" basedir="work"
166                         includes="../src/org/cacert/gigi/database/tableStructure.sql,**,templates/**" />
167         </target>
168
169         <target name="static-bundle-release">
170                 <mkdir dir="work"/>
171                 <mkdir dir="work/static"/>
172                 <copy todir="work/static">
173                         <fileset dir="static"/>
174                 </copy>
175                 <delete file="work/static/static/image/cacert4-test.png"/>
176                 <tar destfile="static.tar.gz" compression="gzip" basedir="work"
177                         includes="../src/org/cacert/gigi/database/tableStructure.sql,**,templates/**" />
178         </target>
179
180         <target name="develop" depends="bundle,static-bundle" />
181
182         <target name="release" depends="bundle,static-bundle-release" />
183
184         <target depends="init,build-testing,update-effective-tlds" name="build-project-test">
185                 <echo message="${ant.project.name}: ${ant.file}" />
186                 <javac encoding="UTF-8" debug="true" debuglevel="${debuglevel}" destdir="bintest"
187                         includeantruntime="false" source="${source}" target="${target}">
188                         <compilerarg value="-XDignore.symbol.file"/>
189                         <src path="tests" />
190                         <classpath refid="cacert-gigi.test.classpath" />
191                 </javac>
192                 <concat destfile="bintest/org/cacert/gigi/util/effective_tld_names.dat">
193                         <path path="bin/org/cacert/gigi/util/effective_tld_names.dat"/>
194                         <path path="publicSuffixFooter.dat"/>
195                 </concat>
196         </target>
197         <target name="check-locale">
198                 <available file="locale/de.xml" property="locale.present" />
199         </target>
200         <target name="FetchLocales" depends="check-locale" unless="locale.present">
201                 <java classname="org.cacert.gigi.util.FetchLocales" failonerror="true"
202                         fork="yes">
203                         <classpath refid="cacert-gigi.classpath" />
204                         <arg value="${localePath}"/>
205                 </java>
206         </target>
207         <target name="check-generateKeys">
208                 <available file="config/keystore.pkcs12" property="keystore.present" />
209         </target>
210         <target name="generateKeys" depends="check-generateKeys" unless="keystore.present">
211                 <exec executable="./generateKeys.sh" dir="keys" />
212                 <exec executable="./generateTruststore.sh" dir="keys">
213                         <arg value="-noprompt" />
214                 </exec>
215         </target>
216         <target name="reset-db" depends="build-project">
217                 <copy file="config/test.properties" tofile="config/gigi.properties"/>
218                 <java classname="org.cacert.gigi.util.DatabaseManager">
219                         <arg value="--test"/>
220                         <classpath refid="cacert-gigi.test.classpath" />
221                 </java>
222         </target>
223         <target name="test" depends="build-project-test,FetchLocales,pack-testing,pack,reset-db">
224                 <delete failonerror="false">
225                         <fileset dir=".">
226                                 <include name="jacoco.exec"/>
227                                 <include name="tester.exec"/>
228                         </fileset>
229                 </delete>
230                 <mkdir dir="${junit.output.dir}" />
231                 <junit maxmemory="2g" fork="yes" printsummary="withOutAndErr">
232                         <jvmarg value="-javaagent:/usr/share/java/jacocoagent.jar=destfile=tester.exec"/>
233                         <jvmarg value="-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=0.0.0.0:50001"/>
234                         <formatter type="xml" />
235                         <batchtest fork="yes" todir="${junit.output.dir}">
236                                 <fileset dir="tests">
237                                         <include name="**/*.java" />
238                                         <exclude name="**/testUtils/**" />
239                                         <exclude name="**/com/lambdaworks/crypto/test/CryptoTestUtil.java"/>
240                                 </fileset>
241                         </batchtest>
242                         <classpath refid="cacert-gigi.test.classpath" />
243                 </junit>
244         </target>
245         <target name="junitreport">
246                 <junitreport todir="${junit.output.dir}">
247                         <fileset dir="${junit.output.dir}">
248                                 <include name="TEST-*.xml" />
249                         </fileset>
250                         <report format="frames" todir="${junit.output.dir}" />
251                 </junitreport>
252         </target>
253         <target name="generatecoco">
254                 <delete file="merged.exec"/>
255
256                 <jacoco:merge destfile="merged.exec">
257                         <fileset dir="." includes="*.exec"/>
258                 </jacoco:merge>
259                 <jacoco:report>
260                         <executiondata>
261                                 <file file="merged.exec" />
262                         </executiondata>
263
264                         <structure name="CAcert gigi">
265                                 <group name="Server">
266                                         <classfiles>
267                                                 <fileset dir="bin">
268                                                         <include name="org/cacert/gigi/**"/>
269                                                 </fileset>
270                                         </classfiles>
271                                         <sourcefiles encoding="UTF-8">
272                                                 <fileset dir="src">
273                                                         <include name="org/cacert/gigi/**"/>
274                                                 </fileset>
275                                         </sourcefiles>
276                                 </group>
277                                 <group name="Testcases">
278                                         <classfiles>
279                                                 <fileset dir="bintest">
280                                                         <include name="org/cacert/gigi/**"/>
281                                                 </fileset>
282                                         </classfiles>
283                                         <sourcefiles encoding="UTF-8">
284                                                 <fileset dir="tests">
285                                                         <include name="org/cacert/gigi/**"/>
286                                                 </fileset>
287                                         </sourcefiles>
288                                 </group>
289                         </structure>
290
291                         <html destdir="cocoReport"/>
292
293                 </jacoco:report>
294         </target>
295         <target name="install-native" depends="native">
296                 <mkdir dir="${env.DESTDIR}/usr/lib/jni"/>
297                 <copy file="natives/libsetuid.so" todir="${env.DESTDIR}/usr/lib/jni"/>
298         </target>
299         <target name="install" depends="install-common">
300                 <mkdir dir="${env.DESTDIR}/usr/share/cacert-gigi/static" />
301                 <copy todir="${env.DESTDIR}/usr/share/cacert-gigi/static">
302                         <fileset dir="static" />
303                 </copy>
304                 <delete file="${env.DESTDIR}/usr/share/cacert-gigi/static/static/images/cacert4-test.png" />
305                 <copy file="gigi.jar" tofile="${env.DESTDIR}/usr/share/java/gigi.jar"/>
306         </target>
307         <target name="install-testing" depends="install-common">
308                 <mkdir dir="${env.DESTDIR}/usr/share/cacert-gigi/static" />
309                 <copy todir="${env.DESTDIR}/usr/share/cacert-gigi/static">
310                         <fileset dir="static" />
311                 </copy>
312                 <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" />
313                 <delete file="${env.DESTDIR}/usr/share/cacert-gigi/static/static/images/cacert4-test.png" />
314                 <copy file="gigi-testing.jar" tofile="${env.DESTDIR}/usr/share/java/gigi.jar"/>
315         </target>
316
317         <target name="install-common" depends="pack">
318                 <mkdir dir="${env.DESTDIR}/usr/share/java" />
319
320                 <mkdir dir="${env.DESTDIR}/usr/bin"/>
321                 <copy file="doc/scripts/gigi" tofile="${env.DESTDIR}/usr/bin/gigi"/>
322
323                 <chmod file="${env.DESTDIR}/usr/bin/gigi" perm="+x"/>
324                 <mkdir dir="${env.DESTDIR}/usr/share/dbconfig-common/data/${PACKAGE}/install/"/>
325                 <copy file="src/org/cacert/gigi/database/tableStructure.sql" tofile="${env.DESTDIR}/usr/share/dbconfig-common/data/${PACKAGE}/install/mysql.sql"/>
326
327                 <mkdir dir="${env.DESTDIR}/var/lib/cacert-gigi/doc"/>
328                 <exec executable="ln">
329                         <arg value="-s"/>
330                         <arg value="/usr/share/dbconfig-common/data/${PACKAGE}/install/mysql.sql"/>
331                         <arg value="${env.DESTDIR}/var/lib/cacert-gigi/doc/tableStructure.sql"/>
332                 </exec>
333                 <mkdir dir="${env.DESTDIR}/var/lib/cacert-gigi/natives"/>
334                 <delete failonerror="false" file="${env.DESTDIR}/var/lib/cacert-gigi/static"/>
335                 <exec executable="ln">
336                         <arg value="-s"/>
337                         <arg value="/usr/share/cacert-gigi/static"/>
338                         <arg value="${env.DESTDIR}/var/lib/cacert-gigi/static"/>
339                 </exec>
340                 <exec executable="ln">
341                         <arg value="-s"/>
342                         <arg value="/usr/lib/jni/libsetuid.so"/>
343                         <arg value="${env.DESTDIR}/var/lib/cacert-gigi/natives/libsetuid.so"/>
344                 </exec>
345
346                 <mkdir dir="${env.DESTDIR}/etc/cacert/gigi"/>
347                 <!--<copy todir="${env.DESTDIR}/DEBIAN">
348                         <fileset dir="debian">
349                         </fileset>
350                 </copy>-->
351         </target>
352         <target name="update-effective-tlds">
353                 <mkdir dir="bin/org/cacert/gigi/util"/>
354                 <exec executable="wget" dir="bin/org/cacert/gigi/util">
355                         <arg value="-N"/>
356                         <arg value="-q"/>
357                         <arg value="https://publicsuffix.org/list/effective_tld_names.dat"/>
358                 </exec>
359         </target>
360 </project>