lanemu-mirror/build.xml
2024-06-13 16:25:23 +00:00

139 lines
4.6 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2008 Wolfgang Ginolas
This file is part of Lanemu.
Lanemu is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Lanemu is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with Lanemu. If not, see <http://www.gnu.org/licenses/>.
-->
<project name="Lanemu" default="jar" basedir="." xmlns:ivy="antlib:org.apache.ivy.ant">
<property name="src" value="src"/>
<property name="build" value="build"/>
<property name="build.classes" value="build/classes"/>
<property name="clib" value="clib"/>
<property name="lib" value="lib"/>
<property name="resources" value="resources"/>
<property name="classpath" value="${lib}/commons-jxpath-1.1.jar;${lib}/commons-logging-1.2.jar;${lib}/bcprov-jdk15on-1.70.jar;${lib}/junit-4.5.jar;${lib}/commons-codec-1.3.jar;${lib}/swing-layout-1.0.3.jar;${lib}/WaifUPnP.jar;${lib}/flatlaf-3.1.1.jar;${lib}/LGoodDatePicker-11.2.1.jar"/>
<property name="ivy.install.version" value="2.5.2"/>
<condition property="ivy.home" value="${env.IVY_HOME}">
<isset property="env.IVY_HOME"/>
</condition>
<property name="ivy.home" value="${user.home}/.ant"/>
<property name="ivy.jar.dir" value="${ivy.home}/${lib}"/>
<property name="ivy.jar.file" value="${ivy.jar.dir}/ivy.jar"/>
<target name="init">
<mkdir dir="${build}"/>
<mkdir dir="${build.classes}"/>
</target>
<target name="clean" depends="clean-3rdparty">
<delete dir="${build}"/>
<delete dir="${clib}"/>
<delete dir="${lib}"/>
</target>
<target name="compile" depends="init,resolve,compile-3rdparty">
<exec executable="git" outputproperty="git.revision">
<arg value="rev-parse"/>
<arg value="--short"/>
<arg value="HEAD"/>
</exec>
<echo file=".gitrevision" message="${git.revision}" />
<javac
srcdir="${src}"
destdir="${build.classes}"
classpath="${classpath}"
source="1.7"
target="1.7"
debug="true"/>
</target>
<target name="compile-3rdparty">
<ant dir="3rdparty/WaifUPnP"/>
<copy file="3rdparty/WaifUPnP/dist/WaifUPnP.jar" tofile="${lib}/WaifUPnP.jar"/>
</target>
<target name="clean-3rdparty">
<ant dir="3rdparty/WaifUPnP" target="clean"/>
</target>
<target name="resolve" depends="init-ivy">
<ivy:retrieve/>
</target>
<target name="init-ivy" depends="download-ivy">
<path id="ivy.lib.path">
<fileset dir="${ivy.jar.dir}" includes="*.jar"/>
</path>
<taskdef resource="org/apache/ivy/ant/antlib.xml" uri="antlib:org.apache.ivy.ant" classpathref="ivy.lib.path"/>
</target>
<target name="download-ivy" unless="offline">
<mkdir dir="${ivy.jar.dir}"/>
<get src="https://repo1.maven.org/maven2/org/apache/ivy/ivy/${ivy.install.version}/ivy-${ivy.install.version}.jar" dest="${ivy.jar.file}" usetimestamp="true"/>
</target>
<target name="jar" depends="compile">
<mkdir dir="${build}/${lib}"/>
<copy todir="${build}/${lib}">
<fileset dir="${lib}/">
<exclude name="junit-4.5.jar"/>
</fileset>
</copy>
<mkdir dir="${build}/${clib}"/>
<copy todir="${build}/${clib}">
<fileset dir="${clib}/">
</fileset>
</copy>
<jar destfile="${build}/Lanemu.jar">
<fileset dir="${build.classes}">
<exclude name="test/**"/>
</fileset>
<fileset file=".gitrevision"/>
<fileset file="default.dat"/>
<zipfileset dir="${resources}" prefix="resources"/>
<manifest>
<attribute name="Main-Class" value="org.p2pvpn.Main"/>
<attribute name="Class-Path" value="${lib}/commons-jxpath-1.1.jar ${lib}/commons-logging-1.2.jar ${lib}/bcprov-jdk15on-1.70.jar ${lib}/commons-codec-1.3.jar ${lib}/swing-layout-1.0.3.jar ${lib}/WaifUPnP.jar ${lib}/flatlaf-3.1.1.jar ${lib}/LGoodDatePicker-11.2.1.jar"/>
</manifest>
</jar>
</target>
<target name="test" depends="compile">
<junit fork="yes" haltonfailure="yes">
<classpath>
<pathelement path="${classpath}"/>
<pathelement location="${build.classes}"/>
</classpath>
<batchtest fork="yes">
<fileset dir="${src}">
<include name="test/**"/>
</fileset>
</batchtest>
<formatter type="plain" usefile="false" />
</junit>
</target>
<target name="run" depends="jar">
<java fork="true" jar="${build}/Lanemu.jar"/>
</target>
</project>