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

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

Fixes #190. target c++ added.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 10.5 KB
Line 
1<?xml version="1.0" encoding="UTF-8"?>
2<!--
3    $Id: build.xml 1039 2009-04-16 09:59:18Z jari $
4
5    Copyright (C) 2008 Martin Svensson
6    Copyright (C) 2009 Jari Häkkinen, Martin Svensson
7
8    This file is part of the Normalizers plug-in package for BASE
9    (net.sf.based.normalizers). The package is available at
10    http://baseplugins.thep.lu.se/ BASE main site is
11    http://base.thep.lu.se/
12
13    This is free software; you can redistribute it and/or modify it
14    under the terms of the GNU General Public License as published by
15    the Free Software Foundation; either version 3 of the License, or
16    (at your option) any later version.
17
18    The software is distributed in the hope that it will be useful,
19    but WITHOUT ANY WARRANTY; without even the implied warranty of
20    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21    General Public License for more details.
22
23    You should have received a copy of the GNU General Public License
24    along with this program. If not, see <http://www.gnu.org/licenses/>.
25-->
26 
27<project   
28  name="NormalizationPlugins"   
29  default="dist"   
30  basedir="." 
31  > 
32  <description>
33    Build file for the Normalizers plug-in package fir BASE. The main
34    targets are ('dist' is default):
35
36    Clean up:
37    clean         Remove generated files
38    distclean     Remove all generated and downloaded files
39
40    Compiling:
41    build         Build all Java code
42    c++           Build all C++ code in directory src/c++
43    dist          Build all Java code for distribution (put in 'dist'
44                  subdirectory)
45    download-lib  Download required external dependecy files
46   
47    Packaging:
48    package:      Create *.tar.gz file containing required jars and
49                  source tar.gz files for non-Java source files.
50  </description>
51   
52  <!--create this file if you need to override values from properties below -->
53  <property file="build.properties" />
54
55  <!-- variables used --> 
56  <property name="name" value="normalization-plugins" /> 
57  <property name="src" value="src" />
58  <property name="build" value="build" description="Location of build class files"/> 
59  <property name="dist" value="dist" description="Location where jar-file are created"/>
60  <property name="jar" value="${name}.jar" description="Name of the jar file"/>
61  <property name="package" location="package" description="Directory where packaged distribution files are created"/>
62  <property name="javac.arg" value="-Xlint:unchecked" />
63  <property name="javac.source" value="1.5" />
64  <property name="javac.target" value="1.5" />
65  <property name="javac.encoding" value="UTF-8" />
66
67  <property name="depend.BASEjars" 
68    value="http://base2.thep.lu.se/base/jars/2.9.0" 
69    description="The location of the BASE core JARs that we depend on"
70  />
71  <property name="depend.PluginUtilityLocation" 
72    value="http://baseplugins.thep.lu.se/attachment/wiki/net.sf.basedb.pluginutilties" 
73    description="The location of the PluginUtility JAR that we depend on"
74  />
75  <property name="PluginUtilityVersion" value="0.1pre" 
76    description="The version of PluginUtility that we depend on"
77  />
78  <property name="PluginUtilitiesBase"
79            value="PluginUtilities-${PluginUtilityVersion}" />
80 
81  <!-- Package variables to be used in normalizers.properties file -->
82  <property name="version" value="1.1pre" description="Version number of the package" />
83  <property name="url" value="http://baseplugins.thep.lu.se/wiki/net.sf.basedb.normalizers" 
84    description="The url to this plug-in's web-page" />
85  <property name="copyright" value="2009 The BASE 2 development team" description="Copyright text" />
86  <property name="email" value="basedb-users@lists.sourceforge.net" description="Email address to get in contact with the developer" />
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    <jar
126      jarfile="${dist}/${jar}"
127      basedir="${build}"
128      manifest="${build}/META-INF/MANIFEST.MF"
129    />
130    <copy todir="${dist}">
131      <fileset dir="." includes="README*,license.txt,INSTALL" />
132    </copy> 
133    <copy file="lib/${PluginUtilitiesBase}/${PluginUtilitiesBase}.jar"
134          tofile="${dist}/PluginUtilities.jar" />
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="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      >
215      <compilerarg value="${javac.arg}" />
216    </javac>
217    <copy todir="${build}">
218      <fileset dir="." includes="META-INF/*" />
219    </copy>
220    <replace token="%%plugins.jar%%" value="${jar}" file="${build}/META-INF/base-plugins.xml" />
221
222    <!-- Write package properties to normalizers.properties file -->
223    <echo file="${build}/normalizers.properties">version: ${version}${line.separator}</echo>
224    <echo append="true" file="${build}/normalizers.properties">url: ${url}${line.separator}</echo>
225    <echo append="true" file="${build}/normalizers.properties">email: ${email}${line.separator}</echo>
226    <echo append="true" file="${build}/normalizers.properties">copyright: ${copyright}${line.separator}</echo>
227   
228  </target>
229 
230  <target 
231    name="checkjar"
232    description="Checks that the BASE2Core.jar, BASE2CorePlugins.jar,
233    and appropriate PluginUtilities jar file exists."
234    >
235    <available classname="net.sf.basedb.core.Application" 
236      classpathref="classpath" property="base2core" />
237    <available classname="net.sf.basedb.plugins.ReporterFlatFileImporter" 
238      classpathref="classpath" property="base2coreplugins" />
239    <available classname="net.sf.basedb.plugins.AbstractRunBinaryPlugin"
240      classpathref="classpath"
241      classpath="lib/${PluginUtilitiesBase}/${PluginUtilitiesBase}.jar"
242      property="pluginutilities" />
243    <fail unless="base2core" message="Can't find BASE2Core.jar in ./lib/compile. Try 'ant download-lib' to download the missing file." />
244    <fail unless="base2coreplugins" message="Can't find BASE2CorePlugins.jar in ./lib/compile. Try 'ant download-lib' to download the missing file." />
245    <fail unless="pluginutilities" message="Can't find PluginUtilities jar file ./lib. Try 'ant download-lib' to download the missing file." />
246    <echo>Found BASE2Core.jar, BASE2WSClient.jar, and PluginUtilities jar file</echo>
247  </target>
248
249  <target name="c++">
250    <exec dir="${src}/c++/" executable="./bootstrap" />
251    <replace file="${src}/c++/configure">
252      <replacefilter 
253         token="@PKGVERSION@"
254         value="${version}"
255         />
256    </replace>
257    <chmod file="${src}/c++/configure" perm="a+x" />
258    <exec dir="${src}/c++/" executable="./configure">
259    </exec>
260    <exec dir="${src}/c++/" executable="make">
261    </exec>
262  </target>
263
264  <target 
265    name="download-lib"
266    depends="download-message, download-pluginutilities"
267    description="Download BASE2Core.jar and BASE2CorePlugins.jar."
268    >
269    <download
270      location="${depend.BASEjars}"
271      file="BASE2Core.jar"
272      destdir="lib/compile"
273      tofile="BASE2Core.jar"
274    />
275    <download
276      location="${depend.BASEjars}"
277      file="BASE2CorePlugins.jar"
278      destdir="lib/compile"
279      tofile="BASE2CorePlugins.jar"
280    />
281  </target>
282   
283  <target name="download-message">
284    <echo>
285-------------------------------------------------------   
286NOTE! You may specify a different download locations by
287creating the file './build.properties' and set one or
288more of the below variables
289
290'depend.BASEjars': the URL to download BASE core jar
291        files from.
292
293'depend.PluginUtilityLocation': the URL to download
294        PluginUtility jar from.
295'PluginUtilityVersion': the version of PluginUtility to
296        download.
297-------------------------------------------------------
298    </echo>
299  </target>
300
301  <target
302    name="download-pluginutilities"
303    description="Download PluginUtilities.jar."
304    >
305    <download
306      location="${depend.PluginUtilityLocation}"
307      file="${PluginUtilitiesBase}.tgz?format=raw"
308      destdir="lib"
309      tofile="${PluginUtilitiesBase}.tgz"
310    />
311    <untar src="lib/${PluginUtilitiesBase}.tgz" dest="lib"
312           compression="gzip" />
313  </target>
314
315  <macrodef name="download" description="Download requested file files">
316    <attribute name="destdir" />
317    <attribute name="location" />
318    <attribute name="file" />
319    <attribute name="tofile" />
320    <sequential>
321      <get 
322        dest="@{destdir}/@{tofile}" 
323        src="@{location}/@{file}" 
324        usetimestamp="true" 
325        verbose="true"
326        ignoreerrors="false"
327      />
328    </sequential>
329  </macrodef> 
330 
331</project>
Note: See TracBrowser for help on using the repository browser.