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