Skip to content

Instantly share code, notes, and snippets.

@carchrae
Created October 24, 2013 16:04
Show Gist options
  • Select an option

  • Save carchrae/7140011 to your computer and use it in GitHub Desktop.

Select an option

Save carchrae/7140011 to your computer and use it in GitHub Desktop.
An ant build that includes source in a jar
<?xml version="1.0" encoding="utf-8" ?>
<project name="glwt" default="jar" basedir=".">
<property name="gwt.sdk" location="/home/tom/bin/gwt" />
<property name="dust.version" location="1.2.6" />
<property name="dust.path" location="/home/tom/code/javascript/dustjs" />
<property name="dust.path.src" location="${dust.path}/dist" />
<property name="dust.path.dst" location="src/glwt/dust/client/js" />
<presetdef name="javac">
<javac includeantruntime="false" />
</presetdef>
<path id="project.class.path">
<pathelement location="src" />
<pathelement location="${gwt.sdk}/gwt-user.jar" />
<fileset dir="lib" includes="*.jar" />
<fileset dir="${gwt.sdk}" includes="gwt-dev*.jar" />
</path>
<target name="update.dust" depends="checkforchanges">
<copy todir="${dust.path.dst}" verbose="true">
<fileset dir="${dust.path.src}">
</fileset>
</copy>
</target>
<target name="compile" description="Compile source" depends="checkforchanges, update.dust" unless="nochanges">
<delete dir="bin" />
<mkdir dir="bin" />
<javac srcdir="src" includes="**/*" destdir="bin" classpathref="project.class.path" includeDestClasses="true" debug="on">
<!-- <javac srcdir="src" includes="**" encoding="utf-8" destdir="bin" source="1.5" target="1.5" nowarn="true" debug="true" debuglevel="lines,vars,source"> -->
<!-- <classpath refid="project.class.path" /> -->
</javac>
<echo message="compile done" />
<copy todir="bin">
<fileset dir="src" />
</copy>
</target>
<target name="checkforchanges">
<uptodate property="nochanges" targetfile="build/glwt.jar">
<srcfiles dir="src" includes="**/*" />
<srcfiles dir="lib" includes="**/*.jar" />
<srcfiles dir="${gwt.sdk}" includes="**/*.jar" />
</uptodate>
<uptodate property="nochangedust" targetfile="${dust.path.dst}/dust-full-${dust.version}.js">
<srcfiles dir="${dust.path.src}" includes="**/*" />
<srcfiles dir="lib" includes="**/*.jar" />
<srcfiles dir="${gwt.sdk}" includes="**/*.jar" />
</uptodate>
<echo message="build/glwt.jar checkforchanges : nochanges=${nochanges}" />
</target>
<target name="jar" description="Package into JAR" depends="compile" unless="nochanges">
<jar destfile="build/glwt.jar" basedir="bin" compress="true" />
<echo message="built jar" />
</target>
<target name="build" depends="jar">
</target>
<target name="clean">
<delete dir="bin" />
<delete dir="build" />
</target>
</project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment