| <!-- vim: set noexpandtab tabstop=4 shiftwidth=4: --> |
| <project name="XRay" default="dist" basedir="."> |
| <description> |
| Minecraft X-Ray |
| </description> |
| |
| <!-- Project attributes --> |
| <property name="version" value="3.0.0"/> |
| <property name="export_base" value="minecraft_xray_${version}"/> |
| |
| <!-- set global properties for this build --> |
| <property name="src" location="src"/> |
| <property name="build" location="build"/> |
| <property name="dist_base" location="dist"/> |
| <property name="dist" location="${dist_base}/${export_base}"/> |
| |
| <!-- Would be nice if ant's "tar" task understood executable bits --> |
| <patternset id="all.files"> |
| <include name="${export_base}/**"/> |
| </patternset> |
| <selector id="executable.files"> |
| <or> |
| <filename name="${export_base}/minecraft_xray_osx.command" /> |
| <filename name="${export_base}/minecraft_xray.sh" /> |
| </or> |
| </selector> |
| |
| <!-- launch4j, for building the Windows EXE --> |
| <property name="launch4j.dir" location="support/launch4j-dist" /> |
| <taskdef name="launch4j" |
| classname="net.sf.launch4j.ant.Launch4jTask" |
| classpath="${launch4j.dir}/launch4j.jar:${launch4j.dir}/xstream.jar" /> |
| |
| <target name="init"> |
| <!-- Create the time stamp --> |
| <tstamp/> |
| <!-- Create the build directory structure used by compile --> |
| <mkdir dir="${build}"/> |
| </target> |
| |
| <target name="compile" depends="init" |
| description="compile the source " > |
| <!-- Compile the java code from ${src} into ${build} --> |
| |
| <javac srcdir="${src}" destdir="${build}" debug="true" includeantruntime="false"> |
| <compilerarg value="-Xlint:unchecked"/> |
| <classpath> |
| <fileset dir="lib"> |
| <include name="*.jar" /> |
| </fileset> |
| </classpath> |
| </javac> |
| </target> |
| |
| <target name="run" depends="compile" |
| description="run the application" > |
| <!-- Run our compiled sourcecode --> |
| <java fork="true" classname="com.apocalyptech.minecraft.xray.XRay"> |
| <classpath> |
| <pathelement path="${build}" /> |
| <pathelement location="lib/AppleJavaExtensions.jar" /> |
| <pathelement location="lib/jinput.jar" /> |
| <pathelement location="lib/lwjgl.jar" /> |
| <pathelement location="lib/lwjgl_test.jar" /> |
| <pathelement location="lib/lwjgl_util.jar" /> |
| <pathelement location="lib/lwjgl_util_applet.jar" /> |
| <pathelement location="lib/lzma.jar" /> |
| </classpath> |
| <jvmarg value="-Xms256m" /> |
| <jvmarg value="-Xmx1024m" /> |
| <jvmarg value="-Djava.library.path=lib/native" /> |
| </java> |
| </target> |
| |
| <target name="prepare_distdir" depends="compile" |
| description="prepares the distribution directories for release" > |
| <!-- Create the distribution directories --> |
| <mkdir dir="${dist}"/> |
| |
| <!-- Put everything in ${build} into xray.jar file --> |
| <jar jarfile="${dist}/xray.jar" basedir="${build}"/> |
| |
| <!-- Dump all our support libraries, launchers, etc in the distdir --> |
| <copy todir="${dist}"> |
| <fileset dir="lib"> |
| <include name="*.jar" /> |
| </fileset> |
| <fileset dir="lib/native"> |
| <include name="*.*" /> |
| </fileset> |
| <fileset dir="support"> |
| <include name="*.*" /> |
| </fileset> |
| <fileset dir="."> |
| <include name="Changelog.txt" /> |
| <include name="BUILDING.txt" /> |
| <include name="TODO.txt" /> |
| <include name="README.txt" /> |
| <include name="COPYING.txt" /> |
| <include name="COPYING-lwjgl.txt" /> |
| <include name="COPYING-jsmooth.txt" /> |
| </fileset> |
| </copy> |
| |
| <!-- Mark the UNIXy ones as executable --> |
| <chmod perm="a+x"> |
| <fileset dir="${dist}"> |
| <include name="minecraft_xray_osx.command" /> |
| <include name="minecraft_xray.sh" /> |
| </fileset> |
| </chmod> |
| |
| <!-- While we're at it, archive the source dir in there too. --> |
| <mkdir dir="${dist}/src"/> |
| <copy todir="${dist}/src"> |
| <fileset dir="."> |
| <include name="**/*" /> |
| <exclude name="bin/" /> |
| <exclude name="build/" /> |
| <exclude name="dist/" /> |
| <exclude name=".git/" /> |
| <exclude name=".gitignore" /> |
| </fileset> |
| </copy> |
| |
| </target> |
| |
| <target name="launch4j" depends="prepare_distdir"> |
| <launch4j configFile="support/launch4j.xml" /> |
| <move todir="${dist}"> |
| <fileset dir="support"> |
| <include name="minecraft_xray.exe" /> |
| </fileset> |
| </move> |
| </target> |
| |
| <target name="dist" depends="launch4j" |
| description="generate the distribution" > |
| |
| <!-- Create our zipfiles, both "binary" and source. --> |
| <zip destfile="${dist_base}/${export_base}.zip" basedir="${dist_base}" includes="${export_base}/"/> |
| <tar destfile="${dist_base}/${export_base}.tbz2" compression="bzip2"> |
| <tarfileset dir="${dist_base}" filemode="755"> |
| <patternset refid="all.files" /> |
| <selector refid="executable.files" /> |
| </tarfileset> |
| <tarfileset dir="${dist_base}"> |
| <patternset refid="all.files" /> |
| <not> |
| <selector refid="executable.files" /> |
| </not> |
| </tarfileset> |
| </tar> |
| |
| </target> |
| |
| <target name="clean" |
| description="clean up" > |
| <!-- Delete the ${build} and ${dist} directory trees --> |
| <delete file="${dist_base}/${export_base}.zip"/> |
| <delete file="${dist_base}/${export_base}.tbz2"/> |
| <delete dir="${build}"/> |
| <delete dir="${dist}"/> |
| </target> |
| </project> |