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

Last change on this file since 1485 was 1139, checked in by Nicklas Nordborg, 13 years ago

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

Make sure the download directory exists.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Date Id
File size: 6.0 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.13.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},download.xml,README,LICENSE*,lib/genepattern/*"
62        excludes="lib/genepattern/GenePattern.jar,lib/genepattern/gp-modules.jar"
63        >
64      </tarfileset>
65    </tar>
66  </target> 
67 
68  <target 
69    name="jar"
70    depends="build"
71    description="Creates the extension JAR file"
72    >
73    <copy todir="${build}">
74      <fileset dir="." includes="META-INF/*" />
75    </copy>
76    <replace token="%%plugins.jar%%" value="${jar.name}" file="${build}/META-INF/base-plugins.xml" />
77    <jar 
78      jarfile="${jar.name}" 
79      manifest="${build}/META-INF/MANIFEST.MF"
80      >
81      <fileset dir="${build}" />
82      <fileset dir="." includes="resources/**" 
83        excludes="resources/visualizer/runVisualizer.jar"/>
84    </jar>
85  </target>
86 
87  <target 
88    name="build"
89    depends="init,checkjar"
90    description="Compiles the plugin and put in jar"
91    >
92    <mkdir dir="${build}" />
93    <javac 
94      encoding="${javac.encoding}" 
95      srcdir="${src}" 
96      destdir="${build}" 
97      debug="true" 
98      classpathref="classpath"
99      source="${javac.source}"
100      target="${javac.target}"
101      >
102      <compilerarg value="${javac.arg}" />
103    </javac>
104  </target>
105 
106  <target 
107    name="checkjar"
108    description="Checks that the BASE2Core.jar, BASE2Webclient.jar, BASE2CorePlugins.jar and BASE2WSClient.jar exists."
109    >
110    <available classname="net.sf.basedb.util.export.spotdata.AbstractBioAssaySetExporter" 
111      classpathref="classpath" property="base2core" />
112    <available classname="net.sf.basedb.plugins.util.Parameters" 
113      classpathref="classpath" property="base2plugins" />
114    <available classname="net.sf.basedb.clients.web.extensions.toolbar.FixedButtonFactory" 
115      classpathref="classpath" property="base2web" />
116    <available classname="net.sf.basedb.info.BioAssaySetInfo" 
117      classpathref="classpath" property="base2webservice" />
118    <available classname="org.genepattern.client.GPClient"
119      classpathref="classpath" property="genepattern.lib" />
120    <fail unless="base2core" message="Can't find BASE2Core.jar in ./lib/compile. Try 'ant download-lib' to download the missing file." />
121    <fail unless="base2plugins" message="Can't find BASE2CorePlugins.jar in ./lib/compile. Try 'ant download-lib' to download the missing file." />
122    <fail unless="base2web" message="Can't find BASE2Webclient.jar in ./lib/compile. Try 'ant download-lib' to download the missing file." />
123    <fail unless="base2webservice" message="Can't find BASE2WSClient.jar in ./lib/compile. Try 'ant download-lib' to download the missing file." />
124    <fail unless="genepattern.lib" message="Can't find GenePattern.jar in ./lib/genepattern. Try 'ant download-lib' to download the missing file." />
125    <echo>Found all required BASE and GenePattern JAR files.</echo>
126  </target>
127 
128  <target 
129    name="download-lib"
130    description="Download BASE and GenePattern JAR files"
131    >
132    <echo>
133-------------------------------------------------------   
134NOTE! You may specifiy a different download location by
135creating the file './build.properties' and setting
136'depend.jars' and 'genepattern.jars' to the URLs to
137download from.
138-------------------------------------------------------
139    </echo>
140    <download-lib file="BASE2Core.jar" />
141    <download-lib file="BASE2CorePlugins.jar" />
142    <download-lib file="BASE2Webclient.jar" />
143    <download-lib file="BASE2WSClient.jar" />
144    <!-- We only need some files from the GenePattern.zip file -->
145    <download-lib file="runVisualizer.jar" todir="./resources/visualizer" from="${genepattern.jars}" />
146    <download-lib file="GenePattern.zip" todir="${build}" from="${genepattern.jars}" />
147    <unzip dest="lib/genepattern" src="${build}/GenePattern.zip">
148      <patternset>
149        <include name="GenePattern.jar" />
150        <include name="lib/gp-modules.jar" />
151      </patternset>
152      <mapper type="flatten"/>
153    </unzip>
154    <delete file="${build}/GenePattern.zip" />
155  </target>
156 
157  <macrodef name="download-lib" description="Download BASE core JAR files">
158    <attribute name="file" />
159    <attribute name="todir" default="lib/compile"/>
160    <attribute name="from" default="${depend.jars}" />
161    <sequential>
162      <mkdir dir="@{todir}" />
163      <get 
164        dest="@{todir}/@{file}" 
165        src="@{from}/@{file}" 
166        usetimestamp="true" 
167        verbose="true"
168        ignoreerrors="true"
169      />
170    </sequential>
171  </macrodef>
172</project>
Note: See TracBrowser for help on using the repository browser.