Skip to content

Commit

Permalink
Add a Launch4j wrapper.
Browse files Browse the repository at this point in the history
  • Loading branch information
skeeto committed Jul 9, 2011
1 parent 992fff2 commit c5cfa7b
Show file tree
Hide file tree
Showing 5 changed files with 219 additions and 211 deletions.
3 changes: 1 addition & 2 deletions .gitignore
@@ -1,4 +1,3 @@
Chess.jar
build
dist
TAGS
doc/javadoc
34 changes: 14 additions & 20 deletions build.xml
Expand Up @@ -3,15 +3,18 @@
<property name="jar.file" value="${ant.project.name}.jar"/>
<property name="src.dir" value="src"/>
<property name="build.dir" value="build"/>
<property name="dist.dir" value="dist"/>
<property name="test.dir" value="test"/>
<property name="doc.dir" value="doc"/>
<property name="build.classes.dir" value="${build.dir}/classes"/>
<property name="test.classes.dir" value="${build.dir}/test"/>
<property name="applet.html" value="index.html"/>

<taskdef resource="checkstyletask.properties"/>
<taskdef resource="proguard/ant/task.properties"/>
<taskdef name="launch4j" classname="net.sf.launch4j.ant.Launch4jTask"/>

<target name="init">
<mkdir dir="${dist.dir}"/>
<mkdir dir="${build.classes.dir}"/>
</target>

Expand All @@ -29,22 +32,24 @@

<target name="jar" depends="compile"
description="Generate the jarfile distributable.">
<jar destfile="${jar.file}">
<jar destfile="${dist.dir}/${jar.file}">
<fileset dir="${build.classes.dir}"/>
<fileset dir="${src.dir}" includes="**/*.java"/>
<fileset file="UNLICENSE"/>
<fileset file="build.xml"/>
<fileset file="launch4j.xml"/>
<fileset file="HACKING"/>
<fileset file="AUTHORS"/>
<fileset file="README"/>
<manifest>
<attribute name="Main-Class" value="com.nullprogram.chess.Chess"/>
</manifest>
</jar>
<copy file="${applet.html}" todir="${dist.dir}"/>
</target>

<target name="run" depends="jar" description="Run the application.">
<java jar="${jar.file}" fork="true">
<java jar="${dist.dir}/${jar.file}" fork="true">
<sysproperty key=".level" value="INFO"/>
<jvmarg value="-server"/>
</java>
Expand All @@ -59,8 +64,7 @@

<target name="clean" description="Delete all generated files.">
<delete dir="${build.dir}"/>
<delete dir="${doc.dir}/javadoc"/>
<delete file="${jar.file}"/>
<delete dir="${dist.dir}"/>
</target>

<target name="format" description="Run the indenter on all source files.">
Expand All @@ -73,7 +77,7 @@
</target>

<target name="check">
<checkstyle config="doc/sun_checks.xml">
<checkstyle config="sun_checks.xml">
<fileset dir="src" includes="**/*.java"/>
</checkstyle>
</target>
Expand All @@ -95,23 +99,13 @@

<target name="applet" depends="jar" description="Run the applet version.">
<exec executable="appletviewer">
<arg value="${applet.html}"/>
<arg value="${dist.dir}/${applet.html}"/>
</exec>
</target>

<target name="optimize" depends="jar">
<proguard>
<libraryjar path="${java.home}/lib/rt.jar"/>
<injar file="${jar.file}"/>
<outjar file="out.${jar.file}"/>
<keepclasseswithmembers access="public" type="class">
<method access="public" type="void" name="main"
parameters="java.lang.String[]"/>
</keepclasseswithmembers>
<keep access="public" type="class" extends="javax.swing.JApplet"/>
</proguard>
<delete file="${jar.file}"/>
<move file="out.${jar.file}" tofile="${jar.file}"/>
<target name="exe" depends="jar"
description="Create a Windows .exe wrapper.">
<launch4j configFile="launch4j.xml"/>
</target>

<!-- JUnit -->
Expand Down
15 changes: 15 additions & 0 deletions launch4j.xml
@@ -0,0 +1,15 @@
<launch4jConfig>
<dontWrapJar>false</dontWrapJar>
<headerType>gui</headerType>
<jar>dist/Chess.jar</jar>
<outfile>dist/Chess.exe</outfile>
<errTitle>October Chess Engine</errTitle>
<priority>normal</priority>
<downloadUrl>http://java.com/download</downloadUrl>
<supportUrl>http://nullprogram.com/</supportUrl>
<icon>src/com/nullprogram/chess/chess.ico</icon>
<jre>
<minVersion>1.6.0</minVersion>
<jdkPreference>preferJre</jdkPreference>
</jre>
</launch4jConfig>
Binary file added src/com/nullprogram/chess/chess.ico
Binary file not shown.

0 comments on commit c5cfa7b

Please sign in to comment.