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

Last change on this file since 2527 was 2527, checked in by Nicklas Nordborg, 7 years ago

Preparing for future release Xfiles 1.1

File size: 5.7 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.1-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.7" />
21  <property name="javac.target" value="1.7" />
22  <property name="javac.encoding" value="UTF-8" />
23  <property name="depend.base-version" 
24    value="3.3.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    <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    </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      source="${javac.source}"
119      target="${javac.target}"
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    </jar>
130  </target>
131 
132  <target 
133    name="checkjar"
134    description="Checks that the base-core-${depend.base-version}.jar exists."
135    >
136    <available classname="net.sf.basedb.core.Application" 
137      classpathref="classpath" property="base-core" />
138    <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." />
139    <echo>Found base-core-${depend.base-version}.jar.</echo>
140  </target>
141 
142  <target 
143    name="download-lib"
144    description="Download base-core-${depend.base-version}.jar."
145    >
146    <echo>
147-------------------------------------------------------   
148NOTE! You may specifiy a different download location by
149creating the file './build.properties' and
150setting 'depend.jars' to the URL to download from.
151-------------------------------------------------------
152    </echo>
153    <download-lib file="base-core-${depend.base-version}.jar" />
154  </target>
155 
156  <macrodef name="download-lib" description="Download BASE core JAR files">
157    <attribute name="file" />
158    <sequential>
159      <get 
160        dest="lib/@{file}" 
161        src="${depend.jars}/@{file}" 
162        usetimestamp="true" 
163        verbose="true"
164        ignoreerrors="true"
165      />
166    </sequential>
167  </macrodef> 
168 
169  <target name="update-version">
170    <echo>Setting version to: ${version}</echo>
171   
172    <echo>XFiles.java</echo>
173    <replaceregexp 
174      file="${src}/net/sf/basedb/xfiles/XFiles.java"
175      match="public static final String VERSION = &#34;.*&#34;;"
176      replace="public static final String VERSION = &#34;${version}&#34;;"
177      encoding="UTF-8"
178    />
179
180    <echo>extensions.xml</echo>
181    <replaceregexp 
182      file="META-INF/extensions.xml"
183      match="&lt;version&gt;.*&lt;/version&gt;"
184      replace="&lt;version&gt;${version}&lt;/version&gt;"
185      encoding="UTF-8"
186    />
187    <replaceregexp 
188      file="META-INF/extensions.xml"
189      match="&lt;min-base-version&gt;.*&lt;/min-base-version&gt;"
190      replace="&lt;min-base-version&gt;${depend.base-version}&lt;/min-base-version&gt;"
191      encoding="UTF-8"
192    />
193   
194    <echo>Don't forget to commit the changes to the subversion repository!</echo>
195  </target>
196
197</project>
Note: See TracBrowser for help on using the repository browser.