<!--
Copyright LWJGL. All rights reserved.
License terms: http://lwjgl.org/license.php
-->
<project name="LWJGL" basedir="." default="all" xmlns:if="ant:if" xmlns:unless="ant:unless">

	<property name="build.sysclasspath" value="ignore"/>

	<property name="config" location="config" relative="true"/>

	<import file="${config}/build-definitions.xml"/>
	<import file="${config}/build-assets.xml"/>
	<import file="${config}/${platform}/build.xml"/>

	<!-- Initialize build -->
	<target name="init" description="Initializes the directories required by the build process">
		<fail message="LWJGL requires Ant version 1.9.3 or higher.">
			<condition>
				<not>
					<antversion atleast="1.9.3"/>
				</not>
			</condition>
		</fail>

		<echo taskname="override" message="Build type: ${build.type}" if:set="env.LWJGL_BUILD_TYPE"/>
		<echo taskname="override" message="Build output: ${build.output}" if:set="env.LWJGL_BUILD_OUTPUT"/>
		<echo taskname="override" message="Build architecture: ${build.arch}" if:set="env.LWJGL_BUILD_ARCH"/>
		<echo taskname="override" message="Build offline: ${build.offline}" if:set="env.LWJGL_BUILD_OFFLINE"/>

		<!-- These depend on LWJGL_BUILD_OUTPUT and may be symlinks -->
		<mkdir-symlink dir="bin"/>
		<mkdir-symlink dir="${src.generated}"/>

		<mkdir dir="${bin.core}"/>
		<mkdir dir="${bin.templates}"/>
		<mkdir dir="${bin.tests}"/>
		<mkdir dir="${bin.native}"/>

		<ant antfile="update-dependencies.xml" target="check-dependencies" inheritAll="false"/>

		<!--<taskdef resource="org/jetbrains/kotlin/buildtools/ant/antlib.xml" classpath="${kotlinc}/lib/kotlin-ant.jar"/>-->
		<taskdef resource="testngtasks" classpath="libs/testng.jar"/>
	</target>

	<target name="init-generated" description="Initializes the lwjgl3-generated git repository in /generated. [Optional]">
		<confirm-replace dir="${src.generated}" msg="The ${src.generated} directory contents will be replaced with a fresh clone of the lwjgl3-generated repository. Continue?"/>

		<!-- Purge /generated contents -->
		<delete-symlink dir="${src.generated}"/>
		<mkdir-symlink dir="${src.generated}"/>

		<!-- Clone repo -->
		<exec executable="git" failonerror="true">
			<arg value="clone"/>
			<arg value="https://github.com/LWJGL/lwjgl3-generated.git"/>
			<arg value="${src.generated}"/>
		</exec>
	</target>

	<target name="init-wiki" description="Initializes the lwjgl3-wiki git repository in /wiki. [Optional]">
		<confirm-replace dir="${wiki}" msg="The ${wiki} directory contents will be replaced with a fresh clone of the lwjgl3-wiki repository. Continue?"/>

		<delete dir="${wiki}"/>
		<exec executable="git" failonerror="true">
			<arg value="clone"/>
			<arg value="https://github.com/LWJGL/lwjgl3-wiki.wiki.git"/>
			<arg value="${wiki}"/>
		</exec>
	</target>

	<target name="reset" description="Resets the repository to its initial state.">
		<local name="reset.input"/>
		<input
			message="This action will clean everything and also remove libraries and sub-repositories. Continue?"
			validargs="y,n"
			defaultvalue="n"
			addproperty="reset.input"
		/>
		<condition property="do.reset">
			<equals arg1="y" arg2="${reset.input}"/>
		</condition>
		<fail unless="do.reset">Cancelled</fail>

		<antcall target="clean"/>

		<delete-symlink dir="${src.generated}"/>
		<delete dir="${wiki}"/>
		<delete dir="${lib}"/>

		<echo message="Reset successful."/>
	</target>

	<target name="clean" description="Cleans all directories controlled by this script" depends="clean-java, clean-native, clean-templates, clean-generated">
		<delete-symlink dir="bin"/>
		<!-- Do not delete /generated, it may contain the lwjgl3-generated git repo -->
		<!-- Do not delete /wiki, it may contain the lwjgl3-wiki git repo -->

		<echo message="Cleanup successful."/>
	</target>

	<target name="clean-java" description="Deletes Java binary files produced by this script">
		<delete dir="${bin.core}"/>
		<delete dir="${bin.tests}"/>
	</target>

	<target name="clean-native" description="Deletes native binary files produced by this script">
		<delete dir="${bin.native}"/>
	</target>

	<target name="clean-templates" description="Deletes template binary files produced by this script">
		<delete dir="${bin.templates}"/>
	</target>

	<target name="clean-generated" description="Deletes sources, test results and documentation generated by this script" depends="clean-generated-java,clean-generated-native">
		<delete dir="${bin.html.tests}"/>
		<delete dir="${bin.html.javadoc}"/>
	</target>

	<target name="clean-generated-java" description="Deletes Java sources generated by this script">
		<delete file="${src.generated}/touch.txt" quiet="true"/>
		<delete dir="${src.generated.java}"/>
	</target>

	<target name="clean-generated-native" description="Deletes native sources generated by this script">
		<delete file="${src.generated}/touch.txt" quiet="true"/>
		<delete dir="${src.generated.native}"/>
	</target>

	<target name="all" description="Build LWJGL and runs the tests" depends="compile-templates,tests"/>

	<target name="compile-templates" description="Compiles the Templates module" depends="init">
		<uptodate targetfile="${bin.templates}/org/lwjgl/generator/Generator.class" property="templates-uptodate">
			<srcfiles dir="${config}" includes="build-bindings.xml"/>
			<srcfiles dir="${src.templates}" includes="**"/>
		</uptodate>
		<antcall target="-compile-templates"/>
	</target>

	<target name="-compile-templates" description="Compiles the Templates module" depends="bindings" unless="templates-uptodate">
		<!-- Compile Java dependencies -->
		<lwjgl.javac destdir="${bin}/Templates" taskname="Java dependencies">
			<src path="${src.templates}/java"/>
			<include name="org/lwjgl/*.java"/>
		</lwjgl.javac>

		<!-- Compile Kotlin code -->
		<echo message="Compiling Kotlin templates. This will take 1-2 minutes..." level="info" taskname="Templates"/>
		<java
			classpath="${kotlinc}/lib/kotlin-preloader.jar"
			classname="org.jetbrains.kotlin.preloading.Preloader"
			fork="true" failonerror="true" taskname="Templates"
		>
			<jvmarg value="-server"/>
			<jvmarg value="-Xms1024m"/>
			<jvmarg value="-Xverify:none"/>

			<arg value="-measure"/>
			<arg value="-classpath"/>
			<arg path="${kotlinc}/lib/kotlin-compiler.jar:${kotlinc}/lib/kotlin-runtime.jar:${kotlinc}/lib/kotlin-reflect.jar"/>
			<arg line="org.jetbrains.kotlin.cli.jvm.K2JVMCompiler"/>

			<arg line="-kotlin-home ${kotlinc}"/>
			<arg line="-d ${bin.templates}"/>

			<arg value="${src.templates.kotlin}/org/lwjgl/generator"/>
			<arg value="${src.templates.kotlin}/org/lwjgl/system"/>

			<arg value="${src.templates.kotlin}/org/lwjgl/egl" if:true="${binding.egl}"/>
			<arg value="${src.templates.kotlin}/org/lwjgl/egl/EGLTypes.kt" unless:true="${binding.egl}"/>
			<arg value="${src.templates.kotlin}/org/lwjgl/glfw" if:true="${binding.glfw}"/>
			<arg value="${src.templates.kotlin}/org/lwjgl/nanovg" if:true="${binding.nanovg}"/>
			<arg value="${src.templates.kotlin}/org/lwjgl/openal" if:true="${binding.openal}"/>
			<arg value="${src.templates.kotlin}/org/lwjgl/opencl" if:true="${binding.opencl}"/>
			<arg value="${src.templates.kotlin}/org/lwjgl/opencl/CLTypes.kt" unless:true="${binding.opencl}"/>
			<arg value="${src.templates.kotlin}/org/lwjgl/opengl" if:true="${binding.opengl}"/>
			<arg value="${src.templates.kotlin}/org/lwjgl/opengl/GLTypes.kt" unless:true="${binding.opengl}"/>
			<arg value="${src.templates.kotlin}/org/lwjgl/opengles" if:true="${binding.opengles}"/>
			<arg value="${src.templates.kotlin}/org/lwjgl/ovr" if:true="${binding.ovr}"/>
			<arg value="${src.templates.kotlin}/org/lwjgl/stb" if:true="${binding.stb}"/>
			<arg value="${src.templates.kotlin}/org/lwjgl/system/jawt" if:true="${binding.jawt}"/>
			<arg value="${src.templates.kotlin}/org/lwjgl/util/nfd" if:true="${binding.nfd}"/>
			<arg value="${src.templates.kotlin}/org/lwjgl/util/par" if:true="${binding.par}"/>
			<arg value="${src.templates.kotlin}/org/lwjgl/vulkan" if:true="${binding.vulkan}"/>
			<arg value="${src.templates.kotlin}/org/lwjgl/vulkan/VKypes.kt" unless:true="${binding.vulkan}"/>
			<arg value="${src.templates.kotlin}/org/lwjgl/vulkan/ExtensionTypes.kt" unless:true="${binding.vulkan}"/>
			<!--
			<arg value="-Xno-call-assertions"/>
			<arg value="-Xno-param-assertions"/>
			-->
		</java>
	</target>

	<target name="formatter" description="Runs the template formatter tool" depends="init"> <!-- Removed "compile-templates" until Kotlin adds support for incremental compilation -->
		<lwjgl.javac destdir="${bin.templates}" taskname="Compile formatter">
			<src path="${src.templates}/java"/>
			<include name="org/lwjgl/generator/util/**"/>
		</lwjgl.javac>

		<java
			classname="org.lwjgl.generator.util.TemplateFormatter"
			fork="true"
			spawn="true"
		>
			<classpath>
				<pathelement path="${bin.templates}"/>
				<pathelement path="${test.resources}"/>
			</classpath>
		</java>
	</target>

	<target name="generate" description="Runs the bindings Generator" depends="init">
		<available file="${bin.templates}/org/lwjgl/generator/Generator.class" property="has-compiled-templates"/>
		<fail unless="has-compiled-templates" message="Please invoke the compile-templates target first."/>

		<uptodate property="generated-uptodate" targetfile="${src.generated}/touch.txt">
			<srcfiles dir="${config}" includes="build-bindings.xml"/>
			<srcfiles dir="${bin.templates}" includes="**/*.class"/>
		</uptodate>
		<antcall target="-generate"/>
	</target>

	<target name="-generate" description="Runs the code Generator" depends="bindings" unless="generated-uptodate">
		<java
			classname="org.lwjgl.generator.GeneratorKt"
			fork="true"
			failonerror="true"
			taskname="Generator"
		>
			<classpath>
				<pathelement path="${bin.templates}"/>
				<pathelement path="${kotlinc}/lib/kotlin-runtime.jar"/>
			</classpath>

			<jvmarg value="-server"/>
			<jvmarg line="${bindings}"/>

			<arg value="${src.templates}/kotlin"/>
			<arg value="${src.generated}"/>
		</java>

		<touch file="${src.generated}/touch.txt" verbose="false"/>
	</target>

	<target name="-init-compile" description="Initializes properties required for compilation" depends="bindings">
		<patternset id="core.main.files">
			<include name="org/lwjgl/*.java"/>
			<include name="org/lwjgl/system/**"/>

			<include name="org/lwjgl/egl/**" if:true="${binding.egl}"/>
			<include name="org/lwjgl/glfw/**" if:true="${binding.glfw}"/>
			<include name="org/lwjgl/nanovg/**" if:true="${binding.nanovg}"/>
			<include name="org/lwjgl/openal/**" if:true="${binding.openal}"/>
			<include name="org/lwjgl/opencl/**" if:true="${binding.opencl}"/>
			<include name="org/lwjgl/opengl/**" if:true="${binding.opengl}"/>
			<include name="org/lwjgl/opengles/**" if:true="${binding.opengles}"/>
			<include name="org/lwjgl/vulkan/**" if:true="${binding.vulkan}"/>
		</patternset>

		<patternset id="core.generated.files">
			<include name="org/lwjgl/system/**"/>

			<include name="org/lwjgl/egl/**" if:true="${binding.egl}"/>
			<include name="org/lwjgl/glfw/**" if:true="${binding.glfw}"/>
			<include name="org/lwjgl/nanovg/**" if:true="${binding.nanovg}"/>
			<include name="org/lwjgl/openal/**" if:true="${binding.openal}"/>
			<include name="org/lwjgl/opencl/**" if:true="${binding.opencl}"/>
			<include name="org/lwjgl/opengl/**" if:true="${binding.opengl}"/>
			<include name="org/lwjgl/opengles/**" if:true="${binding.opengles}"/>
			<include name="org/lwjgl/ovr/**" if:true="${binding.ovr}"/>
			<include name="org/lwjgl/stb/**" if:true="${binding.stb}"/>
			<include name="org/lwjgl/system/jawt/**" if:true="${binding.jawt}"/>
			<include name="org/lwjgl/util/nfd/**" if:true="${binding.nfd}"/>
			<include name="org/lwjgl/util/par/**" if:true="${binding.par}"/>
			<include name="org/lwjgl/vulkan/**" if:true="${binding.vulkan}"/>
		</patternset>
	</target>

	<target name="compile" description="Compiles the Java source code" depends="generate, -init-compile">
		<lwjgl.javac destdir="${bin.core}" taskname="Core">
			<src>
				<pathelement path="${src.core}"/>
				<pathelement path="${src.generated.java}"/>
			</src>

			<patternset refid="core.main.files"/>
			<patternset refid="core.generated.files"/>

			<patternset excludes="**/package-info.java"/>

			<!-- Supresses internal API (e.g. Unsafe) usage warnings -->
			<compilerarg value="-XDignore.symbol.file=true"/>
		</lwjgl.javac>
	</target>

	<target name="compile-native" description="Compiles the native source code" depends="init, compile">
		<antcall target="compile-native-platform"/>
	</target>

	<target name="compile-tests" description="Compiles the LWJGL test suite" depends="compile">
		<local name="openal_stb"/>
		<condition property="openal_stb" value="true" else="false">
			<and>
				<istrue value="${binding.openal}"/>
				<istrue value="${binding.stb}"/>
			</and>
		</condition>

		<local name="opencl_glfw"/>
		<condition property="opencl_glfw" value="true" else="false">
			<and>
				<istrue value="${binding.opencl}"/>
				<istrue value="${binding.glfw}"/>
			</and>
		</condition>

		<local name="stb_glfw"/>
		<condition property="stb_glfw" value="true" else="false">
			<and>
				<istrue value="${binding.stb}"/>
				<istrue value="${binding.glfw}"/>
			</and>
		</condition>

		<local name="nanovg"/>
		<condition property="nanovg" value="true" else="false">
			<and>
				<istrue value="${binding.nanovg}"/>
				<istrue value="${binding.glfw}"/>
				<istrue value="${binding.opengl}"/>
			</and>
		</condition>

		<local name="nfd"/>
		<condition property="nfd" value="true" else="false">
			<and>
				<istrue value="${binding.nfd}"/>
				<istrue value="${binding.glfw}"/>
				<istrue value="${binding.opengl}"/>
			</and>
		</condition>

		<lwjgl.javac destdir="${bin.tests}" taskname="Tests">
			<classpath>
				<pathelement path="${bin.core}"/>
				<pathelement path="${lib}/testng.jar"/>
			</classpath>

			<src path="${src.tests}/"/>

			<!-- Demos -->
			<include name="org/lwjgl/demo/egl/**" if:true="${binding.egl}"/>
			<include name="org/lwjgl/demo/glfw/**" if:true="${binding.glfw}"/>
			<include name="org/lwjgl/demo/nanovg/**" if:true="${nanovg}"/>

			<include name="org/lwjgl/demo/openal/**" if:true="${binding.openal}"/>
			<exclude name="org/lwjgl/demo/openal/ALCDemo.java" unless:true="${openal_stb}"/>
			<exclude name="org/lwjgl/demo/openal/EFXTest.java" unless:true="${openal_stb}"/>

			<include name="org/lwjgl/demo/opencl/**" if:true="${opencl_glfw}"/>
			<include name="org/lwjgl/demo/opencl/CLDemo.java" if:true="${binding.opencl}"/>

			<include name="org/lwjgl/demo/opengl/**" if:true="${binding.glfw}"/>

			<include name="org/lwjgl/demo/ovr/**" if:true="${binding.ovr}"/>
			<include name="org/lwjgl/demo/stb/**" if:true="${stb_glfw}"/>

			<include name="org/lwjgl/demo/system/jawt/**" if:true="${binding.jawt}"/>
			<include name="org/lwjgl/demo/system/xxhash/**"/>

			<include name="org/lwjgl/demo/util/*.java"/>
			<include name="org/lwjgl/demo/util/nfd/**" if:true="${nfd}"/>
			<include name="org/lwjgl/demo/util/par/**" if:true="${binding.par}"/>

			<include name="org/lwjgl/demo/vulkan/**" if:true="${binding.vulkan}"/>

			<!-- Tests -->
			<include name="org/lwjgl/opencl/**" if:true="${binding.opencl}"/>
			<include name="org/lwjgl/system/**"/>
			<include name="org/lwjgl/util/**"/>
		</lwjgl.javac>
	</target>

	<target name="-init-runtime" description="Initializes properties required for running demos and tests">
		<path id="runtime.classpath">
			<pathelement path="${bin.core}"/>
			<pathelement path="${test.resources}"/>
			<pathelement path="${bin.tests}"/>
		</path>
	</target>

	<target name="tests" description="Runs the LWJGL test suite" depends="compile-tests, compile-native, -init-runtime">
		<testng outputDir="${bin.html.tests}" classpathref="runtime.classpath" taskname="Tests">
			<classpath>
				<pathelement path="${lib}/jcommander.jar"/>
			</classpath>

			<!--<jvmarg value="-Xcheck:jni"/>--> <!-- SIMD fails with this (see -XX:+RestoreMXCSROnJNICall) -->
			<jvmarg value="-ea"/>
			<jvmarg value="-Dorg.lwjgl.util.Debug=true"/>
			<jvmarg value="-Djava.library.path=${lib}"/>
			<jvmarg value="-XstartOnFirstThread" if:set="platform.macosx"/>
			<jvmarg line="${jvmargs}" if:set="jvmargs"/>

			<xmlfileset dir="${config}" includes="tests.xml,tests_${platform}.xml"/>
		</testng>
	</target>

	<target name="demo" description="Runs an LWJGL demo" depends="compile-tests, compile-native, -init-runtime, -update-assets">
		<fail message="Please use -Dclass=&lt;class&gt; to specify the demo main class to run." unless="class"/>

		<java classname="${class}" classpathref="runtime.classpath" fork="true" failonerror="true" taskname="Demo">
			<classpath>
				<pathelement path="${lib}/testng.jar"/>
			</classpath>

			<jvmarg value="-Djava.library.path=${lib}"/>
			<jvmarg value="-XstartOnFirstThread" if:set="platform.macosx"/>
			<jvmarg line="${jvmargs}" if:set="jvmargs"/>

			<arg line="${args}" if:set="args"/>
		</java>
	</target>

	<target name="-build-version" description="Retrieves the LWJGL version from org.lwjgl.Version">
		<java classname="org.lwjgl.Version" fork="true" failonerror="true" outputproperty="build.version">
			<classpath path="${bin.core}"/>
			<jvmarg value="-Djava.library.path=${lib}"/>
		</java>
	</target>

	<target name="javadoc" description="Generates the LWJGL JavaDoc" depends="generate">
		<uptodate targetfile="${bin.html.javadoc}/index.html" property="javadoc-uptodate">
			<srcfiles dir="${src.core}" includes="**"/>
			<srcfiles dir="${src.generated.java}" includes="**"/>
		</uptodate>
		<antcall target="-javadoc"/>
	</target>

	<target name="-javadoc" description="Generates the LWJGL JavaDoc" depends="-init-compile,-build-version" unless="javadoc-uptodate">
		<lwjgl.javac destdir="${bin.templates}" taskname="Compile doclets">
			<src path="${src.templates}/java"/>
			<include name="org/lwjgl/system/**"/>
			<classpath>
				<pathelement location="${env.JAVA_HOME}/lib/tools.jar" unless:set="jdk.apple"/>
			</classpath>
		</lwjgl.javac>

		<delete dir="${bin.html.javadoc}"/>
		<javadoc
			destdir="${bin.html.javadoc}"
			source="1.6"
			windowtitle="LWJGL ${build.version}"
			encoding="UTF-8"
			docencoding="UTF-8"
			charset="UTF-8"
			useexternalfile="true"
			nohelp="true"
			notree="true"
			stylesheetfile="${config}/javadoc.css"
			doclet="org.lwjgl.system.ExcludeDoclet"
			docletpath="${bin.templates}"
		    maxmemory="1G"
		    failonerror="true"
		>
			<doctitle><![CDATA[<h1>Lightweight Java Game Library</h1>]]></doctitle>
			<bottom><![CDATA[<i>Copyright LWJGL. All Rights Reserved. <a href="http://lwjgl.org/license.php">License terms</a>.</i>]]></bottom>

			<classpath>
				<pathelement path="${src.core}"/>
				<pathelement path="${src.generated.java}"/>
			</classpath>

			<fileset dir="${src.core}">
				<patternset refid="core.main.files"/>
			</fileset>

			<fileset dir="${src.generated.java}">
				<patternset refid="core.generated.files"/>
			</fileset>

			<!-- Supresses internal API (e.g. Unsafe) usage warnings -->
			<arg value="-XDignore.symbol.file=true"/>
		</javadoc>
	</target>

	<target name="release" description="Creates the LWJGL binary redistributable" depends="compile,javadoc,-build-version">
		<!-- Bundle classes -->
		<mkdir dir="${release.jar}"/>
		<jar destfile="${release.jar}/lwjgl.jar" basedir="${bin.core}" includes="**" level="9" index="true">
			<manifest>
				<section name="org/lwjgl/">
					<attribute name="Specification-Title" value="Lightweight Java Game Library"/>
					<attribute name="Specification-Version" value="${build.version}"/>
					<attribute name="Specification-Vendor" value="lwjgl.org"/>
					<attribute name="Implementation-Title" value="lwjgl"/>
					<attribute name="Implementation-Version" value="build ${build.revision}" if:set="build.revision"/>
					<attribute name="Implementation-Version" value="SNAPSHOT" unless:set="build.revision"/>
					<attribute name="Implementation-Vendor" value="lwjgl.org"/>
				</section>
			</manifest>
		</jar>

		<!-- Download binaries from build.lwjgl.org -->
		<mkdir dir="${release.native}"/>

		<get dest="${release.native}" verbose="false" usetimestamp="true">
			<!-- Linux -->
			<url url="http://build.lwjgl.org/${build.type}/linux/x64/liblwjgl.so"/>
			<url url="http://build.lwjgl.org/${build.type}/linux/x64/libjemalloc.so"/>
			<url url="http://build.lwjgl.org/${build.type}/linux/x64/libglfw.so"/>
			<url url="http://build.lwjgl.org/${build.type}/linux/x64/libopenal.so"/>

			<!--<url url="http://build.lwjgl.org/${build.type}/linux/x86/liblwjgl.so"/>
			<url url="http://build.lwjgl.org/${build.type}/linux/x86/libjemalloc.so"/>
			<url url="http://build.lwjgl.org/${build.type}/linux/x86/libglfw.so"/>
			<url url="http://build.lwjgl.org/${build.type}/linux/x86/libopenal.so"/>-->

			<!-- Mac OS X -->
			<url url="http://build.lwjgl.org/${build.type}/macosx/x64/liblwjgl.dylib"/>
			<url url="http://build.lwjgl.org/${build.type}/macosx/x64/libjemalloc.dylib"/>
			<url url="http://build.lwjgl.org/${build.type}/macosx/x64/libglfw.dylib"/>
			<url url="http://build.lwjgl.org/${build.type}/macosx/x64/libopenal.dylib"/>

			<!-- Windows -->
			<url url="http://build.lwjgl.org/${build.type}/windows/x64/lwjgl.dll"/>
			<url url="http://build.lwjgl.org/${build.type}/windows/x64/jemalloc.dll"/>
			<url url="http://build.lwjgl.org/${build.type}/windows/x64/glfw.dll"/>

			<url url="http://build.lwjgl.org/${build.type}/windows/x86/lwjgl.dll"/>
			<url url="http://build.lwjgl.org/${build.type}/windows/x86/jemalloc.dll"/>
			<url url="http://build.lwjgl.org/${build.type}/windows/x86/glfw.dll"/>

			<firstmatchmapper>
				<regexpmapper from="x86/(\w+)[.](\w+)" to="\132.\2"/> <!-- Append "32" -->
				<flattenmapper/>
			</firstmatchmapper>
		</get>
		<!-- Windows OpenAL -->
		<get src="http://build.lwjgl.org/${build.type}/windows/x64/OpenAL32.dll" dest="${release.native}/OpenAL.dll" verbose="false" usetimestamp="true"/>
		<get src="http://build.lwjgl.org/${build.type}/windows/x86/OpenAL32.dll" dest="${release.native}" verbose="false" usetimestamp="true"/>

		<!-- Bundle javadoc -->
		<mkdir dir="${release.doc}"/>
		<zip destfile="${release.doc}/javadoc.zip" basedir="${bin.html.javadoc}" includes="**" level="9"/>

		<!-- Copy license files -->
		<copy todir="${release.doc}">
			<fileset dir="${doc}" includes="LICENSE.txt"/>
			<fileset dir="${doc}" includes="3rdparty/**"/>
		</copy>

		<!-- Bundle source -->
		<zip destfile="${release}/src.zip" level="9">
			<fileset dir="${src.core}">
				<patternset refid="core.main.files"/>
			</fileset>

			<fileset dir="${src.generated.java}">
				<patternset refid="core.generated.files"/>
			</fileset>
		</zip>

		<echo file="${release}/build.txt" if:set="build.revision">LWJGL ${build.version} build ${build.revision}</echo>
	</target>
</project>