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

Last change on this file since 1441 was 1441, checked in by Nicklas Nordborg, 11 years ago

Changes for future release 'FTP Server 1.3'

File size: 6.1 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.3-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 
134    name="install"
135    depends="jar"
136    >
137    <fail unless="base.plugins" message="base.plugins is not set to the path of BASE plug-ins directory." />
138    <copy todir="${base.plugins}">
139      <fileset file="${jar.name}" />
140    </copy>
141    <echo>Copied '${jar.name}' to '${base.plugins}'.</echo>
142  </target>
143
144  <target name="update-version">
145    <echo>Setting version to: ${version}</echo>
146    <echo>extensions.xml</echo>
147    <replaceregexp 
148      file="META-INF/extensions.xml"
149      match="&lt;version&gt;.*&lt;/version&gt;"
150      replace="&lt;version&gt;${version}&lt;/version&gt;"
151      encoding="UTF-8"
152    />
153    <replaceregexp 
154      file="META-INF/extensions.xml"
155      match="&lt;min-base-version&gt;.*&lt;/min-base-version&gt;"
156      replace="&lt;min-base-version&gt;${depend.base-version}&lt;/min-base-version&gt;"
157      encoding="UTF-8"
158    />
159    <echo>Don't forget to commit the changes to the subversion repository!</echo>
160  </target>
161 
162  <target 
163    name="checkjar"
164    description="Checks that the required BASE JAR files exists."
165    >
166    <available classname="net.sf.basedb.core.Application" 
167      classpathref="classpath" property="basecore" />
168    <available classname="net.sf.basedb.clients.web.extensions.menu.FixedMenuItemFactory" 
169      classpathref="classpath" property="baseweb" />
170    <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." />
171    <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." />
172    <echo>Found all requried BASE core JAR files.</echo>
173  </target>
174 
175  <target 
176    name="download-lib"
177    description="Download BASE JAR files"
178    >
179    <echo>
180-------------------------------------------------------   
181NOTE! You may specifiy a different download location by
182creating the file './build.properties' and
183setting 'depend.jars' to the URL to download from.
184-------------------------------------------------------
185    </echo>
186    <download-lib file="base-core-${depend.base-version}.jar" />
187    <download-lib file="base-webclient-${depend.base-version}.jar" />
188  </target>
189 
190  <macrodef name="download-lib" description="Download BASE core JAR files">
191    <attribute name="file" />
192    <sequential>
193      <get 
194        dest="lib/compile/@{file}" 
195        src="${depend.jars}/@{file}" 
196        usetimestamp="true" 
197        verbose="true"
198        ignoreerrors="true"
199      />
200    </sequential>
201  </macrodef>
202</project>
Note: See TracBrowser for help on using the repository browser.