163 lines
7.4 KiB
XML
163 lines
7.4 KiB
XML
<?xml version="1.0"?>
|
|
<project name="The Game" default="build">
|
|
<property file="build.properties" />
|
|
|
|
<target name="build" depends="unpack-natives, jar">
|
|
<mkdir dir="${target.dir}/lib/native"/>
|
|
|
|
<copy todir="${target.dir}/lib">
|
|
<fileset dir="${lib.dir}">
|
|
<include name="jinput.jar"/>
|
|
<include name="lwjgl.jar"/>
|
|
<include name="lwjgl_util.jar"/>
|
|
</fileset>
|
|
</copy>
|
|
|
|
<copy todir="${target.dir}/lib/native">
|
|
<fileset dir="${lib.dir}/native"/>
|
|
</copy>
|
|
</target>
|
|
|
|
<target name="clear">
|
|
<delete dir="${target.dir}"/>
|
|
</target>
|
|
|
|
<target name="init" description="Инициализация сборки">
|
|
<mkdir dir="${lib.dir}/native"/>
|
|
<mkdir dir="${classes.dir}"/>
|
|
<mkdir dir="${target.dir}/exe"/>
|
|
|
|
<condition property="check-libs">
|
|
<and>
|
|
<available file="${lib.dir}/lwjgl.jar" type="file"/>
|
|
<available file="${lib.dir}/lwjgl_util.jar" type="file"/>
|
|
<available file="${lib.dir}/lwjgl-platform.jar" type="file"/>
|
|
|
|
<available file="${lib.dir}/jinput.jar" type="file"/>
|
|
<available file="${lib.dir}/jinput-platform.jar" type="file"/>
|
|
</and>
|
|
</condition>
|
|
|
|
<fileset dir="${lib.dir}/native" id="native.fileset"/>
|
|
<property name="native.files" refid="native.fileset"/>
|
|
<condition property="check-native">
|
|
<length string="${native.files}" length="0"/>
|
|
</condition>
|
|
|
|
<condition property="exe-check-lib">
|
|
<available file="${lib.dir}/launch4j.zip" type="file"/>
|
|
</condition>
|
|
|
|
<condition property="exe-check-tool">
|
|
<and>
|
|
<available file="${target.dir}/exe/launch4j/bin" type="dir"/>
|
|
<available file="${target.dir}/exe/launch4j/head" type="dir"/>
|
|
<available file="${target.dir}/exe/launch4j/lib" type="dir"/>
|
|
<available file="${target.dir}/exe/launch4j/manifest" type="dir"/>
|
|
<available file="${target.dir}/exe/launch4j/sign4j" type="dir"/>
|
|
<available file="${target.dir}/exe/launch4j/w32api" type="dir"/>
|
|
<available file="${target.dir}/exe/launch4j/launch4j.jar" type="file"/>
|
|
<available file="${target.dir}/exe/launch4j/launch4j.jfpr" type="file"/>
|
|
</and>
|
|
</condition>
|
|
</target>
|
|
|
|
<target name="download-libs" unless="check-libs" depends="init" description="Загрузка необходимых библиотек">
|
|
<get dest="${lib.dir}/lwjgl.jar" src="http://search.maven.org/remotecontent?filepath=org/lwjgl/lwjgl/lwjgl/${lwjgl.version}/lwjgl-${lwjgl.version}.jar" usetimestamp="true" />
|
|
<get dest="${lib.dir}/lwjgl_util.jar" src="http://search.maven.org/remotecontent?filepath=org/lwjgl/lwjgl/lwjgl_util/${lwjgl.version}/lwjgl_util-${lwjgl.version}.jar" usetimestamp="true" />
|
|
<get dest="${lib.dir}/lwjgl-platform.jar" src="http://search.maven.org/remotecontent?filepath=org/lwjgl/lwjgl/lwjgl-platform/${lwjgl.version}/lwjgl-platform-${lwjgl.version}-natives-windows.jar" usetimestamp="true" />
|
|
|
|
<get dest="${lib.dir}/jinput.jar" src="http://search.maven.org/remotecontent?filepath=net/java/jinput/jinput/${jinput.version}/jinput-${jinput.version}.jar" usetimestamp="true" />
|
|
<get dest="${lib.dir}/jinput-platform.jar" src="http://search.maven.org/remotecontent?filepath=net/java/jinput/jinput-platform/${jinput.version}/jinput-platform-${jinput.version}-natives-windows.jar" usetimestamp="true" />
|
|
</target>
|
|
|
|
<target name="unpack-natives" if="check-native" depends="download-libs" description="Распаковка библиотек операционной системы">
|
|
<unzip src="${lib.dir}/lwjgl-platform.jar" dest="${lib.dir}/native">
|
|
<patternset>
|
|
<exclude name="META-INF/"/>
|
|
</patternset>
|
|
</unzip>
|
|
|
|
<unzip src="${lib.dir}/jinput-platform.jar" dest="${lib.dir}/native">
|
|
<patternset>
|
|
<exclude name="META-INF/"/>
|
|
</patternset>
|
|
</unzip>
|
|
</target>
|
|
|
|
<target name="compile" depends="init" description="Компиляция">
|
|
<path id="classpath">
|
|
<fileset dir="${lib.dir}">
|
|
<include name="*.jar"/>
|
|
</fileset>
|
|
</path>
|
|
|
|
<javac
|
|
classpathref="classpath"
|
|
srcdir="${source.dir}"
|
|
destdir="${classes.dir}"
|
|
compiler="javac1.7"
|
|
source="1.7"
|
|
target="1.7"
|
|
debug="true"
|
|
debuglevel="lines,vars,source"
|
|
encoding="UTF-8"
|
|
optimize="true"
|
|
includeantruntime="false"/>
|
|
</target>
|
|
|
|
<target name="jar" depends="compile" description="Сборка в единый java архив">
|
|
<tstamp>
|
|
<format property="BUILD_TIME" pattern="yyyy-MM-dd HH:mm:ss" />
|
|
</tstamp>
|
|
|
|
<jar destfile="${target.dir}/${ant.project.name}.jar">
|
|
<fileset dir="${classes.dir}"/>
|
|
<fileset dir="${resource.dir}/java"/>
|
|
|
|
<manifest>
|
|
<attribute name="Main-Class" value="ru.dmitriymx.game.Main"/>
|
|
<attribute name="Class-Path" value="./lib/lwjgl.jar ./lib/lwjgl_util.jar ./lib/jinput.jar"/>
|
|
<attribute name="Build-By" value="DmitriyMX"/>
|
|
<attribute name="Build-Date" value="${BUILD_TIME}"/>
|
|
</manifest>
|
|
</jar>
|
|
</target>
|
|
|
|
<target name="exe-download-lib" unless="exe-check-lib" depends="init">
|
|
<get dest="${lib.dir}/launch4j.zip" src="http://sourceforge.net/projects/launch4j/files/launch4j-3/${launch4j.version}/launch4j-${launch4j.version}-win32.zip/download" usetimestamp="true"/>
|
|
</target>
|
|
|
|
<target name="exe-unpack-tool" unless="exe-check-tool" depends="exe-download-lib">
|
|
<unzip src="${lib.dir}/launch4j.zip" dest="${target.dir}/exe">
|
|
<patternset>
|
|
<include name="launch4j/bin/"/>
|
|
<include name="launch4j/head/"/>
|
|
<include name="launch4j/lib/"/>
|
|
<include name="launch4j/manifest/"/>
|
|
<include name="launch4j/sign4j/"/>
|
|
<include name="launch4j/w32api/"/>
|
|
<include name="launch4j/launch4j.jar"/>
|
|
<include name="launch4j/launch4j.jfpr"/>
|
|
</patternset>
|
|
</unzip>
|
|
</target>
|
|
|
|
<target name="exe-build" depends="exe-unpack-tool">
|
|
<taskdef name="launch4j" classname="net.sf.launch4j.ant.Launch4jTask"
|
|
classpath="${target.dir}/exe/launch4j/launch4j.jar:${target.dir}/exe/launch4j/lib/xstream.jar"/>
|
|
|
|
<launch4j>
|
|
<config headerType="gui"
|
|
outfile="${target.dir}/${ant.project.name}.exe"
|
|
dontWrapJar="false"
|
|
jarPath="${target.dir}/${ant.project.name}.jar"
|
|
downloadUrl="http://www.oracle.com/technetwork/java/javase/downloads/index.html"
|
|
icon="${resource.dir}/exe/icon.ico">
|
|
<jre minVersion="1.7.0">
|
|
<opt>-Djava.library.path=lib/native</opt>
|
|
</jre>
|
|
</config>
|
|
</launch4j>
|
|
</target>
|
|
</project> |