1 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2 <project basedir="." default="develop" name="gigi" xmlns:jacoco="antlib:org.jacoco.ant">
4 <taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml">
5 <classpath path="/usr/share/java/jacocoant.jar" />
8 <property environment="env" />
9 <property name="PACKAGE" value="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" />
20 <path id="gigi.classpath">
21 <pathelement location="bin" />
22 <pathelement location="binutil" />
23 <pathelement location="${sqlconnector}" />
25 <path id="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}" />
33 <path id="gigi.test.classpath.jdt">
34 <pathelement location="${jdt}" />
38 <mkdir dir="binutil" />
39 <mkdir dir="binutil-testing" />
40 <mkdir dir="bintest" />
42 <copy includeemptydirs="false" todir="bin">
43 <fileset dir="lib/servlet-api">
44 <exclude name="**/*.launch" />
45 <exclude name="**/*.java" />
47 <fileset dir="lib/jetty">
48 <exclude name="**/*.launch" />
49 <exclude name="**/*.java" />
52 <exclude name="**/*.launch" />
53 <exclude name="**/*.java" />
56 <exclude name="**/*.launch" />
57 <exclude name="**/*.java" />
60 <copy includeemptydirs="false" todir="binutil-testing">
61 <fileset dir="util-testing">
62 <exclude name="**/*.launch" />
63 <exclude name="**/*.java" />
66 <copy includeemptydirs="false" todir="bintest">
68 <exclude name="**/*.launch" />
69 <exclude name="**/*.java" />
76 <target name="clean-test">
77 <delete dir="bintest" />
78 <delete dir="cocoReport" failonerror="false"/>
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"/>
88 <manifest file="Gigi.MF">
89 <attribute name="Main-Class" value="club.wpia.gigi.Launcher" />
90 <attribute name="Implementation-Version" value="${git-version}" />
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" />
102 <classpath refid="gigi.classpath" />
104 <javac encoding="UTF-8" debug="true" debuglevel="${debuglevel}" destdir="binutil"
105 includeantruntime="false" source="${source}" target="${target}">
106 <compilerarg value="-XDignore.symbol.file"/>
108 <classpath refid="gigi.classpath" />
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="club/wpia/gigi/localisation/**"/>
117 <classpath refid="gigi.classpath" />
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="club/wpia/gigi/localisation/**"/>
126 <classpath refid="gigi.classpath" />
127 <classpath refid="gigi.test.classpath.jdt" />
129 <java classname="club.wpia.gigi.localisation.TranslationCollector" failonerror="true">
130 <arg value="util-testing/club/wpia/gigi/localisation/conf.txt"/>
132 <arg value="messages.po"/>
133 <classpath refid="gigi.test.classpath" />
134 <classpath refid="gigi.test.classpath.jdt" />
138 <target name="native">
139 <exec executable="make" dir="natives"/>
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"/>
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"/>
153 <target depends="test,native" name="bundle">
154 <zip destfile="gigi-linux_amd64.zip" basedir="."
155 includes="gigi.jar,native/*.so,src/club/wpia/gigi/database/tableStructure.sql,static/**,templates/**" />
157 <target name="static-bundle">
159 <mkdir dir="work/static"/>
160 <copy todir="work/static">
161 <fileset dir="static"/>
163 <tar destfile="static.tar.gz" compression="gzip" basedir="work"
164 includes="../src/club/wpia/gigi/database/tableStructure.sql,**,templates/**" />
167 <target name="static-bundle-release">
169 <mkdir dir="work/static"/>
170 <copy todir="work/static">
171 <fileset dir="static"/>
173 <tar destfile="static.tar.gz" compression="gzip" basedir="work"
174 includes="../src/club/wpia/gigi/database/tableStructure.sql,**,templates/**" />
177 <target name="develop" depends="bundle,static-bundle" />
179 <target name="release" depends="bundle,static-bundle-release" />
181 <target depends="init,build-testing,update-effective-tlds" name="build-project-test">
182 <echo message="${ant.project.name}: ${ant.file}" />
183 <javac encoding="UTF-8" debug="true" debuglevel="${debuglevel}" destdir="bintest"
184 includeantruntime="false" source="${source}" target="${target}">
185 <compilerarg value="-XDignore.symbol.file"/>
187 <classpath refid="gigi.test.classpath" />
189 <concat destfile="bintest/club/wpia/gigi/util/effective_tld_names.dat">
190 <path path="bin/club/wpia/gigi/util/effective_tld_names.dat"/>
191 <path path="publicSuffixFooter.dat"/>
194 <target name="check-locale">
195 <available file="locale/de.xml" property="locale.present" />
197 <target name="FetchLocales" depends="check-locale" unless="locale.present">
198 <java classname="club.wpia.gigi.util.FetchLocales" failonerror="true"
200 <classpath refid="gigi.classpath" />
201 <arg value="${localePath}"/>
204 <target name="check-generateKeys">
205 <available file="config/keystore.pkcs12" property="keystore.present" />
207 <target name="generateKeys" depends="check-generateKeys" unless="keystore.present">
208 <exec executable="./generateKeys.sh" dir="keys" />
209 <exec executable="./generateTruststore.sh" dir="keys">
210 <arg value="-noprompt" />
213 <target name="reset-db" depends="build-project">
214 <copy file="config/test.properties" tofile="config/gigi.properties"/>
215 <java classname="club.wpia.gigi.util.DatabaseManager">
216 <arg value="--test"/>
217 <classpath refid="gigi.test.classpath" />
220 <target name="test" depends="build-project-test,FetchLocales,pack-testing,pack,reset-db">
221 <delete failonerror="false">
223 <include name="jacoco.exec"/>
224 <include name="tester.exec"/>
227 <mkdir dir="${junit.output.dir}" />
228 <junit maxmemory="2g" fork="yes" printsummary="withOutAndErr">
229 <jvmarg value="-javaagent:/usr/share/java/jacocoagent.jar=destfile=tester.exec"/>
230 <jvmarg value="-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=0.0.0.0:50001"/>
231 <formatter type="xml" />
232 <batchtest fork="yes" todir="${junit.output.dir}">
233 <fileset dir="tests">
234 <include name="**/*.java" />
235 <exclude name="**/testUtils/**" />
236 <exclude name="**/com/lambdaworks/crypto/test/CryptoTestUtil.java"/>
239 <classpath refid="gigi.test.classpath" />
242 <target name="junitreport">
243 <junitreport todir="${junit.output.dir}">
244 <fileset dir="${junit.output.dir}">
245 <include name="TEST-*.xml" />
247 <report format="frames" todir="${junit.output.dir}" />
250 <target name="generatecoco">
251 <delete file="merged.exec"/>
253 <jacoco:merge destfile="merged.exec">
254 <fileset dir="." includes="*.exec"/>
258 <file file="merged.exec" />
261 <structure name="Gigi">
262 <group name="Server">
265 <include name="club/wpia/gigi/**"/>
268 <sourcefiles encoding="UTF-8">
270 <include name="club/wpia/gigi/**"/>
274 <group name="Testcases">
276 <fileset dir="bintest">
277 <include name="club/wpia/gigi/**"/>
280 <sourcefiles encoding="UTF-8">
281 <fileset dir="tests">
282 <include name="club/wpia/gigi/**"/>
288 <html destdir="cocoReport"/>
292 <target name="install-native" depends="native">
293 <mkdir dir="${env.DESTDIR}/usr/lib/jni"/>
294 <copy file="natives/libsetuid.so" todir="${env.DESTDIR}/usr/lib/jni"/>
296 <target name="install" depends="install-common">
297 <mkdir dir="${env.DESTDIR}/usr/share/wpia-gigi/static" />
298 <copy todir="${env.DESTDIR}/usr/share/wpia-gigi/static">
299 <fileset dir="static" />
301 <copy file="gigi.jar" tofile="${env.DESTDIR}/usr/share/java/gigi.jar"/>
303 <target name="install-testing" depends="install-common">
304 <mkdir dir="${env.DESTDIR}/usr/share/wpia-gigi/static" />
305 <copy todir="${env.DESTDIR}/usr/share/wpia-gigi/static">
306 <fileset dir="static" />
308 <copy file="gigi-testing.jar" tofile="${env.DESTDIR}/usr/share/java/gigi.jar"/>
311 <target name="install-common" depends="pack">
312 <mkdir dir="${env.DESTDIR}/usr/share/java" />
314 <mkdir dir="${env.DESTDIR}/usr/bin"/>
315 <copy file="doc/scripts/gigi" tofile="${env.DESTDIR}/usr/bin/gigi"/>
317 <chmod file="${env.DESTDIR}/usr/bin/gigi" perm="+x"/>
318 <mkdir dir="${env.DESTDIR}/usr/share/dbconfig-common/data/${PACKAGE}/install/"/>
319 <copy file="src/club/wpia/gigi/database/tableStructure.sql" tofile="${env.DESTDIR}/usr/share/dbconfig-common/data/${PACKAGE}/install/mysql.sql"/>
321 <mkdir dir="${env.DESTDIR}/var/lib/wpia-gigi/doc"/>
322 <exec executable="ln">
324 <arg value="/usr/share/dbconfig-common/data/${PACKAGE}/install/mysql.sql"/>
325 <arg value="${env.DESTDIR}/var/lib/wpia-gigi/doc/tableStructure.sql"/>
327 <mkdir dir="${env.DESTDIR}/var/lib/wpia-gigi/natives"/>
328 <delete failonerror="false" file="${env.DESTDIR}/var/gigigigi/static"/>
329 <exec executable="ln">
331 <arg value="/usr/share/wpia-gigi/static"/>
332 <arg value="${env.DESTDIR}/var/lib/wpia-gigi/static"/>
334 <exec executable="ln">
336 <arg value="/usr/lib/jni/libsetuid.so"/>
337 <arg value="${env.DESTDIR}/var/lib/wpia-gigi/natives/libsetuid.so"/>
340 <mkdir dir="${env.DESTDIR}/etc/wpia/gigi"/>
341 <!--<copy todir="${env.DESTDIR}/DEBIAN">
342 <fileset dir="debian">
346 <target name="update-effective-tlds">
347 <mkdir dir="bin/club/wpia/gigi/util"/>
348 <exec executable="wget" dir="bin/club/wpia/gigi/util">
351 <arg value="https://publicsuffix.org/list/effective_tld_names.dat"/>