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

Last change on this file since 1398 was 1398, checked in by Nicklas Nordborg, 12 years ago

References #313: Updates required for BASE 3 support

Fixed build script so that it can download BASE JAR files. Set <min-base-version> in extensions.xml. Moved 3rd-party licenses to the META-INF/lib directory. Added .classpath t make it easier for Eclipse developers.

File size: 5.8 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.2-dev" />
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.base-version" 
48    value="3.0.0" 
49    description="The BASE version that this project depends on."
50  />
51  <property name="depend.jars" 
52    value="http://base2.thep.lu.se/base/jars/${depend.base-version}" 
53    description="The location of the BASE core JARs that this project depends on."
54  />
55
56  <!-- set up classpath for compiling -->
57  <path id="classpath">
58    <fileset dir="lib">
59      <include name="**/*.jar" />
60    </fileset>
61    <fileset dir="META-INF/lib">
62      <include name="**/*.jar" />
63    </fileset>
64  </path>
65
66  <target name="init">
67    <mkdir dir="${build}" />
68  </target>
69   
70  <target name="clean">
71    <delete failonerror="false" includeemptydirs="true">
72      <fileset dir="${build}" defaultexcludes="no" />
73      <fileset file="${jar.name}" />
74      <fileset file="${tar.name}" />
75    </delete>
76  </target>
77 
78  <target
79    name="package"
80    depends="clean,jar"
81    description="Clean and create binary distribution package"
82    >
83    <tar
84      destfile="${tar.name}"
85      longfile="gnu"
86      compression="gzip"
87      >
88      <tarfileset
89        dir="."
90        prefix="${tar.prefix}"
91        preserveLeadingSlashes="true"
92        includes="${jar.name},README,LICENSE*,ftp-config.xml"
93      />
94    </tar>
95  </target>
96 
97  <target 
98    name="jar"
99    depends="build"
100    description="Creates the extension JAR file"
101    >
102   
103    <jar 
104      jarfile="${jar.name}"
105      manifest="META-INF/MANIFEST.MF"
106      >     
107      <fileset dir="${build}" />
108      <fileset dir="." includes="META-INF/**" />
109      <fileset dir="." includes="resources/**" />
110    </jar>
111  </target>
112 
113  <target 
114    name="build"
115    depends="init,checkjar"
116    description="Compiles the plugin and put in jar"
117    >
118    <mkdir dir="${build}" />
119    <javac 
120      encoding="${javac.encoding}" 
121      srcdir="${src}" 
122      destdir="${build}" 
123      debug="true" 
124      classpathref="classpath"
125      source="${javac.source}"
126      target="${javac.target}"
127      includeantruntime="false"
128      >
129      <compilerarg value="${javac.arg}" />
130    </javac>
131  </target>
132 
133  <target name="update-version">
134    <echo>Setting version to: ${version}</echo>
135    <echo>extensions.xml</echo>
136    <replaceregexp 
137      file="META-INF/extensions.xml"
138      match="&lt;version&gt;.*&lt;/version&gt;"
139      replace="&lt;version&gt;${version}&lt;/version&gt;"
140      encoding="UTF-8"
141    />
142    <replaceregexp 
143      file="META-INF/extensions.xml"
144      match="&lt;min-base-version&gt;.*&lt;/min-base-version&gt;"
145      replace="&lt;min-base-version&gt;${depend.base-version}&lt;/min-base-version&gt;"
146      encoding="UTF-8"
147    />
148    <echo>Don't forget to commit the changes to the subversion repository!</echo>
149  </target>
150 
151  <target 
152    name="checkjar"
153    description="Checks that the required BASE JAR files exists."
154    >
155    <available classname="net.sf.basedb.core.Application" 
156      classpathref="classpath" property="basecore" />
157    <available classname="net.sf.basedb.clients.web.extensions.menu.FixedMenuItemFactory" 
158      classpathref="classpath" property="baseweb" />
159    <fail unless="basecore" message="Can't find base-core-${depend.base-version}.jar in ./lib/compile. Try 'ant download-lib' to download the missing file." />
160    <fail unless="baseweb" message="Can't find base-webclient-${depend.base-version}.jar in ./lib/compile. Try 'ant download-lib' to download the missing file." />
161    <echo>Found all requried BASE core JAR files.</echo>
162  </target>
163 
164  <target 
165    name="download-lib"
166    description="Download BASE JAR files"
167    >
168    <echo>
169-------------------------------------------------------   
170NOTE! You may specifiy a different download location by
171creating the file './build.properties' and
172setting 'depend.jars' to the URL to download from.
173-------------------------------------------------------
174    </echo>
175    <download-lib file="base-core-${depend.base-version}.jar" />
176    <download-lib file="base-webclient-${depend.base-version}.jar" />
177  </target>
178 
179  <macrodef name="download-lib" description="Download BASE core JAR files">
180    <attribute name="file" />
181    <sequential>
182      <get 
183        dest="lib/compile/@{file}" 
184        src="${depend.jars}/@{file}" 
185        usetimestamp="true" 
186        verbose="true"
187        ignoreerrors="true"
188      />
189    </sequential>
190  </macrodef>
191</project>
Note: See TracBrowser for help on using the repository browser.