1 | <?xml version="1.0" encoding="UTF-8"?> |
---|
2 | <!-- |
---|
3 | $Id: build.xml 1077 2009-05-15 15:29:10Z jari $ |
---|
4 | |
---|
5 | Copyright (C) 2008 Jari Hakkinen, Nicklas Nordborg |
---|
6 | Copyright (C) 2009 Jari Hakkinen |
---|
7 | |
---|
8 | This file is part of the net.sf.basedb.pluginutilities package, a |
---|
9 | utility package that simplifies creation of BASE plug-ins. The |
---|
10 | package is available at http://baseplugins.thep.lu.se/ and BASE |
---|
11 | web site is 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 software. If not, see <http://www.gnu.org/licenses/>. |
---|
25 | --> |
---|
26 | <project name="PluginUtilities" default="build" basedir="."> |
---|
27 | |
---|
28 | <!--create this file if you need to override values from properties below --> |
---|
29 | <property file="build.properties" /> |
---|
30 | |
---|
31 | <!-- variables used --> |
---|
32 | <property name="name" value="PluginUtilities" /> |
---|
33 | <property name="version" value="0.2" /> |
---|
34 | <property name="src" location="src" description="Location of source files" /> |
---|
35 | <property name="build" location="build" |
---|
36 | description="Location of compiled files" /> |
---|
37 | <property name="dist" location="dist" |
---|
38 | description="Directory where distribution should be created" /> |
---|
39 | <property name="lib" location="lib" |
---|
40 | description="Directory for jars required for compilation" /> |
---|
41 | <property name="package" location="package" |
---|
42 | description="Directory for created packaged distribution files"/> |
---|
43 | <property name="javac.source" value="1.6" /> |
---|
44 | <property name="javac.target" value="1.6" /> |
---|
45 | <property name="javac.encoding" value="UTF-8" /> |
---|
46 | <property name="depend.jars" |
---|
47 | value="http://base2.thep.lu.se/base/jars/2.6.0" |
---|
48 | description="The location of the BASE core JARs that we depend on" |
---|
49 | /> |
---|
50 | |
---|
51 | <!-- set up classpath for compiling --> |
---|
52 | <path id="classpath"> |
---|
53 | <fileset dir="lib"> |
---|
54 | <include name="**/*.jar" /> |
---|
55 | </fileset> |
---|
56 | </path> |
---|
57 | |
---|
58 | <target |
---|
59 | name="build" |
---|
60 | depends="init, checkjar" |
---|
61 | description="Compiles the package" |
---|
62 | > |
---|
63 | <javac |
---|
64 | encoding="${javac.encoding}" |
---|
65 | srcdir="${src}" |
---|
66 | destdir="${build}" |
---|
67 | debug="true" |
---|
68 | deprecation="true" |
---|
69 | classpathref="classpath" |
---|
70 | > |
---|
71 | </javac> |
---|
72 | </target> |
---|
73 | |
---|
74 | <target |
---|
75 | name="checkjar" |
---|
76 | description="Check existence of jars BASE2Core and BASE2WSClient." |
---|
77 | > |
---|
78 | <available classname="net.sf.basedb.core.Application" |
---|
79 | classpathref="classpath" property="base2core" /> |
---|
80 | <available classname="net.sf.basedb.ws.client.SessionClient" |
---|
81 | classpathref="classpath" property="base2wsclient" /> |
---|
82 | <fail unless="base2core" message="Can't find BASE2Core.jar in ./lib. Try 'ant download-lib' to download the missing file." /> |
---|
83 | <fail unless="base2wsclient" message="Can't find BASE2WSClient.jar in ./lib. Try 'ant download-lib' to download the missing file." /> |
---|
84 | <echo>Found BASE2Core.jar and BASE2WSClient.jar.</echo> |
---|
85 | </target> |
---|
86 | |
---|
87 | <target name="clean"> |
---|
88 | <delete failonerror="false" includeemptydirs="true"> |
---|
89 | <fileset dir="${build}" defaultexcludes="no" /> |
---|
90 | <fileset dir="${dist}" defaultexcludes="no" /> |
---|
91 | <fileset dir="${package}" defaultexcludes="no" /> |
---|
92 | </delete> |
---|
93 | </target> |
---|
94 | |
---|
95 | <target |
---|
96 | name="dist" |
---|
97 | depends="clean, build" |
---|
98 | > |
---|
99 | <property name="jar" value="${name}-${version}.jar" /> |
---|
100 | <jar |
---|
101 | jarfile="${dist}/${jar}" |
---|
102 | basedir="${build}" |
---|
103 | > |
---|
104 | </jar> |
---|
105 | <copy todir="${dist}"> |
---|
106 | <fileset dir="." includes="README*, license.txt" /> |
---|
107 | </copy> |
---|
108 | </target> |
---|
109 | |
---|
110 | <target name="distclean" depends="clean" > |
---|
111 | <delete failonerror="false" includeemptydirs="true"> |
---|
112 | <fileset dir="${lib}" defaultexcludes="no" /> |
---|
113 | </delete> |
---|
114 | </target> |
---|
115 | |
---|
116 | <target name="init"> |
---|
117 | <mkdir dir="${build}" /> |
---|
118 | <mkdir dir="${dist}" /> |
---|
119 | <mkdir dir="${lib}" /> |
---|
120 | </target> |
---|
121 | |
---|
122 | <target |
---|
123 | name="package" |
---|
124 | depends="dist" |
---|
125 | description="Create binary distribution package" |
---|
126 | > |
---|
127 | <property name="tar.prefix" value="${name}-${version}" /> |
---|
128 | <mkdir dir="${package}" /> |
---|
129 | <tar |
---|
130 | destfile="${package}/${tar.prefix}.tgz" |
---|
131 | longfile="gnu" |
---|
132 | compression="gzip" |
---|
133 | > |
---|
134 | <tarfileset |
---|
135 | dir="${dist}" |
---|
136 | prefix="${tar.prefix}" |
---|
137 | preserveLeadingSlashes="true" |
---|
138 | > |
---|
139 | </tarfileset> |
---|
140 | </tar> |
---|
141 | <checksum file="${package}/${tar.prefix}.tgz" /> |
---|
142 | </target> |
---|
143 | |
---|
144 | <target |
---|
145 | name="download-lib" |
---|
146 | depends="init" |
---|
147 | description="Download jars BASE2Core and BASE2WSClient." |
---|
148 | > |
---|
149 | <echo> |
---|
150 | ------------------------------------------------------- |
---|
151 | NOTE! You may specify a different download location by |
---|
152 | creating the file './build.properties' and |
---|
153 | setting 'depend.jars' to the URL to download from. |
---|
154 | ------------------------------------------------------- |
---|
155 | </echo> |
---|
156 | <download-lib file="BASE2Core.jar" /> |
---|
157 | <download-lib file="BASE2WSClient.jar" /> |
---|
158 | </target> |
---|
159 | |
---|
160 | <macrodef name="download-lib" description="Download BASE core JAR files"> |
---|
161 | <attribute name="file" /> |
---|
162 | <sequential> |
---|
163 | <get |
---|
164 | dest="lib/@{file}" |
---|
165 | src="${depend.jars}/@{file}" |
---|
166 | usetimestamp="true" |
---|
167 | verbose="true" |
---|
168 | ignoreerrors="true" |
---|
169 | /> |
---|
170 | </sequential> |
---|
171 | </macrodef> |
---|
172 | |
---|
173 | </project> |
---|