sventon subversion web client - http://www.sventon.org
[show recent changes]
 
  Help
HEAD
Rev: 53206 - http://anonsvn.icesoft.org/repo / icepush / branches / icepush-2.0.x-maintenance / build-common.xml
Show File - build-common.xml  [show properties]
spinner
<!--
 *
 * Version: MPL 1.1
 *
 * "The contents of this file are subject to the Mozilla Public License
 * Version 1.1 (the "License"); you may not use this file except in
 * compliance with the License. You may obtain a copy of the License at
 * http://www.mozilla.org/MPL/
 *
10   * Software distributed under the License is distributed on an "AS IS"
11   * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
12   * License for the specific language governing rights and limitations under
13   * the License.
14   *
15   * The Initial Developer of the Original Code is ICEsoft
16   * Technologies Canada, Corp. Portions created by ICEsoft are Copyright (C)
17   * 2004-2010 ICEsoft Technologies Canada, Corp. All Rights Reserved.
18   *
19   * Contributor(s): _____________________.
20   *
21   *
22  -->
23  <project name="ICEpush integration common builds">
24 
25      <fileset id="dist.icepush.jar" file="${dist.dir}/icepush.jar" />
26 
27      <property file="./build.properties" />
28      
29      <!-- Check if release.type is set, and if so append it after the tertiary value -->
30      <condition property="version.string" value="${version.primary}.${version.secondary}.${version.tertiary}.${release.type}">
31          <isset property="release.type"/>
32      </condition>
33      <property name="version.string" value="${version.primary}.${version.secondary}.${version.tertiary}"/>
34     
35 
36      <fileset id="icepush.dist" dir="${root.offset}/core/${dist.dir}">
37          <include name="icepush.jar" />
38      </fileset>
39      
40      <tstamp>
41          <format property="build.time" pattern="yyyy-mm-dd hh:mm:ss aa" />
42      </tstamp>
43 
44      <macrodef name="clean">
45          <element name="add.filesets" optional="true" />
46          <sequential>
47              <delete failonerror="false" includeEmptyDirs="true">
48                  <fileset dir="${build.dir}" />
49                  <fileset dir="${dist.dir}" />
50                  <add.filesets/>
51              </delete>
52          </sequential>
53      </macrodef>
54      
55      <target name="clean">
56          <echo>Cleaning ${ant.project.name}...</echo>
57          <clean/>
58      </target>
59 
60      <target name="pre.compile" description="prepare for compilation" depends="clean">
61          <mkdir dir="${build.dir}" />
62          <mkdir dir="${build.dir}/classes" />
63          <mkdir dir="${dist.dir}" />
64      </target>
65      
66      <target name="compile" depends="pre.compile">
67          <icepush.available/>
68          <compile/>
69      </target>
70      
71      <target name="jar" depends="compile">
72          <build.jar/>    
73      </target>
74 
75      <macrodef name="compile">
76          <attribute name="src.copy.excludes" default="**/*.java" />
77          <attribute name="failonerror" default="true" />
78          <attribute name="src.javac.excludes" default="" />
79          <attribute name="compile.target" default="1.5" />
80          <attribute name="compile.source" default="1.5" />
81          <attribute name="compile.debug" default="true" />
82          <attribute name="compile.debuglevel" default="lines,vars,source"/>
83          <attribute name="src.dir" default="${java.dir}"/>
84          
85          <element name="add.javac.elements" optional="true" />
86          <element name="add.classpath.elements" optional="true" />
87 
88          <sequential>
89              <echo>Compiling ${ant.project.name}...</echo>
90              <mkdir dir="${java.dir}" />
91              <mkdir dir="${build.dir}/classes" />
92 
93              <javac destdir="${classes.dir}" sourcepath="" 
94                  source="@{compile.source}" 
95                  target="@{compile.target}" 
96                  debug="@{compile.debug}" 
97                  debuglevel="@{compile.debuglevel}"
98                  failonerror="@{failonerror}">
99                  
100                  <src location="@{src.dir}" />
101                  <include name="**/*.java" />
102                  <exclude name="@{src.javac.excludes}" />
103                  <classpath>
104                      <fileset refid="icepush.dist" />
105                      <fileset dir="${root.offset}/${lib.dir}" />
106                      <add.classpath.elements />
107                  </classpath>
108                  <add.javac.elements />
109                  
110              </javac>
111 
112              <copy todir="${build.dir}/classes" preservelastmodified="true">
113                  <fileset dir="${java.dir}" excludes="@{src.copy.excludes}" />
114              </copy>
115 
116          </sequential>
117      </macrodef>
118 
119      <macrodef name="build.jar">
120          <attribute name="jar.file.name" default="${ant.project.name}.jar" />
121          <element name="add.excludes" optional="true" />
122          <element name="add.filesets" optional="true" />
123 
124          <sequential>
125              <echo>Jarring ${ant.project.name}...</echo>
126              <delete file="${dist.dir}/@{jar.file.name}" />
127              <mkdir dir="${dist.dir}" /> 
128              <mkdir dir="${build.dir}/jar"/>     
129              <copy todir="${build.dir}/jar">
130                  <fileset dir="${classes.dir}">
131                      <include name="**/*"/>
132                      <add.excludes />
133                  </fileset>
134              </copy>
135              <copy todir="${build.dir}/jar">
136                  <fileset dir="${java.dir}">
137                      <include name="src/**" />
138                      <include name="*.xml" />
139                      <include name="*.properties" />
140                  </fileset>
141              </copy>
142              
143              <copy todir="${build.dir}/jar/META-INF" failonerror="false" >
144                  <fileset dir="${meta.dir}">
145                      <include name="*.*"/>
146                  </fileset>
147              </copy>
148 
149              <!-- Check if core.groupId is set, and if so use it instead of default groupId -->
150              <condition property="jar.groupId" value="${core.groupId}">
151                  <isset property="core.groupId"/>
152              </condition>
153              <property name="jar.groupId" value="${groupId}"/>
154          
155              <jar destfile="${dist.dir}/@{jar.file.name}" duplicate="fail">
156                  <fileset dir="${build.dir}/jar">
157                      <include name="**/*"></include>
158                  </fileset>
159                  <fileset dir="${java.dir}" includes="**/*.java"/>
160                  <add.filesets/>
161                  <manifest>
162                      <section name="${jar.groupId}">
163                          <attribute name="Implementation-Title"
164                                     value="${product}"/>
165                          <attribute name="Implementation-Version"
166                                     value="${version.string}"/>
167                          <attribute name="Build-Number"
168                                     value="${build.number}"/>
169                          <attribute name="Build-Time"
170                                     value="${build.time}"/>
171                          <attribute name="Implementation-Vendor"
172                                     value="${company}"/>
173                      </section>
174                  </manifest>
175              </jar>          
176          </sequential>
177      </macrodef>
178 
179      <macrodef name="build.war">
180          <attribute name="war.file.name" default="${ant.project.name}.war" />
181          <attribute name="web.xml" default="${web.inf.dir}/web.xml" />
182          <element name="add.filesets" optional="true" />
183          <element name="add.libs" optional="true" />
184 
185          <sequential>
186              <echo>Building war @{war.file.name}...</echo>
187              <mkdir dir="${dist.dir}" />
188              <mkdir dir="${build.dir}/webapp" />
189              <copy todir="${build.dir}/webapp" preservelastmodified="true">
190                  <fileset dir="${web.dir}">
191                      <include name="**" />
192                  </fileset>
193              </copy>
194              <icepush.available/>
195              <copy todir="${build.dir}/webapp/WEB-INF/lib" preservelastmodified="true">
196                  <fileset refid="icepush.dist"/>
197                  <add.libs />
198              </copy>
199              <mkdir dir="${build.dir}/webapp/WEB-INF/classes" />
200              <copy todir="${build.dir}/webapp/WEB-INF/classes" preservelastmodified="true">
201                  <fileset dir="${build.dir}/classes">
202                      <include name="**" />
203                  </fileset>
204              </copy>
205              
206              <antcall target="-pre.war.replace"/>
207              
208              <war basedir="${build.dir}/webapp" destfile="${dist.dir}/@{war.file.name}" webxml="${build.dir}/webapp/WEB-INF/web.xml">
209                  <add.filesets />
210              </war>
211 
212          </sequential>
213      </macrodef>
214      
215      <target name="-check.replace">
216          <condition property="replace.ready">
217              <and>
218                  <available file="${replace.file}"/>
219                  <isset property="replace.token"/>
220                  <isset property="replace.value"/>
221              </and>
222          </condition>
223      </target>
224      
225      <target name="-pre.war.replace" depends="-check.replace" if="replace.ready">
226          <replace file="${replace.file}" token="${replace.token}" value="${replace.value}"/>
227      </target>
228      
229      <macrodef name="icepush.available">
230          <sequential>            
231              <available file="${root.offset}/core/${dist.dir}/icepush.jar" property="icepush.jar.present"/>
232              <echo message="checking for ${root.offset}/core/${dist.dir}/icepush.jar"/>
233              <fail message="The core icepush.jar has to be built before this target. Building from the root will ensure all dependencies are pre-built.">
234                  <condition>
235                      <not>
236                          <isset property="icepush.jar.present" />
237                      </not>
238                  </condition>
239              </fail>
240          </sequential>
241      </macrodef>
242      
243      <macrodef  name="icepush.jsp.available">
244          <sequential>
245              <available file="${root.offset}/integration/jsp/core/${dist.dir}/icepush-jsp.jar" property="icepush.jsp.available"/>
246              <fail message="The core icepush-jsp.jar has to be built before this target. Building from the root will ensure all dependencies are pre-built.">
247                  <condition>
248                      <not>
249                          <isset property="icepush.jsp.available" />
250                      </not>
251                  </condition>
252              </fail>
253          </sequential>
254      </macrodef>
255      
256      <fileset id="icepush.jsp.dist" file="${root.offset}/integration/jsp/core/${dist.dir}/icepush-jsp.jar"/>
257      
258      <fileset id="icepush.gwt.dist" file="${root.offset}/integration/gwt/core/${dist.dir}/icepush-gwt.jar"/>
259      
260      <macrodef  name="icepush.gwt.available">
261          <sequential>
262              <available file="${root.offset}/integration/gwt/core/${dist.dir}/icepush-gwt.jar" property="icepush.gwt.available"/>
263              <fail message="The core icepush-gwt.jar has to be built before this target. Building from the root will ensure all dependencies are pre-built.">
264                  <condition>
265                      <not>
266                          <isset property="icepush.gwt.available" />
267                      </not>
268                  </condition>
269              </fail>
270          </sequential>
271      </macrodef>
272 
273      <target name="jar-icepush-core">
274          <ant dir="./core"/>
275      </target>       
276          
277      <target name="war" depends="compile">
278          <build.war/>
279      </target>
280      
281      <macrodef name="copy.dist.wars">
282          <attribute name="todir" default="${dist.dir}"/>
283          <attribute name="fromdir"/>
284          <sequential>
285              <copy todir="@{todir}">
286                  <fileset dir="@{fromdir}" includes="*.war"/>
287              </copy>
288          </sequential>
289      </macrodef>
290      
291      <!-- use this macro to merge the core classes into an integration classes dir. -->
292      <macrodef name="mergeCoreWithIntegration">
293          <attribute name="integration.classes" default="${classes.dir}"/>
294          <sequential>
295              <copy todir="@{integration.classes}" preservelastmodified="true" verbose="true">
296                  <fileset dir="../core/${classes.dir}">
297                      <include name="**" />
298                  </fileset>
299              </copy>
300          </sequential>
301      </macrodef>
302 
303  </project>


feed icon

sventon 2.5.1