source: extensions/net.sf.basedb.opengrid/trunk/build.xml @ 5566

Last change on this file since 5566 was 5566, checked in by Nicklas Nordborg, 2 years ago

Preparing for future release Open Grid Scheduler extension 1.4

File size: 7.1 KB
Line 
1<?xml version="1.0" encoding="UTF-8"?>
2<project 
3  name="OpenGridSchedulerService" 
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="opengrid" />
12  <property name="version" value="1.4-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.release" value="11" />
21  <property name="javac.encoding" value="UTF-8" />
22  <property name="depend.base-version" 
23    value="3.15.0" 
24    description="The BASE version that this project depends on."
25  />
26  <property name="depend.jars" 
27    value="http://base.thep.lu.se/chrome/site/files/base/jars/${depend.base-version}" 
28    description="The location of the BASE core JARs that this project depends on."
29  />
30
31  <!-- set up classpath for compiling -->
32  <path id="classpath">
33    <fileset dir="lib">
34      <include name="**/*.jar" />
35    </fileset>
36    <fileset dir="META-INF/lib">
37      <include name="**/*.jar" />
38    </fileset>
39  </path>
40
41  <target name="init">
42    <mkdir dir="${build}" />
43    <mkdir dir="${dist}" />
44  </target>
45   
46  <target name="clean">
47    <delete failonerror="false" includeemptydirs="true">
48      <fileset dir="${build}" defaultexcludes="no" />
49      <fileset dir="${dist}" defaultexcludes="no" />
50      <fileset dir="lib" includes="base-*.jar" /> 
51      <fileset file="${jar.name}" />
52      <fileset file="${tar.name}" />
53    </delete>
54  </target>
55 
56  <target 
57    name="dist" 
58    depends="clean,download-lib,build,doc"
59    >
60    <copy todir="${dist}">
61      <fileset dir="." includes="README,LICENSE,opengrid-config.xml" />
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    </tar>
92  </target>
93 
94  <target 
95    name="install"
96    depends="build"
97    >
98    <fail unless="base.plugins" message="base.plugins is not set to the path of BASE plug-ins directory." />
99    <copy todir="${base.plugins}">
100      <fileset file="${jar.name}" />
101    </copy>
102    <echo>Copied '${jar.name}' to '${base.plugins}'.</echo>
103  </target>
104
105 
106  <target 
107    name="build"
108    depends="init,checkjar"
109    description="Compiles the plugin and put in jar"
110    >
111    <mkdir dir="${build}" />
112    <javac 
113      encoding="${javac.encoding}" 
114      srcdir="${src}" 
115      destdir="${build}" 
116      debug="true" 
117      includeantruntime="false"
118      classpathref="classpath"
119      release="${javac.release}"
120      >
121      <compilerarg value="${javac.arg}" />
122    </javac>
123    <jar 
124      jarfile="${jar.name}" 
125      manifest="META-INF/MANIFEST.MF"
126      >
127      <fileset dir="${build}" />
128      <fileset dir="." includes="META-INF/**" />
129      <fileset dir="." includes="resources/**" />
130    </jar>
131  </target>
132 
133  <target 
134    name="checkjar"
135    description="Checks that required BASE JAR files exists"
136    >
137    <available classname="net.sf.basedb.core.Application" 
138      classpathref="classpath" property="base-core" />
139    <available classname="net.sf.basedb.clients.web.Base" 
140      classpathref="classpath" property="base-web" />
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    <echo>Found all requried BASE core JAR files.</echo>
144  </target>
145 
146  <target
147    name="doc"
148    depends="init"
149    description="Generate JavaDoc of entire API"
150    >
151    <!-- Create the time stamp -->
152    <tstamp>
153      <format property="TODAY" pattern="yyyy-MM-dd"/>
154    </tstamp>
155    <delete dir="${dist}/doc/api" />
156    <sleep milliseconds="1000"/>
157    <mkdir dir="${dist}/doc/api" />
158
159    <javadoc
160      packagenames="net.sf.basedb.*"
161      sourcepath="${src}"
162      destdir="${dist}/doc/api"
163      author="true"
164      version="true"
165      use="false"
166      private="true"
167      windowtitle="Open Grid Scheduler package for BASE ${version} API documentation"
168      classpathref="classpath"
169      linksource="false"
170      breakiterator="yes"
171      encoding="${javac.encoding}"
172      additionalparam="-Xdoclint:all,-missing"
173      >
174      <header><![CDATA[Open Grid Scheduler package for BASE ${version}: ${TODAY}]]></header>
175      <link href="https://docs.oracle.com/en/java/javase/11/docs/api/"/>
176      <link href="http://base.thep.lu.se/chrome/site/latest/api/" />
177    </javadoc>
178  </target>
179
180 
181  <target 
182    name="download-lib"
183    description="Download required BASE core jar files"
184    >
185    <echo>
186-------------------------------------------------------   
187NOTE! You may specifiy a different download location by
188creating the file './build.properties' and
189setting 'depend.jars' to the URL to download from.
190-------------------------------------------------------
191    </echo>
192    <download-lib file="base-core-${depend.base-version}.jar" />
193    <download-lib file="base-webclient-${depend.base-version}.jar" />
194  </target>
195 
196  <macrodef name="download-lib" description="Download BASE core JAR files">
197    <attribute name="file" />
198    <sequential>
199      <get 
200        dest="lib/@{file}" 
201        src="${depend.jars}/@{file}" 
202        usetimestamp="true" 
203        verbose="true"
204        ignoreerrors="true"
205      />
206    </sequential>
207  </macrodef> 
208 
209  <target name="update-version">
210    <echo>Setting version to: ${version}</echo>
211   
212    <echo>OpenGrid.java</echo>
213    <replaceregexp 
214      file="${src}/net/sf/basedb/opengrid/OpenGrid.java"
215      match="public static final String VERSION = &#34;.*&#34;;"
216      replace="public static final String VERSION = &#34;${version}&#34;;"
217      encoding="UTF-8"
218    />
219   
220    <echo>extensions.xml</echo>
221    <replaceregexp 
222      file="META-INF/extensions.xml"
223      match="&lt;version&gt;.*&lt;/version&gt;"
224      replace="&lt;version&gt;${version}&lt;/version&gt;"
225      encoding="UTF-8"
226    />
227    <replaceregexp 
228      file="META-INF/extensions.xml"
229      match="&lt;min-base-version&gt;.*&lt;/min-base-version&gt;"
230      replace="&lt;min-base-version&gt;${depend.base-version}&lt;/min-base-version&gt;"
231      encoding="UTF-8"
232    />
233
234    <echo>Don't forget to commit the changes to the subversion repository!</echo>
235  </target>
236
237</project>
Note: See TracBrowser for help on using the repository browser.