source: extensions/net.sf.basedb.genepattern/trunk/build.xml @ 1103

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

References #223: Add target in build.xml for downloading required GenePattern? jar files

Downloads some of required JAR files. There are probably some more, but which ones we need depends on the code we are writing.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Date Id
File size: 5.6 KB
Line 
1<?xml version="1.0" encoding="UTF-8"?>
2<project 
3  name="GenePattern" 
4  default="jar" 
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="gp-integration" />
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="jar.name" value="${name}.jar" 
16    description="Name of JAR file with the extensions." />
17  <property name="tar.prefix" value="${name}-${version}" 
18    description="Prefix of .tar.gz file for download." />
19  <property name="tar.name" value="${tar.prefix}.tar.gz" 
20    description="Full name of .tar.gz file for download." />
21  <property name="javac.arg" value="-Xlint:unchecked" />
22  <property name="javac.source" value="1.5" />
23  <property name="javac.target" value="1.5" />
24  <property name="javac.encoding" value="UTF-8" />
25  <property name="depend.jars" value="http://base2.thep.lu.se/base/jars/2.12.0" />
26  <property name="genepattern.jars" value="http://genepattern.broad.mit.edu/gp/downloads" />
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  </target>
38   
39  <target name="clean">
40    <delete failonerror="false" includeemptydirs="true">
41      <fileset dir="${build}" defaultexcludes="no" />
42      <fileset file="${jar.name}" />
43      <fileset file="${tar.name}" />
44    </delete>
45  </target>
46 
47  <target
48    name="package"
49    depends="clean,jar"
50    description="Clean and create binary distribution package"
51    >
52    <tar
53      destfile="${tar.name}"
54      longfile="gnu"
55      compression="gzip"
56      >
57      <tarfileset
58        dir="."
59        prefix="${tar.prefix}"
60        preserveLeadingSlashes="true"
61        includes="${jar.name},README,LICENSE*"
62        >
63      </tarfileset>
64    </tar>
65  </target> 
66 
67  <target 
68    name="jar"
69    depends="build"
70    description="Creates the extension JAR file"
71    >
72    <copy todir="${build}">
73      <fileset dir="." includes="META-INF/*" />
74    </copy>
75    <replace token="%%plugins.jar%%" value="${jar.name}" file="${build}/META-INF/base-plugins.xml" />
76    <jar 
77      jarfile="${jar.name}" 
78      >
79      <fileset dir="${build}" />
80      <fileset dir="." includes="resources/**" />
81    </jar>
82  </target>
83 
84  <target 
85    name="build"
86    depends="init,checkjar"
87    description="Compiles the plugin and put in jar"
88    >
89    <mkdir dir="${build}" />
90    <javac 
91      encoding="${javac.encoding}" 
92      srcdir="${src}" 
93      destdir="${build}" 
94      debug="true" 
95      classpathref="classpath"
96      source="${javac.source}"
97      target="${javac.target}"
98      >
99      <compilerarg value="${javac.arg}" />
100    </javac>
101  </target>
102 
103  <target 
104    name="checkjar"
105    description="Checks that the BASE2Core.jar, BASE2Webclient.jar, BASE2CorePlugins.jar and BASE2WSClient.jar exists."
106    >
107    <available classname="net.sf.basedb.util.export.spotdata.AbstractBioAssaySetExporter" 
108      classpathref="classpath" property="base2core" />
109    <available classname="net.sf.basedb.plugins.util.Parameters" 
110      classpathref="classpath" property="base2plugins" />
111    <available classname="net.sf.basedb.clients.web.extensions.toolbar.FixedButtonFactory" 
112      classpathref="classpath" property="base2web" />
113    <available classname="net.sf.basedb.info.BioAssaySetInfo" 
114      classpathref="classpath" property="base2webservice" />
115    <available classname="org.genepattern.client.GPClient"
116      classpathref="classpath" property="genepattern.lib" />
117    <fail unless="base2core" message="Can't find BASE2Core.jar in ./lib/compile. Try 'ant download-lib' to download the missing file." />
118    <fail unless="base2plugins" message="Can't find BASE2CorePlugins.jar in ./lib/compile. Try 'ant download-lib' to download the missing file." />
119    <fail unless="base2web" message="Can't find BASE2Webclient.jar in ./lib/compile. Try 'ant download-lib' to download the missing file." />
120    <fail unless="base2webservice" message="Can't find BASE2WSClient.jar in ./lib/compile. Try 'ant download-lib' to download the missing file." />
121    <fail unless="genepattern.lib" message="Can't find GenePattern.jar in ./lib/genepattern. Try 'ant download-lib' to download the missing file." />
122    <echo>Found all required BASE and GenePattern JAR files.</echo>
123  </target>
124 
125  <target 
126    name="download-lib"
127    description="Download BASE and GenePattern JAR files"
128    >
129    <echo>
130-------------------------------------------------------   
131NOTE! You may specifiy a different download location by
132creating the file './build.properties' and setting
133'depend.jars' and 'genepattern.jars' to the URLs to
134download from.
135-------------------------------------------------------
136    </echo>
137    <download-lib file="BASE2Core.jar" />
138    <download-lib file="BASE2CorePlugins.jar" />
139    <download-lib file="BASE2Webclient.jar" />
140    <download-lib file="BASE2WSClient.jar" />
141    <!-- We only need some files from the GenePattern.zip file -->
142    <download-lib file="GenePattern.zip" todir="${build}" from="${genepattern.jars}" />
143    <unzip dest="lib/genepattern" src="${build}/GenePattern.zip">
144      <patternset>
145        <include name="GenePattern.jar" />
146        <include name="lib/gp-modules.jar" />
147      </patternset>
148      <mapper type="flatten"/>
149    </unzip>
150  </target>
151 
152  <macrodef name="download-lib" description="Download BASE core JAR files">
153    <attribute name="file" />
154    <attribute name="todir" default="lib/compile"/>
155    <attribute name="from" default="${depend.jars}" />
156    <sequential>
157      <get 
158        dest="@{todir}/@{file}" 
159        src="@{from}/@{file}" 
160        usetimestamp="true" 
161        verbose="true"
162        ignoreerrors="true"
163      />
164    </sequential>
165  </macrodef>
166</project>
Note: See TracBrowser for help on using the repository browser.