source: extensions/net.sf.basedb.reggie/branches/2.0-dev/build.xml @ 1424

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

References #326: Updates required for BASE 3 support

This should fix:

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