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="dnsjava" value="/usr/share/java/dnsjava.jar" />
15 <property name="sqlconnector" value="/usr/share/java/postgresql-jdbc4.jar" />
16 <property name="juintexec" value="/usr/share/java" />
17 <path id="JUnit 4.libraryclasspath">
18 <pathelement location="${juintexec}/junit4.jar" />
19 <pathelement location="${juintexec}/hamcrest-core.jar" />
21 <path id="gigi.classpath">
22 <pathelement location="bin" />
23 <pathelement location="binutil" />
24 <pathelement location="${sqlconnector}" />
25 <pathelement location="${dnsjava}" />
27 <path id="gigi.test.classpath">
28 <pathelement location="bintest" />
29 <pathelement location="bin" />
30 <pathelement location="binutil" />
31 <pathelement location="binutil-testing" />
32 <path refid="JUnit 4.libraryclasspath" />
33 <pathelement location="${sqlconnector}" />
34 <pathelement location="${dnsjava}" />
36 <path id="gigi.test.classpath.jdt">
37 <pathelement location="${jdt}" />
41 <mkdir dir="binutil" />
42 <mkdir dir="binutil-testing" />
43 <mkdir dir="bintest" />
45 <copy includeemptydirs="false" todir="bin">
46 <fileset dir="lib/servlet-api">
47 <exclude name="**/*.launch" />
48 <exclude name="**/*.java" />
50 <fileset dir="lib/jetty">
51 <exclude name="**/*.launch" />
52 <exclude name="**/*.java" />
55 <exclude name="**/*.launch" />
56 <exclude name="**/*.java" />
59 <exclude name="**/*.launch" />
60 <exclude name="**/*.java" />
63 <copy includeemptydirs="false" todir="binutil-testing">
64 <fileset dir="util-testing">
65 <exclude name="**/*.launch" />
66 <exclude name="**/*.java" />
69 <copy includeemptydirs="false" todir="bintest">
71 <exclude name="**/*.launch" />
72 <exclude name="**/*.java" />
79 <target name="clean-test">
80 <delete dir="bintest" />
81 <delete dir="cocoReport" failonerror="false"/>
84 <target depends="clean,clean-test" name="cleanall" />
85 <target depends="build-project, build-testing, native" name="build" />
86 <target depends="init" name="build-project">
87 <exec outputproperty="git-version" executable="sh">
89 <arg value="git describe HEAD --tags --match "v*" | sed "s/^v//""/>
91 <manifest file="Gigi.MF">
92 <attribute name="Main-Class" value="club.wpia.gigi.Launcher" />
93 <attribute name="Implementation-Version" value="${git-version}" />
95 <echo message="${ant.project.name}: ${ant.file}" />
96 <javac encoding="UTF-8" debug="true" debuglevel="${debuglevel}" destdir="bin"
97 includeantruntime="false" source="${source}" target="${target}">
98 <compilerarg value="-XDignore.symbol.file"/>
99 <src path="lib/servlet-api" />
100 <src path="lib/jetty" />
101 <src path="lib/jtar" />
102 <src path="lib/scrypt" />
103 <src path="lib/json" />
105 <classpath refid="gigi.classpath" />
107 <javac encoding="UTF-8" debug="true" debuglevel="${debuglevel}" destdir="binutil"
108 includeantruntime="false" source="${source}" target="${target}">
109 <compilerarg value="-XDignore.symbol.file"/>
111 <classpath refid="gigi.classpath" />
114 <target depends="init, build-project" name="build-testing">
115 <javac encoding="UTF-8" debug="true" debuglevel="${debuglevel}" destdir="binutil-testing"
116 includeantruntime="false" source="${source}" target="${target}">
117 <compilerarg value="-XDignore.symbol.file"/>
118 <src path="util-testing" />
119 <exclude name="club/wpia/gigi/localisation/**"/>
120 <classpath refid="gigi.classpath" />
123 <target depends="init, build-project, reset-db" name="build-testing-l10n">
124 <javac encoding="UTF-8" debug="true" debuglevel="${debuglevel}" destdir="binutil-testing"
125 includeantruntime="false" source="${source}" target="${target}">
126 <compilerarg value="-XDignore.symbol.file"/>
127 <src path="util-testing" />
128 <include name="club/wpia/gigi/localisation/**"/>
129 <classpath refid="gigi.classpath" />
130 <classpath refid="gigi.test.classpath.jdt" />
132 <java classname="club.wpia.gigi.localisation.TranslationCollector" failonerror="true">
133 <arg value="util-testing/club/wpia/gigi/localisation/conf.txt"/>
135 <arg value="messages.po"/>
136 <classpath refid="gigi.test.classpath" />
137 <classpath refid="gigi.test.classpath.jdt" />
139 <java classname="club.wpia.gigi.localisation.TranslationCollector" failonerror="true">
140 <arg value="util-testing/club/wpia/gigi/localisation/conf.txt"/>
142 <arg value="SQLValidation"/>
143 <classpath refid="gigi.test.classpath" />
144 <classpath refid="gigi.test.classpath.jdt" />
148 <target name="native">
149 <exec executable="make" dir="natives"/>
152 <target depends="build-project, update-effective-tlds" name="pack">
153 <jar destfile="gigi.jar" basedir="bin" manifest="Gigi.MF" update="false"/>
154 <jar destfile="gigi.jar" basedir="binutil" update="on"/>
157 <target depends="build-testing,update-effective-tlds" name="pack-testing">
158 <jar destfile="gigi-testing.jar" basedir="bin" manifest="Gigi.MF" update="false"/>
159 <jar destfile="gigi-testing.jar" basedir="binutil" update="on"/>
160 <jar destfile="gigi-testing.jar" basedir="binutil-testing" update="on"/>
163 <target depends="test,native" name="bundle">
164 <zip destfile="gigi-linux_amd64.zip" basedir="."
165 includes="gigi.jar,native/*.so,src/club/wpia/gigi/database/tableStructure.sql,static/**,templates/**" />
167 <target name="static-bundle">
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="static-bundle-release">
179 <mkdir dir="work/static"/>
180 <copy todir="work/static">
181 <fileset dir="static"/>
183 <tar destfile="static.tar.gz" compression="gzip" basedir="work"
184 includes="../src/club/wpia/gigi/database/tableStructure.sql,**,templates/**" />
187 <target name="develop" depends="bundle,static-bundle" />
189 <target name="release" depends="bundle,static-bundle-release" />
191 <target depends="init,build-testing,update-effective-tlds" name="build-project-test">
192 <echo message="${ant.project.name}: ${ant.file}" />
193 <javac encoding="UTF-8" debug="true" debuglevel="${debuglevel}" destdir="bintest"
194 includeantruntime="false" source="${source}" target="${target}">
195 <compilerarg value="-XDignore.symbol.file"/>
197 <classpath refid="gigi.test.classpath" />
199 <concat destfile="bintest/club/wpia/gigi/util/effective_tld_names.dat">
200 <path path="bin/club/wpia/gigi/util/effective_tld_names.dat"/>
201 <path path="publicSuffixFooter.dat"/>
204 <target name="check-locale">
205 <available file="locale/de.xml" property="locale.present" />
207 <target name="FetchLocales" depends="check-locale" unless="locale.present">
208 <java classname="club.wpia.gigi.util.FetchLocales" failonerror="true"
210 <classpath refid="gigi.classpath" />
211 <arg value="${localePath}"/>
214 <target name="check-generateKeys">
215 <available file="config/keystore.pkcs12" property="keystore.present" />
217 <target name="generateKeys" depends="check-generateKeys" unless="keystore.present">
218 <exec executable="./generateKeys.sh" dir="keys" />
219 <exec executable="./generateTruststore.sh" dir="keys">
220 <arg value="-noprompt" />
223 <target name="reset-db" depends="build-project">
224 <copy file="config/test.properties" tofile="config/gigi.properties"/>
225 <java classname="club.wpia.gigi.util.DatabaseManager">
226 <arg value="--test"/>
227 <classpath refid="gigi.test.classpath" />
230 <target name="test" depends="build-project-test,FetchLocales,pack-testing,pack,reset-db">
231 <delete failonerror="false">
233 <include name="jacoco.exec"/>
234 <include name="tester.exec"/>
237 <mkdir dir="${junit.output.dir}" />
238 <junit maxmemory="2g" fork="yes" printsummary="withOutAndErr">
239 <jvmarg value="-javaagent:/usr/share/java/jacocoagent.jar=destfile=tester.exec"/>
240 <jvmarg value="-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=0.0.0.0:50001"/>
241 <formatter type="xml" />
242 <batchtest fork="yes" todir="${junit.output.dir}">
243 <fileset dir="tests">
244 <include name="**/*.java" />
245 <exclude name="**/testUtils/**" />
246 <exclude name="**/com/lambdaworks/crypto/test/CryptoTestUtil.java"/>
249 <classpath refid="gigi.test.classpath" />
252 <target name="junitreport">
253 <junitreport todir="${junit.output.dir}">
254 <fileset dir="${junit.output.dir}">
255 <include name="TEST-*.xml" />
257 <report format="frames" todir="${junit.output.dir}" />
260 <target name="generatecoco">
261 <delete file="merged.exec"/>
263 <jacoco:merge destfile="merged.exec">
264 <fileset dir="." includes="*.exec"/>
268 <file file="merged.exec" />
271 <structure name="Gigi">
272 <group name="Server">
275 <include name="club/wpia/gigi/**"/>
278 <sourcefiles encoding="UTF-8">
280 <include name="club/wpia/gigi/**"/>
284 <group name="Testcases">
286 <fileset dir="bintest">
287 <include name="club/wpia/gigi/**"/>
290 <sourcefiles encoding="UTF-8">
291 <fileset dir="tests">
292 <include name="club/wpia/gigi/**"/>
298 <html destdir="cocoReport"/>
302 <target name="install-native" depends="native">
303 <mkdir dir="${env.DESTDIR}/usr/lib/jni"/>
304 <copy file="natives/libsetuid.so" todir="${env.DESTDIR}/usr/lib/jni"/>
306 <target name="install" depends="install-common">
307 <mkdir dir="${env.DESTDIR}/usr/share/wpia-gigi/static" />
308 <copy todir="${env.DESTDIR}/usr/share/wpia-gigi/static">
309 <fileset dir="static" />
311 <copy file="gigi.jar" tofile="${env.DESTDIR}/usr/share/java/gigi.jar"/>
313 <target name="install-testing" depends="install-common">
314 <mkdir dir="${env.DESTDIR}/usr/share/wpia-gigi/static" />
315 <copy todir="${env.DESTDIR}/usr/share/wpia-gigi/static">
316 <fileset dir="static" />
318 <copy file="gigi-testing.jar" tofile="${env.DESTDIR}/usr/share/java/gigi.jar"/>
321 <target name="install-common" depends="pack">
322 <mkdir dir="${env.DESTDIR}/usr/share/java" />
324 <mkdir dir="${env.DESTDIR}/usr/bin"/>
325 <copy file="doc/scripts/gigi" tofile="${env.DESTDIR}/usr/bin/gigi"/>
327 <chmod file="${env.DESTDIR}/usr/bin/gigi" perm="+x"/>
328 <mkdir dir="${env.DESTDIR}/usr/share/dbconfig-common/data/${PACKAGE}/install/"/>
329 <copy file="src/club/wpia/gigi/database/tableStructure.sql" tofile="${env.DESTDIR}/usr/share/dbconfig-common/data/${PACKAGE}/install/mysql.sql"/>
331 <mkdir dir="${env.DESTDIR}/var/lib/wpia-gigi/doc"/>
332 <exec executable="ln">
334 <arg value="/usr/share/dbconfig-common/data/${PACKAGE}/install/mysql.sql"/>
335 <arg value="${env.DESTDIR}/var/lib/wpia-gigi/doc/tableStructure.sql"/>
337 <mkdir dir="${env.DESTDIR}/var/lib/wpia-gigi/natives"/>
338 <delete failonerror="false" file="${env.DESTDIR}/var/gigigigi/static"/>
339 <exec executable="ln">
341 <arg value="/usr/share/wpia-gigi/static"/>
342 <arg value="${env.DESTDIR}/var/lib/wpia-gigi/static"/>
344 <exec executable="ln">
346 <arg value="/usr/lib/jni/libsetuid.so"/>
347 <arg value="${env.DESTDIR}/var/lib/wpia-gigi/natives/libsetuid.so"/>
350 <mkdir dir="${env.DESTDIR}/etc/wpia/gigi"/>
351 <!--<copy todir="${env.DESTDIR}/DEBIAN">
352 <fileset dir="debian">
356 <target name="update-effective-tlds">
357 <mkdir dir="bin/club/wpia/gigi/util"/>
358 <exec executable="wget" dir="bin/club/wpia/gigi/util">
361 <arg value="https://publicsuffix.org/list/effective_tld_names.dat"/>