opsu-dance/build.xml

148 lines
4.5 KiB
XML
Raw Normal View History

2018-10-02 20:39:21 +02:00
<project name="opsu!dance" default="hi">
2017-04-30 01:53:32 +02:00
<property name="dir.src" value="${basedir}/src" />
<property name="dir.lib" value="${basedir}/lib" />
<property name="dir.mvnlibs" value="${basedir}/mvnlibs" />
<property name="dir.res" value="${basedir}/res" />
<property name="dir.out" value="${basedir}/bin" />
2017-12-16 13:43:43 +01:00
<property name="lang.src" value="1.8" />
<property name="lang.target" value="1.8" />
2017-04-30 01:53:32 +02:00
<property name="version" value="0.5.0-SNAPSHOT" />
<property name="main" value="yugecin.opsudance.core.Entrypoint" />
<tstamp>
<format property="timestamp" pattern="yyyy-MM-dd HH:mm" />
</tstamp>
<target name="hi">
<echo>
ant clean --> clean the ant working dir
ant cleanlib --> clean the lib folder
ant mvnresolve --> resolve dependencies using mvn
ant compile --> compile the code
ant run --> prepare to run and run
ant jar --> package a jar
2018-10-02 20:39:21 +02:00
resolve dependencies first (mvnresolve)
2017-04-30 01:53:32 +02:00
then run (code is compiled automatically when you run)
</echo>
</target>
<target name="clean" description="--> clean the ant working dir">
<delete dir="${dir.out}" />
</target>
<target name="cleanlib" description="--> clean the lib folder">
<delete dir="${dir.lib}" />
<delete dir="${dir.mvnlibs}" />
</target>
<target name="mvnresolve" depends="cleanlib" description="--> resolve dependencies using mvn">
<condition property="shellexecutable" value="cmd">
<os family="windows" />
</condition>
<condition property="shellcmdarg" value="/c">
<os family="windows" />
</condition>
<!-- properties are immutable, the following 2 lines won't do anything if os is windows -->
<property name="shellexecutable" value="sh" />
<property name="shellcmdarg" value="-c" />
<exec executable="${shellexecutable}">
<arg value="${shellcmdarg}" />
2017-05-26 11:10:52 +02:00
<arg value="mvn initialize" />
2017-04-30 01:53:32 +02:00
</exec>
<move file="${dir.mvnlibs}" tofile="${dir.lib}" />
</target>
<target name="compile" description="--> compile sources">
<mkdir dir="${dir.out}/classes" />
<javac
srcdir="${dir.src}"
destdir="${dir.out}/classes"
includes="**/*.java"
source="${lang.src}"
target="${lang.target}"
includeantruntime="false"
classpathref="classpath.base" />
<copy todir="${dir.out}/classes">
<fileset dir="${dir.res}" excludes="version,*.pdn" />
</copy>
<copy todir="${dir.out}/classes">
<filterchain>
<expandproperties />
</filterchain>
<fileset dir="${dir.res}" includes="version" />
</copy>
</target>
<target name="run" depends="compile" description="--> run opsu!dance">
<mkdir dir="${dir.out}/Natives" />
<unzip dest="${dir.out}/Natives">
<fileset dir="${dir.lib}" includes="**/lwjgl-*-natives-*.jar" />
</unzip>
<java
fork="true"
dir="${dir.out}"
failonerror="false"
classpathref="classpath.run"
classname="${main}" />
</target>
<target name="jar" depends="compile" description="--> package a jar">
<property name="jarfile" value="${dir.out}/opsu-dance-${version}.jar" />
<delete file="${jarfile}" />
<jar jarfile="${dir.out}/lib.jar" roundup="false">
<zipgroupfileset dir="${dir.lib}" />
</jar>
<jar destfile="${jarfile}" duplicate="fail">
<manifest>
<attribute name="Manifest-Version" value="1.0" />
<attribute name="Built-By" value="${user.name}" />
<attribute name="Main-Class" value="${main}" />
</manifest>
<fileset dir="${dir.out}/classes" />
<zipfileset src="${dir.out}/lib.jar">
<exclude name="META-INF/**" />
<exclude name="org/newdawn/slick/GameContainer.*" />
<exclude name="org/newdawn/slick/Image.*" />
<exclude name="org/newdawn/slick/Music.*" />
<exclude name="org/newdawn/slick/Input.*" />
<exclude name="org/newdawn/slick/Input$NullOutputStream.*" />
2017-05-27 00:37:02 +02:00
<exclude name="org/newdawn/slick/MouseListener.*" />
<exclude name="org/newdawn/slick/KeyListener.*" />
<exclude name="org/newdawn/slick/InputListener.*" />
2017-04-30 01:53:32 +02:00
<exclude name="org/newdawn/slick/gui/TextField.*" />
<exclude name="org/newdawn/slick/openal/AudioInputStream*" />
<exclude name="org/newdawn/slick/openal/OpenALStreamPlayer*" />
<exclude name="org/newdawn/slick/openal/SoundStore*" />
<!-- sqlite contains sources for some reason -->
<exclude name="**/*.java" />
<exclude name="**/*.c" />
2017-04-30 01:53:32 +02:00
</zipfileset>
</jar>
<delete file="${dir.out}/lib.jar" />
</target>
<path id="classpath.base">
<fileset dir="${dir.lib}" includes="**/*.jar" />
</path>
<path id="classpath.run">
<pathelement path="${dir.out}/classes" />
<fileset dir="${dir.lib}" includes="**/*.jar" />
</path>
2017-05-26 11:10:52 +02:00
</project>