gwt.team.scottb | 14c5b9d | 2006-12-10 06:06:08 +0000 | [diff] [blame] | 1 | <project name="samples-common"> |
fabbott@google.com | 0e2dc628 | 2008-08-22 16:09:01 +0000 | [diff] [blame] | 2 | <property name="gwt.root" location="../.." /> |
| 3 | <property name="project.tail" value="samples/${sample.root}" /> |
| 4 | <import file="${gwt.root}/common.ant.xml" /> |
gwt.team.scottb | 14c5b9d | 2006-12-10 06:06:08 +0000 | [diff] [blame] | 5 | |
scottb@google.com | 6cd61e9 | 2009-01-16 19:50:20 +0000 | [diff] [blame] | 6 | <property name="sample.lower" value="${sample.root}" /> |
| 7 | <property name="sample.upper" value="${sample.module}" /> |
gwt.team.scottb | 14c5b9d | 2006-12-10 06:06:08 +0000 | [diff] [blame] | 8 | |
fabbott@google.com | 0e2dc628 | 2008-08-22 16:09:01 +0000 | [diff] [blame] | 9 | <property.ensure name="gwt.user.jar" location="${gwt.build.lib}/gwt-user.jar" /> |
| 10 | <!-- Platform shouldn't matter here, just picking one --> |
| 11 | <property.ensure name="gwt.dev.jar" location="${gwt.build.lib}/gwt-dev-linux.jar" /> |
gwt.team.scottb | 14c5b9d | 2006-12-10 06:06:08 +0000 | [diff] [blame] | 12 | |
fabbott@google.com | 0e2dc628 | 2008-08-22 16:09:01 +0000 | [diff] [blame] | 13 | <!-- Mirror directory for scripts; makes building distro easier --> |
| 14 | <property name="samples.scripts" value="${gwt.build.out}/samples-scripts" /> |
| 15 | <!-- Use the uppercase name rather than the lowercase name --> |
scottb@google.com | 6cd61e9 | 2009-01-16 19:50:20 +0000 | [diff] [blame] | 16 | <property name="sample.build" value="${gwt.build.out}/samples/${sample.upper}" /> |
gwt.team.scottb | 6996532 | 2006-12-19 23:58:19 +0000 | [diff] [blame] | 17 | |
fabbott@google.com | 0e2dc628 | 2008-08-22 16:09:01 +0000 | [diff] [blame] | 18 | <target name="source" description="Copy source to the output folder"> |
| 19 | <mkdir dir="${sample.build}/src" /> |
| 20 | <copy todir="${sample.build}/src"> |
| 21 | <fileset dir="src" /> |
| 22 | </copy> |
scottb@google.com | 6cd61e9 | 2009-01-16 19:50:20 +0000 | [diff] [blame] | 23 | <mkdir dir="${sample.build}/war" /> |
| 24 | <copy todir="${sample.build}/war"> |
| 25 | <fileset dir="war" excludes="WEB-INF/classes/**"/> |
| 26 | </copy> |
fabbott@google.com | 0e2dc628 | 2008-08-22 16:09:01 +0000 | [diff] [blame] | 27 | </target> |
gwt.team.scottb | 6996532 | 2006-12-19 23:58:19 +0000 | [diff] [blame] | 28 | |
fabbott@google.com | 0e2dc628 | 2008-08-22 16:09:01 +0000 | [diff] [blame] | 29 | <target name="compile" description="Compile all java files"> |
scottb@google.com | 6cd61e9 | 2009-01-16 19:50:20 +0000 | [diff] [blame] | 30 | <mkdir dir="${sample.build}/war/WEB-INF/classes" /> |
| 31 | <gwt.javac destdir="${sample.build}/war/WEB-INF/classes"> |
fabbott@google.com | 0e2dc628 | 2008-08-22 16:09:01 +0000 | [diff] [blame] | 32 | <classpath> |
| 33 | <pathelement location="${gwt.user.jar}" /> |
| 34 | <pathelement location="${gwt.dev.jar}" /> |
| 35 | </classpath> |
| 36 | </gwt.javac> |
| 37 | </target> |
gwt.team.scottb | 14c5b9d | 2006-12-10 06:06:08 +0000 | [diff] [blame] | 38 | |
fabbott@google.com | 0e2dc628 | 2008-08-22 16:09:01 +0000 | [diff] [blame] | 39 | <target name="gwtc" description="Compile to JavaScript"> |
| 40 | <outofdate> |
| 41 | <sourcefiles> |
| 42 | <fileset dir="src" /> |
scottb@google.com | 6cd61e9 | 2009-01-16 19:50:20 +0000 | [diff] [blame] | 43 | <fileset dir="${sample.build}/war/WEB-INF/classes" /> |
fabbott@google.com | 0e2dc628 | 2008-08-22 16:09:01 +0000 | [diff] [blame] | 44 | <fileset file="${gwt.user.jar}" /> |
| 45 | <fileset file="${gwt.dev.jar}" /> |
| 46 | </sourcefiles> |
scottb@google.com | 6cd61e9 | 2009-01-16 19:50:20 +0000 | [diff] [blame] | 47 | <targetfiles path="${sample.build}/war/${sample.lower}/${sample.lower}.nocache.js" /> |
fabbott@google.com | 0e2dc628 | 2008-08-22 16:09:01 +0000 | [diff] [blame] | 48 | <sequential> |
scottb@google.com | 6cd61e9 | 2009-01-16 19:50:20 +0000 | [diff] [blame] | 49 | <mkdir dir="${sample.build}/war" /> |
| 50 | <gwt.timer name="${sample.upper}"> |
| 51 | <java dir="${sample.build}" classname="com.google.gwt.dev.Compiler" classpath="src:${sample.build}/war/WEB-INF/classes:${gwt.user.jar}:${gwt.dev.jar}" fork="yes" failonerror="true"> |
fabbott@google.com | 0e2dc628 | 2008-08-22 16:09:01 +0000 | [diff] [blame] | 52 | <jvmarg value="-Xmx256M"/> |
scottb@google.com | 6cd61e9 | 2009-01-16 19:50:20 +0000 | [diff] [blame] | 53 | <arg value="-war" /> |
| 54 | <arg file="${sample.build}/war" /> |
| 55 | <arg value="com.google.gwt.sample.${sample.lower}.${sample.upper}" /> |
fabbott@google.com | 0e2dc628 | 2008-08-22 16:09:01 +0000 | [diff] [blame] | 56 | </java> |
| 57 | </gwt.timer> |
| 58 | <length property="sample.size"> |
scottb@google.com | 6cd61e9 | 2009-01-16 19:50:20 +0000 | [diff] [blame] | 59 | <fileset dir="${sample.build}/war/${sample.lower}" includes="*.cache.html,*.cache.js"/> |
fabbott@google.com | 0e2dc628 | 2008-08-22 16:09:01 +0000 | [diff] [blame] | 60 | </length> |
scottb@google.com | 6cd61e9 | 2009-01-16 19:50:20 +0000 | [diff] [blame] | 61 | <echo message="output size for ${sample.upper} is ${sample.size} bytes"/> |
fabbott@google.com | 0e2dc628 | 2008-08-22 16:09:01 +0000 | [diff] [blame] | 62 | </sequential> |
| 63 | </outofdate> |
| 64 | </target> |
gwt.team.scottb | 14c5b9d | 2006-12-10 06:06:08 +0000 | [diff] [blame] | 65 | |
scottb@google.com | 6cd61e9 | 2009-01-16 19:50:20 +0000 | [diff] [blame] | 66 | <macrodef name="webAppCreator"> |
fabbott@google.com | 0e2dc628 | 2008-08-22 16:09:01 +0000 | [diff] [blame] | 67 | <attribute name="platform" /> |
| 68 | <attribute name="extension" default="" /> |
| 69 | <sequential> |
| 70 | <outofdate> |
| 71 | <sourcefiles /> |
| 72 | <targetfiles> |
scottb@google.com | 6cd61e9 | 2009-01-16 19:50:20 +0000 | [diff] [blame] | 73 | <pathelement location="${samples.scripts}/@{platform}/${sample.upper}/build.xml" /> |
fabbott@google.com | 0e2dc628 | 2008-08-22 16:09:01 +0000 | [diff] [blame] | 74 | </targetfiles> |
| 75 | <sequential> |
scottb@google.com | 6cd61e9 | 2009-01-16 19:50:20 +0000 | [diff] [blame] | 76 | <mkdir dir="${samples.scripts}/@{platform}/${sample.upper}" /> |
| 77 | <java classname="com.google.gwt.user.tools.WebAppCreator" classpath="${gwt.user.jar}:${gwt.dev.jar}" failonerror="true"> |
fabbott@google.com | 0e2dc628 | 2008-08-22 16:09:01 +0000 | [diff] [blame] | 78 | <!-- Relative path is important! Paths will be relative in final distro --> |
| 79 | <sysproperty key="gwt.devjar" value="../../gwt-dev-@{platform}.jar" /> |
jgw@google.com | a3509e2 | 2009-02-06 21:06:24 +0000 | [diff] [blame] | 80 | <arg value="-XnoEclipse" /> |
scottb@google.com | 6cd61e9 | 2009-01-16 19:50:20 +0000 | [diff] [blame] | 81 | <arg value="-overwrite" /> |
fabbott@google.com | 0e2dc628 | 2008-08-22 16:09:01 +0000 | [diff] [blame] | 82 | <arg value="-out" /> |
scottb@google.com | 6cd61e9 | 2009-01-16 19:50:20 +0000 | [diff] [blame] | 83 | <arg file="${samples.scripts}/@{platform}/${sample.upper}" /> |
| 84 | <arg value="com.google.gwt.sample.${sample.lower}.${sample.upper}" /> |
fabbott@google.com | 0e2dc628 | 2008-08-22 16:09:01 +0000 | [diff] [blame] | 85 | </java> |
| 86 | </sequential> |
| 87 | </outofdate> |
| 88 | </sequential> |
| 89 | </macrodef> |
gwt.team.scottb | 14c5b9d | 2006-12-10 06:06:08 +0000 | [diff] [blame] | 90 | |
fabbott@google.com | 0e2dc628 | 2008-08-22 16:09:01 +0000 | [diff] [blame] | 91 | <target name="scripts" description="Create launch scripts"> |
scottb@google.com | 6cd61e9 | 2009-01-16 19:50:20 +0000 | [diff] [blame] | 92 | <webAppCreator platform="linux" /> |
| 93 | <webAppCreator platform="windows" extension=".cmd" /> |
| 94 | <webAppCreator platform="mac" /> |
fabbott@google.com | 0e2dc628 | 2008-08-22 16:09:01 +0000 | [diff] [blame] | 95 | </target> |
gwt.team.scottb | 14c5b9d | 2006-12-10 06:06:08 +0000 | [diff] [blame] | 96 | |
fabbott@google.com | 0e2dc628 | 2008-08-22 16:09:01 +0000 | [diff] [blame] | 97 | <target name="build" depends="source, compile, gwtc, scripts" description="Build and package this project" /> |
gwt.team.scottb | 14c5b9d | 2006-12-10 06:06:08 +0000 | [diff] [blame] | 98 | |
fabbott@google.com | 0e2dc628 | 2008-08-22 16:09:01 +0000 | [diff] [blame] | 99 | <target name="checkstyle" description="Static analysis of source"> |
| 100 | <gwt.checkstyle> |
| 101 | <fileset dir="src" /> |
| 102 | </gwt.checkstyle> |
| 103 | </target> |
gwt.team.scottb | 6996532 | 2006-12-19 23:58:19 +0000 | [diff] [blame] | 104 | |
fabbott@google.com | 0e2dc628 | 2008-08-22 16:09:01 +0000 | [diff] [blame] | 105 | <target name="clean" description="Cleans this project's intermediate and output files"> |
| 106 | <delete dir="${sample.build}" /> |
| 107 | <delete includeemptydirs="true"> |
| 108 | <fileset dir="${samples.scripts}"> |
scottb@google.com | 6cd61e9 | 2009-01-16 19:50:20 +0000 | [diff] [blame] | 109 | <include name="*/${sample.upper}/**" /> |
fabbott@google.com | 0e2dc628 | 2008-08-22 16:09:01 +0000 | [diff] [blame] | 110 | </fileset> |
| 111 | </delete> |
| 112 | </target> |
gwt.team.scottb | 14c5b9d | 2006-12-10 06:06:08 +0000 | [diff] [blame] | 113 | </project> |