source: plugins/base2/net.sf.basedb.normalizers/trunk/build.xml @ 2176

Last change on this file since 2176 was 2176, checked in by Jari Häkkinen, 9 years ago

Changes from release procedure and other minor things.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 10.7 KB
Line 
1<?xml version="1.0" encoding="UTF-8"?>
2<!--
3    $Id: build.xml 2176 2013-12-12 10:39:47Z jari $
4
5    Copyright (C) 2008 Martin Svensson
6    Copyright (C) 2009 Jari Häkkinen, Martin Svensson
7    Copyright (C) 2010 Jari Häkkinen
8
9    This file is part of the Normalizers plug-in package for BASE
10    (net.sf.based.normalizers). The package is available at
11    http://baseplugins.thep.lu.se/ BASE main site is
12    http://base.thep.lu.se/
13
14    This is free software; you can redistribute it and/or modify it
15    under the terms of the GNU General Public License as published by
16    the Free Software Foundation; either version 3 of the License, or
17    (at your option) any later version.
18
19    The software is distributed in the hope that it will be useful,
20    but WITHOUT ANY WARRANTY; without even the implied warranty of
21    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22    General Public License for more details.
23
24    You should have received a copy of the GNU General Public License
25    along with this program. If not, see <http://www.gnu.org/licenses/>.
26-->
27 
28<project   
29  name="NormalizationPlugins"   
30  default="dist"   
31  basedir="." 
32  > 
33  <description>
34    Build file for the Normalizers plug-in package for BASE. The main
35    targets are ('dist' is default):
36
37    Clean up:
38    clean         Remove generated files
39    distclean     Remove all generated and downloaded files
40
41    Compiling:
42    build         Build all Java code
43    c++           Build all C++ code in directory src/c++
44    dist          Build all Java code for distribution (put in 'dist'
45                  subdirectory)
46    download-lib  Download required external dependecy files
47   
48    Packaging:
49    package:      Create *.tar.gz file containing required jars and
50                  source tar.gz files for non-Java source files.
51  </description>
52   
53  <!--create this file if you need to override values from properties below -->
54  <property file="build.properties" />
55
56  <!-- variables used --> 
57  <property name="name" value="normalization-plugins" /> 
58  <property name="version" value="1.1-beta2"  description="Version number of the package" />
59  <property name="src" value="src" />
60  <property name="build" value="build" description="Location of build class files"/> 
61  <property name="dist" value="dist" description="Location where jar-file are created"/>
62  <property name="jar" value="${name}.jar" description="Name of the jar file"/>
63  <property name="package" location="package" description="Directory where packaged distribution files are created"/>
64  <property name="javac.arg" value="-Xlint:unchecked" />
65  <property name="javac.source" value="1.6" />
66  <property name="javac.target" value="1.6" />
67  <property name="javac.encoding" value="UTF-8" />
68  <property name="depend.base-version" 
69    value="3.2.4" 
70    description="The BASE version that this project depends on."
71  />
72  <property name="depend.jars" 
73    value="http://base2.thep.lu.se/base/jars/${depend.base-version}" 
74    description="The location of the BASE core JARs that this project depends on."
75  />
76
77  <property name="depend.PluginUtilityLocation" 
78    value="http://baseplugins.thep.lu.se/attachment/wiki/net.sf.basedb.pluginutilties" 
79    description="The location of the PluginUtility JAR that we depend on"
80  />
81  <property name="PluginUtilityVersion" value="0.2" 
82    description="The version of PluginUtility that we depend on"
83  />
84  <property name="PluginUtilitiesBase"
85            value="PluginUtilities-${PluginUtilityVersion}" />
86 
87
88  <!-- set up classpath for compiling -->
89  <path id="classpath">
90    <fileset dir="lib">
91      <include name="**/*.jar"/>
92    </fileset>
93  </path>
94
95  <target name="init">
96    <mkdir dir="${build}" />
97    <mkdir dir="${dist}" />
98  </target>
99   
100  <target name="clean">
101    <delete failonerror="false" includeemptydirs="true">
102      <fileset dir="${build}" defaultexcludes="no" />
103      <fileset dir="${dist}" defaultexcludes="no" />
104      <fileset dir="${package}" defaultexcludes="no" />
105    </delete>
106  </target>
107
108  <target
109    name="distclean"
110    depends="clean">
111    <delete failonerror="false" includeemptydirs="true">
112      <fileset dir="lib/${PluginUtilitiesBase}" defaultexcludes="no" />
113      <fileset file="lib/${PluginUtilitiesBase}.tgz" />
114      <fileset dir="lib/compile" defaultexcludes="no">
115        <include name="*.jar" />
116      </fileset>
117    </delete>
118  </target>
119
120  <!-- main target -->
121  <target
122    name="dist"
123    depends="clean,build,manifest"
124    >
125    <copy file="lib/${PluginUtilitiesBase}/${PluginUtilitiesBase}.jar"
126          tofile="${build}/lib/PluginUtilities.jar" />
127    <jar
128      jarfile="${dist}/${jar}"
129      basedir="${build}"
130      manifest="${build}/META-INF/MANIFEST.MF"
131    />
132    <copy todir="${dist}">
133      <fileset dir="." includes="README*,license.txt,INSTALL" />
134    </copy> 
135  </target> 
136
137  <target
138    name="manifest"
139    description="Create MANIFEST.MF needed to set class path"
140    >
141    <manifest file="${build}/META-INF/MANIFEST.MF">
142      <attribute name="Built-By" value="${user.name}"/>
143      <attribute name="Class-Path" value="lib/PluginUtilities.jar"/>
144    </manifest>
145  </target>
146
147  <target
148    name="package"
149    depends="dist, package-qQuantileSource"
150    description="Create binary distribution package"
151    >
152    <property name="tar.prefix" value="${name}-${version}" />
153    <mkdir dir="${package}" />
154    <tar
155      destfile="${package}/${tar.prefix}.tar.gz"
156      longfile="gnu"
157      compression="gzip"
158      >
159      <tarfileset
160        dir="${dist}"
161        mode="755"
162        prefix="${tar.prefix}"
163        preserveLeadingSlashes="true"
164        >
165        <include name="**/*.sh" />
166      </tarfileset>
167      <tarfileset
168        dir="${dist}"
169        prefix="${tar.prefix}"
170        preserveLeadingSlashes="true"
171        >
172        <exclude name="**/*.sh" />
173      </tarfileset>
174    </tar>
175    <checksum file="${package}/${tar.prefix}.tar.gz" />
176  </target>
177
178  <target
179     name="package-qQuantileSource"
180     description="Add qQuantileNormalization C++ package to 'dist'"
181     >
182    <exec dir="${src}/c++/" executable="./bootstrap" />
183    <replace file="${src}/c++/configure">
184      <replacefilter 
185         token="@PKGVERSION@"
186         value="${version}"
187         />
188    </replace>
189    <chmod file="${src}/c++/configure" perm="a+x" />
190    <exec dir="${src}/c++/" executable="./configure">
191      <arg line="--disable-libcheck" />
192    </exec>
193    <exec dir="${src}/c++/" executable="make">
194      <arg line="dist" />
195    </exec>
196    <move file="${src}/c++/qqn-${version}.tar.gz" todir="dist" />
197  </target>
198
199  <target 
200    name="build"
201    depends="init, checkjar"
202    description="Compiles the plugin and put in jar"
203    >
204    <property name="jar" value="${name}.jar" />
205    <mkdir dir="${build}" />
206    <javac 
207      encoding="${javac.encoding}" 
208      srcdir="${src}" 
209      destdir="${build}" 
210      debug="true" 
211      classpathref="classpath"
212      source="${javac.source}"
213      target="${javac.target}"
214      includeantruntime="false"
215      >
216      <compilerarg value="${javac.arg}" />
217    </javac>
218    <copy todir="${build}">
219      <fileset dir="." includes="META-INF/*" />
220    </copy>
221   
222  </target>
223 
224  <target name="update-version">
225    <echo>Setting version to: ${version}</echo>
226   
227    <echo>Normalizations.java</echo>
228    <replaceregexp 
229      file="${src}/net/sf/basedb/normalizers/Normalizations.java"
230      match="public static final String VERSION = &#34;.*&#34;;"
231      replace="public static final String VERSION = &#34;${version}&#34;;"
232      encoding="UTF-8"
233    />
234   
235    <echo>extensions.xml</echo>
236    <replaceregexp 
237      file="META-INF/extensions.xml"
238      match="&lt;version&gt;.*&lt;/version&gt;"
239      replace="&lt;version&gt;${version}&lt;/version&gt;"
240      encoding="UTF-8"
241    />
242    <replaceregexp 
243      file="META-INF/extensions.xml"
244      match="&lt;min-base-version&gt;.*&lt;/min-base-version&gt;"
245      replace="&lt;min-base-version&gt;${depend.base-version}&lt;/min-base-version&gt;"
246      encoding="UTF-8"
247    />
248    <echo>Don't forget to commit the changes to the subversion repository!</echo>
249  </target>
250 
251  <target 
252    name="checkjar"
253    description="Checks that the BASE JAR files,
254    and appropriate PluginUtilities jar file exists."
255    >
256    <available classname="net.sf.basedb.core.Application" 
257      classpathref="classpath" property="base-core" />
258    <available classname="net.sf.basedb.plugins.ReporterFlatFileImporter" 
259      classpathref="classpath" property="base-coreplugins" />
260    <available classname="net.sf.basedb.plugins.AbstractRunBinaryPlugin"
261      classpathref="classpath"
262      classpath="lib/${PluginUtilitiesBase}/${PluginUtilitiesBase}.jar"
263      property="pluginutilities" />
264    <fail unless="base-core" message="Can't find base-core-${depend.base-version}.jar in ./lib/compile. Try 'ant download-lib' to download the missing file." />
265    <fail unless="base-coreplugins" message="Can't find base-coreplugins-${depend.base-version}.jar in ./lib/compile. Try 'ant download-lib' to download the missing file." />
266    <fail unless="pluginutilities" message="Can't find PluginUtilities jar file ./lib. Try 'ant download-lib' to download the missing file." />
267    <echo>Found all required jar files</echo>
268  </target>
269
270  <target name="c++">
271    <exec dir="${src}/c++/" executable="./bootstrap" />
272    <replace file="${src}/c++/configure">
273      <replacefilter 
274         token="@PKGVERSION@"
275         value="${version}"
276         />
277    </replace>
278    <chmod file="${src}/c++/configure" perm="a+x" />
279    <exec dir="${src}/c++/" executable="./configure">
280    </exec>
281    <exec dir="${src}/c++/" executable="make">
282    </exec>
283  </target>
284
285  <target 
286    name="download-lib"
287    depends="download-message, download-pluginutilities"
288    description="Download BASE JAR files"
289    >
290    <download
291      location="${depend.jars}"
292      file="base-core-${depend.base-version}.jar"
293      destdir="lib/compile"
294      tofile="base-core-${depend.base-version}.jar"
295    />
296    <download
297      location="${depend.jars}"
298      file="base-coreplugins-${depend.base-version}.jar"
299      destdir="lib/compile"
300      tofile="base-coreplugins-${depend.base-version}.jar"
301    />
302  </target>
303   
304  <target name="download-message">
305    <echo>
306-------------------------------------------------------   
307NOTE! You may specify a different download locations by
308creating the file './build.properties' and set one or
309more of the below variables
310
311'depend.jars': the URL to download BASE core jar
312        files from.
313
314'depend.PluginUtilityLocation': the URL to download
315        PluginUtility jar from.
316'PluginUtilityVersion': the version of PluginUtility to
317        download.
318-------------------------------------------------------
319    </echo>
320  </target>
321
322  <target
323    name="download-pluginutilities"
324    description="Download PluginUtilities.jar."
325    >
326    <download
327      location="${depend.PluginUtilityLocation}"
328      file="${PluginUtilitiesBase}.tgz?format=raw"
329      destdir="lib"
330      tofile="${PluginUtilitiesBase}.tgz"
331    />
332    <untar src="lib/${PluginUtilitiesBase}.tgz" dest="lib"
333           compression="gzip" />
334  </target>
335
336  <macrodef name="download" description="Download requested files">
337    <attribute name="destdir" />
338    <attribute name="location" />
339    <attribute name="file" />
340    <attribute name="tofile" />
341    <sequential>
342      <get 
343        dest="@{destdir}/@{tofile}" 
344        src="@{location}/@{file}" 
345        usetimestamp="true" 
346        verbose="true"
347        ignoreerrors="false"
348      />
349    </sequential>
350  </macrodef> 
351 
352</project>
Note: See TracBrowser for help on using the repository browser.