1 | <?xml version="1.0" encoding="UTF-8"?> |
---|
2 | <project |
---|
3 | name="MeLuDi" |
---|
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 | <!-- variables used --> |
---|
11 | <property name="name" value="meludi" /> |
---|
12 | <property name="title" value="MeLuDI" /> |
---|
13 | <property name="version" value="1.3.4a1" /> |
---|
14 | <property name="src" location="src" description="Location of source files" /> |
---|
15 | <property name="build" location="build" description="Location of compiled files" /> |
---|
16 | <property name="dist" location="dist" description="Directory where distribution should be created" /> |
---|
17 | <property name="jar.name" value="${name}.jar" description="Name of JAR file with the extensions." /> |
---|
18 | <property name="tar.prefix" value="${name}-${version}" description="Prefix of .tar.gz file for download." /> |
---|
19 | <property name="tar.name" value="${tar.prefix}.tar.gz" description="Full name of .tar.gz file for download." /> |
---|
20 | <property name="javac.arg" value="-Xlint:unchecked" /> |
---|
21 | <property name="javac.source" value="1.7" /> |
---|
22 | <property name="javac.target" value="1.7" /> |
---|
23 | <property name="javac.encoding" value="UTF-8" /> |
---|
24 | <property name="depend.base-version" |
---|
25 | value="3.5.0" |
---|
26 | description="The BASE version that this project depends on." |
---|
27 | /> |
---|
28 | <property name="depend.jars" |
---|
29 | value="http://base.thep.lu.se/chrome/site/files/base/jars/${depend.base-version}" |
---|
30 | description="The location of the BASE core JARs that this project depends on." |
---|
31 | /> |
---|
32 | |
---|
33 | <!-- set up classpath for compiling --> |
---|
34 | <path id="classpath"> |
---|
35 | <fileset dir="lib"> |
---|
36 | <include name="**/*.jar" /> |
---|
37 | </fileset> |
---|
38 | </path> |
---|
39 | |
---|
40 | <target name="init"> |
---|
41 | <mkdir dir="${build}" /> |
---|
42 | <mkdir dir="${dist}" /> |
---|
43 | </target> |
---|
44 | |
---|
45 | <target name="clean"> |
---|
46 | <delete failonerror="false" includeemptydirs="true"> |
---|
47 | <fileset dir="${build}" defaultexcludes="no" /> |
---|
48 | <fileset dir="${dist}" defaultexcludes="no" /> |
---|
49 | <fileset file="${jar.name}" /> |
---|
50 | <fileset file="${tar.name}" /> |
---|
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,meludi-ogs-hosts.xml,config/*" /> |
---|
60 | <fileset file="${jar.name}" /> |
---|
61 | </copy> |
---|
62 | </target> |
---|
63 | |
---|
64 | <target |
---|
65 | name="package" |
---|
66 | depends="dist" |
---|
67 | description="Create binary distribution package" |
---|
68 | > |
---|
69 | <tar |
---|
70 | destfile="${tar.name}" |
---|
71 | longfile="gnu" |
---|
72 | compression="gzip" |
---|
73 | > |
---|
74 | <tarfileset |
---|
75 | dir="${dist}" |
---|
76 | mode="755" |
---|
77 | prefix="${tar.prefix}" |
---|
78 | preserveLeadingSlashes="true" |
---|
79 | > |
---|
80 | <include name="**/*.sh" /> |
---|
81 | </tarfileset> |
---|
82 | <tarfileset |
---|
83 | dir="${dist}" |
---|
84 | prefix="${tar.prefix}" |
---|
85 | preserveLeadingSlashes="true" |
---|
86 | > |
---|
87 | <exclude name="**/*.sh" /> |
---|
88 | </tarfileset> |
---|
89 | </tar> |
---|
90 | </target> |
---|
91 | |
---|
92 | <target |
---|
93 | name="install" |
---|
94 | depends="build" |
---|
95 | > |
---|
96 | <fail unless="base.plugins" message="base.plugins is not set to the path of BASE plug-ins directory." /> |
---|
97 | <copy todir="${base.plugins}"> |
---|
98 | <fileset file="${jar.name}" /> |
---|
99 | </copy> |
---|
100 | <echo>Copied '${jar.name}' to '${base.plugins}'.</echo> |
---|
101 | </target> |
---|
102 | |
---|
103 | |
---|
104 | <target |
---|
105 | name="build" |
---|
106 | depends="init,checkjar" |
---|
107 | description="Compiles the plugin and put in jar" |
---|
108 | > |
---|
109 | <mkdir dir="${build}" /> |
---|
110 | <javac |
---|
111 | encoding="${javac.encoding}" |
---|
112 | srcdir="${src}" |
---|
113 | destdir="${build}" |
---|
114 | debug="true" |
---|
115 | includeantruntime="false" |
---|
116 | classpathref="classpath" |
---|
117 | source="${javac.source}" |
---|
118 | target="${javac.target}" |
---|
119 | > |
---|
120 | <compilerarg value="${javac.arg}" /> |
---|
121 | </javac> |
---|
122 | <jar |
---|
123 | jarfile="${jar.name}" |
---|
124 | manifest="META-INF/MANIFEST.MF" |
---|
125 | > |
---|
126 | <fileset dir="${build}" /> |
---|
127 | <fileset dir="." includes="META-INF/**" /> |
---|
128 | <fileset dir="." includes="resources/**" /> |
---|
129 | </jar> |
---|
130 | </target> |
---|
131 | |
---|
132 | <target |
---|
133 | name="checkjar" |
---|
134 | description="Checks that required BASE JAR files exists" |
---|
135 | > |
---|
136 | <available classname="net.sf.basedb.core.Application" |
---|
137 | classpathref="classpath" property="base-core" /> |
---|
138 | <available classname="net.sf.basedb.clients.web.Base" |
---|
139 | classpathref="classpath" property="base-web" /> |
---|
140 | <available classname="net.sf.basedb.info.BioAssaySetInfo" |
---|
141 | classpathref="classpath" property="base-webservice" /> |
---|
142 | <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." /> |
---|
143 | <fail unless="base-web" message="Can't find base-webclient-${depend.base-version}.jar in ./lib/compile. Try 'ant download-lib' to download the missing file." /> |
---|
144 | <!-- |
---|
145 | <fail unless="base-webservice" message="Can't find base-webservices-client-${depend.base-version}.jar in ./lib/compile. Try 'ant download-lib' to download the missing file." /> |
---|
146 | --> |
---|
147 | <echo>Found all requried BASE core JAR files.</echo> |
---|
148 | </target> |
---|
149 | |
---|
150 | <target |
---|
151 | name="download-lib" |
---|
152 | description="Download required BASE core jar files" |
---|
153 | > |
---|
154 | <echo> |
---|
155 | ------------------------------------------------------- |
---|
156 | NOTE! You may specifiy a different download location by |
---|
157 | creating the file './build.properties' and |
---|
158 | setting 'depend.jars' to the URL to download from. |
---|
159 | ------------------------------------------------------- |
---|
160 | </echo> |
---|
161 | <download-lib file="base-core-${depend.base-version}.jar" /> |
---|
162 | <download-lib file="base-webclient-${depend.base-version}.jar" /> |
---|
163 | <!-- |
---|
164 | <download-lib file="base-webservices-client-${depend.base-version}.jar" /> |
---|
165 | --> |
---|
166 | </target> |
---|
167 | |
---|
168 | <macrodef name="download-lib" description="Download BASE core JAR files"> |
---|
169 | <attribute name="file" /> |
---|
170 | <sequential> |
---|
171 | <get |
---|
172 | dest="lib/compile/@{file}" |
---|
173 | src="${depend.jars}/@{file}" |
---|
174 | usetimestamp="true" |
---|
175 | verbose="true" |
---|
176 | ignoreerrors="true" |
---|
177 | /> |
---|
178 | </sequential> |
---|
179 | </macrodef> |
---|
180 | |
---|
181 | <target name="update-title"> |
---|
182 | <echo>Setting title to: ${title}</echo> |
---|
183 | |
---|
184 | <echo>Meludi.java</echo> |
---|
185 | <replaceregexp |
---|
186 | file="${src}/net/sf/basedb/meludi/Meludi.java" |
---|
187 | match="public static final String TITLE = ".*";" |
---|
188 | replace="public static final String TITLE = "${title}";" |
---|
189 | encoding="UTF-8" |
---|
190 | /> |
---|
191 | |
---|
192 | <echo>meludi-2.js</echo> |
---|
193 | <replaceregexp |
---|
194 | file="resources/meludi-2.js" |
---|
195 | match="meludi.TITLE = '.*';" |
---|
196 | replace="meludi.TITLE = '${title}';" |
---|
197 | encoding="UTF-8" |
---|
198 | /> |
---|
199 | |
---|
200 | <echo>samplereport.js</echo> |
---|
201 | <replaceregexp |
---|
202 | file="resources/reports/samplereportgenerator.js" |
---|
203 | match="report.TITLE = '.*';" |
---|
204 | replace="report.TITLE = '${title}';" |
---|
205 | encoding="UTF-8" |
---|
206 | /> |
---|
207 | |
---|
208 | <echo>extraction_protocol.js</echo> |
---|
209 | <replaceregexp |
---|
210 | file="resources/sampleproc/extraction_protocol.js" |
---|
211 | match="ep.TITLE = '.*';" |
---|
212 | replace="ep.TITLE = '${title}';" |
---|
213 | encoding="UTF-8" |
---|
214 | /> |
---|
215 | |
---|
216 | <echo>Don't forget to commit the changes to the subversion repository!</echo> |
---|
217 | </target> |
---|
218 | |
---|
219 | <target name="update-version"> |
---|
220 | <echo>Setting version to: ${version}</echo> |
---|
221 | |
---|
222 | <echo>Meludi.java</echo> |
---|
223 | <replaceregexp |
---|
224 | file="${src}/net/sf/basedb/meludi/Meludi.java" |
---|
225 | match="public static final String VERSION = ".*";" |
---|
226 | replace="public static final String VERSION = "${version}";" |
---|
227 | encoding="UTF-8" |
---|
228 | /> |
---|
229 | |
---|
230 | <echo>meludi-2.js</echo> |
---|
231 | <replaceregexp |
---|
232 | file="resources/meludi-2.js" |
---|
233 | match="meludi.VERSION = '.*';" |
---|
234 | replace="meludi.VERSION = '${version}';" |
---|
235 | encoding="UTF-8" |
---|
236 | /> |
---|
237 | |
---|
238 | <echo>samplereport.js</echo> |
---|
239 | <replaceregexp |
---|
240 | file="resources/reports/samplereportgenerator.js" |
---|
241 | match="report.VERSION = '.*';" |
---|
242 | replace="report.VERSION = '${version}';" |
---|
243 | encoding="UTF-8" |
---|
244 | /> |
---|
245 | |
---|
246 | <echo>extensions.xml</echo> |
---|
247 | <replaceregexp |
---|
248 | file="META-INF/extensions.xml" |
---|
249 | match="<version>.*</version>" |
---|
250 | replace="<version>${version}</version>" |
---|
251 | encoding="UTF-8" |
---|
252 | /> |
---|
253 | <replaceregexp |
---|
254 | file="META-INF/extensions.xml" |
---|
255 | match="<min-base-version>.*</min-base-version>" |
---|
256 | replace="<min-base-version>${depend.base-version}</min-base-version>" |
---|
257 | encoding="UTF-8" |
---|
258 | /> |
---|
259 | |
---|
260 | <echo>Don't forget to commit the changes to the subversion repository!</echo> |
---|
261 | </target> |
---|
262 | |
---|
263 | </project> |
---|