source: trunk/build.xml @ 532

Last change on this file since 532 was 104, checked in by gav, 15 years ago

Move /trunk/src/* to /trunk/

File size: 5.0 KB
Line 
1<project xmlns:ivy="antlib:org.apache.ivy.ant" name="gnumims" default="test">
2    <property environment="env"/>
3        <property name="ivy.install.version" value="2.0.0" />
4    <condition property="ivy.home" value="${env.IVY_HOME}">
5      <isset property="env.IVY_HOME" />
6    </condition>
7    <property name="ivy.home" value="${user.home}/.ant" />
8    <property name="ivy.jar.dir" value="${ivy.home}/lib" />
9    <property name="ivy.jar.file" value="${ivy.jar.dir}/ivy-${ivy.install.version}.jar" />
10
11    <target name="download-ivy" unless="offline">
12                <available file="${ivy.jar.file}" property="ivy.available"/>
13                <antcall target="-download-ivy" />
14    </target>
15
16        <target name="-download-ivy" unless="ivy.available">
17        <mkdir dir="${ivy.jar.dir}"/>
18        <!-- download Ivy from web site so that it can be used even without any special installation -->
19        <get src="http://www.apache.org/dist/ant/ivy/${ivy.install.version}/apache-ivy-${ivy.install.version}-bin.zip"
20            dest="${ivy.home}/ivy.zip" usetimestamp="true" verbose="true"/>
21            <unzip src="${ivy.home}/ivy.zip" dest="${ivy.jar.dir}">
22                   <patternset>
23                        <include name="**/*.jar"/>
24                    </patternset>
25                        <mapper type="flatten"/>
26                </unzip>
27        </target>
28
29    <target name="init-ivy" depends="download-ivy" unless="ivy.lib.path">
30      <!-- try to load ivy here from ivy home, in case the user has not already dropped
31              it into ant's lib dir (note that the latter copy will always take precedence).
32              We will not fail as long as local lib dir exists (it may be empty) and
33              ivy is in at least one of ant's lib dir or the local lib dir. -->
34        <path id="ivy.lib.path">
35            <fileset dir="${ivy.jar.dir}" includes="*.jar"/>
36        </path>
37        <taskdef resource="org/apache/ivy/ant/antlib.xml"
38                 uri="antlib:org.apache.ivy.ant" classpathref="ivy.lib.path"/>
39    </target>
40
41
42    <property name="lib.dir" value="${basedir}/lib"/>
43
44    <macrodef name="grails">
45        <attribute name="script"/>
46        <attribute name="args" default="" />
47        <sequential>
48            <grailsTask script="@{script}" args="@{args}" classpathref="grails.classpath">
49                <compileClasspath refid="compile.classpath"/>
50                <testClasspath refid="test.classpath"/>
51                <runtimeClasspath refid="app.classpath"/>
52            </grailsTask>
53        </sequential>
54    </macrodef>
55
56    <!-- =================================
57          target: resolve
58         ================================= -->
59    <target name="-resolve" description="--> Retrieve dependencies with ivy" depends="init-ivy">
60        <ivy:retrieve pattern="${lib.dir}/[conf]/[artifact]-[revision].[ext]"/>
61    </target>
62
63    <target name="-init-grails" depends="-resolve">
64        <path id="grails.classpath">
65            <fileset dir="${lib.dir}/build"/>
66        </path>
67
68        <path id="compile.classpath">
69            <fileset dir="${lib.dir}/compile"/>
70        </path>
71
72        <path id="test.classpath">
73            <fileset dir="${lib.dir}/test"/>
74        </path>
75
76        <path id="app.classpath">
77            <fileset dir="${lib.dir}/runtime"/>
78        </path>
79
80        <taskdef name="grailsTask"
81                 classname="grails.ant.GrailsTask"
82                 classpathref="grails.classpath"/>
83    </target>
84
85    <target name="deps-report" depends="-resolve" description="--> Generate report of module dependencies.">
86        <ivy:report conf="*"/>
87    </target>
88
89    <!-- =================================
90          target: clean
91         ================================= -->
92    <target name="clean" depends="-init-grails" description="--> Cleans a Grails application">
93        <grails script="Clean"/>
94        <delete dir="${lib.dir}" includes="**/*"/>
95    </target>
96
97    <!-- =================================
98          target: compile
99         ================================= -->
100    <target name="compile" depends="-init-grails" description="--> Compiles a Grails application">
101        <grails script="Compile"/>
102    </target>
103
104    <!-- =================================
105          target: war
106         ================================= -->
107    <target name="war" depends="-init-grails" description="--> Creates a WAR of a Grails application">
108        <grails script="War"/>
109    </target>
110
111    <!-- =================================
112          target: test
113         ================================= -->
114    <target name="test" depends="-init-grails" description="--> Run a Grails applications unit tests">
115        <grails script="TestApp"/>
116    </target>
117
118    <!-- =================================
119          target: run
120         ================================= -->
121    <target name="run" depends="-init-grails" description="--> Runs a Grails application using embedded Jetty">
122        <grails script="RunApp"/>
123    </target>
124
125    <!-- =================================
126          target: deploy
127         ================================= -->
128    <target name="deploy" depends="war" description="--> The deploy target (initially empty)">
129        <!-- TODO -->
130    </target>
131</project>
Note: See TracBrowser for help on using the repository browser.