Paul Curtis wrote:
No CVS ... but feel free to post patches.

This isn't a patch, but I do find it helpful. Here's an ant build file for your applet that automatically creates debug and release jars. Note that it plays nicely with Eclipse. That is,


0. In Eclipse, under Window, Preferences, Java, New Project select the Folders option. Leave the directory names as suggested (src and bin).
1. Create a new Java project in Eclipse, say in ~/workspace/Terrapin.
2. Put the e4applet source code in subdirectory src (~/workspace/Terrapin/src).
3. Put this file in the root project directory (~/workspace/Terrapin), and save it as build.xml.
4. In Eclipse, refresh so it sees the new file.
5. In Eclipse, right-click on the new file and click Run Ant. Select the target of interest. The default, dist, will create a debug jar (which includes debug info and prints warnings on the use of deprecated methods). Another useful target is dist-release, which will build a jar without debug info or deprecation warnings, but with optimization. Note that you may need to run the clean target (deletes bin and dist dirs) before switching between dist and dist-release or vice versa.


For both dist and dist-release, the jar will contain *.class and *.properties (localization). The dist/lib directory will contain the jar as well as *.html (e.g., applet.html).

-JT
<project name="e4Terrapin" default="dist" basedir=".">
    <description>
        e4Terrapin build file by Jack Tanner <[EMAIL PROTECTED]>	, 2003-06-11. 
    </description>
  <!-- set global properties for this build -->
  <property name="build.compiler" value="modern"/>
  <property name="src" location="src"/>
  <property name="build" location="bin"/>
  <property name="dist" location="dist"/>
  
  <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 -- debug">
    <!-- Compile the java code from ${src} into ${build} -->
    <javac srcdir="${src}" destdir="${build}" deprecation="on" debug="true"/>
  </target>

  <target name="dist" depends="compile"
        description="generate the distribution" >
    <!-- Create the distribution directory -->
    <mkdir dir="${dist}/lib"/>
    <!-- Put everything in ${build} into the e4Terrapin-${DSTAMP}.jar file -->
    <jar jarfile="${dist}/lib/e4Terrapin-${DSTAMP}.jar" basedir="${build}" includes="*.class *.properties"/>
    <copy todir="${dist}/lib">
		<fileset dir="${src}">
			<include name="*.html"/>
		</fileset>
	</copy>	    
  </target>

  <target name="compile-release" depends="init"
        description="compile the source -- release">
    <!-- Compile the java code from ${src} into ${build} -->
    <javac srcdir="${src}" destdir="${build}" optimize="on"/>
  </target>

  <target name="dist-release" depends="compile-release"
        description="generate the distribution" >
    <!-- Create the distribution directory -->
    <mkdir dir="${dist}/lib"/>
    <!-- Put everything in ${build} into the e4Terrapin-${DSTAMP}.jar file -->
    <jar jarfile="${dist}/lib/e4Terrapin-${DSTAMP}.jar" basedir="${build}" includes="*.class *.properties"/>
    <copy todir="${dist}/lib">
		<fileset dir="${src}">
			<include name="*.html"/>
		</fileset>
	</copy>	    
  </target>

  <target name="clean"
        description="clean up" >
    <!-- Delete the ${build} and ${dist} directory trees -->
    <delete dir="${build}"/>
    <delete dir="${dist}"/>
  </target>
</project>

Reply via email to