source: extensions/net.sf.basedb.mev/trunk/build.xml @ 1416

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

Fixes #312: Updates required for BASE 3 support

Fixes build script so that it:

  • Can download BASE JAR file with ant download-lib
  • Put the current version numbers in various places
  • Removed obsolete file META-INF/base-plugins.xml

Fixes JSP files so that the compile against the BASE 3 API.

Fixes installation plug-in so that it doesn't crash when updating.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Date Id
File size: 8.4 KB
Line 
1<?xml version="1.0" encoding="UTF-8"?>
2<project 
3  name="MevLauncher" 
4  default="jar" 
5  basedir=".">
6
7  <!--create this file if you need to override values from properties below -->
8  <property file="build.properties" />
9 
10  <!-- variables used -->
11  <property name="name" value="mev-launcher" />
12  <property name="version" value="1.8-alfa" />
13  <property name="src" location="src" description="Location of source files" />
14  <property name="build" location="build" description="Location of compiled files" />
15  <property name="jar.name" value="${name}.jar" 
16    description="Name of JAR file with the extensions." />
17  <property name="tar.prefix" value="${name}-${version}" 
18    description="Prefix of .tar.gz file for download." />
19  <property name="tar.name" value="${tar.prefix}.tar.gz" 
20    description="Full name of .tar.gz file for download." />
21  <property name="javac.arg" value="-Xlint:unchecked" />
22  <property name="javac.source" value="1.6" />
23  <property name="javac.target" value="1.6" />
24  <property name="javac.encoding" value="UTF-8" />
25  <property name="depend.base-version" 
26    value="3.0.0" 
27    description="The BASE version that this project depends on."
28  />
29  <property name="depend.jars" 
30    value="http://base2.thep.lu.se/base/jars/${depend.base-version}" 
31    description="The location of the BASE core JARs that this project depends on."
32  />
33
34  <!-- set up classpath for compiling -->
35  <path id="classpath">
36    <fileset dir="lib">
37      <include name="**/*.jar" />
38    </fileset>
39    <fileset dir="resources/jar">
40      <include name="mev-base.jar" />
41      <include name="mev-gui-impl.jar" />
42      <include name="HTTPClient.jar" />
43    </fileset>
44  </path>
45
46  <target name="init">
47    <mkdir dir="${build}" />
48  </target>
49   
50  <target name="clean">
51    <delete failonerror="false" includeemptydirs="true">
52      <fileset dir="${build}" defaultexcludes="no" />
53      <fileset file="${jar.name}" />
54      <fileset file="${tar.name}" />
55    </delete>
56  </target>
57 
58  <target
59    name="package"
60    depends="clean,jar"
61    description="Clean and create binary distribution package"
62    >
63    <tar
64      destfile="${tar.name}"
65      longfile="gnu"
66      compression="gzip"
67      >
68      <tarfileset
69        dir="."
70        prefix="${tar.prefix}"
71        preserveLeadingSlashes="true"
72        includes="${jar.name},README,LICENSE*"
73        >
74      </tarfileset>
75    </tar>
76  </target> 
77 
78  <target
79    name="jar"
80    depends="jar.server"
81  />
82 
83  <target 
84    name="jar.server"
85    depends="build.server,jar.webstart"
86    description="Creates the server-side plugin/extension JAR file"
87    >
88    <copy todir="${build}/server">
89      <fileset dir="." includes="META-INF/*" />
90    </copy>
91    <jar 
92      jarfile="${jar.name}" 
93      >
94      <fileset dir="${build}/server" />
95      <fileset dir="." includes="resources/**" />
96    </jar>
97  </target>
98
99  <target 
100    name="jar.webstart"
101    depends="build.webstart"
102    description="Creates the webstart wrapper JAR file"
103    >
104    <mkdir dir="${build}/server/resources/jar/" />
105    <jar
106      jarfile="${build}/server/resources/jar/base-mev-wrapper.jar"
107      >
108      <fileset dir="${build}/webstart" includes="**/*" />
109    </jar>
110    <signjar
111      alias="mev-base" 
112      keystore="./jarsign/mev-base.key"
113      storepass="mev-base"
114      lazy="true">
115      <fileset 
116        dir="${build}/server/resources/jar/"
117        includes="*.jar" 
118      />
119    </signjar>
120  </target>
121 
122  <target 
123    name="build"
124    depends="build.server,build.webstart"
125  />
126 
127  <target 
128    name="build.server"
129    depends="init,checkjar"
130    description="Compiles the server-side plugin/extension"
131    >
132    <mkdir dir="${build}/server" />
133    <javac 
134      srcdir="${src}/server" 
135      destdir="${build}/server" 
136      debug="true" 
137      classpathref="classpath"
138      encoding="${javac.encoding}" 
139      source="${javac.source}"
140      target="${javac.target}"
141      includeantruntime="false"
142      >
143      <compilerarg value="${javac.arg}" />
144    </javac>
145  </target>
146 
147  <target 
148    name="build.webstart"
149    depends="init,checkjar"
150    description="Compiles the webstart wrapper"
151    >
152    <mkdir dir="${build}/webstart" />
153    <javac 
154      srcdir="${src}/webstart" 
155      destdir="${build}/webstart" 
156      debug="true" 
157      classpathref="classpath"
158      encoding="${javac.encoding}" 
159      source="${javac.source}"
160      target="${javac.target}"
161      includeantruntime="false"
162      >
163      <compilerarg value="${javac.arg}" />
164    </javac>
165  </target>
166 
167  <target name="update-version">
168    <echo>Setting version to: ${version}</echo>
169   
170    <echo>Mev.java</echo>
171    <replaceregexp 
172      file="${src}/server/net/sf/basedb/mev/Mev.java"
173      match="public static final String VERSION = &#34;.*&#34;;"
174      replace="public static final String VERSION = &#34;${version}&#34;;"
175      encoding="UTF-8"
176    />
177   
178    <echo>extensions.xml</echo>
179    <replaceregexp 
180      file="META-INF/extensions.xml"
181      match="&lt;version&gt;.*&lt;/version&gt;"
182      replace="&lt;version&gt;${version}&lt;/version&gt;"
183      encoding="UTF-8"
184    />
185   
186    <replaceregexp 
187      file="META-INF/extensions.xml"
188      match="&lt;min-base-version&gt;.*&lt;/min-base-version&gt;"
189      replace="&lt;min-base-version&gt;${depend.base-version}&lt;/min-base-version&gt;"
190      encoding="UTF-8"
191    />
192    <echo>Don't forget to commit the changes to the subversion repository!</echo>
193  </target>
194 
195  <target 
196    name="checkjar"
197    description="Checks that the required BASE JAR files exists."
198    >
199    <available classname="net.sf.basedb.util.export.spotdata.AbstractBioAssaySetExporter" 
200      classpathref="classpath" property="basecore" />
201    <available classname="net.sf.basedb.plugins.util.Parameters" 
202      classpathref="classpath" property="baseplugins" />
203    <available classname="net.sf.basedb.clients.web.extensions.toolbar.FixedButtonFactory" 
204      classpathref="classpath" property="baseweb" />
205    <available classname="net.sf.basedb.info.BioAssaySetInfo" 
206      classpathref="classpath" property="basewebservice" />
207    <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." />
208    <fail unless="baseplugins" message="Can't find base-coreplugins-${depend.base-version}.jar in ./lib/compile. Try 'ant download-lib' to download the missing file." />
209    <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." />
210    <fail unless="basewebservice" message="Can't find base-webservices-client-${depend.base-version}.jar in ./lib/compile. Try 'ant download-lib' to download the missing file." />
211    <echo>Found all requried BASE core JAR files.</echo>
212  </target>
213 
214  <target name="fixjars" description="Fix some of the original JAR files included with MEV">
215    <!-- Re-package 'magetab-parser.jar' since it contains duplicate entries for each file -->
216    <jar
217      jarfile="./resources/jar/magetab-tmp.jar"
218      duplicate="preserve"
219      >
220      <zipfileset src="./resources/jar/magetab-parser.jar" />
221    </jar>
222    <delete file="./resources/jar/magetab-parser.jar" />
223    <move 
224      file="./resources/jar/magetab-tmp.jar"
225      tofile="./resources/jar/magetab-parser.jar"
226    />
227    <!-- Re-package 'goose.jar' since we want to sign it with our own key -->
228    <jar
229      jarfile="./resources/jar/goose-tmp.jar"
230      >
231      <zipfileset src="./resources/jar/goose.jar" excludes="**/*.DSA,**/*.SF"/>
232    </jar>
233    <delete file="./resources/jar/goose.jar" />
234    <move 
235      file="./resources/jar/goose-tmp.jar" 
236      tofile="./resources/jar/goose.jar" 
237    />
238  </target>
239 
240  <target name="signjars">
241    <signjar
242      alias="mev-base" 
243      keystore="./jarsign/mev-base.key"
244      storepass="mev-base"
245      lazy="true">
246      <fileset 
247        dir="./resources/jar"
248        includes="*.jar"
249      />
250    </signjar>
251  </target>
252 
253  <target 
254    name="download-lib"
255    description="Download base-core-3.x.jar, base-webclient-3.0.0.jar, base-coreplugins-3.x.jar and base-webservices-client-3.0x.jar"
256    >
257    <echo>
258-------------------------------------------------------   
259NOTE! You may specifiy a different download location by
260creating the file './build.properties' and
261setting 'depend.jars' to the URL to download from.
262-------------------------------------------------------
263    </echo>
264    <download-lib file="base-core-${depend.base-version}.jar" />
265    <download-lib file="base-webclient-${depend.base-version}.jar" />
266    <download-lib file="base-coreplugins-${depend.base-version}.jar" />
267    <download-lib file="base-webservices-client-${depend.base-version}.jar" />
268  </target>
269 
270  <macrodef name="download-lib" description="Download BASE core JAR files">
271    <attribute name="file" />
272    <sequential>
273      <get 
274        dest="lib/compile/@{file}" 
275        src="${depend.jars}/@{file}" 
276        usetimestamp="true" 
277        verbose="true"
278        ignoreerrors="true"
279      />
280    </sequential>
281  </macrodef>
282</project>
Note: See TracBrowser for help on using the repository browser.