source: extensions/net.sf.basedb.ftp/trunk/build.xml @ 1382

Last change on this file since 1382 was 1382, checked in by Martin Svensson, 11 years ago

Fixes #313 Updates required for BASE 3 support

File size: 5.5 KB
Line 
1<?xml version="1.0" encoding="UTF-8"?>
2<!--
3  $Id $
4
5  Copyright (C) 2008 Nicklas Nordborg
6
7  This file is part of the FTP Server extension for BASE.
8  Available at http://baseplugins.thep.lu.se/
9  BASE main site: http://base.thep.lu.se/
10 
11  This is free software; you can redistribute it and/or
12  modify it under the terms of the GNU General Public License
13  as published by the Free Software Foundation; either version 3
14  of the License, or (at your option) any later version.
15 
16  The software is distributed in the hope that it will be useful,
17  but WITHOUT ANY WARRANTY; without even the implied warranty of
18  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  GNU General Public License for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with BASE. If not, see <http://www.gnu.org/licenses/>.
23-->
24<project 
25  name="FtpServerExtension" 
26  default="jar" 
27  basedir=".">
28
29  <!--create this file if you need to override values from properties below -->
30  <property file="build.properties" />
31 
32  <!-- variables used -->
33  <property name="name" value="base-ftpserver" />
34  <property name="version" value="1.2pre" />
35  <property name="src" location="src" description="Location of source files" />
36  <property name="build" location="build" description="Location of compiled files" />
37  <property name="jar.name" value="${name}.jar" 
38    description="Name of JAR file with the extensions." />
39  <property name="tar.prefix" value="${name}-${version}" 
40    description="Prefix of .tar.gz file for download." />
41  <property name="tar.name" value="${tar.prefix}.tar.gz" 
42    description="Full name of .tar.gz file for download." />
43  <property name="javac.arg" value="-Xlint:unchecked" />
44  <property name="javac.source" value="1.6" />
45  <property name="javac.target" value="1.6" />
46  <property name="javac.encoding" value="UTF-8" />
47  <property name="depend.jars.directory" value="http://base2.thep.lu.se/base/jars/" />
48  <property name="depend.jars.core" value="base-core-3.0.0.jar" />
49  <property name="depend.jars.webclient" value="base-webclient-3.0.0.jar" />
50
51  <!-- set up classpath for compiling -->
52  <path id="classpath">
53    <fileset dir="lib">
54      <include name="**/*.jar" />
55    </fileset>
56    <fileset dir="META-INF/lib">
57      <include name="**/*.jar" />
58    </fileset>
59  </path>
60
61  <target name="init">
62    <mkdir dir="${build}" />
63  </target>
64   
65  <target name="clean">
66    <delete failonerror="false" includeemptydirs="true">
67      <fileset dir="${build}" defaultexcludes="no" />
68      <fileset file="${jar.name}" />
69      <fileset file="${tar.name}" />
70    </delete>
71  </target>
72 
73  <target
74    name="package"
75    depends="clean,jar"
76    description="Clean and create binary distribution package"
77    >
78    <tar
79      destfile="${tar.name}"
80      longfile="gnu"
81      compression="gzip"
82      >
83      <tarfileset
84        dir="."
85        prefix="${tar.prefix}"
86        preserveLeadingSlashes="true"
87        includes="${jar.name},README,LICENSE*,ftp-config.xml"
88      />
89    </tar>
90  </target>
91 
92  <target 
93    name="jar"
94    depends="build"
95    description="Creates the extension JAR file"
96    >
97   
98    <jar 
99      jarfile="${jar.name}"
100      manifest="META-INF/MANIFEST.MF"
101      >     
102      <fileset dir="${build}" />
103      <fileset dir="." includes="META-INF/**" />
104      <fileset dir="." includes="resources/**" />
105    </jar>
106  </target>
107 
108  <target 
109    name="build"
110    depends="init,checkjar"
111    description="Compiles the plugin and put in jar"
112    >
113    <mkdir dir="${build}" />
114    <javac 
115      encoding="${javac.encoding}" 
116      srcdir="${src}" 
117      destdir="${build}" 
118      debug="true" 
119      classpathref="classpath"
120      source="${javac.source}"
121      target="${javac.target}"
122      includeantruntime="false"
123      >
124      <compilerarg value="${javac.arg}" />
125    </javac>
126  </target>
127 
128  <target name="update-version">
129    <echo>Setting version to: ${version}</echo>
130    <echo>extensions.xml</echo>
131    <replaceregexp 
132      file="META-INF/extensions.xml"
133      match="&lt;version&gt;.*&lt;/version&gt;"
134      replace="&lt;version&gt;${version}&lt;/version&gt;"
135      encoding="UTF-8"
136    />
137    <echo>Don't forget to commit the changes to the subversion repository!</echo>
138  </target>
139 
140  <target 
141    name="checkjar"
142    description="Checks that the ${depend.jars.core} and ${depend.jars.webclient} exists."
143    >
144    <available classname="net.sf.basedb.core.Application" 
145      classpathref="classpath" property="basecore" />
146    <available classname="net.sf.basedb.clients.web.extensions.menu.FixedMenuItemFactory" 
147      classpathref="classpath" property="baseweb" />
148    <fail unless="basecore" message="Can't find ${depend.jars.core} in ./lib/compile. Try 'ant download-lib' to download the missing file." />
149    <fail unless="baseweb" message="Can't find ${depend.jars.webclient} in ./lib/compile. Try 'ant download-lib' to download the missing file." />
150    <echo>Found ${depend.jars.core} and ${depend.jars.webclient}.</echo>
151  </target>
152 
153  <target 
154    name="download-lib"
155    description="Download ${depend.jars.core} and ${depend.jars.webclient}"
156    >
157    <echo>
158-------------------------------------------------------   
159NOTE! You may specifiy a different download location by
160creating the file './build.properties' and
161setting 'depend.jars' to the URL to download from.
162-------------------------------------------------------
163    </echo>
164    <download-lib file="${depend.jars.core}" />
165    <download-lib file="${depend.jars.webclient}" />
166  </target>
167 
168  <macrodef name="download-lib" description="Download BASE core JAR files">
169    <attribute name="file" />
170    <sequential>
171      <get 
172        dest="lib/compile/@{file}" 
173        src="${depend.jars.directory}/@{file}" 
174        usetimestamp="true" 
175        verbose="true"
176        ignoreerrors="true"
177      />
178    </sequential>
179  </macrodef>
180</project>
Note: See TracBrowser for help on using the repository browser.