blob: b4a5dfb7b868c03f9a48c510eab0e1ca4f5958e3 [file] [log] [blame]
gwt.team.scottbab0aa682006-12-06 23:14:19 +00001<project name="common">
2 <property name="test.ant.file" location="${gwt.root}/${project.tail}/build.xml" />
3 <condition property="project.valid">
4 <equals arg1="${ant.file}" arg2="${test.ant.file}" />
5 </condition>
6 <fail unless="project.valid" message="This build file is in an inconsistent state." />
7
8 <!-- Global Properties -->
9 <property environment="env" />
10 <property name="gwt.version" value="${env.GWT_VERSION}" />
11 <property name="gwt.tools" location="${env.GWT_TOOLS}" />
12 <property name="gwt.tools.lib" location="${gwt.tools}/lib" />
13 <property name="gwt.tools.antlib" location="${gwt.tools}/antlib" />
14 <property name="gwt.tools.redist" location="${gwt.tools}/redist" />
15 <property name="gwt.build" location="${gwt.root}/build" />
16 <property name="gwt.build.out" location="${gwt.build}/out" />
17 <property name="gwt.build.lib" location="${gwt.build}/lib" />
18 <property name="gwt.build.jni" location="${gwt.build}/jni" />
19 <property name="gwt.build.staging" location="${gwt.build}/staging" />
20 <property name="gwt.build.dist" location="${gwt.build}/dist" />
21 <property name="project.build" location="${gwt.build.out}/${project.tail}" />
22 <property name="project.lib" location="${gwt.build.lib}/gwt-${ant.project.name}.jar" />
23 <property name="project.jni" location="${gwt.build}/${project.tail}" />
24 <property name="unjar.out" location="${project.build}/unjar" />
25 <property name="javac.out" location="${project.build}/bin" />
26 <property name="javac.debug" value="true" />
27 <property name="javac.debuglevel" value="lines,vars,source" />
28 <property name="javac.source" value="1.4" />
29 <property name="javac.nowarn" value="true" />
30
gwt.team.scottb35e9b0e2006-12-06 23:38:46 +000031 <!-- Sanity check -->
32 <available file="${gwt.tools}" type="dir" property="gwt.tools.exists" />
33 <fail unless="gwt.tools.exists" message="Cannot find '${gwt.tools}' tools directory; perhaps you should define the GWT_TOOLS environment variable" />
34
gwt.team.scottbab0aa682006-12-06 23:14:19 +000035 <!-- Plug-in Tasks -->
36 <taskdef resource="checkstyletask.properties" classpath="${gwt.tools.antlib}/checkstyle-all-4.2.jar" />
37
38 <!-- Global Custom Tasks -->
39 <presetdef name="gwt.javac">
40 <javac srcdir="src" destdir="${javac.out}" classpath="${unjar.out}" debug="${javac.debug}" debuglevel="${javac.debuglevel}" source="${javac.source}" nowarn="${javac.nowarn}" />
41 </presetdef>
42
43 <presetdef name="gwt.jar">
44 <jar destfile="${project.lib}" update="true" duplicate="preserve" index="true" />
45 </presetdef>
46
47 <macrodef name="gwt.untar">
48 <attribute name="src" />
49 <attribute name="dest" />
50 <sequential>
51 <!-- GNU tar handles permissions and symlinks correctly -->
52 <exec executable="tar" failonerror="true">
53 <arg value="-xpzf" />
54 <arg file="@{src}" />
55 <arg value="-C" />
56 <arg file="@{dest}" />
57 </exec>
58 </sequential>
59 </macrodef>
60
gwt.team.scottb35e9b0e2006-12-06 23:38:46 +000061 <target name="antcall.unjar.maybe" unless="unjar.upToDate">
gwt.team.scottbab0aa682006-12-06 23:14:19 +000062 <mkdir dir="${unjar.out}" />
63 <unjar src="${unjar.path}" dest="${unjar.out}" overwrite="true" />
64 <touch file="${unjar.flagFile}" />
65 </target>
66
67 <target name="antcall.unjar">
68 <basename property="unjar.name" file="${unjar.path}" />
69 <property name="unjar.flagFile" value="${project.build}/${unjar.name}.unjar" />
70 <uptodate property="unjar.upToDate" srcfile="${unjar.path}" targetfile="${unjar.flagFile}" />
71 <antcall target="antcall.unjar.maybe" />
72 </target>
73
74 <macrodef name="gwt.unjar">
75 <attribute name="toollib" default="" />
76 <attribute name="path" default="${gwt.tools.lib}/@{toollib}" />
77 <sequential>
78 <antcall target="antcall.unjar">
79 <param name="unjar.path" value="@{path}" />
80 </antcall>
81 </sequential>
82 </macrodef>
83
84 <macrodef name="property.ensure">
85 <attribute name="name" />
86 <attribute name="location" />
87 <sequential>
88 <property name="@{name}" location="@{location}" />
89 <available file="${@{name}}" property="@{name}.exists" />
90 <fail unless="@{name}.exists" message="Cannot find dependency ${@{name}}" />
91 </sequential>
92 </macrodef>
93
94 <presetdef name="gwt.checkstyle">
95 <checkstyle config="${gwt.root}/eclipse/settings/code-style/gwtCheckStyle.xml" maxWarnings="0">
96 <fileset dir="src" />
gwt.team.scottb36f322f2006-12-07 19:49:22 +000097 <property key="checkstyle.header.file" file="${gwt.root}/eclipse/settings/code-style/google.header" />
gwt.team.scottbab0aa682006-12-06 23:14:19 +000098
99 <!-- Location of cache-file if we decide to try turning it on -->
100 <!--
101 <property key="checkstyle.cache.file" file="target/cachefile" />
102 -->
103 </checkstyle>
104 </presetdef>
gwt.team.scottb36f322f2006-12-07 19:49:22 +0000105
106 <!-- Default implementations of the required targets; projects should
107 override the ones that matter -->
108 <target name="all" depends="verify" />
109 <target name="verify" depends="checkstyle, test" description="Verify this project" />
110 <target name="checkstyle" description="Static analysis of source" />
111 <target name="test" depends="build" description="Test this project" />
112 <target name="build" description="Build and (maybe) package this project" />
113
114 <target name="clean" description="Cleans this project's intermediate and output files">
115 <delete dir="${project.build}" />
116 </target>
117
gwt.team.scottbab0aa682006-12-06 23:14:19 +0000118</project>