Guest User

gwt gae ant

a guest
Nov 16th, 2011
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
XML 7.33 KB | None | 0 0
  1. <project name="gwt-base" default="dist" basedir=".">
  2.     <description>
  3.         GWT/GAE build file
  4.     </description>
  5.  
  6.     <property environment="env" />
  7.  
  8.     <!-- Build and dist -->
  9.     <property name="webapp.dir" location="war" />
  10.     <property name="classes" location="${webapp.dir}/WEB-INF/classes" />
  11.     <property name="lib.dir" location="${webapp.dir}/WEB-INF/lib" />
  12.     <property name="devmode.lib.dir" location="lib" />
  13.     <property name="apt.lib.dir" location="apt" />
  14.     <property name="build.dir" location="build" />
  15.     <property name="test.classes" location="${build.dir}/test-classes" />
  16.     <property name="war.file" location="${build.dir}/webapp.war" />
  17.  
  18.     <!-- Source dirs -->
  19.     <property name="src" location="src" />
  20.     <property name="gen" location="gen" />
  21.     <property name="test" location="test" />
  22.     <property name="test.gen" location="${build.dir}/test.gen" />
  23.     <property name="delombok" location="${build.dir}/src" />
  24.     <property name="test.delombok" location="${build.dir}/test" />
  25.  
  26.     <!-- Gwt's classpath -->
  27.     <path id="gwt.classpath">
  28.         <pathelement location="${gwt.home}/gwt-user.jar" />
  29.         <pathelement location="${gwt.home}/gwt-dev.jar" />
  30.         <pathelement location="${gwt.home}/validation-api-1.0.0.GA-sources.jar" />
  31.     </path>
  32.  
  33.     <!-- Appengine's classpath -->
  34.     <path id="gae.classpath">
  35.         <pathelement location="${appengine.home}/lib/appengine-tools-api.jar" />
  36.         <fileset dir="${appengine.home}/lib/tools">
  37.             <include name="**/asm-*.jar" />
  38.             <include name="**/datanucleus-enhancer-*.jar" />
  39.         </fileset>
  40.     </path>
  41.  
  42.     <!-- Compile classpath -->
  43.     <path id="compile.classpath">
  44.         <path refid="gwt.classpath" />
  45.         <fileset dir="${lib.dir}" />
  46.         <fileset dir="${devmode.lib.dir}" />
  47.         <pathelement location="${src}" />
  48.         <pathelement location="${gen}" />
  49.         <pathelement location="${classes}" />
  50.         <pathelement location="${test.classes}" />
  51.     </path>
  52.  
  53.     <!-- Devmode classpath -->
  54.     <path id="run.classpath">
  55.         <path refid="compile.classpath" />
  56.     </path>
  57.  
  58.     <!-- Devmode classpath -->
  59.     <path id="devmode.gae.classpath">
  60.         <path refid="compile.classpath" />
  61.         <path refid="gae.classpath" />
  62.     </path>
  63.  
  64.     <!-- Test classpath -->
  65.     <path id="test.classpath">
  66.         <path refid="compile.classpath" />
  67.         <pathelement location="${test}" />
  68.     </path>
  69.  
  70.     <!-- Apt classpath -->
  71.     <path id="gen.classpath">
  72.         <path refid="compile.classpath" />
  73.         <fileset dir="${apt.lib.dir}" />
  74.     </path>
  75.  
  76.     <!-- Cleans generated folders -->
  77.     <target name="clean" description="Cleaning">
  78.         <delete dir="${classes}" />
  79.         <delete dir="${gen}" />
  80.         <delete dir="${test.classes}" />
  81.         <delete dir="${delombok}" />
  82.         <delete dir="${test.gen}" />
  83.         <delete dir="${build.dir}" />
  84.  
  85.         <mkdir dir="${classes}" />
  86.         <mkdir dir="${gen}" />
  87.         <mkdir dir="${build.dir}" />
  88.         <mkdir dir="${delombok}" />
  89.         <mkdir dir="${test.classes}" />
  90.         <mkdir dir="${test.gen}" />
  91.     </target>
  92.  
  93.     <!-- Copy resources to classpath -->
  94.     <target name="resources" depends="clean">
  95.         <copy todir="${classes}">
  96.             <fileset dir="${src}">
  97.                 <exclude name="**/*.java" />
  98.                 <exclude name="**/*.ui.xml" />
  99.             </fileset>
  100.         </copy>
  101.     </target>
  102.  
  103.     <!-- Run annotation processors -->
  104.     <target name="compile" depends="resources">
  105.         <taskdef classname="lombok.delombok.ant.DelombokTask" classpath="${devmode.lib.dir}/lombok.jar" name="delombok" />
  106.  
  107.         <javac srcdir="${src}:${gen}" fork="true" encoding="UTF-8" classpathref="gen.classpath" includeantruntime="false">
  108.             <compilerarg value="-proc:only" />
  109.             <compilerarg value="-s" />
  110.             <compilerarg path="${gen}" />
  111.         </javac>
  112.  
  113.         <delombok verbose="false" classpathref="compile.classpath" encoding="UTF-8" to="${delombok}" from="${src}" />
  114.  
  115.         <javac srcdir="${delombok}:${gen}" fork="true" destdir="${classes}" encoding="UTF-8" classpathref="compile.classpath" includeantruntime="false">
  116.             <compilerarg value="-proc:none" />
  117.         </javac>
  118.  
  119.         <javac srcdir="${test}" fork="true" encoding="UTF-8" classpathref="gen.classpath" includeantruntime="false">
  120.             <compilerarg value="-proc:only" />
  121.             <compilerarg value="-s" />
  122.             <compilerarg path="${test.gen}" />
  123.         </javac>
  124.  
  125.         <delombok verbose="false" classpathref="test.classpath" encoding="UTF-8" to="${test.delombok}" from="${test}" />
  126.  
  127.         <javac srcdir="${test.delombok}" fork="true" destdir="${test.classes}" encoding="UTF-8" classpathref="compile.classpath" includeantruntime="false">
  128.             <compilerarg value="-proc:none" />
  129.         </javac>
  130.     </target>
  131.  
  132.     <!-- Compiles gwt -->
  133.     <target name="gwt">
  134.         <java classname="com.google.gwt.dev.Compiler" failonerror="true" classpath="${classes}" fork="yes" classpathref="run.classpath">
  135.             <jvmarg line="-Xmx1024m -javaagent:${devmode.lib.dir}/lombok.jar=ECJ" />
  136.             <arg line="-logLevel INFO -war ${webapp.dir} ${gwt.module} -localWorkers 2" />
  137.         </java>
  138.     </target>
  139.  
  140.     <!-- Run tests -->
  141.     <target name="test">
  142.         <junit>
  143.             <classpath refid="test.classpath" />
  144.             <formatter type="brief" usefile="false" />
  145.             <batchtest>
  146.                 <fileset dir="${test.classes}">
  147.                     <include name="**/*Test.class" />
  148.                 </fileset>
  149.             </batchtest>
  150.         </junit>
  151.     </target>
  152.  
  153.     <!-- Copy GWT dependencies -->
  154.     <target name="gwt.jars">
  155.         <copy file="${gwt.home}/gwt-servlet.jar" tofile="${lib.dir}/gwt-servlet.jar" />
  156.         <copy file="${gwt.home}/validation-api-1.0.0.GA.jar" tofile="${lib.dir}/validation-api-1.0.0.GA.jar" />
  157.  
  158.         <copy todir="${lib.dir}" flatten="true">
  159.             <fileset dir="${appengine.home}/lib/user" includes="**/*.jar" />
  160.         </copy>
  161.     </target>
  162.  
  163.     <!-- Copy GAE dependencies -->
  164.     <target name="gae.jars">
  165.         <copy todir="${lib.dir}" flatten="true">
  166.             <fileset dir="${appengine.home}/lib/user" includes="**/*.jar" />
  167.         </copy>
  168.     </target>
  169.  
  170.     <!-- Creates war file -->
  171.     <target name="dist">
  172.         <war destfile="${war.file}" basedir="${webapp.dir}" webxml="${webapp.dir}/WEB-INF/web.xml" />
  173.     </target>
  174.  
  175.     <!-- Runs devmode -->
  176.     <target name="devmode">
  177.         <java failonerror="true" fork="true" classname="com.google.gwt.dev.DevMode" classpathref="run.classpath">
  178.             <jvmarg value="-Dgwt.nowarn.webapp.classpath" />
  179.             <jvmarg value="-Xmx1024m" />
  180.             <jvmarg value="-XX:MaxPermSize=512M" />
  181.             <jvmarg value="-javaagent:${devmode.lib.dir}/lombok.jar=ECJ" />
  182.             <arg value="-logLevel" />
  183.             <arg value="INFO" />
  184.             <arg value="-war" />
  185.             <arg value="${webapp.dir}" />
  186.             <arg value="-startupUrl" />
  187.             <arg value="${gwt.html}" />
  188.             <arg value="${gwt.module}" />
  189.         </java>
  190.     </target>
  191.  
  192.     <!-- Runs devmode with gae -->
  193.     <target name="devmode.gae">
  194.         <java failonerror="true" fork="true" classname="com.google.gwt.dev.DevMode" classpathref="devmode.gae.classpath">
  195.             <jvmarg value="-Dgwt.nowarn.webapp.classpath" />
  196.             <jvmarg value="-Xmx1024m" />
  197.             <jvmarg value="-XX:MaxPermSize=512M" />
  198.             <jvmarg value="-javaagent:${devmode.lib.dir}/lombok.jar=ECJ" />
  199.             <jvmarg value="-javaagent:${appengine.home}/lib/agent/appengine-agent.jar" />
  200.             <arg value="-logLevel" />
  201.             <arg value="INFO" />
  202.             <arg value="-war" />
  203.             <arg value="${webapp.dir}" />
  204.             <arg value="-startupUrl" />
  205.             <arg value="${gwt.html}" />
  206.             <arg value="-server" />
  207.             <arg value="com.google.appengine.tools.development.gwt.AppEngineLauncher" />
  208.             <arg value="${gwt.module}" />
  209.         </java>
  210.     </target>
  211.  
  212.     <target name="deploy">
  213.         <exec executable="${appengine.home}/bin/appcfg.sh">
  214.             <arg value="-e" />
  215.             <arg value="${appengine.email}" />
  216.             <arg value="update" />
  217.             <arg value="war" />
  218.         </exec>
  219.     </target>
  220. </project>
  221.  
  222.  
Advertisement
Add Comment
Please, Sign In to add comment