source: extensions/net.sf.basedb.hdfs/trunk/build.xml @ 1358

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

References #304: Implement HDFS external file support

Re-packaging of extra JAR files since BASE now supports including them with the main JAR file (http://base.thep.lu.se/ticket/1594).

  • Property svn:eol-style set to native
  • Property svn:keywords set to Date Id
File size: 5.6 KB
Line 
1<?xml version="1.0" encoding="UTF-8"?>
2<project 
3  name="Hdfs" 
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="hdfs" />
12  <property name="version" value="1.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    <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 dir="." includes="lib/hdfs/*" />
63      <fileset file="${jar.name}" />
64    </copy>
65  </target>
66 
67  <target
68    name="package"
69    depends="dist"
70    description="Create binary distribution package"
71    >
72    <tar
73      destfile="${tar.name}"
74      longfile="gnu"
75      compression="gzip"
76      >
77      <tarfileset
78        dir="${dist}"
79        mode="755"
80        prefix="${tar.prefix}"
81        preserveLeadingSlashes="true"
82        >
83        <include name="**/*.sh" />
84      </tarfileset>
85      <tarfileset
86        dir="${dist}"
87        prefix="${tar.prefix}"
88        preserveLeadingSlashes="true"
89        >
90        <exclude name="**/*.sh" />
91      </tarfileset>
92    </tar>
93  </target>
94 
95  <target 
96    name="install"
97    depends="build"
98    >
99    <fail unless="base.plugins" message="base.plugins is not set to the path of BASE plug-ins directory." />
100    <copy todir="${base.plugins}">
101      <fileset file="${jar.name}" />
102    </copy>
103    <echo>Copied '${jar.name}' to '${base.plugins}'.</echo>
104  </target>
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      source="${javac.source}"
120      target="${javac.target}"
121      >
122      <compilerarg value="${javac.arg}" />
123    </javac>
124    <jar 
125      jarfile="${jar.name}" 
126      manifest="META-INF/MANIFEST.MF"
127      >
128      <fileset dir="${build}" />
129      <fileset dir="." includes="META-INF/**" />
130    </jar>
131  </target>
132 
133  <target 
134    name="checkjar"
135    description="Checks that the base-core-${depend.base-version}.jar exists."
136    >
137    <available classname="net.sf.basedb.core.Application" 
138      classpathref="classpath" property="base-core" />
139
140    <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." />
141    <echo>Found base-core-${depend.base-version}.jar.</echo>
142  </target>
143 
144  <target 
145    name="download-lib"
146    description="Download base-core-${depend.base-version}.jar."
147    >
148    <echo>
149-------------------------------------------------------   
150NOTE! You may specifiy a different download location by
151creating the file './build.properties' and
152setting 'depend.jars' to the URL to download from.
153-------------------------------------------------------
154    </echo>
155    <download-lib file="base-core-${depend.base-version}.jar" />
156  </target>
157 
158  <macrodef name="download-lib" description="Download BASE core JAR files">
159    <attribute name="file" />
160    <sequential>
161      <get 
162        dest="lib/compile/@{file}" 
163        src="${depend.jars}/@{file}" 
164        usetimestamp="true" 
165        verbose="true"
166        ignoreerrors="true"
167      />
168    </sequential>
169  </macrodef> 
170 
171  <target name="update-version">
172    <echo>Setting version to: ${version}</echo>
173   
174    <echo>Hdfs.java</echo>
175    <replaceregexp 
176      file="${src}/net/sf/basedb/hdfs/Hdfs.java"
177      match="public static final String VERSION = &#34;.*&#34;;"
178      replace="public static final String VERSION = &#34;${version}&#34;;"
179      encoding="UTF-8"
180    />
181
182    <echo>extensions.xml</echo>
183    <replaceregexp 
184      file="META-INF/extensions.xml"
185      match="&lt;version&gt;.*&lt;/version&gt;"
186      replace="&lt;version&gt;${version}&lt;/version&gt;"
187      encoding="UTF-8"
188    />
189    <replaceregexp 
190      file="META-INF/extensions.xml"
191      match="&lt;min-base-version&gt;.*&lt;/min-base-version&gt;"
192      replace="&lt;min-base-version&gt;${depend.base-version}&lt;/min-base-version&gt;"
193      encoding="UTF-8"
194    />
195   
196    <echo>Don't forget to commit the changes to the subversion repository!</echo>
197  </target>
198
199</project>
Note: See TracBrowser for help on using the repository browser.