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

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

Initial checkin of HDFS extension.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Date Id
File size: 5.0 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.0pre" />
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.jars" 
24    value="http://base2.thep.lu.se/base/jars/3.0.0" 
25    description="The location of the BASE core JARs that we depend on"
26  />
27
28  <!-- set up classpath for compiling -->
29  <path id="classpath">
30    <fileset dir="lib">
31      <include name="**/*.jar" />
32    </fileset>
33  </path>
34
35  <target name="init">
36    <mkdir dir="${build}" />
37    <mkdir dir="${dist}" />
38  </target>
39   
40  <target name="clean">
41    <delete failonerror="false" includeemptydirs="true">
42      <fileset dir="${build}" defaultexcludes="no" />
43      <fileset dir="${dist}" defaultexcludes="no" />
44      <fileset file="${jar.name}" />
45      <fileset file="${tar.name}" />
46    </delete>
47  </target>
48 
49  <target 
50    name="dist" 
51    depends="clean,build"
52    >
53    <copy todir="${dist}">
54      <fileset dir="." includes="README,LICENSE" />
55      <fileset dir="." includes="lib/hdfs/*" />
56      <fileset file="${jar.name}" />
57    </copy>
58  </target>
59 
60  <target
61    name="package"
62    depends="dist"
63    description="Create binary distribution package"
64    >
65    <tar
66      destfile="${tar.name}"
67      longfile="gnu"
68      compression="gzip"
69      >
70      <tarfileset
71        dir="${dist}"
72        mode="755"
73        prefix="${tar.prefix}"
74        preserveLeadingSlashes="true"
75        >
76        <include name="**/*.sh" />
77      </tarfileset>
78      <tarfileset
79        dir="${dist}"
80        prefix="${tar.prefix}"
81        preserveLeadingSlashes="true"
82        >
83        <exclude name="**/*.sh" />
84      </tarfileset>
85    </tar>
86  </target>
87 
88  <target 
89    name="install"
90    depends="build"
91    >
92    <fail unless="base.home" message="base.home is not set to the path of BASE installation." />
93    <copy todir="${base.home}/www/WEB-INF/extensions">
94      <fileset dir="." includes="lib/hdfs/*" />
95      <fileset file="${jar.name}" />
96    </copy>
97   
98  </target>
99 
100  <target 
101    name="build"
102    depends="init,checkjar"
103    description="Compiles the plugin and put in jar"
104    >
105    <mkdir dir="${build}" />
106    <javac 
107      encoding="${javac.encoding}" 
108      srcdir="${src}" 
109      destdir="${build}" 
110      debug="true" 
111      includeantruntime="false"
112      classpathref="classpath"
113      source="${javac.source}"
114      target="${javac.target}"
115      >
116      <compilerarg value="${javac.arg}" />
117    </javac>
118    <jar 
119      jarfile="${jar.name}" 
120      manifest="META-INF/MANIFEST.MF"
121      >
122      <fileset dir="${build}" />
123      <fileset dir="." includes="META-INF/**" />
124    </jar>
125  </target>
126 
127  <target 
128    name="checkjar"
129    description="Checks that the base-core-3.x.jar exists."
130    >
131    <available classname="net.sf.basedb.core.Application" 
132      classpathref="classpath" property="base2core" />
133
134    <fail unless="base2core" message="Can't find base-core-3.x.jar in ./lib/compile. Try 'ant download-lib' to download the missing file." />
135    <echo>Found base-core-3.x.jar.</echo>
136  </target>
137 
138  <target 
139    name="download-lib"
140    description="Download base-core-3.x.jar."
141    >
142    <echo>
143-------------------------------------------------------   
144NOTE! You may specifiy a different download location by
145creating the file './build.properties' and
146setting 'depend.jars' to the URL to download from.
147-------------------------------------------------------
148    </echo>
149    <download-lib file="base-core-3.0.0.jar" />
150  </target>
151 
152  <macrodef name="download-lib" description="Download BASE core JAR files">
153    <attribute name="file" />
154    <sequential>
155      <get 
156        dest="lib/compile/@{file}" 
157        src="${depend.jars}/@{file}" 
158        usetimestamp="true" 
159        verbose="true"
160        ignoreerrors="true"
161      />
162    </sequential>
163  </macrodef> 
164 
165  <target name="update-version">
166    <echo>Setting version to: ${version}</echo>
167   
168    <echo>Hdfs.java</echo>
169    <replaceregexp 
170      file="${src}/net/sf/basedb/hdfs/Hdfs.java"
171      match="public static final String VERSION = &#34;.*&#34;;"
172      replace="public static final String VERSION = &#34;${version}&#34;;"
173      encoding="UTF-8"
174    />
175
176    <echo>extensions.xml</echo>
177    <replaceregexp 
178      file="META-INF/extensions.xml"
179      match="&lt;version&gt;.*&lt;/version&gt;"
180      replace="&lt;version&gt;${version}&lt;/version&gt;"
181      encoding="UTF-8"
182    />
183
184    <echo>Don't forget to commit the changes to the subversion repository!</echo>
185  </target>
186
187</project>
Note: See TracBrowser for help on using the repository browser.