source: extensions/net.sf.basedb.reggie/trunk/build.xml @ 1341

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

Preparing for future Reggie 1.3 release.

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