Skip to content

Instantly share code, notes, and snippets.

@gkossakowski
Created August 25, 2011 21:04
Show Gist options
  • Save gkossakowski/1171944 to your computer and use it in GitHub Desktop.
Save gkossakowski/1171944 to your computer and use it in GitHub Desktop.
<?xml version="1.0" encoding="utf-8" ?>
<project name="Hello" default="build" basedir=".">
<!-- Arguments -style PRETTY or -logLevel DEBUG to gwtc and devmode targets -->
<property name="gwt.args" value="-draftCompile -ea -style pretty -logLevel DEBUG" />
<property name="scala.args" value="-g:notailcalls -Xplugin:${basedir}/lib/scala/factorymanifests.jar"/>
<path id="scala.class.path">
<fileset dir="lib/scala">
<include name="scala-compiler.jar"/>
<include name="scala-library.jar"/>
</fileset>
</path>
<path id="project.class.path">
<pathelement location="war/WEB-INF/classes"/>
<pathelement location="lib/scala/scala-library-jribble.jar"/>
<fileset dir="lib/gwt" includes="*.jar"/>
<!-- Add any additional non-server libs (such as JUnit) -->
<fileset dir="war/WEB-INF/lib" includes="**/*.jar"/>
</path>
<target name="libs" description="Copy libs to WEB-INF/lib">
<mkdir dir="war/WEB-INF/lib" />
<copy todir="war/WEB-INF/lib" file="lib/gwt/gwt-servlet.jar" />
</target>
<target name="gwtc" depends="scalac" description="GWT compile to JavaScript">
<java failonerror="true" fork="true" classname="com.google.gwt.dev.Compiler">
<classpath>
<pathelement location="src"/>
<pathelement location="war/WEB-INF/jribble"/>
<path refid="project.class.path"/>
</classpath>
<!-- add jvmarg -Xss16M or similar if you see a StackOverflowError -->
<jvmarg value="-Xmx512M"/>
<jvmarg value="-Dx.gwt.astBuilder=true"/>
<jvmarg value="-Dgwt.scalalibrary.path=${basedir}/lib/scala/scala-library-gwt.jar"/>
<arg line="${gwt.args}"/>
<arg value="com.google.gwt.sample.jribble.Hello"/>
<!-- <arg value="com.google.gwt.sample.showcase.Showcase"/> -->
</java>
</target>
<taskdef name="scalac" classname="scala.tools.ant.Scalac" classpathref="scala.class.path"/>
<target name="scalac" description="Scalac compile to jribble">
<mkdir dir="war/WEB-INF/jribble"/>
<!-- srcdir should really be 'src', but we can't compile both samples to jribble yet -->
<scalac srcdir="src" includes="**" destdir="war/WEB-INF/jribble" target="jribble" addparams="${scala.args}">
<classpath>
<pathelement location="lib/scala/scala-library-gwt.jar"/>
<path refid="project.class.path"/>
</classpath>
</scalac>
<mkdir dir="war/WEB-INF/classes"/>
<!-- TODO(grek): We should have a proper javabootclasspath here -->
<scalac srcdir="src" includes="**" destdir="war/WEB-INF/classes" addparams="${scala.args}">
<classpath>
<pathelement location="lib/scala/scala-library-gwt.jar"/>
<path refid="project.class.path"/>
</classpath>
</scalac>
<javac srcdir="src" destdir="war/WEB-INF/classes">
<classpath refid="project.class.path"/>
</javac>
</target>
<!-- temporary target to compile the showcase sample to jvm bytecode until jribble can be used -->
<target name="scalac-jvm" description="Scalac compile showcase to jvm bytecode">
<mkdir dir="war/WEB-INF/jribble"/>
<scalac srcdir="src" includes="**" destdir="war/WEB-INF/jribble">
<classpath refid="project.class.path"/>
</scalac>
</target>
<!-- temporary target to try compiling the showcase sample to jribble -->
<target name="scalac-jribble" description="Scalac compile showcase to jribble">
<mkdir dir="war/WEB-INF/jribble"/>
<scalac srcdir="src" includes="**" destdir="war/WEB-INF/jribble" target="jribble" addparams="${scala.args}">
<classpath refid="project.class.path"/>
</scalac>
</target>
<target name="devmode" depends="scalac" description="Run development mode">
<java failonerror="true" fork="true" classname="com.google.gwt.dev.DevMode">
<classpath>
<pathelement location="src"/>
<path refid="project.class.path"/>
</classpath>
<jvmarg value="-Xmx256M"/>
<arg value="-startupUrl"/>
<arg value="Hello.html"/>
<arg line="${gwt.args}"/>
<arg value="com.google.gwt.sample.jribble.Hello"/>
</java>
</target>
<target name="build" depends="gwtc" description="Build this project" />
<target name="war" depends="build" description="Create a war file">
<zip destfile="Hello.war" basedir="war"/>
</target>
<target name="clean" description="Cleans this project">
<delete dir="war/WEB-INF/classes" failonerror="false" />
<delete dir="war/WEB-INF/jribble" failonerror="false" />
<delete dir="war/hello" failonerror="false" />
<delete dir="war/showcase" failonerror="false" />
<delete dir="gwt-unitCache" failonerror="false" />
<delete dir="jribbleCache" failonerror="false" />
<delete dir="war/jribbleCache" failonerror="false" />
<delete file="Hello.war"/>
</target>
</project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment