source: plugins/base2/net.sf.basedb.pluginutilities/trunk/build.xml @ 847

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

Renamed package to PluginUtilities?.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Date Id
File size: 5.1 KB
Line 
1<?xml version="1.0" encoding="UTF-8"?>
2<!--
3    $Id: build.xml 847 2008-12-01 19:10:33Z jari $
4
5    Copyright (C) 2008 Jari Hakkinen, Nicklas Nordborg
6
7    This file is part of the net.sf.basedb.pluginutilities package, a
8    utility package that simplifies creation of BASE plug-ins. The
9    package is available at http://baseplugins.thep.lu.se/ and BASE
10    web site is http://base.thep.lu.se
11
12    This is free software; you can redistribute it and/or modify it
13    under the terms of the GNU General Public License as published by
14    the Free Software Foundation; either version 3 of the License, or
15    (at your option) any later version.
16
17    The software is distributed in the hope that it will be useful,
18    but WITHOUT ANY WARRANTY; without even the implied warranty of
19    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20    General Public License for more details.
21
22    You should have received a copy of the GNU General Public License
23    along with BASE. If not, see <http://www.gnu.org/licenses/>.
24-->
25<project name="PluginUtilities" default="build" basedir=".">
26
27  <!--create this file if you need to override values from properties below -->
28  <property file="build.properties" />
29
30  <!-- variables used -->
31  <property name="name" value="PluginUtilities" />
32  <property name="version" value="0.1pre" />
33  <property name="src" location="src" description="Location of source files" />
34  <property name="build" location="build"
35            description="Location of compiled files" />
36  <property name="dist" location="dist"
37            description="Directory where distribution should be created" />
38  <property name="lib" location="lib"
39            description="Directory for jars required for compilation" />
40  <property name="package" location="package"
41            description="Directory for created packaged distribution files"/>
42  <property name="javac.source" value="1.5" />
43  <property name="javac.target" value="1.5" />
44  <property name="javac.encoding" value="ISO-8859-1" />
45  <property name="depend.jars" 
46    value="http://base2.thep.lu.se/base/jars/2.8.4" 
47    description="The location of the BASE core JARs that we depend on"
48  />
49
50  <!-- set up classpath for compiling -->
51  <path id="classpath">
52    <fileset dir="lib">
53      <include name="**/*.jar" />
54    </fileset>
55  </path>
56
57  <target name="init">
58    <mkdir dir="${build}" />
59    <mkdir dir="${dist}" />
60    <mkdir dir="${lib}" />
61  </target>
62
63  <target name="clean">
64    <delete failonerror="false" includeemptydirs="true">
65      <fileset dir="${build}" defaultexcludes="no" />
66      <fileset dir="${dist}" defaultexcludes="no" />
67      <fileset dir="${package}" defaultexcludes="no" />
68    </delete>
69  </target>
70
71  <target name="distclean" depends="clean" >
72    <delete failonerror="false" includeemptydirs="true">
73      <fileset dir="${lib}" defaultexcludes="no" />
74    </delete>
75  </target>
76
77  <target
78    name="dist"
79    depends="clean, build"
80    >
81    <property name="jar" value="${name}-${version}.jar" />
82    <jar 
83      jarfile="${dist}/${jar}" 
84      basedir="${build}" 
85      >
86    </jar>
87    <copy todir="${dist}">
88      <fileset dir="." includes="README*, license.txt" />
89    </copy>
90  </target>
91
92  <target
93    name="package"
94    depends="dist"
95    description="Create binary distribution package"
96    >
97    <property name="tar.prefix" value="${name}-${version}" />
98    <mkdir dir="${package}" />
99    <tar
100      destfile="${package}/${tar.prefix}.tgz"
101      longfile="gnu"
102      compression="gzip"
103      >
104      <tarfileset
105        dir="${dist}"
106        prefix="${tar.prefix}"
107        preserveLeadingSlashes="true"
108        >
109      </tarfileset>
110    </tar>
111    <checksum file="${package}/${tar.prefix}.tgz" />
112  </target>
113
114  <target
115    name="build"
116    depends="init, checkjar"
117    description="Compiles the package"
118    >
119    <javac 
120      encoding="${javac.encoding}"
121      srcdir="${src}"
122      destdir="${build}"
123      debug="true"
124      deprecation="true"
125      classpathref="classpath"
126      >
127    </javac>
128  </target>
129 
130  <target 
131    name="checkjar"
132    description="Check existence of jars BASE2Core and BASE2WSClient."
133    >
134    <available classname="net.sf.basedb.core.Application"
135      classpathref="classpath" property="base2core" />
136    <available classname="net.sf.basedb.ws.client.SessionClient"
137      classpathref="classpath" property="base2wsclient" />
138    <fail unless="base2core" message="Can't find BASE2Core.jar in ./lib. Try 'ant download-lib' to download the missing file." />
139    <fail unless="base2wsclient" message="Can't find BASE2WSClient.jar in ./lib. Try 'ant download-lib' to download the missing file." />
140    <echo>Found BASE2Core.jar and BASE2WSClient.jar.</echo>
141  </target>
142
143  <target
144    name="download-lib"
145    depends="init"
146    description="Download jars BASE2Core and BASE2WSClient."
147    >
148    <echo>
149-------------------------------------------------------
150NOTE! You may specify a different download location by
151creating the file './build.properties' and
152setting 'depend.jars' to the URL to download from.
153-------------------------------------------------------
154    </echo>
155    <download-lib file="BASE2Core.jar" />
156    <download-lib file="BASE2WSClient.jar" />
157  </target>
158
159  <macrodef name="download-lib" description="Download BASE core JAR files">
160    <attribute name="file" />
161    <sequential>
162      <get
163        dest="lib/@{file}"
164        src="${depend.jars}/@{file}"
165        usetimestamp="true"
166        verbose="true"
167        ignoreerrors="true"
168      />
169    </sequential>
170  </macrodef>
171
172</project>
Note: See TracBrowser for help on using the repository browser.