blob: c01ec765f5d484d5c8a00cd989d03b445d0e006a [file] [log] [blame]
<?xml version="1.0" encoding="utf-8" ?>
<project name="MobileWebApp" default="build" basedir=".">
<property file="local.properties" />
<!-- Arguments to gwtc and devmode targets -->
<property name="gwt.args" value="" />
<property name="src.dir" value="src/main" />
<property name="src.dev.dir" value="src/dev" />
<property name="war.dir" value="war" />
<property name="gwt.sdk" value="../.." />
<fail unless="appengine.sdk">Missing property:
The property 'appengine.sdk' is not set.
Either specity the property by passing an argument
-Dappengine.sdk="path-to-your-appengine-sdk"
or create a 'local.properties' file containing the
location of the App Engine SDK. i.e. the line:
appengine.sdk=path-to-your-appengine-sdk
</fail>
<!-- Configure AppEngine macros -->
<import file="${appengine.sdk}/config/user/ant-macros.xml" />
<path id="project.class.path">
<pathelement location="${war.dir}/WEB-INF/classes"/>
<pathelement location="${gwt.sdk}/gwt-user.jar"/>
<fileset dir="${gwt.sdk}" includes="gwt-dev*.jar"/>
<fileset dir="${gwt.sdk}" includes="validation-api-1.0.0.GA-sources.jar"/>
<fileset dir="${gwt.sdk}" includes="validation-api-1.0.0.GA.jar"/>
<!-- Add any additional non-server libs (such as JUnit) -->
<fileset dir="${war.dir}/WEB-INF/lib" includes="**/*.jar"/>
</path>
<path id="tools.class.path">
<path refid="project.class.path"/>
<pathelement location="${appengine.sdk}/lib/appengine-tools-api.jar"/>
<fileset dir="${appengine.sdk}/lib/tools">
<include name="**/asm-*.jar"/>
<include name="**/datanucleus-enhancer-*.jar"/>
</fileset>
</path>
<target name="appengine-copyjars"
description="Copies the App Engine JARs to the WAR.">
<copy
todir="${war.dir}/WEB-INF/lib"
flatten="true">
<fileset dir="${appengine.sdk}/lib/user">
<include name="**/*.jar" />
</fileset>
</copy>
</target>
<target name="libs" description="Copy libs to WEB-INF/lib">
<mkdir dir="${war.dir}/WEB-INF/lib" />
<copy todir="${war.dir}/WEB-INF/lib" file="${gwt.sdk}/gwt-servlet.jar" />
<copy todir="${war.dir}/WEB-INF/lib" file="${gwt.sdk}/gwt-servlet-deps.jar" />
<copy todir="${war.dir}/WEB-INF/lib" file="${gwt.sdk}/validation-api-1.0.0.GA.jar"/>
<copy todir="${war.dir}/WEB-INF/lib" file="${gwt.sdk}/validation-api-1.0.0.GA-sources.jar"/>
<!-- Add any additional server libs that need to be copied -->
</target>
<target name="javac" depends="libs,appengine-copyjars" description="Compile java source to bytecode">
<mkdir dir="${war.dir}/WEB-INF/classes"/>
<javac srcdir="${src.dir}/" includes="**" encoding="utf-8"
destdir="${war.dir}/WEB-INF/classes"
source="1.6" target="1.6" nowarn="true"
debug="true" debuglevel="lines,vars,source">
<classpath refid="project.class.path"/>
</javac>
<copy todir="${war.dir}/WEB-INF/classes">
<fileset dir="${src.dir}/" excludes="**/*.java"/>
</copy>
</target>
<target name="javac-dev" description="Compile gwtc related classes">
<mkdir dir="build/dev-classes"/>
<javac srcdir="${src.dev.dir}" includes="**" encoding="utf-8"
destdir="build/dev-classes"
source="1.6" target="1.6" nowarn="true"
debug="true" debuglevel="lines,vars,source">
<classpath refid="project.class.path"/>
</javac>
</target>
<target name="gwtc" depends="javac,javac-dev" description="GWT compile to JavaScript (production mode)">
<java failonerror="true" fork="true" classname="com.google.gwt.dev.Compiler">
<classpath>
<path location="build/dev-classes"/>
<pathelement location="${src.dir}/"/>
<path refid="project.class.path"/>
</classpath>
<!-- add jvmarg -Xss16M or similar if you see a StackOverflowError -->
<jvmarg value="-Xmx256M"/>
<arg line="-war"/>
<arg value="${war.dir}/"/>
<!-- Additional arguments like -style PRETTY or -logLevel DEBUG -->
<arg line="${gwt.args}"/>
<arg value="com.google.gwt.sample.mobilewebapp.MobileWebApp"/>
</java>
</target>
<target name="datanucleusenhance" depends="javac"
description="Performs JDO enhancement on compiled data classes.">
<enhance_war war="${war.dir}/" />
</target>
<target name="devmode" depends="javac,javac-dev,datanucleusenhance" description="Run development mode">
<java failonerror="true" fork="true" classname="com.google.gwt.dev.DevMode">
<classpath>
<path location="build/dev-classes"/>
<pathelement location="${src.dir}/"/>
<path refid="project.class.path"/>
<path refid="tools.class.path"/>
</classpath>
<jvmarg value="-Xmx256M"/>
<jvmarg value="-javaagent:${appengine.sdk}/lib/agent/appengine-agent.jar"/>
<arg value="-startupUrl"/>
<arg value="MobileWebApp.html"/>
<arg line="-war"/>
<arg value="${war.dir}/"/>
<arg value="-server"/>
<arg value="com.google.appengine.tools.development.gwt.AppEngineLauncher"/>
<!-- Additional arguments like -style PRETTY or -logLevel DEBUG -->
<arg line="${gwt.args}"/>
<arg value="com.google.gwt.sample.mobilewebapp.MobileWebApp"/>
</java>
</target>
<target name="build" depends="gwtc,datanucleusenhance" description="Build this project" />
<target name="war" depends="build" description="Create a war file">
<zip destfile="MobileWebApp.war" basedir="${war.dir}/"/>
</target>
<target name="clean" description="Cleans this project">
<delete file="MobileWebApp.war" failonerror="false" />
<delete dir="war/WEB-INF/appengine-generated/" failonerror="false" />
<delete dir="war/WEB-INF/classes/com" failonerror="false" />
<delete dir="war/WEB-INF/classes/META-INF" failonerror="false" />
<delete file="war/WEB-INF/classes/log4j.properties" failonerror="false" />
<delete dir="war/WEB-INF/deploy/" failonerror="false" />
<delete dir="war/mobilewebapp/" failonerror="false" />
<delete dir="build/" failonerror="false" />
</target>
</project>