source: plugins/base2/net.sf.basedb.agilent/trunk/build.xml @ 1199

Last change on this file since 1199 was 1199, checked in by Jari Häkkinen, 11 years ago

net.sf.basdb.agilent first commit

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 6.1 KB
Line 
1<?xml version="1.0" encoding="UTF-8"?>
2
3<!-- $Id: build.xml 1199 2010-03-06 08:54:15Z jari $ -->
4
5<!--
6  Copyright (C) 2010 Jari Häkkinen
7
8  This file is part of Agilent plug-in package for BASE.
9  Available at http://baseplugins.thep.lu.se/
10  BASE main site: http://base.thep.lu.se/
11
12  This is a free software; you can redistribute it and/or modify it
13  under the terms of the GNU General Public License as published by
14  the Free Software Foundation; either version 3 of the License, or
15  (at your option) any later version.
16
17  This software is distributed in the hope that it will be useful, but
18  WITHOUT ANY WARRANTY; without even the implied warranty of
19  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20  General Public License for more details.
21
22  You should have received a copy of the GNU General Public License
23  along with BASE. If not, see <http://www.gnu.org/licenses/>.
24-->
25
26<project 
27  name="AgilentPlugins"
28  default="dist"
29  basedir=".">
30
31  <description>
32    Build file for the Agilent plug-in package for BASE. The main
33    targets are ('dist' is default):
34
35    Clean up:
36    clean         Remove generated files
37    distclean     Remove all generated and downloaded files
38
39    Compiling:
40    build         Build all Java code
41    dist          Build all Java code for distribution (put in 'dist'
42                  subdirectory)
43    download-lib  Download required external dependecy files
44   
45    Packaging:
46    package:      Create *.tar.gz file containing required files.
47  </description>
48
49  <!--create this file if you need to override values from properties below -->
50  <property file="build.properties" />
51
52  <!-- variables used -->
53  <property name="depend.jars"
54    value="http://base2.thep.lu.se/base/jars/2.14.0"
55    description="The location of the BASE core JARs that we depend on" />
56  <property name="name" value="agilent-plugins" />
57  <property name="version" value="0.1pre" />
58  <!-- directories -->
59  <property name="build" location="build"
60            description="Location of compiled files" />
61  <property name="dist" location="dist"
62            description="Directory where distribution should be created" />
63  <property name="lib" location="lib"
64            description="Directory where support jars are located" />
65  <property name="package" location="package"
66            description="Directory for packaged distribution files"/>
67  <property name="src" location="src"
68            description="Location of source files" />
69  <!-- Java stuff -->
70  <property name="javac.arg" value="-Xlint:unchecked" />
71  <property name="javac.source" value="1.6" />
72  <property name="javac.target" value="1.6" />
73  <property name="javac.encoding" value="UTF-8" />
74
75  <!-- set up classpath for compiling -->
76  <mkdir dir="${lib}" />
77  <path id="classpath">
78    <fileset dir="${lib}">
79      <include name="**/*.jar" />
80    </fileset>
81  </path>
82
83  <!-- macro definitions -->
84  <macrodef name="download-lib" description="Download BASE core JAR files">
85    <attribute name="file" />
86    <sequential>
87      <get 
88        dest="${lib}/compile/@{file}" 
89        src="${depend.jars}/@{file}" 
90        usetimestamp="true" 
91        verbose="true"
92        ignoreerrors="true"
93      />
94    </sequential>
95  </macrodef> 
96
97  <!-- targets -->
98  <target name="build"
99          depends="checkjar"
100          description="Compiles the plugin and put in jar">
101    <property name="jar" value="${name}.jar" />
102    <mkdir dir="${build}" />
103    <javac encoding="${javac.encoding}" 
104           srcdir="${src}" 
105           destdir="${build}" 
106           debug="true" 
107           classpathref="classpath"
108           source="${javac.source}"
109           target="${javac.target}" >
110      <compilerarg value="${javac.arg}" />
111    </javac>
112    <copy todir="${build}">
113      <fileset dir="." includes="META-INF/*"/>
114    </copy>
115    <replace token="%%plugins.jar%%"
116             value="${jar}" file="${build}/META-INF/base-plugins.xml" />
117  </target>
118 
119  <target name="checkjar"
120    description="Checks that the BASE2Core.jar exists." >
121    <available classname="net.sf.basedb.core.Application"
122               classpathref="classpath" property="base2core" />
123    <fail unless="base2core" message="Can't find BASE2Core.jar in ./${lib}/compile. Try 'ant download-lib' to download the missing file." />
124    <echo>Found BASE2Core.jar</echo>
125  </target>
126
127  <target name="clean">
128    <delete failonerror="false" includeemptydirs="true">
129      <fileset dir="${build}" defaultexcludes="no" />
130      <fileset dir="${dist}" defaultexcludes="no" />
131      <fileset dir="${package}" defaultexcludes="no" />
132    </delete>
133  </target>
134
135  <target name="dist" depends="clean,build">
136    <mkdir dir="${dist}" />
137    <jar jarfile="${dist}/${jar}" basedir="${build}" />
138    <copy todir="${dist}">
139      <fileset dir="." includes="README*,License,INSTALL" />
140      <fileset dir="." includes="config/*" />
141    </copy>
142  </target>
143
144  <target name="distclean" depends="clean">
145    <delete failonerror="false" includeemptydirs="true">
146      <fileset dir="${lib}" defaultexcludes="no" />
147    </delete>
148  </target>
149
150    <target name="download-lib"
151            depends="download-message"
152            description="Download BASE2Core.jar, BASE2CorePlugins.jar,
153                         and BASE2WSClient.jar.">
154    <mkdir dir="${lib}/compile" />
155    <download-lib file="BASE2Core.jar" />
156<!--
157    <download-lib file="BASE2CorePlugins.jar" />
158    <download-lib file="BASE2WSClient.jar" />
159    <download-lib file="BASE2Webclient.jar" />
160-->
161    </target>
162
163  <target name="download-message">
164    <echo>
165----------------------------------------------------------------
166NOTE! You may specify a different download locations by
167creating the file './build.properties' and set variable
168
169'depend.BASEjars': the URL to BASE core jar files
170----------------------------------------------------------------
171    </echo>
172  </target>
173
174  <target name="package"
175          depends="version,dist"
176          description="Create binary distribution package">
177    <property name="tar.prefix" value="${name}-${version}" />
178    <mkdir dir="${package}" />
179    <tar destfile="${package}/${tar.prefix}.tar.gz"
180         longfile="gnu" compression="gzip">
181      <tarfileset dir="${dist}" mode="755" prefix="${tar.prefix}"
182                  preserveLeadingSlashes="true">
183        <include name="**/*.sh" />
184      </tarfileset>
185      <tarfileset dir="${dist}" prefix="${tar.prefix}"
186                  preserveLeadingSlashes="true">
187        <exclude name="**/*.sh" />
188      </tarfileset>
189    </tar>
190    <checksum file="${package}/${tar.prefix}.tar.gz" />
191  </target>
192
193  <target name="version">
194  </target>
195
196</project>
Note: See TracBrowser for help on using the repository browser.