Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: develop
Fetching contributors…

Cannot retrieve contributors at this time

187 lines (170 sloc) 8.217 kb
<?xml version="1.0"?>
<project name="tinyworld" default="run-java" xmlns:artifact="urn:maven-artifact-ant">
<!-- Define your project information here -->
<property name="java.classname" value="com.calumgilchrist.ld23.tinyworld.java.TinyWorldJava"/>
<property name="html.classname" value="com.calumgilchrist.ld23.tinyworld.TinyWorld"/>
<property name="html.index" value="TinyWorld.html"/>
<!-- Everything below here shouldn't need to be modified -->
<!-- run 'ant -p' to see available targets -->
<property name="src.dir" value="src/main/java"/>
<property name="war.dir" value="src/main/webapp"/>
<property name="target.dir" value="target"/>
<property name="classes.dir" value="${target.dir}/classes"/>
<property name="webapp.dir" value="${target.dir}/webapp"/>
<!-- Maven Ant task wiring -->
<property name="maven-ant.vers" value="2.1.3"/>
<property name="maven-ant.dir" value="${user.home}/.m2/ant-support"/>
<property name="maven-ant.jar" value="${maven-ant.dir}/maven-ant-tasks-${maven-ant.vers}.jar"/>
<property name="maven-ant.url"
value="http://mirrors.ibiblio.org/pub/mirrors/apache/maven/binaries"/>
<condition property="maven-ant.exists"><available file="${maven-ant.jar}"/></condition>
<target name="-download-maven-ant" unless="maven-ant.exists">
<mkdir dir="${maven-ant.dir}"/>
<get src="${maven-ant.url}/maven-ant-tasks-${maven-ant.vers}.jar"
dest="${maven-ant.jar}" usetimestamp="true"/>
</target>
<target name="-init-maven-ant" depends="-download-maven-ant">
<taskdef resource="org/apache/maven/artifact/ant/antlib.xml"
uri="urn:maven-artifact-ant" classpath="${maven-ant.jar}"/>
</target>
<target name="-prepare" depends="-init-maven-ant">
<mkdir dir="${target.dir}"/>
<artifact:pom id="pom" file="core/pom.xml"/>
<artifact:dependencies pathId="core.classpath" pomRefId="pom" useScope="compile"/>
</target>
<!-- unfortunately the Maven Ant Tasks don't handle multi-submodule projects well -->
<!-- so we have to do a bunch of manual dependency management in here -->
<target name="-prepare-java" depends="-prepare">
<artifact:dependencies pathId="java-extras.classpath">
<dependency groupId="com.googlecode.playn" artifactId="playn-java"
version="${pom.properties.playn.version}"/>
</artifact:dependencies>
<path id="java.classpath">
<path refid="core.classpath"/>
<path refid="java-extras.classpath"/>
</path>
</target>
<target name="-prepare-html" depends="-prepare">
<artifact:dependencies pathId="html-extras.classpath">
<dependency groupId="com.googlecode.playn" artifactId="playn-html"
version="${pom.properties.playn.version}"/>
<dependency groupId="com.google.gwt" artifactId="gwt-dev"
version="${pom.properties.gwt.version}"/>
</artifact:dependencies>
<path id="html.classpath">
<path refid="core.classpath"/>
<path refid="html-extras.classpath"/>
</path>
</target>
<target name="-prepare-android" depends="-prepare">
<artifact:dependencies pathId="android-extras.classpath">
<dependency groupId="com.googlecode.playn" artifactId="playn-android"
version="${pom.properties.playn.version}"/>
<dependency groupId="com.google.android" artifactId="android"
version="${pom.properties.android.version}"/>
</artifact:dependencies>
<path id="android.classpath">
<path refid="core.classpath"/>
<path refid="android-extras.classpath"/>
</path>
</target>
<target name="-prep-webapp" depends="-prepare-html">
<mkdir dir="${webapp.dir}"/>
<copy todir="${webapp.dir}">
<fileset dir="html/${war.dir}" includes="**"/>
</copy>
<!-- we need to resolve this for the GWT classpath to avoid a bunch of warnings -->
<artifact:dependencies sourcesFileSetId="validation.sources.fileset">
<dependency groupId="javax.validation" artifactId="validation-api" version="1.0.0.GA"/>
</artifact:dependencies>
<pathconvert property="validation.source.jar" refid="validation.sources.fileset"/>
</target>
<target name="clean" description="Cleans out all build results.">
<delete dir="${target.dir}"/>
</target>
<target name="compile" depends="-prepare-java" description="Compiles the core code.">
<mkdir dir="${classes.dir}"/>
<javac destdir="${classes.dir}" includeAntRuntime="false"
debug="on" deprecation="on" source="1.6" target="1.6">
<src path="core/${src.dir}"/>
<src path="java/${src.dir}"/>
<classpath refid="java.classpath"/>
<compilerarg value="-Xlint"/>
<compilerarg value="-Xlint:-serial"/>
</javac>
<!-- copy all of our resources into the classes directory -->
<copy todir="${classes.dir}">
<fileset dir="core/${src.dir}" includes="**" excludes="**/*.java"/>
</copy>
</target>
<target name="-compile-html" depends="-prepare-html,compile">
<javac srcdir="html/${src.dir}" destdir="${classes.dir}" includeAntRuntime="false"
debug="on" deprecation="on" source="1.6" target="1.6">
<classpath refid="html.classpath"/>
<compilerarg value="-Xlint"/>
<compilerarg value="-Xlint:-serial"/>
</javac>
</target>
<property name="gwt.style" value="obf"/>
<target name="compile-html" depends="-prep-webapp,-compile-html"
description="Compiles game to JavaScript.">
<java fork="true" maxmemory="1024M" failonerror="true" classname="com.google.gwt.dev.Compiler">
<classpath>
<pathelement location="${javax.validation:validation-api:jar}"/>
<pathelement location="${validation.source.jar}"/>
<pathelement path="core/${src.dir}"/>
<pathelement path="html/${src.dir}"/>
<pathelement location="${classes.dir}"/>
<path refid="html.classpath"/>
</classpath>
<jvmarg value="-Djava.awt.headless=true"/>
<arg value="-style"/><arg value="${gwt.style}"/>
<arg value="-war"/>
<arg value="${target.dir}/webapp"/>
<arg value="${html.classname}"/>
</java>
</target>
<target name="run-html" depends="compile-html" description="Serves HTML game on localhost.">
<artifact:dependencies pathId="jetty-ant.classpath">
<remoteRepository id="jetty-repo" url="http://oss.sonatype.org/content/groups/jetty/"/>
<Dependency groupId="org.mortbay.jetty" artifactId="jetty-ant"
version="7.4.2.v20110526" scope="runtime" />
</artifact:dependencies>
<taskdef classpathref="jetty-ant.classpath" resource="tasks.properties"/>
<echo>=================================================================</echo>
<echo>Browse to http://localhost:8080/${ant.project.name}/${html.index}</echo>
<echo>=================================================================</echo>
<jetty tempDirectory="${target.dir}/jetty-temp">
<webApp name="html-server" warfile="${target.dir}/webapp" contextpath="/${ant.project.name}"/>
</jetty>
</target>
<target name="run-devmode" depends="-prep-webapp,-compile-html"
description="Runs game in GWT development mode.">
<java fork="true" classname="com.google.gwt.dev.DevMode">
<classpath>
<pathelement location="${javax.validation:validation-api:jar}"/>
<pathelement location="${validation.source.jar}"/>
<pathelement path="core/${src.dir}"/>
<pathelement path="html/${src.dir}"/>
<pathelement location="${classes.dir}"/>
<path refid="html.classpath"/>
</classpath>
<jvmarg value="-Xmx256M"/>
<arg value="-startupUrl"/>
<arg value="index.html"/>
<arg value="-war"/>
<arg value="${target.dir}/webapp"/>
<arg value="-startupUrl"/>
<arg value="${html.index}"/>
<arg value="${html.classname}"/>
</java>
</target>
<target name="run-java" depends="compile" description="Runs game in JVM.">
<java fork="true" dir="core" classname="${java.classname}">
<classpath>
<pathelement location="${classes.dir}"/>
<path refid="java.classpath"/>
</classpath>
</java>
</target>
</project>
Jump to Line
Something went wrong with that request. Please try again.