blob: 8431484132c97111a22492a8954070dd4ee30fdc [file] [log] [blame]
Richard S. Hall85bafab2009-07-13 13:25:46 +00001<?xml version="1.0">
2<!--
3 Licensed to the Apache Software Foundation (ASF) under one
4 or more contributor license agreements. See the NOTICE file
5 distributed with this work for additional information
6 regarding copyright ownership. The ASF licenses this file
7 to you under the Apache License, Version 2.0 (the
8 "License"); you may not use this file except in compliance
9 with the License. You may obtain a copy of the License at
10
11 http://www.apache.org/licenses/LICENSE-2.0
12
13 Unless required by applicable law or agreed to in writing,
14 software distributed under the License is distributed on an
15 "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 KIND, either express or implied. See the License for the
17 specific language governing permissions and limitations
18 under the License.
19-->
20<project name="common"
21 xmlns:ivy="antlib:org.apache.ivy.ant">
22
23 <dirname property="common.dir" file="${ant.file.common}"/>
24 <property file="${common.dir}/build.properties"/>
25
26 <path id="lib.path.id">
27 <fileset dir="${deps.dir}" />
28 </path>
29
30 <path id="sigil.path.id">
31 <path refid="lib.path.id" />
32 <path location="${classes.dir}" />
33 </path>
34
35 <!-- setup ivy default configuration with some custom info -->
36 <property name="ivy.local.default.root" value="${repository.dir}/local"/>
37 <property name="ivy.shared.default.root" value="${repository.dir}/shared"/>
38
39 <!-- =================================
40 target: load-ivy
41 ================================= -->
42 <target name="load-ivy" depends="ivy-taskdefs">
43 <ivy:settings file="${common.dir}/ivysettings.xml" />
44 </target>
45
46 <!-- =================================
47 target: ivy-taskdefs
48 ================================= -->
49 <target name="ivy-taskdefs" unless="ivy.loaded">
50 <property name="ivy.loaded" value="true"/>
51 <echo message="Loading Ivy ... common.dir=${common.dir}"/>
52
53 <taskdef resource="org/apache/ivy/ant/antlib.xml"
54 uri="antlib:org.apache.ivy.ant"
55 classpath="${ivy.jar}"/>
56
57 <taskdef name="sigil.bundle"
58 classname="org.cauldron.bld.ant.BundleTask"
59 classpath="${sigil-ivy-plugin.jar}"/>
60 </target>
61
62
63
64 <!-- =================================
65 target: build (default target)
66 ================================= -->
67 <target name="build" depends="ident, jar, resources" />
68
69 <target name="ident">
70 <echo message="${ant.project.name}"/>
71 </target>
72
73 <!-- =================================
74 target: resolve
75 ================================= -->
76 <target name="resolve" depends="load-ivy, clean-deps"
77 description="--> resolve and retrieve dependencies with ivy">
78 <mkdir dir="${deps.dir}"/>
79 <ivy:resolve file="${ivy.file}"/>
80 <ivy:retrieve pattern="${deps.dir}/[artifact].[ext]" />
81 </target>
82
83 <!-- =================================
84 target: install
85 ================================= -->
86 <target name="install" depends="install-version, build"
87 description="--> publish this project in the local repository">
88 <ivy:publish artifactspattern="${dest.lib.dir}/[artifact].[ext]"
89 resolver="local"
90 pubrevision="${version}"
91 pubdate="${now}"
92 forcedeliver="true"
93 status="integration"/>
94 <echo message="project ${ant.project.name} published locally with version ${version}" />
95 </target>
96
97 <target name="install-version">
98 <tstamp>
99 <format property="now" pattern="yyyyMMddHHmmss"/>
100 </tstamp>
101 <property name="version"
102 value="${module.version.target}-local-${now}"/>
103 </target>
104
105 <!-- =================================
106 target: report
107 ================================= -->
108 <target name="report" depends="resolve"
109 description="--> generates a report of dependencies">
110 <ivy:report todir="${build.dir}"/>
111 </target>
112
113 <!-- =================================
114 target: compile
115 ================================= -->
116 <target name="compile" depends="resolve"
117 description="--> compile the project">
118 <mkdir dir="${classes.dir}" />
119 <javac srcdir="${src.dir}"
120 destdir="${classes.dir}"
121 classpathref="lib.path.id"
122 target="1.5"
123 debug="true" />
124 </target>
125
126 <!-- =================================
127 target: jar
128 ================================= -->
129 <target name="jar" depends="compile"
130 description="--> make a jar file for this project">
131 <mkdir dir="${dest.lib.dir}"/>
132 <sigil.bundle destpattern="${dest.lib.dir}/[id].[ext]"
133 classpathref="sigil.path.id"/>
134 </target>
135
136 <!-- =================================
137 target: resources
138 ================================= -->
139 <available file="${resource.dir}" type="dir"
140 property="resource.dir.present"/>
141
142 <target name="resources" if="resource.dir.present"
143 description="--> filter xml resources replacing ${VERSION} etc.">
144 <mkdir dir="${dest.etc.dir}"/>
145 <copy todir="${dest.etc.dir}">
146 <fileset dir="${resource.dir}">
147 <include name="*.composite"/>
148 <include name="*.system"/>
149 </fileset>
150 <filterset begintoken="$${" endtoken="}">
151 <filter token="VERSION" value="${bundle.version}"/>
152 <filter token="BLITZ_VERSION" value="${blitz.version}"/>
153 <filter token="JINI_VERSION" value="${jini.version}"/>
154 </filterset>
155 </copy>
156 </target>
157
158 <!-- =================================
159 target: clean-local
160 ================================= -->
161 <target name="clean-local"
162 description="--> cleans the local repository for the current module">
163 <delete dir="${ivy.local.default.root}/${ant.project.name}"/>
164 </target>
165
166 <!-- =================================
167 target: clean-deps
168 ================================= -->
169 <target name="clean-deps"
170 description="--> clean the project libraries directory (dependencies)">
171 <delete includeemptydirs="true" dir="${deps.dir}"/>
172 </target>
173
174 <!-- =================================
175 target: clean-build
176 ================================= -->
177 <target name="clean-build"
178 description="--> clean the project built files">
179 <delete includeemptydirs="true" dir="${build.dir}"/>
180 </target>
181
182 <!-- =================================
183 target: clean
184 ================================= -->
185 <target name="clean" depends="clean-build, clean-deps"
186 description="--> clean the project" />
187
188
189 <!-- =================================
190 target: buildlist
191 ================================= -->
192 <fileset id="projects" dir="${basedir}" includes="**/build.xml"/>
193
194 <target name="buildlist" depends="load-ivy">
195 <ivy:buildlist reference="ordered-list"
196 onMissingDescriptor="skip">
197 <fileset refid="projects"/>
198 </ivy:buildlist>
199 </target>
200
201 <!-- =================================
202 target: install-list
203 ================================= -->
204 <target name="install-list" depends="buildlist"
205 description="--> compile, jar and install all projects in the right order">
206 <subant target="install" buildpathref="ordered-list">
207 <propertyset>
208 <propertyref name="ivy.loaded" />
209 </propertyset>
210 </subant>
211 </target>
212
213 <!-- =================================
214 target: clean-list
215 ================================= -->
216 <target name="clean-list" depends="clean, buildlist"
217 description="--> clean all projects">
218 <subant target="clean" buildpathref="ordered-list" />
219 </target>
220
221 <!-- =================================
222 target: clean-all
223 ================================= -->
224 <target name="clean-all" depends="clean-list"
225 description="--> delete repository, ivy cache, and all projects">
226 <delete dir="${repository.dir}"/>
227 <ivy:cleancache />
228 </target>
229
230</project>