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

Last change on this file since 2758 was 2758, checked in by Nicklas Nordborg, 8 years ago

References #652: New location of BASE JAR files

MeV trunk.

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