source: extensions/net.sf.basedb.reggie/trunk/build.xml @ 1284

Last change on this file since 1284 was 1284, checked in by Nicklas Nordborg, 11 years ago

References #292: Check/create annotation types, etc. required by reggie

This should now work with the items that we need so far for the personal information registration wizard.

File size: 5.4 KB
Line 
1<?xml version="1.0" encoding="UTF-8"?>
2<project 
3  name="Reggie" 
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="reggie" />
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/2.16.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/reggie/*" />
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="install"
91    depends="build"
92    >
93    <fail unless="base.home" message="base.home is not set to the path of BASE installation." />
94    <copy todir="${base.home}/www/WEB-INF/extensions">
95      <fileset dir="." includes="lib/reggie/*" />
96      <fileset file="${jar.name}" />
97    </copy>
98   
99  </target>
100 
101  <target 
102    name="build"
103    depends="init,checkjar"
104    description="Compiles the plugin and put in jar"
105    >
106    <mkdir dir="${build}" />
107    <javac 
108      encoding="${javac.encoding}" 
109      srcdir="${src}" 
110      destdir="${build}" 
111      debug="true" 
112      includeantruntime="false"
113      classpathref="classpath"
114      source="${javac.source}"
115      target="${javac.target}"
116      >
117      <compilerarg value="${javac.arg}" />
118    </javac>
119    <jar 
120      jarfile="${jar.name}" 
121      manifest="META-INF/MANIFEST.MF"
122      >
123      <fileset dir="${build}" />
124      <fileset dir="." includes="META-INF/**" />
125      <fileset dir="." includes="resources/**" />
126    </jar>
127  </target>
128 
129  <target 
130    name="checkjar"
131    description="Checks that the BASE2Core.jar, BASE2Webclient.jar and BASE2WSClient.jar exists."
132    >
133    <available classname="net.sf.basedb.core.Application" 
134      classpathref="classpath" property="base2core" />
135    <available classname="net.sf.basedb.clients.web.Base" 
136      classpathref="classpath" property="base2web" />
137    <available classname="net.sf.basedb.info.BioAssaySetInfo" 
138      classpathref="classpath" property="base2webservice" />
139
140    <fail unless="base2core" message="Can't find BASE2Core.jar in ./lib/compile. Try 'ant download-lib' to download the missing file." />
141    <fail unless="base2web" message="Can't find BASE2Webclient.jar in ./lib/compile. Try 'ant download-lib' to download the missing file." />
142    <fail unless="base2webservice" message="Can't find BASE2WSClient.jar in ./lib/compile. Try 'ant download-lib' to download the missing file." />
143    <echo>Found BASE2Core.jar and BASE2Webclient.jar.</echo>
144  </target>
145 
146  <target 
147    name="download-lib"
148    description="Download BASE2Core.jar, BASE2Webclient.jar and BASE2WSClient.jar."
149    >
150    <echo>
151-------------------------------------------------------   
152NOTE! You may specifiy a different download location by
153creating the file './build.properties' and
154setting 'depend.jars' to the URL to download from.
155-------------------------------------------------------
156    </echo>
157    <download-lib file="BASE2Core.jar" />
158    <download-lib file="BASE2Webclient.jar" />
159    <download-lib file="BASE2WSClient.jar" />
160  </target>
161 
162  <macrodef name="download-lib" description="Download BASE core JAR files">
163    <attribute name="file" />
164    <sequential>
165      <get 
166        dest="lib/compile/@{file}" 
167        src="${depend.jars}/@{file}" 
168        usetimestamp="true" 
169        verbose="true"
170        ignoreerrors="true"
171      />
172    </sequential>
173  </macrodef> 
174</project>
Note: See TracBrowser for help on using the repository browser.