source: extensions/net.sf.basedb.xfiles/trunk/build.xml

Last change on this file was 6320, checked in by Nicklas Nordborg, 22 months ago

Changes for future release External files support 1.7

File size: 5.9 KB
Line 
1<?xml version="1.0" encoding="UTF-8"?>
2<project 
3  name="XFiles" 
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="xfiles" />
12  <property name="version" value="1.7-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.18.0" 
24    description="The BASE version that this project depends on."
25  />
26  <property name="depend.jars" 
27    value="https://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"
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    </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  <target 
106    name="build"
107    depends="init,checkjar"
108    description="Compiles the plugin and put in jar"
109    >
110    <mkdir dir="${build}" />
111    <javac 
112      encoding="${javac.encoding}" 
113      srcdir="${src}" 
114      destdir="${build}" 
115      debug="true" 
116      includeantruntime="false"
117      classpathref="classpath"
118      release="${javac.release}"
119      >
120      <compilerarg value="${javac.arg}" />
121    </javac>
122    <jar 
123      jarfile="${jar.name}" 
124      manifest="META-INF/MANIFEST.MF"
125      >
126      <fileset dir="${build}" />
127      <fileset dir="." includes="META-INF/**" />
128    </jar>
129  </target>
130 
131  <target 
132    name="checkjar"
133    description="Checks that the base-core-${depend.base-version}.jar exists."
134    >
135    <available classname="net.sf.basedb.core.Application" 
136      classpathref="classpath" property="base-core" />
137    <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." />
138    <echo>Found base-core-${depend.base-version}.jar.</echo>
139  </target>
140 
141  <target 
142    name="download-lib"
143    description="Download base-core-${depend.base-version}.jar."
144    >
145    <echo>
146-------------------------------------------------------   
147NOTE! You may specifiy a different download location by
148creating the file './build.properties' and
149setting 'depend.jars' to the URL to download from.
150-------------------------------------------------------
151    </echo>
152    <download-lib file="base-core-${depend.base-version}.jar" />
153  </target>
154 
155  <macrodef name="download-lib" description="Download BASE core JAR files">
156    <attribute name="file" />
157    <sequential>
158      <get 
159        dest="lib/@{file}" 
160        src="${depend.jars}/@{file}" 
161        usetimestamp="true" 
162        verbose="true"
163        ignoreerrors="true"
164      />
165    </sequential>
166  </macrodef> 
167 
168  <target name="update-version">
169    <echo>Setting version to: ${version}</echo>
170   
171    <echo>XFiles.java</echo>
172    <replaceregexp 
173      file="${src}/net/sf/basedb/xfiles/XFiles.java"
174      match="public static final String VERSION = &#34;.*&#34;;"
175      replace="public static final String VERSION = &#34;${version}&#34;;"
176      encoding="UTF-8"
177    />
178
179    <echo>extensions.xml</echo>
180    <replaceregexp 
181      file="META-INF/extensions.xml"
182      match="&lt;version&gt;.*&lt;/version&gt;"
183      replace="&lt;version&gt;${version}&lt;/version&gt;"
184      encoding="UTF-8"
185    />
186    <replaceregexp 
187      file="META-INF/extensions.xml"
188      match="&lt;min-base-version&gt;.*&lt;/min-base-version&gt;"
189      replace="&lt;min-base-version&gt;${depend.base-version}&lt;/min-base-version&gt;"
190      encoding="UTF-8"
191    />
192   
193    <echo>.classpath</echo>
194    <replaceregexp 
195      file=".classpath"
196      match="base-(\w+)-[0-9.]+jar"
197      replace="base-\1-${depend.base-version}.jar"
198      encoding="UTF-8"
199      byline="true"
200    />
201   
202    <echo>Don't forget to commit the changes to the subversion repository!</echo>
203  </target>
204
205</project>
Note: See TracBrowser for help on using the repository browser.