source: webservices/net.sf.basedb.examples/trunk/build.xml @ 1459

Last change on this file since 1459 was 1459, checked in by Nicklas Nordborg, 10 years ago

References #338: Update Ajax2 to 1.6.1

Require BASE 3.1

  • Property svn:eol-style set to native
  • Property svn:keywords set to Date Id
File size: 5.2 KB
Line 
1<?xml version="1.0" encoding="UTF-8"?>
2<project 
3  name="ExampleWebServiceClient" 
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  <!-- settings for the BASE webservices server -->
11  <!-- modify the values as needed              -->
12  <property name="services.url" value="http://localhost:8080/base2/services" />
13  <property name="services.login" value="root" />
14  <property name="services.password" value="root" />
15  <!-- set this to a valid directory to enable download of raw data from raw bioassays -->
16  <property name="download.dir" value="" />
17
18  <!-- variables used -->
19  <property name="name" value="example-webservices" />
20  <property name="version" value="3.1-dev" />
21  <property name="src" location="src" description="Location of source files" />
22  <property name="build" location="build" description="Location of compiled files" />
23  <property name="dist" location="dist" description="Directory where distribution should be created" />
24  <property name="jar.name" value="${name}.jar" description="Name of JAR file with the compiled code." />
25  <property name="tar.prefix" value="${name}-${version}" description="Prefix of .tar.gz file for download." />
26  <property name="tar.name" value="${tar.prefix}.tar.gz" description="Full name of .tar.gz file for download." />
27  <property name="javac.arg" value="-Xlint:unchecked" />
28  <property name="javac.source" value="1.6" />
29  <property name="javac.target" value="1.6" />
30  <property name="javac.encoding" value="UTF-8" />
31  <property name="depend.base-version" 
32    value="3.1.0" 
33    description="The BASE version that this project depends on."
34  />
35  <property name="depend.jars" 
36    value="http://base2.thep.lu.se/base/jars/${depend.base-version}" 
37    description="The location of the BASE core JARs that this project depends on."
38  />
39
40  <!-- set up classpath for compiling -->
41  <path id="classpath">
42    <fileset dir="lib">
43      <include name="**/*.jar" />
44    </fileset>
45  </path>
46
47  <target name="init">
48    <mkdir dir="${build}" />
49    <mkdir dir="${dist}" />
50  </target>
51   
52  <target name="clean">
53    <delete failonerror="false" includeemptydirs="true">
54      <fileset dir="${build}" defaultexcludes="no" />
55      <fileset dir="${dist}" defaultexcludes="no" />
56      <fileset file="${jar.name}" />
57      <fileset file="${tar.name}" />
58    </delete>
59  </target>
60 
61  <target 
62    name="dist" 
63    depends="clean,build"
64    >
65    <copy todir="${dist}">
66      <fileset dir="." includes="README,LICENSE,RELEASE,build.xml" />
67      <fileset dir="." includes="src/**" />
68      <fileset dir="." includes="lib/**" />
69      <fileset file="${jar.name}" />
70    </copy>
71  </target>
72 
73  <target
74    name="package"
75    depends="dist"
76    description="Create binary distribution package"
77    >
78    <tar
79      destfile="${tar.name}"
80      longfile="gnu"
81      compression="gzip"
82      >
83      <tarfileset
84        dir="${dist}"
85        mode="755"
86        prefix="${tar.prefix}"
87        preserveLeadingSlashes="true"
88        >
89        <include name="**/*.sh" />
90      </tarfileset>
91      <tarfileset
92        dir="${dist}"
93        prefix="${tar.prefix}"
94        preserveLeadingSlashes="true"
95        >
96        <exclude name="**/*.sh" />
97      </tarfileset>
98    </tar>
99  </target>
100 
101  <target 
102    name="test" 
103    description="Test the client by logging in to BASE and listing projects and experiments" 
104    depends="build"
105    >
106    <java
107      classname="net.sf.basedb.ws.example.Main"
108      >
109      <arg value="${services.url}" />
110      <arg value="${services.login}" />
111      <arg value="${services.password}" />
112      <arg value="${download.dir}" />
113      <classpath>
114        <path refid="classpath" />
115        <path location="${build}" />
116      </classpath>
117    </java>
118  </target>
119 
120  <target 
121    name="build"
122    depends="init,checkjar"
123    description="Compiles the plugin and put in jar"
124    >
125    <mkdir dir="${build}" />
126    <javac 
127      encoding="${javac.encoding}" 
128      srcdir="${src}" 
129      destdir="${build}" 
130      debug="true" 
131      classpathref="classpath"
132      source="${javac.source}"
133      target="${javac.target}"
134      includeantruntime="false"
135      >
136      <compilerarg value="${javac.arg}" />
137    </javac>
138    <jar 
139      jarfile="${jar.name}" 
140      basedir="${build}" 
141      >
142    </jar>
143  </target>
144 
145  <target 
146    name="checkjar"
147    description="Checks that the BASE JAR files exists."
148    >
149    <available classname="net.sf.basedb.ws.client.SessionClient"
150      classpathref="classpath" property="base-wsclient" />
151    <fail unless="base-wsclient" message="Can't find base-webservices-client-${depend.base-version}.jar in ./lib. Try 'ant download-lib' to download the missing file." />
152    <echo>Found base-webservices-client-${depend.base-version}.jar</echo>
153  </target>
154
155  <target 
156    name="download-lib"
157    description="Download BASE JAR Files"
158    >
159    <echo>
160-------------------------------------------------------   
161NOTE! You may specifiy a different download location by
162creating the file './build.properties' and
163setting 'depend.jars' to the URL to download from.
164-------------------------------------------------------
165    </echo>
166    <download-lib file="base-webservices-client-${depend.base-version}.jar" />
167  </target>
168 
169  <macrodef name="download-lib" description="Download BASE JAR files">
170    <attribute name="file" />
171    <sequential>
172      <get 
173        dest="lib/@{file}" 
174        src="${depend.jars}/@{file}" 
175        usetimestamp="true" 
176        verbose="true"
177        ignoreerrors="true"
178      />
179    </sequential>
180  </macrodef>
181</project>
Note: See TracBrowser for help on using the repository browser.