source: extensions/net.sf.basedb.examples/trunk/build.xml @ 1274

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

Fixes #283: Change "source" and "target" compilation options to 1.6

  • Property svn:eol-style set to native
  • Property svn:keywords set to Date Id
File size: 4.6 KB
Line 
1<?xml version="1.0" encoding="UTF-8"?>
2<project 
3  name="ExtensionExamples" 
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="extension-examples" />
12  <property name="version" value="1.3pre" />
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/2.17.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,RELEASE,build.xml" />
55      <fileset dir="." includes="src/**,resources/**,META-INF/**" />
56      <fileset dir="." includes="lib/compile/*" />
57      <fileset file="${jar.name}" />
58    </copy>
59  </target>
60 
61  <target
62    name="package"
63    depends="dist"
64    description="Create binary distribution package"
65    >
66    <tar
67      destfile="${tar.name}"
68      longfile="gnu"
69      compression="gzip"
70      >
71      <tarfileset
72        dir="${dist}"
73        mode="755"
74        prefix="${tar.prefix}"
75        preserveLeadingSlashes="true"
76        >
77        <include name="**/*.sh" />
78      </tarfileset>
79      <tarfileset
80        dir="${dist}"
81        prefix="${tar.prefix}"
82        preserveLeadingSlashes="true"
83        >
84        <exclude name="**/*.sh" />
85      </tarfileset>
86    </tar>
87  </target>
88 
89  <target 
90    name="build"
91    depends="init,checkjar"
92    description="Compiles the plugin and put in jar"
93    >
94    <mkdir dir="${build}" />
95    <javac 
96      encoding="${javac.encoding}" 
97      srcdir="${src}" 
98      destdir="${build}" 
99      debug="true" 
100      includeantruntime="false"
101      classpathref="classpath"
102      source="${javac.source}"
103      target="${javac.target}"
104      >
105      <compilerarg value="${javac.arg}" />
106    </javac>
107    <copy todir="${build}">
108      <fileset dir="." includes="META-INF/*" />
109      <fileset dir="." includes="resources/**" />
110    </copy>
111    <jar 
112      jarfile="${jar.name}" 
113      basedir="${build}" 
114      >
115    </jar>
116  </target>
117 
118  <target 
119    name="checkjar"
120    description="Checks that the BASE2Core.jar and BASE2Webclient.jar exists."
121    >
122    <available classname="net.sf.basedb.core.Application" 
123      classpathref="classpath" property="base2core" />
124    <available classname="net.sf.basedb.clients.web.Base" 
125      classpathref="classpath" property="base2web" />
126    <fail unless="base2core" message="Can't find BASE2Core.jar in ./lib/compile. Try 'ant download-lib' to download the missing file." />
127    <fail unless="base2web" message="Can't find BASE2Webclient.jar in ./lib/compile. Try 'ant download-lib' to download the missing file." />
128    <echo>Found BASE2Core.jar and BASE2Webclient.jar.</echo>
129  </target>
130 
131  <target 
132    name="download-lib"
133    description="Download BASE2Core.jar, BASE2Webclient.jar and BASE2CorePlugins.jar."
134    >
135    <echo>
136-------------------------------------------------------   
137NOTE! You may specifiy a different download location by
138creating the file './build.properties' and
139setting 'depend.jars' to the URL to download from.
140-------------------------------------------------------
141    </echo>
142    <download-lib file="BASE2Core.jar" />
143    <download-lib file="BASE2Webclient.jar" />
144  </target>
145 
146  <macrodef name="download-lib" description="Download BASE core JAR files">
147    <attribute name="file" />
148    <sequential>
149      <get 
150        dest="lib/compile/@{file}" 
151        src="${depend.jars}/@{file}" 
152        usetimestamp="true" 
153        verbose="true"
154        ignoreerrors="true"
155      />
156    </sequential>
157  </macrodef> 
158</project>
Note: See TracBrowser for help on using the repository browser.