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

Last change on this file since 637 was 637, checked in by Nicklas Nordborg, 14 years ago

References #103: Create example extensions

ant package now also includes source code in the tar.gz file.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Date Id
File size: 3.3 KB
Line 
1<?xml version="1.0" encoding="UTF-8"?>
2<project 
3  name="ExtensionExamples" 
4  default="dist" 
5  basedir=".">
6
7  <!-- variables used -->
8  <property name="name" value="extension-examples" />
9  <property name="version" value="1.0" />
10  <property name="src" location="src" description="Location of source files" />
11  <property name="build" location="build" description="Location of compiled files" />
12  <property name="dist" location="dist" description="Directory where distribution should be created" />
13  <property name="package" location="package" description="Directory where packaged distribution files are created"/>
14  <property name="javac.arg" value="-Xlint:unchecked" />
15  <property name="javac.source" value="1.5" />
16  <property name="javac.target" value="1.5" />
17  <property name="javac.encoding" value="ISO-8859-1" />
18
19  <!-- set up classpath for compiling -->
20  <path id="classpath">
21    <fileset dir="lib">
22      <include name="**/*.jar" />
23    </fileset>
24  </path>
25
26  <target name="init">
27    <mkdir dir="${build}" />
28    <mkdir dir="${dist}" />
29  </target>
30   
31  <target name="clean">
32    <delete failonerror="false" includeemptydirs="true">
33      <fileset dir="${build}" defaultexcludes="no" />
34      <fileset dir="${dist}" defaultexcludes="no" />
35      <fileset dir="${package}" defaultexcludes="no" />
36    </delete>
37  </target>
38 
39  <target 
40    name="dist" 
41    depends="clean,build"
42    >
43    <copy todir="${dist}">
44      <fileset dir="." includes="README,LICENSE,RELEASE,build.xml" />
45      <fileset dir="." includes="src/**,resources/**,META-INF/**" />
46      <fileset dir="." includes="lib/compile/readme.txt" />
47    </copy>
48  </target>
49 
50  <target
51    name="package"
52    depends="dist"
53    description="Create binary distribution package"
54    >
55    <property name="tar.prefix" value="${name}-${version}" />
56    <mkdir dir="${package}" />
57    <tar
58      destfile="${package}/${tar.prefix}.tar.gz"
59      longfile="gnu"
60      compression="gzip"
61      >
62      <tarfileset
63        dir="${dist}"
64        mode="755"
65        prefix="${tar.prefix}"
66        preserveLeadingSlashes="true"
67        >
68        <include name="**/*.sh" />
69      </tarfileset>
70      <tarfileset
71        dir="${dist}"
72        prefix="${tar.prefix}"
73        preserveLeadingSlashes="true"
74        >
75        <exclude name="**/*.sh" />
76      </tarfileset>
77    </tar>
78  </target>
79 
80  <target 
81    name="build"
82    depends="init,checkjar"
83    description="Compiles the plugin and put in jar"
84    >
85    <property name="jar" value="${name}.jar" />
86    <mkdir dir="${build}" />
87    <javac 
88      encoding="${javac.encoding}" 
89      srcdir="${src}" 
90      destdir="${build}" 
91      debug="true" 
92      classpathref="classpath"
93      source="${javac.source}"
94      target="${javac.target}"
95      >
96      <compilerarg value="${javac.arg}" />
97    </javac>
98    <copy todir="${build}">
99      <fileset dir="." includes="META-INF/*" />
100      <fileset dir="." includes="resources/**" />
101    </copy>
102    <jar 
103      jarfile="${dist}/${jar}" 
104      basedir="${build}" 
105      >
106    </jar>
107  </target>
108 
109  <target 
110    name="checkjar"
111    description="Checks that the BASE2Core.jar and BASE2Webclient.jar exists."
112    >
113    <available classname="net.sf.basedb.core.Application" 
114      classpathref="classpath" property="base2core" />
115    <available classname="net.sf.basedb.clients.web.Base" 
116      classpathref="classpath" property="base2web" />
117    <fail unless="base2core" message="Can't find BASE2Core.jar in ./lib/compile" />
118    <fail unless="base2web" message="Can't find BASE2Webclient.jar in ./lib/compile" />
119    <echo>Found BASE2Core.jar and BASE2Webclient.jar.</echo>
120  </target>
121</project>
Note: See TracBrowser for help on using the repository browser.