source: plugins/base2/net.sf.basedb.examples/trunk/build.xml @ 1292

Last change on this file since 1292 was 1292, checked in by Nicklas Nordborg, 13 years ago

Fixes #281: Plug-in should suggest better job names

Also removed calls to deprecated methods and tagger methods with @Override.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Date Id
File size: 4.2 KB
Line 
1<?xml version="1.0" encoding="UTF-8"?>
2<project 
3  name="ExamplePlugin" 
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="example-plugins" />
12  <property name="version" value="2.Xpre" />
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" value="http://base2.thep.lu.se/base/jars/2.17.0" />
24
25  <!-- set up classpath for compiling -->
26  <path id="classpath">
27    <fileset dir="lib">
28      <include name="**/*.jar" />
29    </fileset>
30  </path>
31
32  <target name="init">
33    <mkdir dir="${build}" />
34    <mkdir dir="${dist}" />
35  </target>
36   
37  <target name="clean">
38    <delete failonerror="false" includeemptydirs="true">
39      <fileset dir="${build}" defaultexcludes="no" />
40      <fileset dir="${dist}" defaultexcludes="no" />
41      <fileset file="${jar.name}" />
42      <fileset file="${tar.name}" />
43    </delete>
44  </target>
45 
46  <target 
47    name="dist" 
48    depends="clean,build"
49    >
50    <copy todir="${dist}">
51      <fileset dir="." includes="README,LICENSE,RELEASE,build.xml" />
52      <fileset dir="." includes="src/**,META-INF/**" />
53      <fileset dir="." includes="lib/**" />
54      <fileset file="${jar.name}" />
55    </copy>
56  </target>
57 
58  <target
59    name="package"
60    depends="dist"
61    description="Create binary distribution package"
62    >
63    <tar
64      destfile="${tar.name}"
65      longfile="gnu"
66      compression="gzip"
67      >
68      <tarfileset
69        dir="${dist}"
70        mode="755"
71        prefix="${tar.prefix}"
72        preserveLeadingSlashes="true"
73        >
74        <include name="**/*.sh" />
75      </tarfileset>
76      <tarfileset
77        dir="${dist}"
78        prefix="${tar.prefix}"
79        preserveLeadingSlashes="true"
80        >
81        <exclude name="**/*.sh" />
82      </tarfileset>
83    </tar>
84  </target>
85 
86  <target 
87    name="build"
88    depends="init"
89    description="Compiles the plugin and put in jar"
90    >
91    <mkdir dir="${build}" />
92    <javac 
93      encoding="${javac.encoding}" 
94      srcdir="${src}" 
95      destdir="${build}" 
96      debug="true" 
97      classpathref="classpath"
98      source="${javac.source}"
99      target="${javac.target}"
100      includeantruntime="false"
101      >
102      <compilerarg value="${javac.arg}" />
103    </javac>
104    <copy todir="${build}">
105      <fileset dir="." includes="META-INF/*" />
106    </copy>
107    <replace token="%%plugins.jar%%" value="${jar.name}" file="${build}/META-INF/base-plugins.xml" />
108    <jar 
109      jarfile="${jar.name}" 
110      basedir="${build}" 
111      >
112    </jar>
113  </target>
114 
115  <target 
116    name="checkjar"
117    description="Checks that the BASE2Core.jar exists."
118    >
119    <available classname="net.sf.basedb.core.plugin.Plugin" 
120      classpathref="classpath" property="base2core" />
121    <fail unless="base2core" message="Can't find BASE2Core.jar in ./lib/compile. Try 'ant download-lib' to download the missing file." />
122    <echo>Found BASE2Core.jar.</echo>
123  </target>
124
125 
126  <target 
127    name="download-lib"
128    description="Download BASE2Core.jar"
129    >
130    <echo>
131-------------------------------------------------------   
132NOTE! You may specifiy a different download location by
133creating the file './build.properties' and
134setting 'depend.jars' to the URL to download from.
135-------------------------------------------------------
136    </echo>
137    <download-lib file="BASE2Core.jar" />
138  </target>
139 
140  <macrodef name="download-lib" description="Download BASE core JAR files">
141    <attribute name="file" />
142    <sequential>
143      <get 
144        dest="lib/compile/@{file}" 
145        src="${depend.jars}/@{file}" 
146        usetimestamp="true" 
147        verbose="true"
148        ignoreerrors="true"
149      />
150    </sequential>
151  </macrodef>
152</project>
Note: See TracBrowser for help on using the repository browser.