build.properties
gwt.path=c:/gwt-windows-1.7.1
build.dir=c:/build
build.xml
<project name="projectname" default="compile-all" basedir=".">
<property file="build.properties"/>
<property name="war.name" value="projectname.war"/>
<property name="gwt.module.name" value="com.projectname.Main"/>
<property name="proj.web-inf.dir" value="${basedir}/WebContent/WEB-INF"/>
<property name="proj.src.dir" value="${basedir}/src"/>
<property name="proj.lib.dir" value="${proj.web-inf.dir}/lib"/>
<property name="build.deploy.dir" value="${build.dir}"/>
<property name="build.deploy.classes.dir" value="${build.deploy.dir}/${gwt.module.name}/WEB-INF/classes"/>
<path id="classpath">
<pathelement location="${gwt.path}/gwt-user.jar"/>
<pathelement location="${gwt.path}/gwt-dev-windows.jar"/>
<pathelement location="${proj.src.dir}"/>
<fileset dir="${proj.lib.dir}">
<include name="**/*.jar"/>
</fileset>
</path>
<target name="init">
<echo message="=========================================="/>
<echo message="OS Name: ${os.name} "/>
<echo message="Java Home: ${java.home} "/>
<echo message="Ant java version: ${ant.java.version} "/>
<echo message="Java vendor: ${java.vendor} "/>
<echo message="Java Version: ${java.version} "/>
<echo message="=========================================="/>
</target>
<target name="clean-deploy">
<delete dir="${build.deploy.dir}/${gwt.module.name}"/>
<delete dir="${build.deploy.dir}/${gwt.module.name}-aux"/>
<delete dir="${build.deploy.dir}/${war.name}"/>
</target>
<target name="compile-to-js" depends="init" description="Compiles client code and generates relevent JavaScripts">
<java classname="com.google.gwt.dev.GWTCompiler" fork="true">
<classpath refid="classpath"/>
<jvmarg value="-Xmx1G" />
<jvmarg value="-Xss1024k"/>
<jvmarg value="-Xms64M"/>
<jvmarg value="-Dgwt.nowarn.legacy.tools"/>
<arg value="-out"/>
<arg value="${build.deploy.dir}"/>
<arg value="-localWorkers"/>
<arg value="5"/>
<arg value="${gwt.module.name}"/>
<arg value="-style"/>
<arg value="pretty"/>
</java>
<delete dir="${build.deploy.dir}/${gwt.module.name}-aux"/>
</target>
<target name="compile">
<echo message="=========================================="/>
<echo message="Compiling source files… "/>
<echo message="=========================================="/>
<mkdir dir="${build.deploy.classes.dir}"/>
<javac destdir="${build.deploy.classes.dir}"
excludes="**/client/*.java"
classpathref="classpath"
verbose="off"
debug="on"
deprecation="false">
<src path="${proj.src.dir}"/>
</javac>
<echo message="=========================================="/>
<echo message="Copying application files… "/>
<echo message="=========================================="/>
<copy todir="${build.deploy.classes.dir}">
<fileset dir="${proj.src.dir}" includes="**/*.xml"/>
<fileset dir="${proj.src.dir}" includes="**/*.properties"/>
</copy>
</target>
<target name="copy-web-content" description="Copies WebContent contents to WAR">
<echo message="=========================================="/>
<echo message="Copying Web content files… "/>
<echo message="=========================================="/>
<copy todir="${build.deploy.dir}/${gwt.module.name}">
<fileset dir="${basedir}/WebContent">
</fileset>
</copy>
</target>
</project>
No comments:
Post a Comment