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, reset-db" 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" />
136 <java classname="club.wpia.gigi.localisation.TranslationCollector" failonerror="true">
137 <arg value="util-testing/club/wpia/gigi/localisation/conf.txt"/>
139 <arg value="SQLValidation"/>
140 <classpath refid="gigi.test.classpath" />
141 <classpath refid="gigi.test.classpath.jdt" />
145 <target name="native">
146 <exec executable="make" dir="natives"/>
149 <target depends="build-project, update-effective-tlds" name="pack">
150 <jar destfile="gigi.jar" basedir="bin" manifest="Gigi.MF" update="false"/>
151 <jar destfile="gigi.jar" basedir="binutil" update="on"/>
154 <target depends="build-testing,update-effective-tlds" name="pack-testing">
155 <jar destfile="gigi-testing.jar" basedir="bin" manifest="Gigi.MF" update="false"/>
156 <jar destfile="gigi-testing.jar" basedir="binutil" update="on"/>
157 <jar destfile="gigi-testing.jar" basedir="binutil-testing" update="on"/>
160 <target depends="test,native" name="bundle">
161 <zip destfile="gigi-linux_amd64.zip" basedir="."
162 includes="gigi.jar,native/*.so,src/club/wpia/gigi/database/tableStructure.sql,static/**,templates/**" />
164 <target name="static-bundle">
166 <mkdir dir="work/static"/>
167 <copy todir="work/static">
168 <fileset dir="static"/>
170 <tar destfile="static.tar.gz" compression="gzip" basedir="work"
171 includes="../src/club/wpia/gigi/database/tableStructure.sql,**,templates/**" />
174 <target name="static-bundle-release">
176 <mkdir dir="work/static"/>
177 <copy todir="work/static">
178 <fileset dir="static"/>
180 <tar destfile="static.tar.gz" compression="gzip" basedir="work"
181 includes="../src/club/wpia/gigi/database/tableStructure.sql,**,templates/**" />
184 <target name="develop" depends="bundle,static-bundle" />
186 <target name="release" depends="bundle,static-bundle-release" />
188 <target depends="init,build-testing,update-effective-tlds" name="build-project-test">
189 <echo message="${ant.project.name}: ${ant.file}" />
190 <javac encoding="UTF-8" debug="true" debuglevel="${debuglevel}" destdir="bintest"
191 includeantruntime="false" source="${source}" target="${target}">
192 <compilerarg value="-XDignore.symbol.file"/>
194 <classpath refid="gigi.test.classpath" />
196 <concat destfile="bintest/club/wpia/gigi/util/effective_tld_names.dat">
197 <path path="bin/club/wpia/gigi/util/effective_tld_names.dat"/>
198 <path path="publicSuffixFooter.dat"/>
201 <target name="check-locale">
202 <available file="locale/de.xml" property="locale.present" />
204 <target name="FetchLocales" depends="check-locale" unless="locale.present">
205 <java classname="club.wpia.gigi.util.FetchLocales" failonerror="true"
207 <classpath refid="gigi.classpath" />
208 <arg value="${localePath}"/>
211 <target name="check-generateKeys">
212 <available file="config/keystore.pkcs12" property="keystore.present" />
214 <target name="generateKeys" depends="check-generateKeys" unless="keystore.present">
215 <exec executable="./generateKeys.sh" dir="keys" />
216 <exec executable="./generateTruststore.sh" dir="keys">
217 <arg value="-noprompt" />
220 <target name="reset-db" depends="build-project">
221 <copy file="config/test.properties" tofile="config/gigi.properties"/>
222 <java classname="club.wpia.gigi.util.DatabaseManager">
223 <arg value="--test"/>
224 <classpath refid="gigi.test.classpath" />
227 <target name="test" depends="build-project-test,FetchLocales,pack-testing,pack,reset-db">
228 <delete failonerror="false">
230 <include name="jacoco.exec"/>
231 <include name="tester.exec"/>
234 <mkdir dir="${junit.output.dir}" />
235 <junit maxmemory="2g" fork="yes" printsummary="withOutAndErr">
236 <jvmarg value="-javaagent:/usr/share/java/jacocoagent.jar=destfile=tester.exec"/>
237 <jvmarg value="-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=0.0.0.0:50001"/>
238 <formatter type="xml" />
239 <batchtest fork="yes" todir="${junit.output.dir}">
240 <fileset dir="tests">
241 <include name="**/*.java" />
242 <exclude name="**/testUtils/**" />
243 <exclude name="**/com/lambdaworks/crypto/test/CryptoTestUtil.java"/>
246 <classpath refid="gigi.test.classpath" />
249 <target name="junitreport">
250 <junitreport todir="${junit.output.dir}">
251 <fileset dir="${junit.output.dir}">
252 <include name="TEST-*.xml" />
254 <report format="frames" todir="${junit.output.dir}" />
257 <target name="generatecoco">
258 <delete file="merged.exec"/>
260 <jacoco:merge destfile="merged.exec">
261 <fileset dir="." includes="*.exec"/>
265 <file file="merged.exec" />
268 <structure name="Gigi">
269 <group name="Server">
272 <include name="club/wpia/gigi/**"/>
275 <sourcefiles encoding="UTF-8">
277 <include name="club/wpia/gigi/**"/>
281 <group name="Testcases">
283 <fileset dir="bintest">
284 <include name="club/wpia/gigi/**"/>
287 <sourcefiles encoding="UTF-8">
288 <fileset dir="tests">
289 <include name="club/wpia/gigi/**"/>
295 <html destdir="cocoReport"/>
299 <target name="install-native" depends="native">
300 <mkdir dir="${env.DESTDIR}/usr/lib/jni"/>
301 <copy file="natives/libsetuid.so" todir="${env.DESTDIR}/usr/lib/jni"/>
303 <target name="install" 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.jar" tofile="${env.DESTDIR}/usr/share/java/gigi.jar"/>
310 <target name="install-testing" depends="install-common">
311 <mkdir dir="${env.DESTDIR}/usr/share/wpia-gigi/static" />
312 <copy todir="${env.DESTDIR}/usr/share/wpia-gigi/static">
313 <fileset dir="static" />
315 <copy file="gigi-testing.jar" tofile="${env.DESTDIR}/usr/share/java/gigi.jar"/>
318 <target name="install-common" depends="pack">
319 <mkdir dir="${env.DESTDIR}/usr/share/java" />
321 <mkdir dir="${env.DESTDIR}/usr/bin"/>
322 <copy file="doc/scripts/gigi" tofile="${env.DESTDIR}/usr/bin/gigi"/>
324 <chmod file="${env.DESTDIR}/usr/bin/gigi" perm="+x"/>
325 <mkdir dir="${env.DESTDIR}/usr/share/dbconfig-common/data/${PACKAGE}/install/"/>
326 <copy file="src/club/wpia/gigi/database/tableStructure.sql" tofile="${env.DESTDIR}/usr/share/dbconfig-common/data/${PACKAGE}/install/mysql.sql"/>
328 <mkdir dir="${env.DESTDIR}/var/lib/wpia-gigi/doc"/>
329 <exec executable="ln">
331 <arg value="/usr/share/dbconfig-common/data/${PACKAGE}/install/mysql.sql"/>
332 <arg value="${env.DESTDIR}/var/lib/wpia-gigi/doc/tableStructure.sql"/>
334 <mkdir dir="${env.DESTDIR}/var/lib/wpia-gigi/natives"/>
335 <delete failonerror="false" file="${env.DESTDIR}/var/gigigigi/static"/>
336 <exec executable="ln">
338 <arg value="/usr/share/wpia-gigi/static"/>
339 <arg value="${env.DESTDIR}/var/lib/wpia-gigi/static"/>
341 <exec executable="ln">
343 <arg value="/usr/lib/jni/libsetuid.so"/>
344 <arg value="${env.DESTDIR}/var/lib/wpia-gigi/natives/libsetuid.so"/>
347 <mkdir dir="${env.DESTDIR}/etc/wpia/gigi"/>
348 <!--<copy todir="${env.DESTDIR}/DEBIAN">
349 <fileset dir="debian">
353 <target name="update-effective-tlds">
354 <mkdir dir="bin/club/wpia/gigi/util"/>
355 <exec executable="wget" dir="bin/club/wpia/gigi/util">
358 <arg value="https://publicsuffix.org/list/effective_tld_names.dat"/>