<project name="applet">

	<!-- Create our packer task -->
	<taskdef name="pack200" classname="com.sun.tools.apache.ant.pack200.Pack200Task" classpath="platform_build/Pack200Task.jar"/>

	<target name="applet">
		<antcall target="-applet">
		    <param name="keystore" value="applet/lwjglkeystore"/>
			<param name="alias" value="lwjgl"/>			
			<param name="password" value="123456"/>			
		  </antcall>
	</target>
	
	<target name="applet-release">
		<input message="Please enter the keystore" addproperty="keystore.location" defaultvalue="applet/lwjglkeystore"/>
		<input message="Please enter the keystore alias" addproperty="keystore.alias" defaultvalue="lwjgl"/>
		<input message="Please type the password for the keystore" addproperty="sign.pwd" defaultvalue="123456"/>

		<antcall target="-applet">
			<!--
		    <param name="keystore" value="signing/matzon_java_code_signing.keystore"/>
			<param name="alias" value="oddlabs_java_code_signing"/>
			<param name="password" value="${sign.pwd}"/>
			-->
		    <param name="keystore" value="${keystore.location}"/>
			<param name="alias" value="${keystore.alias}"/>
			<param name="password" value="${sign.pwd}"/>
		</antcall>
	</target>

	<target name="-applet">
	
		<!-- Create lwjgl_applet.jar -->
		<jar destfile="applet/basic/lwjgl_applet.jar" taskname="lwjgl_applet.jar">
			<fileset refid="lwjgl_applet.fileset" />
		</jar>
		
		<!-- create each of the native jars -->
		<jar destfile="applet/basic/windows_natives.jar" taskname="windows_natives.jar">
			<fileset dir="${lwjgl.lib}/windows">
				<patternset refid="lwjgl-windows.fileset"/>
			</fileset>
		</jar>
		<signjar jar="applet/basic/windows_natives.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/>
		
		<jar destfile="applet/basic/linux_natives.jar" taskname="linux_natives.jar">
			<fileset dir="${lwjgl.lib}/linux">
				<patternset refid="lwjgl-linux.fileset"/>
			</fileset>
		</jar>
		<signjar jar="applet/basic/linux_natives.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/>
			
		<jar destfile="applet/basic/macosx_natives.jar" taskname="macosx_natives.jar">
			<fileset dir="${lwjgl.lib}/macosx">
				<patternset refid="lwjgl-macosx.fileset"/>
			</fileset>
		</jar>
		<signjar jar="applet/basic/macosx_natives.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/>
		
		<jar destfile="applet/basic/solaris_natives.jar" taskname="solaris_natives.jar">
			<fileset dir="${lwjgl.lib}/solaris">
				<patternset refid="lwjgl-solaris.fileset"/>
			</fileset>
		</jar>
		<signjar jar="applet/basic/solaris_natives.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/>		

	  	<copy file="${lwjgl.lib}/lwjgl.jar" todir="applet/basic" overwrite="true"/>
		<copy file="${lwjgl.lib}/lwjgl-debug.jar" todir="applet/basic" overwrite="true"/>
		<copy file="${lwjgl.lib}/lwjgl_util_applet.jar" todir="applet/basic" overwrite="true"/>
		<copy file="${lwjgl.lib}/lwjgl_util.jar" todir="applet/basic" overwrite="true"/>
		<copy file="${lwjgl.lib}/jinput.jar" todir="applet/basic" overwrite="true"/>

        <input
                message="Press Return key to continue..."
                />

		<copy file="${lwjgl.lib}/lzma.jar" todir="applet/advance" overwrite="true"/>
		
		<signjar jar="applet/basic/lwjgl_util_applet.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/>
        <input
                message="Press Return key to continue..."
                />
		<signjar jar="applet/advance/lzma.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/>
        <input
                message="Press Return key to continue..."
                />
		<copy file="applet/basic/lwjgl_util_applet.jar" todir="applet/advance" overwrite="true"/>

		<!-- LZMA only, for 1.4 only clients -->
		<!--antcall target="compress-resource">
			<param name="input" value="applet/basic/lwjgl.jar"/>
			<param name="output" value="applet/advance/lwjgl.jar.lzma"/>
		</antcall>
		<antcall target="compress-resource">
			<param name="input" value="applet/basic/lwjgl-debug.jar"/>
			<param name="output" value="applet/advance/lwjgl-debug.jar.lzma"/>
		</antcall>
		
		<antcall target="compress-resource">
			<param name="input" value="applet/basic/lwjgl_util.jar"/>
			<param name="output" value="applet/advance/lwjgl_util.jar.lzma"/>
		</antcall>
		<antcall target="compress-resource">
			<param name="input" value="applet/basic/jinput.jar"/>
			<param name="output" value="applet/advance/jinput.jar.lzma"/>
		</antcall>
		<antcall target="compress-resource">
			<param name="input" value="applet/basic/lwjgl_applet.jar"/>
			<param name="output" value="applet/advance/lwjgl_applet.jar.lzma"/>
		</antcall>
		<antcall target="compress-resource">
			<param name="input" value="applet/basic/windows_natives.jar"/>
			<param name="output" value="applet/advance/windows_natives.jar.lzma"/>
		</antcall -->
		
		<antcall target="compress-sign-class">
			<param name="dir" value="applet/basic/"/>
			<param name="outputdir" value="applet/advance/"/>
			<param name="jarfile" value="lwjgl"/>
		</antcall>
		<antcall target="compress-sign-class">
			<param name="dir" value="applet/basic/"/>
			<param name="outputdir" value="applet/advance/"/>
			<param name="jarfile" value="lwjgl-debug"/>
		</antcall>
		<antcall target="compress-sign-class">
			<param name="dir" value="applet/basic/"/>
			<param name="outputdir" value="applet/advance/"/>
			<param name="jarfile" value="lwjgl_util"/>
		</antcall>
		<antcall target="compress-sign-class">
			<param name="dir" value="applet/basic/"/>
			<param name="outputdir" value="applet/advance/"/>
			<param name="jarfile" value="jinput"/>
		</antcall>
		<antcall target="compress-sign-class">
			<param name="dir" value="applet/basic/"/>
			<param name="outputdir" value="applet/advance/"/>
			<param name="jarfile" value="lwjgl_applet"/>
		</antcall>
		<antcall target="compress-resource">
			<param name="input" value="applet/basic/windows_natives.jar"/>
			<param name="output" value="applet/advance/windows_natives.jar.lzma"/>
		</antcall>
		<antcall target="compress-resource">
			<param name="input" value="applet/basic/macosx_natives.jar"/>
			<param name="output" value="applet/advance/macosx_natives.jar.lzma"/>
		</antcall>
		<antcall target="compress-resource">
			<param name="input" value="applet/basic/linux_natives.jar"/>
			<param name="output" value="applet/advance/linux_natives.jar.lzma"/>
		</antcall>
		<antcall target="compress-resource">
			<param name="input" value="applet/basic/solaris_natives.jar"/>
			<param name="output" value="applet/advance/solaris_natives.jar.lzma"/>
		</antcall>
	</target>
</project>