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

Last change on this file since 1295 was 1295, checked in by Nicklas Nordborg, 13 years ago

Fixes #280: Plug-in should suggest better job names

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 10.6 KB
Line 
1<?xml version="1.0" encoding="UTF-8"?>
2<!--
3    $Id: build.xml 1295 2011-02-24 12:33:54Z nicklas $
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="src" value="src" />
59  <property name="build" value="build" description="Location of build class files"/> 
60  <property name="dist" value="dist" description="Location where jar-file are created"/>
61  <property name="jar" value="${name}.jar" description="Name of the jar file"/>
62  <property name="package" location="package" description="Directory where packaged distribution files are created"/>
63  <property name="javac.arg" value="-Xlint:unchecked" />
64  <property name="javac.source" value="1.5" />
65  <property name="javac.target" value="1.5" />
66  <property name="javac.encoding" value="UTF-8" />
67
68  <property name="depend.BASEjars" 
69    value="http://base2.thep.lu.se/base/jars/2.17.0" 
70    description="The location of the BASE core JARs that we depend on"
71  />
72  <property name="depend.PluginUtilityLocation" 
73    value="http://baseplugins.thep.lu.se/attachment/wiki/net.sf.basedb.pluginutilties" 
74    description="The location of the PluginUtility JAR that we depend on"
75  />
76  <property name="PluginUtilityVersion" value="0.2" 
77    description="The version of PluginUtility that we depend on"
78  />
79  <property name="PluginUtilitiesBase"
80            value="PluginUtilities-${PluginUtilityVersion}" />
81 
82  <!-- Package variables to be used in normalizers.properties file -->
83  <property name="version" value="1.1pre" description="Version number of the package" />
84  <property name="url" value="http://baseplugins.thep.lu.se/wiki/net.sf.basedb.normalizers" 
85    description="The url to this plug-in's web-page" />
86  <property name="copyright" value="2009 The BASE 2 development team" description="Copyright text" />
87  <property name="email" value="basedb-users@lists.sourceforge.net" description="Email address to get in contact with the developer" />
88 
89  <!-- set up classpath for compiling -->
90  <path id="classpath">
91    <fileset dir="lib">
92      <include name="**/*.jar"/>
93    </fileset>
94  </path>
95
96  <target name="init">
97    <mkdir dir="${build}" />
98    <mkdir dir="${dist}" />
99  </target>
100   
101  <target name="clean">
102    <delete failonerror="false" includeemptydirs="true">
103      <fileset dir="${build}" defaultexcludes="no" />
104      <fileset dir="${dist}" defaultexcludes="no" />
105      <fileset dir="${package}" defaultexcludes="no" />
106    </delete>
107  </target>
108
109  <target
110    name="distclean"
111    depends="clean">
112    <delete failonerror="false" includeemptydirs="true">
113      <fileset dir="lib/${PluginUtilitiesBase}" defaultexcludes="no" />
114      <fileset file="lib/${PluginUtilitiesBase}.tgz" />
115      <fileset dir="lib/compile" defaultexcludes="no">
116        <include name="*.jar" />
117      </fileset>
118    </delete>
119  </target>
120
121  <!-- main target -->
122  <target
123    name="dist"
124    depends="clean,build,manifest"
125    >
126    <jar
127      jarfile="${dist}/${jar}"
128      basedir="${build}"
129      manifest="${build}/META-INF/MANIFEST.MF"
130    />
131    <copy todir="${dist}">
132      <fileset dir="." includes="README*,license.txt,INSTALL" />
133    </copy> 
134    <copy file="lib/${PluginUtilitiesBase}/${PluginUtilitiesBase}.jar"
135          tofile="${dist}/PluginUtilities.jar" />
136  </target> 
137
138  <target
139    name="manifest"
140    description="Create MANIFEST.MF needed to set class path"
141    >
142    <manifest file="${build}/META-INF/MANIFEST.MF">
143      <attribute name="Built-By" value="${user.name}"/>
144      <attribute name="Class-Path" value="PluginUtilities.jar"/>
145    </manifest>
146  </target>
147
148  <target
149    name="package"
150    depends="dist, package-qQuantileSource"
151    description="Create binary distribution package"
152    >
153    <property name="tar.prefix" value="${name}-${version}" />
154    <mkdir dir="${package}" />
155    <tar
156      destfile="${package}/${tar.prefix}.tar.gz"
157      longfile="gnu"
158      compression="gzip"
159      >
160      <tarfileset
161        dir="${dist}"
162        mode="755"
163        prefix="${tar.prefix}"
164        preserveLeadingSlashes="true"
165        >
166        <include name="**/*.sh" />
167      </tarfileset>
168      <tarfileset
169        dir="${dist}"
170        prefix="${tar.prefix}"
171        preserveLeadingSlashes="true"
172        >
173        <exclude name="**/*.sh" />
174      </tarfileset>
175    </tar>
176    <checksum file="${package}/${tar.prefix}.tar.gz" />
177  </target>
178
179  <target
180     name="package-qQuantileSource"
181     description="Add qQuantileNormalization C++ package to 'dist'"
182     >
183    <exec dir="${src}/c++/" executable="./bootstrap" />
184    <replace file="${src}/c++/configure">
185      <replacefilter 
186         token="@PKGVERSION@"
187         value="${version}"
188         />
189    </replace>
190    <chmod file="${src}/c++/configure" perm="a+x" />
191    <exec dir="${src}/c++/" executable="./configure">
192      <arg line="--disable-libcheck" />
193    </exec>
194    <exec dir="${src}/c++/" executable="make">
195      <arg line="dist" />
196    </exec>
197    <move file="${src}/c++/qqn-${version}.tar.gz" todir="dist" />
198  </target>
199
200  <target 
201    name="build"
202    depends="init, checkjar"
203    description="Compiles the plugin and put in jar"
204    >
205    <property name="jar" value="${name}.jar" />
206    <mkdir dir="${build}" />
207    <javac 
208      encoding="${javac.encoding}" 
209      srcdir="${src}" 
210      destdir="${build}" 
211      debug="true" 
212      classpathref="classpath"
213      source="${javac.source}"
214      target="${javac.target}"
215      >
216      <compilerarg value="${javac.arg}" />
217    </javac>
218    <copy todir="${build}">
219      <fileset dir="." includes="META-INF/*" />
220    </copy>
221    <replace token="%%plugins.jar%%" value="${jar}" file="${build}/META-INF/base-plugins.xml" />
222
223    <!-- Write package properties to normalizers.properties file -->
224    <echo file="${build}/normalizers.properties">version: ${version}${line.separator}</echo>
225    <echo append="true" file="${build}/normalizers.properties">url: ${url}${line.separator}</echo>
226    <echo append="true" file="${build}/normalizers.properties">email: ${email}${line.separator}</echo>
227    <echo append="true" file="${build}/normalizers.properties">copyright: ${copyright}${line.separator}</echo>
228   
229  </target>
230 
231  <target 
232    name="checkjar"
233    description="Checks that the BASE2Core.jar, BASE2CorePlugins.jar,
234    and appropriate PluginUtilities jar file exists."
235    >
236    <available classname="net.sf.basedb.core.Application" 
237      classpathref="classpath" property="base2core" />
238    <available classname="net.sf.basedb.plugins.ReporterFlatFileImporter" 
239      classpathref="classpath" property="base2coreplugins" />
240    <available classname="net.sf.basedb.plugins.AbstractRunBinaryPlugin"
241      classpathref="classpath"
242      classpath="lib/${PluginUtilitiesBase}/${PluginUtilitiesBase}.jar"
243      property="pluginutilities" />
244    <fail unless="base2core" message="Can't find BASE2Core.jar in ./lib/compile. Try 'ant download-lib' to download the missing file." />
245    <fail unless="base2coreplugins" message="Can't find BASE2CorePlugins.jar in ./lib/compile. Try 'ant download-lib' to download the missing file." />
246    <fail unless="pluginutilities" message="Can't find PluginUtilities jar file ./lib. Try 'ant download-lib' to download the missing file." />
247    <echo>Found BASE2Core.jar, BASE2WSClient.jar, and PluginUtilities jar file</echo>
248  </target>
249
250  <target name="c++">
251    <exec dir="${src}/c++/" executable="./bootstrap" />
252    <replace file="${src}/c++/configure">
253      <replacefilter 
254         token="@PKGVERSION@"
255         value="${version}"
256         />
257    </replace>
258    <chmod file="${src}/c++/configure" perm="a+x" />
259    <exec dir="${src}/c++/" executable="./configure">
260    </exec>
261    <exec dir="${src}/c++/" executable="make">
262    </exec>
263  </target>
264
265  <target 
266    name="download-lib"
267    depends="download-message, download-pluginutilities"
268    description="Download BASE2Core.jar and BASE2CorePlugins.jar."
269    >
270    <download
271      location="${depend.BASEjars}"
272      file="BASE2Core.jar"
273      destdir="lib/compile"
274      tofile="BASE2Core.jar"
275    />
276    <download
277      location="${depend.BASEjars}"
278      file="BASE2CorePlugins.jar"
279      destdir="lib/compile"
280      tofile="BASE2CorePlugins.jar"
281    />
282  </target>
283   
284  <target name="download-message">
285    <echo>
286-------------------------------------------------------   
287NOTE! You may specify a different download locations by
288creating the file './build.properties' and set one or
289more of the below variables
290
291'depend.BASEjars': the URL to download BASE core jar
292        files from.
293
294'depend.PluginUtilityLocation': the URL to download
295        PluginUtility jar from.
296'PluginUtilityVersion': the version of PluginUtility to
297        download.
298-------------------------------------------------------
299    </echo>
300  </target>
301
302  <target
303    name="download-pluginutilities"
304    description="Download PluginUtilities.jar."
305    >
306    <download
307      location="${depend.PluginUtilityLocation}"
308      file="${PluginUtilitiesBase}.tgz?format=raw"
309      destdir="lib"
310      tofile="${PluginUtilitiesBase}.tgz"
311    />
312    <untar src="lib/${PluginUtilitiesBase}.tgz" dest="lib"
313           compression="gzip" />
314  </target>
315
316  <macrodef name="download" description="Download requested files">
317    <attribute name="destdir" />
318    <attribute name="location" />
319    <attribute name="file" />
320    <attribute name="tofile" />
321    <sequential>
322      <get 
323        dest="@{destdir}/@{tofile}" 
324        src="@{location}/@{file}" 
325        usetimestamp="true" 
326        verbose="true"
327        ignoreerrors="false"
328      />
329    </sequential>
330  </macrodef> 
331 
332</project>
Note: See TracBrowser for help on using the repository browser.