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

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

Fixes #279: Plug-in should suggest better job names

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