|
| 1 | +<?xml version="1.0" encoding="utf-8" ?> |
| 2 | +<project name="StockWatcher" default="build" basedir="."> |
| 3 | + <!-- Configure path to GWT SDK --> |
| 4 | + <property name="gwt.sdk" location="/path/to/gwt.sdk" /> |
| 5 | + |
| 6 | + <path id="project.class.path"> |
| 7 | + <pathelement location="war/WEB-INF/classes"/> |
| 8 | + <pathelement location="${gwt.sdk}/gwt-user.jar"/> |
| 9 | + <fileset dir="${gwt.sdk}" includes="gwt-dev*.jar"/> |
| 10 | + <!-- Add any additional non-server libs (such as JUnit) --> |
| 11 | + <fileset dir="war/WEB-INF/lib" includes="**/*.jar"/> |
| 12 | + </path> |
| 13 | + |
| 14 | + <target name="libs" description="Copy libs to WEB-INF/lib"> |
| 15 | + <mkdir dir="war/WEB-INF/lib" /> |
| 16 | + <copy todir="war/WEB-INF/lib" file="${gwt.sdk}/gwt-servlet.jar" /> |
| 17 | + <!-- Add any additional server libs that need to be copied --> |
| 18 | + </target> |
| 19 | + |
| 20 | + <target name="javac" depends="libs" description="Compile java source"> |
| 21 | + <mkdir dir="war/WEB-INF/classes"/> |
| 22 | + <javac srcdir="src" includes="**" encoding="utf-8" |
| 23 | + destdir="war/WEB-INF/classes" |
| 24 | + source="1.5" target="1.5" nowarn="true" |
| 25 | + debug="true" debuglevel="lines,vars,source"> |
| 26 | + <classpath refid="project.class.path"/> |
| 27 | + </javac> |
| 28 | + <copy todir="war/WEB-INF/classes"> |
| 29 | + <fileset dir="src" excludes="**/*.java"/> |
| 30 | + </copy> |
| 31 | + </target> |
| 32 | + |
| 33 | + <target name="gwtc" depends="javac" description="GWT compile to JavaScript"> |
| 34 | + <java failonerror="true" fork="true" classname="com.google.gwt.dev.Compiler"> |
| 35 | + <classpath> |
| 36 | + <pathelement location="src"/> |
| 37 | + <path refid="project.class.path"/> |
| 38 | + </classpath> |
| 39 | + <!-- add jvmarg -Xss16M or similar if you see a StackOverflowError --> |
| 40 | + <jvmarg value="-Xmx256M"/> |
| 41 | + <!-- Additional arguments like -style PRETTY or -logLevel DEBUG --> |
| 42 | + <arg value="com.google.gwt.sample.stockwatcher.StockWatcher"/> |
| 43 | + </java> |
| 44 | + </target> |
| 45 | + |
| 46 | + <target name="devmode" depends="javac" description="Run development mode"> |
| 47 | + <java failonerror="true" fork="true" classname="com.google.gwt.dev.DevMode"> |
| 48 | + <classpath> |
| 49 | + <pathelement location="src"/> |
| 50 | + <path refid="project.class.path"/> |
| 51 | + </classpath> |
| 52 | + <jvmarg value="-Xmx256M"/> |
| 53 | + <arg value="-startupUrl"/> |
| 54 | + <arg value="StockWatcher.html"/> |
| 55 | + <!-- Additional arguments like -style PRETTY or -logLevel DEBUG --> |
| 56 | + <arg value="com.google.gwt.sample.stockwatcher.StockWatcher"/> |
| 57 | + </java> |
| 58 | + </target> |
| 59 | + |
| 60 | + <target name="javac.tests" depends="javac" description="Compiles test code"> |
| 61 | + <javac srcdir="test" includes="**" encoding="utf-8" |
| 62 | + source="1.5" target="1.5" nowarn="true" |
| 63 | + debug="true" debuglevel="lines,vars,source"> |
| 64 | + <classpath location="path_to_the_junit_jar"/> |
| 65 | + <classpath refid="project.class.path"/> |
| 66 | + </javac> |
| 67 | + </target> |
| 68 | + |
| 69 | + <target name="test.dev" depends="javac.tests" description="Run development mode tests"> |
| 70 | + <mkdir dir="reports/htmlunit.dev" /> |
| 71 | + <junit fork="yes" printsummary="yes" haltonfailure="yes"> |
| 72 | + <jvmarg line="-Xmx256m" /> |
| 73 | + <sysproperty key="gwt.args" value="-logLevel WARN" /> |
| 74 | + <sysproperty key="java.awt.headless" value="true" /> |
| 75 | + <classpath> |
| 76 | + <pathelement location="src" /> |
| 77 | + <pathelement location="test" /> |
| 78 | + <path refid="project.class.path" /> |
| 79 | + <pathelement location="path_to_the_junit_jar" /> |
| 80 | + </classpath> |
| 81 | + <batchtest todir="reports/htmlunit.dev" > |
| 82 | + <fileset dir="test" > |
| 83 | + <include name="**/*Test.java" /> |
| 84 | + </fileset> |
| 85 | + </batchtest> |
| 86 | + <formatter type="plain" /> |
| 87 | + <formatter type="xml" /> |
| 88 | + </junit> |
| 89 | + </target> |
| 90 | + |
| 91 | + <target name="test.prod" depends="javac.tests" description="Run production mode tests"> |
| 92 | + <mkdir dir="reports/htmlunit.prod" /> |
| 93 | + <junit fork="yes" printsummary="yes" haltonfailure="yes"> |
| 94 | + <jvmarg line="-Xmx256m" /> |
| 95 | + <sysproperty key="gwt.args" value="-prod -logLevel WARN -out www-test" /> |
| 96 | + <sysproperty key="java.awt.headless" value="true" /> |
| 97 | + <classpath> |
| 98 | + <pathelement location="src" /> |
| 99 | + <pathelement location="test" /> |
| 100 | + <path refid="project.class.path" /> |
| 101 | + <pathelement location="path_to_the_junit_jar" /> |
| 102 | + </classpath> |
| 103 | + <batchtest todir="reports/htmlunit.prod" > |
| 104 | + <fileset dir="test" > |
| 105 | + <include name="**/*Test.java" /> |
| 106 | + </fileset> |
| 107 | + </batchtest> |
| 108 | + <formatter type="plain" /> |
| 109 | + <formatter type="xml" /> |
| 110 | + </junit> |
| 111 | + </target> |
| 112 | + |
| 113 | + <target name="test" description="Run development and production mode tests"> |
| 114 | + <antcall target="test.dev" /> |
| 115 | + <antcall target="test.prod" /> |
| 116 | + </target> |
| 117 | + |
| 118 | + <target name="hosted" depends="devmode" description="Run development mode (NOTE: the 'hosted' target is deprecated)" /> |
| 119 | + |
| 120 | + <target name="build" depends="gwtc" description="Build this project" /> |
| 121 | + |
| 122 | + <target name="war" depends="build" description="Create a war file"> |
| 123 | + <zip destfile="StockWatcher.war" basedir="war"/> |
| 124 | + </target> |
| 125 | + |
| 126 | + <target name="clean" description="Cleans this project"> |
| 127 | + <delete dir="war/WEB-INF/classes" failonerror="false" /> |
| 128 | + <delete dir="war/stockwatcher" failonerror="false" /> |
| 129 | + </target> |
| 130 | + |
| 131 | +</project> |
0 commit comments