| <project name="common"> | |
| <property name="test.ant.file" location="${gwt.root}/${project.tail}/build.xml" /> | |
| <condition property="project.valid"> | |
| <equals arg1="${ant.file}" arg2="${test.ant.file}" /> | |
| </condition> | |
| <fail unless="project.valid" message="This build file is in an inconsistent state." /> | |
| <!-- Global Properties --> | |
| <property environment="env" /> | |
| <property name="gwt.version" value="${env.GWT_VERSION}" /> | |
| <property name="gwt.tools" location="${env.GWT_TOOLS}" /> | |
| <property name="gwt.tools.lib" location="${gwt.tools}/lib" /> | |
| <property name="gwt.tools.antlib" location="${gwt.tools}/antlib" /> | |
| <property name="gwt.tools.redist" location="${gwt.tools}/redist" /> | |
| <property name="gwt.build" location="${gwt.root}/build" /> | |
| <property name="gwt.build.out" location="${gwt.build}/out" /> | |
| <property name="gwt.build.lib" location="${gwt.build}/lib" /> | |
| <property name="gwt.build.jni" location="${gwt.build}/jni" /> | |
| <property name="gwt.build.staging" location="${gwt.build}/staging" /> | |
| <property name="gwt.build.dist" location="${gwt.build}/dist" /> | |
| <property name="project.build" location="${gwt.build.out}/${project.tail}" /> | |
| <property name="project.lib" location="${gwt.build.lib}/gwt-${ant.project.name}.jar" /> | |
| <property name="project.jni" location="${gwt.build}/${project.tail}" /> | |
| <property name="unjar.out" location="${project.build}/unjar" /> | |
| <property name="javac.out" location="${project.build}/bin" /> | |
| <property name="javac.debug" value="true" /> | |
| <property name="javac.debuglevel" value="lines,vars,source" /> | |
| <property name="javac.source" value="1.4" /> | |
| <property name="javac.nowarn" value="true" /> | |
| <!-- Sanity check --> | |
| <available file="${gwt.tools}" type="dir" property="gwt.tools.exists" /> | |
| <fail unless="gwt.tools.exists" message="Cannot find '${gwt.tools}' tools directory; perhaps you should define the GWT_TOOLS environment variable" /> | |
| <!-- Global Custom Tasks --> | |
| <presetdef name="gwt.javac"> | |
| <javac srcdir="src" destdir="${javac.out}" classpath="${unjar.out}" debug="${javac.debug}" debuglevel="${javac.debuglevel}" source="${javac.source}" nowarn="${javac.nowarn}" /> | |
| </presetdef> | |
| <presetdef name="gwt.jar"> | |
| <jar destfile="${project.lib}" update="true" duplicate="preserve" index="true" /> | |
| </presetdef> | |
| <macrodef name="gwt.untar"> | |
| <attribute name="src" /> | |
| <attribute name="dest" /> | |
| <sequential> | |
| <!-- GNU tar handles permissions and symlinks correctly --> | |
| <exec executable="tar" failonerror="true"> | |
| <arg value="-xpzf" /> | |
| <arg file="@{src}" /> | |
| <arg value="-C" /> | |
| <arg file="@{dest}" /> | |
| </exec> | |
| </sequential> | |
| </macrodef> | |
| <target name="antcall.unjar.maybe" unless="unjar.upToDate"> | |
| <mkdir dir="${unjar.out}" /> | |
| <unjar src="${unjar.path}" dest="${unjar.out}" overwrite="true" /> | |
| <touch file="${unjar.flagFile}" /> | |
| </target> | |
| <target name="antcall.unjar"> | |
| <basename property="unjar.name" file="${unjar.path}" /> | |
| <property name="unjar.flagFile" value="${project.build}/${unjar.name}.unjar" /> | |
| <uptodate property="unjar.upToDate" srcfile="${unjar.path}" targetfile="${unjar.flagFile}" /> | |
| <antcall target="antcall.unjar.maybe" /> | |
| </target> | |
| <macrodef name="gwt.unjar"> | |
| <attribute name="toollib" default="" /> | |
| <attribute name="path" default="${gwt.tools.lib}/@{toollib}" /> | |
| <sequential> | |
| <antcall target="antcall.unjar"> | |
| <param name="unjar.path" value="@{path}" /> | |
| </antcall> | |
| </sequential> | |
| </macrodef> | |
| <macrodef name="property.ensure"> | |
| <attribute name="name" /> | |
| <attribute name="location" /> | |
| <sequential> | |
| <property name="@{name}" location="@{location}" /> | |
| <available file="${@{name}}" property="@{name}.exists" /> | |
| <fail unless="@{name}.exists" message="Cannot find dependency ${@{name}}" /> | |
| </sequential> | |
| </macrodef> | |
| <macrodef name="gwt.checkstyle"> | |
| <element name="sourcepath" implicit="yes" optional="true"/> | |
| <sequential> | |
| <taskdef resource="checkstyletask.properties" classpath="${gwt.tools.antlib}/checkstyle-all-4.2.jar;${gwt.build.lib}/gwt-customchecks.jar" /> | |
| <checkstyle config="${gwt.root}/eclipse/settings/code-style/gwtCheckStyle.xml" maxWarnings="0"> | |
| <property key="checkstyle.header.file" file="${gwt.root}/eclipse/settings/code-style/google.header" /> | |
| <sourcepath /> | |
| </checkstyle> | |
| </sequential> | |
| </macrodef> | |
| <!-- Default implementations of the required targets; projects should | |
| override the ones that matter --> | |
| <target name="all" depends="verify" /> | |
| <target name="verify" depends="checkstyle, test" description="Verify this project" /> | |
| <target name="checkstyle" description="Static analysis of source" /> | |
| <target name="test" depends="build" description="Test this project" /> | |
| <target name="build" description="Build and (maybe) package this project" /> | |
| <target name="clean" description="Cleans this project's intermediate and output files"> | |
| <delete dir="${project.build}" /> | |
| </target> | |
| </project> |