source: extensions/net.sf.basedb.labenv/trunk/build.xml @ 2491

Last change on this file since 2491 was 2491, checked in by olle, 9 years ago

Refs #592. Lab environment extension updated by setting version number to "1.1":

  1. Ant build file build.xml updated by setting version number to "1.1".
  2. Class/file LabEnv.java in src/net/sf/basedb/labenv/ updated by setting public static constant String VERSION to "1.1".


File size: 6.9 KB
Line 
1<?xml version="1.0" encoding="UTF-8"?>
2<project 
3  name="LabEnv" 
4  default="build" 
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="labenv" />
12  <property name="version" value="1.1" />
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="dist" location="dist" description="Directory where distribution should be created" />
16  <property name="jar.name" value="${name}.jar" description="Name of JAR file with the extensions." />
17  <property name="tar.prefix" value="${name}-${version}" description="Prefix of .tar.gz file for download." />
18  <property name="tar.name" value="${tar.prefix}.tar.gz" description="Full name of .tar.gz file for download." />
19  <property name="javac.arg" value="-Xlint:unchecked" />
20  <property name="javac.source" value="1.6" />
21  <property name="javac.target" value="1.6" />
22  <property name="javac.encoding" value="UTF-8" />
23  <property name="depend.base-version" 
24    value="3.2.2" 
25    description="The BASE version that this project depends on."
26  />
27  <property name="depend.jars" 
28    value="http://base2.thep.lu.se/base/jars/${depend.base-version}" 
29    description="The location of the BASE core JARs that this project depends on."
30  />
31
32  <!-- set up classpath for compiling -->
33  <path id="classpath">
34    <fileset dir="lib">
35      <include name="**/*.jar" />
36    </fileset>
37    <fileset dir="META-INF/lib">
38      <include name="**/*.jar" />
39    </fileset>
40  </path>
41
42  <target name="init">
43    <mkdir dir="${build}" />
44    <mkdir dir="${dist}" />
45  </target>
46   
47  <target name="clean">
48    <delete failonerror="false" includeemptydirs="true">
49      <fileset dir="${build}" defaultexcludes="no" />
50      <fileset dir="${dist}" defaultexcludes="no" />
51      <fileset file="${jar.name}" />
52      <fileset file="${tar.name}" />
53    </delete>
54  </target>
55 
56  <target 
57    name="dist" 
58    depends="clean,build"
59    >
60    <copy todir="${dist}">
61      <fileset dir="." includes="README,LICENSE" />
62      <fileset file="${jar.name}" />
63    </copy>
64  </target>
65 
66  <target
67    name="package"
68    depends="dist"
69    description="Create binary distribution package"
70    >
71    <tar
72      destfile="${tar.name}"
73      longfile="gnu"
74      compression="gzip"
75      >
76      <tarfileset
77        dir="${dist}"
78        mode="755"
79        prefix="${tar.prefix}"
80        preserveLeadingSlashes="true"
81        >
82        <include name="**/*.sh" />
83      </tarfileset>
84      <tarfileset
85        dir="${dist}"
86        prefix="${tar.prefix}"
87        preserveLeadingSlashes="true"
88        >
89        <exclude name="**/*.sh" />
90      </tarfileset>
91      <tarfileset
92        dir="."
93        prefix="${tar.prefix}"
94        preserveLeadingSlashes="true"
95        includes="labenv-config.xml"
96        >
97      </tarfileset>
98      <tarfileset
99        dir="lib/compile"
100        prefix="${tar.prefix}"
101        preserveLeadingSlashes="true"
102        includes="sqlite-jdbc*.jar"
103        >
104      </tarfileset>
105    </tar>
106  </target>
107 
108  <target 
109    name="install"
110    depends="build"
111    >
112    <fail unless="base.plugins" message="base.plugins is not set to the path of BASE plug-ins directory." />
113    <copy todir="${base.plugins}">
114      <fileset file="${jar.name}" />
115    </copy>
116    <echo>Copied '${jar.name}' to '${base.plugins}'.</echo>
117<!--
118    <copy todir="${dist}/www/WEB-INF/classes">
119      <fileset file="labenv-config.xml" />
120    </copy>
121    <echo>Copied 'labenv-config.xml' to '${dist}/www/WEB-INF/classes'.</echo>
122-->
123  </target>
124
125 
126  <target 
127    name="build"
128    depends="init,checkjar"
129    description="Compiles the plugin and put in jar"
130    >
131    <mkdir dir="${build}" />
132    <javac 
133      encoding="${javac.encoding}" 
134      srcdir="${src}" 
135      destdir="${build}" 
136      debug="true" 
137      includeantruntime="false"
138      classpathref="classpath"
139      source="${javac.source}"
140      target="${javac.target}"
141      >
142      <compilerarg value="${javac.arg}" />
143    </javac>
144    <jar 
145      jarfile="${jar.name}" 
146      manifest="META-INF/MANIFEST.MF"
147      >
148      <fileset dir="${build}" />
149      <fileset dir="." includes="META-INF/**" />
150      <fileset dir="." includes="resources/**" />
151    </jar>
152  </target>
153 
154  <target 
155    name="checkjar"
156    description="Checks that required BASE JAR files exists"
157    >
158    <available classname="net.sf.basedb.core.Application" 
159      classpathref="classpath" property="base-core" />
160    <available classname="net.sf.basedb.clients.web.Base" 
161      classpathref="classpath" property="base-web" />
162    <available classname="net.sf.basedb.info.BioAssaySetInfo" 
163      classpathref="classpath" property="base-webservice" />
164    <fail unless="base-core" message="Can't find base-core-${depend.base-version}.jar in ./lib/compile. Try 'ant download-lib' to download the missing file." />
165    <fail unless="base-web" message="Can't find base-webclient-${depend.base-version}.jar in ./lib/compile. Try 'ant download-lib' to download the missing file." />
166    <fail unless="base-webservice" message="Can't find base-webservices-client-${depend.base-version}.jar in ./lib/compile. Try 'ant download-lib' to download the missing file." />
167    <echo>Found all requried BASE core JAR files.</echo>
168  </target>
169 
170  <target 
171    name="download-lib"
172    description="Download required BASE core jar files"
173    >
174    <echo>
175-------------------------------------------------------   
176NOTE! You may specifiy a different download location by
177creating the file './build.properties' and
178setting 'depend.jars' to the URL to download from.
179-------------------------------------------------------
180    </echo>
181    <download-lib file="base-core-${depend.base-version}.jar" />
182    <download-lib file="base-webclient-${depend.base-version}.jar" />
183    <download-lib file="base-webservices-client-${depend.base-version}.jar" />
184  </target>
185 
186  <macrodef name="download-lib" description="Download BASE core JAR files">
187    <attribute name="file" />
188    <sequential>
189      <get 
190        dest="lib/compile/@{file}" 
191        src="${depend.jars}/@{file}" 
192        usetimestamp="true" 
193        verbose="true"
194        ignoreerrors="true"
195      />
196    </sequential>
197  </macrodef> 
198 
199  <target name="update-version">
200    <echo>Setting version to: ${version}</echo>
201   
202    <echo>LabEnv.java</echo>
203    <replaceregexp 
204      file="${src}/net/sf/basedb/labenv/LabEnv.java"
205      match="public static final String VERSION = &#34;.*&#34;;"
206      replace="public static final String VERSION = &#34;${version}&#34;;"
207      encoding="UTF-8"
208    />
209
210    <echo>extensions.xml</echo>
211    <replaceregexp 
212      file="META-INF/extensions.xml"
213      match="&lt;version&gt;.*&lt;/version&gt;"
214      replace="&lt;version&gt;${version}&lt;/version&gt;"
215      encoding="UTF-8"
216    />
217    <replaceregexp 
218      file="META-INF/extensions.xml"
219      match="&lt;min-base-version&gt;.*&lt;/min-base-version&gt;"
220      replace="&lt;min-base-version&gt;${depend.base-version}&lt;/min-base-version&gt;"
221      encoding="UTF-8"
222    />
223
224    <echo>Don't forget to commit the changes to the subversion repository!</echo>
225  </target>
226
227</project>
Note: See TracBrowser for help on using the repository browser.