1 | <?xml version="1.0" encoding="UTF-8"?> |
---|
2 | |
---|
3 | <!-- $Id: build.xml 1448 2011-11-02 13:44:16Z nicklas $ --> |
---|
4 | |
---|
5 | <project |
---|
6 | name="IlluminaPlugins" |
---|
7 | default="dist" |
---|
8 | basedir="."> |
---|
9 | |
---|
10 | <!--create this file if you need to override values from properties below --> |
---|
11 | <property file="build.properties" /> |
---|
12 | |
---|
13 | |
---|
14 | <!-- variables used --> |
---|
15 | <property name="name" value="illumina-plugins" /> |
---|
16 | <property name="version" value="1.8-dev" /> |
---|
17 | <property name="src" location="src" description="Location of source files" /> |
---|
18 | <property name="build" location="build" description="Location of compiled files" /> |
---|
19 | <property name="dist" location="dist" description="Directory where distribution should be created" /> |
---|
20 | <property name="package" location="package" description="Directory where packaged distribution files are created"/> |
---|
21 | <property name="javac.arg" value="-Xlint:unchecked" /> |
---|
22 | <property name="javac.source" value="1.6" /> |
---|
23 | <property name="javac.target" value="1.6" /> |
---|
24 | <property name="javac.encoding" value="UTF-8" /> |
---|
25 | <property name="depend.base-version" |
---|
26 | value="3.0.0" |
---|
27 | description="The BASE version that this project depends on." |
---|
28 | /> |
---|
29 | <property name="depend.jars" |
---|
30 | value="http://base2.thep.lu.se/base/jars/${depend.base-version}" |
---|
31 | description="The location of the BASE core JARs that this project depends on." |
---|
32 | /> |
---|
33 | |
---|
34 | <!-- set up classpath for compiling --> |
---|
35 | <path id="classpath"> |
---|
36 | <fileset dir="lib"> |
---|
37 | <include name="**/*.jar" /> |
---|
38 | </fileset> |
---|
39 | </path> |
---|
40 | |
---|
41 | <target name="init"> |
---|
42 | <mkdir dir="${build}" /> |
---|
43 | <mkdir dir="${dist}" /> |
---|
44 | </target> |
---|
45 | |
---|
46 | <target name="clean"> |
---|
47 | <delete failonerror="false" includeemptydirs="true"> |
---|
48 | <fileset dir="${build}" defaultexcludes="no" /> |
---|
49 | <fileset dir="${dist}" defaultexcludes="no" /> |
---|
50 | <fileset dir="${package}" defaultexcludes="no" /> |
---|
51 | </delete> |
---|
52 | </target> |
---|
53 | |
---|
54 | <target |
---|
55 | name="dist" |
---|
56 | depends="clean,build" |
---|
57 | > |
---|
58 | <copy todir="${dist}"> |
---|
59 | <fileset dir="." includes="README*,LICENSE,INSTALL" /> |
---|
60 | <fileset dir="." includes="config/*" /> |
---|
61 | <fileset dir="." includes="contrib/*" /> |
---|
62 | </copy> |
---|
63 | </target> |
---|
64 | |
---|
65 | <target |
---|
66 | name="package" |
---|
67 | depends="dist" |
---|
68 | description="Create binary distribution package" |
---|
69 | > |
---|
70 | <property name="tar.prefix" value="${name}-${version}" /> |
---|
71 | <mkdir dir="${package}" /> |
---|
72 | <tar |
---|
73 | destfile="${package}/${tar.prefix}.tar.gz" |
---|
74 | longfile="gnu" |
---|
75 | compression="gzip" |
---|
76 | > |
---|
77 | <tarfileset |
---|
78 | dir="${dist}" |
---|
79 | mode="755" |
---|
80 | prefix="${tar.prefix}" |
---|
81 | preserveLeadingSlashes="true" |
---|
82 | > |
---|
83 | <include name="**/*.sh" /> |
---|
84 | </tarfileset> |
---|
85 | <tarfileset |
---|
86 | dir="${dist}" |
---|
87 | prefix="${tar.prefix}" |
---|
88 | preserveLeadingSlashes="true" |
---|
89 | > |
---|
90 | <exclude name="**/*.sh" /> |
---|
91 | </tarfileset> |
---|
92 | </tar> |
---|
93 | </target> |
---|
94 | |
---|
95 | <target |
---|
96 | name="build" |
---|
97 | depends="init,checkjar" |
---|
98 | description="Compiles the plugin and put in jar" |
---|
99 | > |
---|
100 | <property name="jar" value="${name}.jar" /> |
---|
101 | <property name="jar.extensions" value="illumina-extensions.jar" /> |
---|
102 | <mkdir dir="${build}" /> |
---|
103 | <javac |
---|
104 | encoding="${javac.encoding}" |
---|
105 | srcdir="${src}" |
---|
106 | destdir="${build}" |
---|
107 | debug="true" |
---|
108 | deprecation="true" |
---|
109 | classpathref="classpath" |
---|
110 | source="${javac.source}" |
---|
111 | target="${javac.target}" |
---|
112 | includeantruntime="false" |
---|
113 | > |
---|
114 | <compilerarg value="${javac.arg}" /> |
---|
115 | </javac> |
---|
116 | <copy todir="${build}"> |
---|
117 | <fileset dir="." includes="META-INF/*"/> |
---|
118 | </copy> |
---|
119 | <jar |
---|
120 | jarfile="${dist}/${jar}" |
---|
121 | basedir="${build}" |
---|
122 | > |
---|
123 | </jar> |
---|
124 | </target> |
---|
125 | |
---|
126 | <target name="update-version"> |
---|
127 | <echo>Setting version to: ${version}</echo> |
---|
128 | |
---|
129 | <echo>Illumina.java</echo> |
---|
130 | <replaceregexp |
---|
131 | file="${src}/net/sf/basedb/illumina/Illumina.java" |
---|
132 | match="public static final String VERSION = ".*";" |
---|
133 | replace="public static final String VERSION = "${version}";" |
---|
134 | encoding="UTF-8" |
---|
135 | /> |
---|
136 | |
---|
137 | <echo>extensions.xml</echo> |
---|
138 | <replaceregexp |
---|
139 | file="META-INF/extensions.xml" |
---|
140 | match="<version>.*</version>" |
---|
141 | replace="<version>${version}</version>" |
---|
142 | encoding="UTF-8" |
---|
143 | /> |
---|
144 | <replaceregexp |
---|
145 | file="META-INF/extensions.xml" |
---|
146 | match="<min-base-version>.*</min-base-version>" |
---|
147 | replace="<min-base-version>${depend.base-version}</min-base-version>" |
---|
148 | encoding="UTF-8" |
---|
149 | /> |
---|
150 | <echo>Don't forget to commit the changes to the subversion repository!</echo> |
---|
151 | </target> |
---|
152 | |
---|
153 | <target |
---|
154 | name="checkjar" |
---|
155 | description="Checks that the base-core-${depend.base-version}.jar, base-webclient-${depend.base-version}.jar, base-coreplugins-${depend.base-version}.jar and base-wsclient-${depend.base-version}.jar exists." |
---|
156 | > |
---|
157 | <available classname="net.sf.basedb.core.Application" |
---|
158 | classpathref="classpath" property="base-core" /> |
---|
159 | <available classname="net.sf.basedb.plugins.ReporterFlatFileImporter" |
---|
160 | classpathref="classpath" property="base-coreplugins" /> |
---|
161 | <available classname="net.sf.basedb.ws.client.SessionClient" |
---|
162 | classpathref="classpath" property="base-webservices-client" /> |
---|
163 | <available classname="net.sf.basedb.clients.web.extensions.menu.FixedMenuItemFactory" |
---|
164 | classpathref="classpath" property="base-webclient" /> |
---|
165 | <fail unless="base-core" message="Can't find base-core-${depend.base-version}.jar in ./lib/compile. Try 'ant download-lib' to download the missing file." /> |
---|
166 | <fail unless="base-coreplugins" message="Can't find base-coreplugins-${depend.base-version}.jar in ./lib/compile. Try 'ant download-lib' to download the missing file." /> |
---|
167 | <fail unless="base-webservices-client" message="Can't find base-webservices-client-${depend.base-version}.jar in ./lib/compile. Try 'ant download-lib' to download the missing file." /> |
---|
168 | <fail unless="base-webclient" message="Can't find base-webclient-${depend.base-version}.jar in ./lib/compile. Try 'ant download-lib' to download the missing file." /> |
---|
169 | <echo> |
---|
170 | Found base-core-${depend.base-version}.jar, |
---|
171 | base-coreplugins-${depend.base-version}.jar, |
---|
172 | base-webservices-client-${depend.base-version}.jar and |
---|
173 | base-webclient-${depend.base-version}.jar.</echo> |
---|
174 | </target> |
---|
175 | |
---|
176 | <target |
---|
177 | name="download-lib" |
---|
178 | description="Download BASE JAR files that are needed for compilation" |
---|
179 | > |
---|
180 | <echo> |
---|
181 | ------------------------------------------------------- |
---|
182 | NOTE! You may specify a different download location by |
---|
183 | creating the file './build.properties' and |
---|
184 | setting 'depend.jars' to the URL to download from. |
---|
185 | ------------------------------------------------------- |
---|
186 | </echo> |
---|
187 | <download-lib file="base-core-${depend.base-version}.jar" /> |
---|
188 | <download-lib file="base-coreplugins-${depend.base-version}.jar" /> |
---|
189 | <download-lib file="base-webservices-client-${depend.base-version}.jar" /> |
---|
190 | <download-lib file="base-webclient-${depend.base-version}.jar" /> |
---|
191 | </target> |
---|
192 | |
---|
193 | <macrodef name="download-lib" description="Download BASE core JAR files"> |
---|
194 | <attribute name="file" /> |
---|
195 | <sequential> |
---|
196 | <get |
---|
197 | dest="lib/compile/@{file}" |
---|
198 | src="${depend.jars}/@{file}" |
---|
199 | usetimestamp="true" |
---|
200 | verbose="true" |
---|
201 | ignoreerrors="true" |
---|
202 | /> |
---|
203 | </sequential> |
---|
204 | </macrodef> |
---|
205 | |
---|
206 | </project> |
---|