]> WPIA git - gigi.git/blobdiff - build.xml
Merge "upd: small changes for consistent wording and better translation"
[gigi.git] / build.xml
index 630a0117d3594dad0980c3abfc0e77db0a89a989..abf1e3b1f9f2c434ab1fe755acc7ec940b0a278c 100644 (file)
--- a/build.xml
+++ b/build.xml
 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<project basedir="." default="build" name="cacert-gigi">
-    <property environment="env"/>
-    <property name="junit.output.dir" value="junit"/>
-    <property name="debuglevel" value="source,lines,vars"/>
-    <property name="target" value="1.8"/>
-    <property name="source" value="1.8"/>
-    <property name="mysqlconnector" value="mysql-connector-java-5.1.31-bin.jar"/>
-    <property name="juintexec" value="junit.jar"/>
-    <path id="JUnit 4.libraryclasspath">
-        <pathelement location="${juintexec}"/>
-    </path>
-    <path id="cacert-gigi.classpath">
-        <pathelement location="bin"/>
-        <path refid="JUnit 4.libraryclasspath"/>
-        <pathelement location="${mysqlconnector}"/>
-    </path>
-    <path id="cacert-gigi.test.classpath">
-        <pathelement location="bintest"/>
-        <path refid="JUnit 4.libraryclasspath"/>
-        <pathelement location="${mysqlconnector}"/>
-    </path>
-    <target name="init">
-        <mkdir dir="bin"/>
-        <mkdir dir="bintest"/>
-        
-        <copy includeemptydirs="false" todir="bin">
-            <fileset dir="lib/servlet-api">
-                <exclude name="**/*.launch"/>
-                <exclude name="**/*.java"/>
-            </fileset>
-        </copy>
-        <copy includeemptydirs="false" todir="bin">
-            <fileset dir="lib/jetty">
-                <exclude name="**/*.launch"/>
-                <exclude name="**/*.java"/>
-            </fileset>
-        </copy>
-        <copy includeemptydirs="false" todir="bin">
-            <fileset dir="src">
-                <exclude name="**/*.launch"/>
-                <exclude name="**/*.java"/>
-            </fileset>
-        </copy>
-        <copy includeemptydirs="false" todir="bin">
-            <fileset dir="util">
-                <exclude name="**/*.launch"/>
-                <exclude name="**/*.java"/>
-            </fileset>
-        </copy>
-        <copy includeemptydirs="false" todir="bintest">
-            <fileset dir="tests">
-                <exclude name="**/*.launch"/>
-                <exclude name="**/*.java"/>
-            </fileset>
-        </copy>
-    </target>
-    <target name="clean">
-        <delete dir="bin"/>
-    </target>
-    <target depends="clean" name="cleanall"/>
-    <target depends="build-subprojects,build-project" name="build"/>
-    <target name="build-subprojects"/>
-    <target depends="init" name="build-project">
-        <echo message="${ant.project.name}: ${ant.file}"/>
-        <javac debug="true" debuglevel="${debuglevel}" destdir="bin" includeantruntime="false" source="${source}" target="${target}">
-            <src path="lib/servlet-api"/>
-            <src path="lib/jetty"/>
-            <src path="src"/>
-            <src path="util"/>
-            <classpath refid="cacert-gigi.classpath"/>
-        </javac>
-    </target>
-    <target depends="init" name="build-project-test">
-        <echo message="${ant.project.name}: ${ant.file}"/>
-        <javac debug="true" debuglevel="${debuglevel}" destdir="bintest" includeantruntime="false" source="${source}" target="${target}">
-            <src path="tests"/>
-            <classpath refid="cacert-gigi.test.classpath"/>
-        </javac>
-    </target>
-    <target description="Build all projects which reference this project. Useful to propagate changes." name="build-refprojects"/>
-    <target name="FetchLocales">
-        <java classname="org.cacert.gigi.util.FetchLocales" failonerror="true" fork="yes">
-            <classpath refid="cacert-gigi.classpath"/>
-        </java>
-    </target>
-    <target name="Launcher">
-        <java classname="org.cacert.gigi.Launcher" failonerror="true" fork="yes">
-            <classpath refid="cacert-gigi.classpath"/>
-        </java>
-    </target>
-    <target name="test" depends="build-project-test">
-        <mkdir dir="${junit.output.dir}"/>
-        <junit fork="yes" printsummary="withOutAndErr">
-            <formatter type="xml"/>
-            <test name="org.cacert.gigi.TestSSL" todir="${junit.output.dir}"/>
-            <test name="org.cacert.gigi.pages.main.ResgisterPageTest" todir="${junit.output.dir}"/>
-            <classpath refid="cacert-gigi.classpath"/>
-        </junit>
-    </target>
-    <target name="junitreport">
-        <junitreport todir="${junit.output.dir}">
-            <fileset dir="${junit.output.dir}">
-                <include name="TEST-*.xml"/>
-            </fileset>
-            <report format="frames" todir="${junit.output.dir}"/>
-        </junitreport>
-    </target>
+<project basedir="." default="develop" name="gigi" xmlns:jacoco="antlib:org.jacoco.ant">
+
+       <taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml">
+               <classpath path="/usr/share/java/jacocoant.jar" />
+       </taskdef>
+
+       <property environment="env" />
+       <property name="PACKAGE" value="gigi" />
+       <property name="junit.output.dir" value="junit" />
+       <property name="debuglevel" value="source,lines,vars" />
+       <property name="target" value="1.8" />
+       <property name="source" value="1.8" />
+       <property name="dnsjava" value="/usr/share/java/dnsjava.jar" />
+       <property name="sqlconnector" value="/usr/share/java/postgresql-jdbc4.jar" />
+       <property name="juintexec" value="/usr/share/java" />
+       <path id="JUnit 4.libraryclasspath">
+               <pathelement location="${juintexec}/junit4.jar" />
+               <pathelement location="${juintexec}/hamcrest-core.jar" />
+       </path>
+       <path id="gigi.classpath">
+               <pathelement location="bin" />
+               <pathelement location="binutil" />
+               <pathelement location="${sqlconnector}" />
+               <pathelement location="${dnsjava}" />
+       </path>
+       <path id="gigi.test.classpath">
+               <pathelement location="bintest" />
+               <pathelement location="bin" />
+               <pathelement location="binutil" />
+               <pathelement location="binutil-testing" />
+               <path refid="JUnit 4.libraryclasspath" />
+               <pathelement location="${sqlconnector}" />
+               <pathelement location="${dnsjava}" />
+       </path>
+       <path id="gigi.test.classpath.jdt">
+               <pathelement location="${jdt}" />
+       </path>
+       <target name="init">
+               <mkdir dir="bin" />
+               <mkdir dir="binutil" />
+               <mkdir dir="binutil-testing" />
+               <mkdir dir="bintest" />
+
+               <copy includeemptydirs="false" todir="bin">
+                       <fileset dir="lib/servlet-api">
+                               <exclude name="**/*.launch" />
+                               <exclude name="**/*.java" />
+                       </fileset>
+                       <fileset dir="lib/jetty">
+                               <exclude name="**/*.launch" />
+                               <exclude name="**/*.java" />
+                       </fileset>
+                       <fileset dir="src">
+                               <exclude name="**/*.launch" />
+                               <exclude name="**/*.java" />
+                       </fileset>
+                       <fileset dir="util">
+                               <exclude name="**/*.launch" />
+                               <exclude name="**/*.java" />
+                       </fileset>
+               </copy>
+               <copy includeemptydirs="false" todir="binutil-testing">
+                       <fileset dir="util-testing">
+                               <exclude name="**/*.launch" />
+                               <exclude name="**/*.java" />
+                       </fileset>
+               </copy>
+               <copy includeemptydirs="false" todir="bintest">
+                       <fileset dir="tests">
+                               <exclude name="**/*.launch" />
+                               <exclude name="**/*.java" />
+                       </fileset>
+               </copy>
+       </target>
+       <target name="clean">
+               <delete dir="bin" />
+       </target>
+       <target name="clean-test">
+               <delete dir="bintest" />
+               <delete dir="cocoReport" failonerror="false"/>
+
+       </target>
+       <target depends="clean,clean-test" name="cleanall" />
+       <target depends="build-project, build-testing, native" name="build" />
+       <target depends="init" name="build-project">
+               <exec outputproperty="git-version" executable="sh">
+                       <arg value="-c"/>
+                       <arg value="git describe HEAD --tags --match &quot;v*&quot; | sed &quot;s/^v//&quot;"/>
+               </exec>
+               <manifest file="Gigi.MF">
+                       <attribute name="Main-Class" value="club.wpia.gigi.Launcher" />
+                       <attribute name="Implementation-Version" value="${git-version}" />
+               </manifest>
+               <echo message="${ant.project.name}: ${ant.file}" />
+               <javac encoding="UTF-8" debug="true" debuglevel="${debuglevel}" destdir="bin"
+                       includeantruntime="false" source="${source}" target="${target}">
+                       <compilerarg value="-XDignore.symbol.file"/>
+                       <src path="lib/servlet-api" />
+                       <src path="lib/jetty" />
+                       <src path="lib/jtar" />
+                       <src path="lib/scrypt" />
+                       <src path="lib/json" />
+                       <src path="src" />
+                       <classpath refid="gigi.classpath" />
+               </javac>
+               <javac encoding="UTF-8" debug="true" debuglevel="${debuglevel}" destdir="binutil"
+                       includeantruntime="false" source="${source}" target="${target}">
+                       <compilerarg value="-XDignore.symbol.file"/>
+                       <src path="util" />
+                       <classpath refid="gigi.classpath" />
+               </javac>
+       </target>
+       <target depends="init, build-project" name="build-testing">
+               <javac encoding="UTF-8" debug="true" debuglevel="${debuglevel}" destdir="binutil-testing"
+                       includeantruntime="false" source="${source}" target="${target}">
+                       <compilerarg value="-XDignore.symbol.file"/>
+                       <src path="util-testing" />
+                       <exclude name="club/wpia/gigi/localisation/**"/>
+                       <classpath refid="gigi.classpath" />
+               </javac>
+       </target>
+       <target depends="init, build-project, reset-db" name="build-testing-l10n">
+               <javac encoding="UTF-8" debug="true" debuglevel="${debuglevel}" destdir="binutil-testing"
+                       includeantruntime="false" source="${source}" target="${target}">
+                       <compilerarg value="-XDignore.symbol.file"/>
+                       <src path="util-testing" />
+                       <include name="club/wpia/gigi/localisation/**"/>
+                       <classpath refid="gigi.classpath" />
+                       <classpath refid="gigi.test.classpath.jdt" />
+               </javac>
+               <java classname="club.wpia.gigi.localisation.TranslationCollector" failonerror="true">
+                       <arg value="util-testing/club/wpia/gigi/localisation/conf.txt"/>
+                       <arg value="."/>
+                       <arg value="messages.po"/>
+                       <classpath refid="gigi.test.classpath" />
+                       <classpath refid="gigi.test.classpath.jdt" />
+               </java>
+               <java classname="club.wpia.gigi.localisation.TranslationCollector" failonerror="true">
+                       <arg value="util-testing/club/wpia/gigi/localisation/conf.txt"/>
+                       <arg value="."/>
+                       <arg value="SQLValidation"/>
+                       <classpath refid="gigi.test.classpath" />
+                       <classpath refid="gigi.test.classpath.jdt" />
+               </java>
+       </target>
+
+       <target name="native">
+               <exec executable="make" dir="natives"/>
+       </target>
+
+       <target depends="build-project, update-effective-tlds" name="pack">
+               <jar destfile="gigi.jar" basedir="bin" manifest="Gigi.MF" update="false"/>
+               <jar destfile="gigi.jar" basedir="binutil" update="on"/>
+       </target>
+
+       <target depends="build-testing,update-effective-tlds" name="pack-testing">
+               <jar destfile="gigi-testing.jar" basedir="bin" manifest="Gigi.MF" update="false"/>
+               <jar destfile="gigi-testing.jar" basedir="binutil" update="on"/>
+               <jar destfile="gigi-testing.jar" basedir="binutil-testing" update="on"/>
+       </target>
+
+       <target depends="test,native" name="bundle">
+               <zip destfile="gigi-linux_amd64.zip" basedir="."
+                       includes="gigi.jar,native/*.so,src/club/wpia/gigi/database/tableStructure.sql,static/**,templates/**" />
+       </target>
+       <target name="static-bundle">
+               <mkdir dir="work"/>
+               <mkdir dir="work/static"/>
+               <copy todir="work/static">
+                       <fileset dir="static"/>
+               </copy>
+               <tar destfile="static.tar.gz" compression="gzip" basedir="work"
+                       includes="../src/club/wpia/gigi/database/tableStructure.sql,**,templates/**" />
+       </target>
+
+       <target name="static-bundle-release">
+               <mkdir dir="work"/>
+               <mkdir dir="work/static"/>
+               <copy todir="work/static">
+                       <fileset dir="static"/>
+               </copy>
+               <tar destfile="static.tar.gz" compression="gzip" basedir="work"
+                       includes="../src/club/wpia/gigi/database/tableStructure.sql,**,templates/**" />
+       </target>
+
+       <target name="develop" depends="bundle,static-bundle" />
+
+       <target name="release" depends="bundle,static-bundle-release" />
+
+       <target depends="init,build-testing,update-effective-tlds" name="build-project-test">
+               <echo message="${ant.project.name}: ${ant.file}" />
+               <javac encoding="UTF-8" debug="true" debuglevel="${debuglevel}" destdir="bintest"
+                       includeantruntime="false" source="${source}" target="${target}">
+                       <compilerarg value="-XDignore.symbol.file"/>
+                       <src path="tests" />
+                       <classpath refid="gigi.test.classpath" />
+               </javac>
+               <concat destfile="bintest/club/wpia/gigi/util/effective_tld_names.dat">
+                       <path path="bin/club/wpia/gigi/util/effective_tld_names.dat"/>
+                       <path path="publicSuffixFooter.dat"/>
+               </concat>
+       </target>
+       <target name="check-locale">
+               <available file="locale/de.xml" property="locale.present" />
+       </target>
+       <target name="FetchLocales" depends="check-locale" unless="locale.present">
+               <java classname="club.wpia.gigi.util.FetchLocales" failonerror="true"
+                       fork="yes">
+                       <classpath refid="gigi.classpath" />
+                       <arg value="${localePath}"/>
+               </java>
+       </target>
+       <target name="check-generateKeys">
+               <available file="config/keystore.pkcs12" property="keystore.present" />
+       </target>
+       <target name="generateKeys" depends="check-generateKeys" unless="keystore.present">
+               <exec executable="./generateKeys.sh" dir="keys" />
+               <exec executable="./generateTruststore.sh" dir="keys">
+                       <arg value="-noprompt" />
+               </exec>
+       </target>
+       <target name="reset-db" depends="build-project">
+               <copy file="config/test.properties" tofile="config/gigi.properties"/>
+               <java classname="club.wpia.gigi.util.DatabaseManager">
+                       <arg value="--test"/>
+                       <classpath refid="gigi.test.classpath" />
+               </java>
+       </target>
+       <target name="test" depends="build-project-test,FetchLocales,pack-testing,pack,reset-db">
+               <delete failonerror="false">
+                       <fileset dir=".">
+                               <include name="jacoco.exec"/>
+                               <include name="tester.exec"/>
+                       </fileset>
+               </delete>
+               <mkdir dir="${junit.output.dir}" />
+               <junit maxmemory="2g" fork="yes" printsummary="withOutAndErr">
+                       <jvmarg value="-javaagent:/usr/share/java/jacocoagent.jar=destfile=tester.exec"/>
+                       <jvmarg value="-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=0.0.0.0:50001"/>
+                       <formatter type="xml" />
+                       <batchtest fork="yes" todir="${junit.output.dir}">
+                               <fileset dir="tests">
+                                       <include name="**/*.java" />
+                                       <exclude name="**/testUtils/**" />
+                                       <exclude name="**/com/lambdaworks/crypto/test/CryptoTestUtil.java"/>
+                               </fileset>
+                       </batchtest>
+                       <classpath refid="gigi.test.classpath" />
+               </junit>
+       </target>
+       <target name="junitreport">
+               <junitreport todir="${junit.output.dir}">
+                       <fileset dir="${junit.output.dir}">
+                               <include name="TEST-*.xml" />
+                       </fileset>
+                       <report format="frames" todir="${junit.output.dir}" />
+               </junitreport>
+       </target>
+       <target name="generatecoco">
+               <delete file="merged.exec"/>
+
+               <jacoco:merge destfile="merged.exec">
+                       <fileset dir="." includes="*.exec"/>
+               </jacoco:merge>
+               <jacoco:report>
+                       <executiondata>
+                               <file file="merged.exec" />
+                       </executiondata>
+
+                       <structure name="Gigi">
+                               <group name="Server">
+                                       <classfiles>
+                                               <fileset dir="bin">
+                                                       <include name="club/wpia/gigi/**"/>
+                                               </fileset>
+                                       </classfiles>
+                                       <sourcefiles encoding="UTF-8">
+                                               <fileset dir="src">
+                                                       <include name="club/wpia/gigi/**"/>
+                                               </fileset>
+                                       </sourcefiles>
+                               </group>
+                               <group name="Testcases">
+                                       <classfiles>
+                                               <fileset dir="bintest">
+                                                       <include name="club/wpia/gigi/**"/>
+                                               </fileset>
+                                       </classfiles>
+                                       <sourcefiles encoding="UTF-8">
+                                               <fileset dir="tests">
+                                                       <include name="club/wpia/gigi/**"/>
+                                               </fileset>
+                                       </sourcefiles>
+                               </group>
+                       </structure>
+
+                       <html destdir="cocoReport"/>
+
+               </jacoco:report>
+       </target>
+       <target name="install-native" depends="native">
+               <mkdir dir="${env.DESTDIR}/usr/lib/jni"/>
+               <copy file="natives/libsetuid.so" todir="${env.DESTDIR}/usr/lib/jni"/>
+       </target>
+       <target name="install" depends="install-common">
+               <mkdir dir="${env.DESTDIR}/usr/share/wpia-gigi/static" />
+               <copy todir="${env.DESTDIR}/usr/share/wpia-gigi/static">
+                       <fileset dir="static" />
+               </copy>
+               <copy file="gigi.jar" tofile="${env.DESTDIR}/usr/share/java/gigi.jar"/>
+       </target>
+       <target name="install-testing" depends="install-common">
+               <mkdir dir="${env.DESTDIR}/usr/share/wpia-gigi/static" />
+               <copy todir="${env.DESTDIR}/usr/share/wpia-gigi/static">
+                       <fileset dir="static" />
+               </copy>
+               <copy file="gigi-testing.jar" tofile="${env.DESTDIR}/usr/share/java/gigi.jar"/>
+       </target>
+
+       <target name="install-common" depends="pack">
+               <mkdir dir="${env.DESTDIR}/usr/share/java" />
+
+               <mkdir dir="${env.DESTDIR}/usr/bin"/>
+               <copy file="doc/scripts/gigi" tofile="${env.DESTDIR}/usr/bin/gigi"/>
+
+               <chmod file="${env.DESTDIR}/usr/bin/gigi" perm="+x"/>
+               <mkdir dir="${env.DESTDIR}/usr/share/dbconfig-common/data/${PACKAGE}/install/"/>
+               <copy file="src/club/wpia/gigi/database/tableStructure.sql" tofile="${env.DESTDIR}/usr/share/dbconfig-common/data/${PACKAGE}/install/mysql.sql"/>
+
+               <mkdir dir="${env.DESTDIR}/var/lib/wpia-gigi/doc"/>
+               <exec executable="ln">
+                       <arg value="-s"/>
+                       <arg value="/usr/share/dbconfig-common/data/${PACKAGE}/install/mysql.sql"/>
+                       <arg value="${env.DESTDIR}/var/lib/wpia-gigi/doc/tableStructure.sql"/>
+               </exec>
+               <mkdir dir="${env.DESTDIR}/var/lib/wpia-gigi/natives"/>
+               <delete failonerror="false" file="${env.DESTDIR}/var/gigigigi/static"/>
+               <exec executable="ln">
+                       <arg value="-s"/>
+                       <arg value="/usr/share/wpia-gigi/static"/>
+                       <arg value="${env.DESTDIR}/var/lib/wpia-gigi/static"/>
+               </exec>
+               <exec executable="ln">
+                       <arg value="-s"/>
+                       <arg value="/usr/lib/jni/libsetuid.so"/>
+                       <arg value="${env.DESTDIR}/var/lib/wpia-gigi/natives/libsetuid.so"/>
+               </exec>
+
+               <mkdir dir="${env.DESTDIR}/etc/wpia/gigi"/>
+               <!--<copy todir="${env.DESTDIR}/DEBIAN">
+                       <fileset dir="debian">
+                       </fileset>
+               </copy>-->
+       </target>
+       <target name="update-effective-tlds">
+               <mkdir dir="bin/club/wpia/gigi/util"/>
+               <exec executable="wget" dir="bin/club/wpia/gigi/util">
+                       <arg value="-N"/>
+                       <arg value="-q"/>
+                       <arg value="https://publicsuffix.org/list/effective_tld_names.dat"/>
+               </exec>
+       </target>
 </project>