root/branches/restlet-annotations/build.xml

Revision 2800, 5.0 kB (checked in by michael, 5 years ago)

Some tidy ups

Line 
1 <project name="xtc" default="help" xmlns:ivy="antlib:org.apache.ivy.ant">
2         <!-- Sarugo common ant configuration -->
3         <property name="ant.lib.dir" value="ant" />
4         <property name="ant.server" value="http://ant.sarugo.org" />
5         <property name="sarugo.ant.file" value="${ant.lib.dir}/common-build.xml" />
6         <!-- Ivy configuration -->
7         <property name="ivy.server" value="${ant.server}/ivy" />
8         <property name="ivy.version" value="2.0.0-alpha-1-incubating" />
9         <property name="ivy.dest.file" value="${ant.lib.dir}/ivy-${ivy.version}.jar" />
10         <condition property="download-ivy.required">
11                 <not>
12                         <available file="${ivy.dest.file}" type="file" />
13                 </not>
14         </condition>
15         <!-- Project directories -->
16         <property name="src.dir" value="src" />
17         <property name="build.dir" value="build" />
18         <property name="dist.dir" value="dist" />
19         <property name="lib.dir" value="lib" />
20         <condition property="bootstrap.required">
21                 <not>
22                         <and>
23                                 <available file="${ant.lib.dir}" type="dir" />
24                                 <available file="${lib.dir}" type="dir" />
25                         </and>
26                 </not>
27         </condition>
28
29         <target name="download-ivy" if="download-ivy.required">
30                 <!-- download Ivy from web site so that it can be used even without any special installation -->
31                 <get src="${ivy.server}/${ivy.version}/ivy-${ivy.version}.jar" dest="${ivy.dest.file}" usetimestamp="true" />
32         </target>
33
34         <target name="bootstrap" description="Downloads common ant scripts and libraries">
35                 <mkdir dir="${ant.lib.dir}" />
36                 <antcall target="download-ivy" />
37                 <path id="ivy.lib.path">
38                         <fileset file="${ivy.dest.file}" />
39                 </path>
40                 <taskdef resource="org/apache/ivy/ant/antlib.xml" uri="antlib:org.apache.ivy.ant" classpathref="ivy.lib.path" />
41                 <ivy:configure file="ivysettings.xml" />
42                 <ivy:resolve file="ivy.xml" />
43                 <ivy:retrieve pattern="${lib.dir}/[artifact]-[revision].[ext]" />
44         </target>
45
46         <target name="init" if="bootstrap.required">
47                 <fail message="You need to run ant bootstrap" />
48         </target>
49
50         <target name="compile" depends="init" description="Compile the library">
51                 <mkdir dir="${build.dir}/main/java" />
52                 <javac source="1.5" target="1.5" destdir="${build.dir}/main/java">
53                         <src path="${src.dir}/main/java" />
54                         <classpath>
55                                 <dirset dir="${build.dir}">
56                                         <include name="main/*" />
57                                 </dirset>
58                                 <fileset dir="${lib.dir}" includes="**/*.jar" />
59                         </classpath>
60                 </javac>
61                 <copy todir="${build.dir}/main">
62                         <fileset dir="${src.dir}/main" excludes="java/**"/>
63                 </copy>
64         </target>
65
66         <target name="test" depends="compile" description="Build and run unit tests">
67                 <mkdir dir="${build.dir}/test/java" />
68                 <javac source="1.5" target="1.5" destdir="${build.dir}/test/java">
69                         <src path="${src.dir}/test/java" />
70                         <classpath>
71                                 <dirset dir="${build.dir}">
72                                         <include name="main/*" />
73                                         <include name="test/*" />
74                                 </dirset>
75                                 <fileset dir="${lib.dir}" includes="**/*.jar" />
76                         </classpath>
77                 </javac>
78                 <copy todir="${build.dir}/test">
79                         <fileset dir="${src.dir}/test" excludes="java/**"/>
80                 </copy>
81                 <junit printsummary="on">
82                         <classpath>
83                                 <dirset dir="${build.dir}">
84                                         <include name="main/*" />
85                                         <include name="test/*" />
86                                 </dirset>
87                                 <fileset dir="${lib.dir}" includes="**/*.jar" />
88                         </classpath>
89                         <batchtest>
90                                 <fileset dir="${src.dir}/test/java">
91                                         <include name="**/*Tests.java" />
92                                 </fileset>
93                         </batchtest>
94                 </junit>
95         </target>
96
97         <target name="package" depends="compile" description="Build distribution files">
98                 <mkdir dir="${dist.dir}" />
99                 <jar destfile="${dist.dir}/xtc.jar">
100                         <fileset dir="${build.dir}/main/java" />
101                         <fileset dir="${build.dir}/main/resources" />
102                 </jar>
103                 <!-- Use ivy to copy the runtime dependencies to distribution directory -->
104                 <path id="ivy.lib.path">
105                         <fileset file="${ivy.dest.file}" />
106                 </path>
107                 <taskdef resource="org/apache/ivy/ant/antlib.xml" uri="antlib:org.apache.ivy.ant" classpathref="ivy.lib.path" />
108                 <ivy:configure file="ivysettings.xml" />
109                 <ivy:resolve file="ivy.xml" />
110                 <ivy:retrieve pattern="${dist.dir}/[artifact]-[revision].[ext]" conf="default" />
111         </target>
112
113         <target name="integration-test" depends="package" description="Test distribution files">
114         </target>
115        
116         <target name="publish" depends="package" description="Publish distribution to repository">
117                 <ivy:publish resolver="local" artifactspattern="${dist.dir}/[artifact].[ext]" />
118         </target>
119
120         <target name="clean" description="Clean the project built files (not dist)">
121                 <delete includeemptydirs="true" failonerror="false">
122                         <fileset dir="${build.dir}" />
123                 </delete>
124         </target>
125
126         <target name="clean-dist" depends="clean" description="Clean compiled, packaged and downloaded library files">
127                 <delete includeemptydirs="true" failonerror="false">
128                         <fileset dir="${dist.dir}" />
129                 </delete>
130         </target>
131
132         <target name="clean-all" depends="clean-dist" description="Clean all generated (or downloaded) files">
133                 <delete includeemptydirs="true" failonerror="false">
134                         <fileset dir="${ant.lib.dir}" />
135                         <fileset dir="${lib.dir}" />
136                 </delete>
137         </target>
138
139         <target name="help">
140                 <echo message="Run ant -p to see a list of targets." />
141                 <echo message="Most likely you want to test or package." />
142         </target>
143
144 </project>
Note: See TracBrowser for help on using the browser.