1 | <?xml version="1.0" encoding="UTF-8"?> |
---|
2 | <project |
---|
3 | name="Reggie" |
---|
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="reggie" /> |
---|
12 | <property name="version" value="1.6-dev" /> |
---|
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="dist" location="dist" description="Directory where distribution should be created" /> |
---|
16 | <property name="jar.name" value="${name}.jar" description="Name of JAR file with the extensions." /> |
---|
17 | <property name="tar.prefix" value="${name}-${version}" description="Prefix of .tar.gz file for download." /> |
---|
18 | <property name="tar.name" value="${tar.prefix}.tar.gz" description="Full name of .tar.gz file for download." /> |
---|
19 | <property name="javac.arg" value="-Xlint:unchecked" /> |
---|
20 | <property name="javac.source" value="1.6" /> |
---|
21 | <property name="javac.target" value="1.6" /> |
---|
22 | <property name="javac.encoding" value="UTF-8" /> |
---|
23 | <property name="depend.jars" |
---|
24 | value="http://base2.thep.lu.se/base/jars/2.17.1" |
---|
25 | description="The location of the BASE core JARs that we depend on" |
---|
26 | /> |
---|
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 | <mkdir dir="${dist}" /> |
---|
38 | </target> |
---|
39 | |
---|
40 | <target name="clean"> |
---|
41 | <delete failonerror="false" includeemptydirs="true"> |
---|
42 | <fileset dir="${build}" defaultexcludes="no" /> |
---|
43 | <fileset dir="${dist}" defaultexcludes="no" /> |
---|
44 | <fileset file="${jar.name}" /> |
---|
45 | <fileset file="${tar.name}" /> |
---|
46 | </delete> |
---|
47 | </target> |
---|
48 | |
---|
49 | <target |
---|
50 | name="dist" |
---|
51 | depends="clean,build" |
---|
52 | > |
---|
53 | <copy todir="${dist}"> |
---|
54 | <fileset dir="." includes="README,LICENSE" /> |
---|
55 | <fileset file="${jar.name}" /> |
---|
56 | </copy> |
---|
57 | </target> |
---|
58 | |
---|
59 | <target |
---|
60 | name="package" |
---|
61 | depends="dist" |
---|
62 | description="Create binary distribution package" |
---|
63 | > |
---|
64 | <tar |
---|
65 | destfile="${tar.name}" |
---|
66 | longfile="gnu" |
---|
67 | compression="gzip" |
---|
68 | > |
---|
69 | <tarfileset |
---|
70 | dir="${dist}" |
---|
71 | mode="755" |
---|
72 | prefix="${tar.prefix}" |
---|
73 | preserveLeadingSlashes="true" |
---|
74 | > |
---|
75 | <include name="**/*.sh" /> |
---|
76 | </tarfileset> |
---|
77 | <tarfileset |
---|
78 | dir="${dist}" |
---|
79 | prefix="${tar.prefix}" |
---|
80 | preserveLeadingSlashes="true" |
---|
81 | > |
---|
82 | <exclude name="**/*.sh" /> |
---|
83 | </tarfileset> |
---|
84 | </tar> |
---|
85 | </target> |
---|
86 | |
---|
87 | <target |
---|
88 | name="install" |
---|
89 | depends="build" |
---|
90 | > |
---|
91 | <fail unless="base.home" message="base.home is not set to the path of BASE installation." /> |
---|
92 | <copy todir="${base.home}/www/WEB-INF/extensions"> |
---|
93 | <fileset file="${jar.name}" /> |
---|
94 | </copy> |
---|
95 | |
---|
96 | </target> |
---|
97 | |
---|
98 | <target |
---|
99 | name="build" |
---|
100 | depends="init,checkjar" |
---|
101 | description="Compiles the plugin and put in jar" |
---|
102 | > |
---|
103 | <mkdir dir="${build}" /> |
---|
104 | <javac |
---|
105 | encoding="${javac.encoding}" |
---|
106 | srcdir="${src}" |
---|
107 | destdir="${build}" |
---|
108 | debug="true" |
---|
109 | includeantruntime="false" |
---|
110 | classpathref="classpath" |
---|
111 | source="${javac.source}" |
---|
112 | target="${javac.target}" |
---|
113 | > |
---|
114 | <compilerarg value="${javac.arg}" /> |
---|
115 | </javac> |
---|
116 | <jar |
---|
117 | jarfile="${jar.name}" |
---|
118 | manifest="META-INF/MANIFEST.MF" |
---|
119 | > |
---|
120 | <fileset dir="${build}" /> |
---|
121 | <fileset dir="." includes="META-INF/**" /> |
---|
122 | <fileset dir="." includes="resources/**" /> |
---|
123 | </jar> |
---|
124 | </target> |
---|
125 | |
---|
126 | <target |
---|
127 | name="checkjar" |
---|
128 | description="Checks that the BASE2Core.jar, BASE2Webclient.jar and BASE2WSClient.jar exists." |
---|
129 | > |
---|
130 | <available classname="net.sf.basedb.core.Application" |
---|
131 | classpathref="classpath" property="base2core" /> |
---|
132 | <available classname="net.sf.basedb.clients.web.Base" |
---|
133 | classpathref="classpath" property="base2web" /> |
---|
134 | <available classname="net.sf.basedb.info.BioAssaySetInfo" |
---|
135 | classpathref="classpath" property="base2webservice" /> |
---|
136 | |
---|
137 | <fail unless="base2core" message="Can't find BASE2Core.jar in ./lib/compile. Try 'ant download-lib' to download the missing file." /> |
---|
138 | <fail unless="base2web" message="Can't find BASE2Webclient.jar in ./lib/compile. Try 'ant download-lib' to download the missing file." /> |
---|
139 | <fail unless="base2webservice" message="Can't find BASE2WSClient.jar in ./lib/compile. Try 'ant download-lib' to download the missing file." /> |
---|
140 | <echo>Found BASE2Core.jar and BASE2Webclient.jar.</echo> |
---|
141 | </target> |
---|
142 | |
---|
143 | <target |
---|
144 | name="download-lib" |
---|
145 | description="Download BASE2Core.jar, BASE2Webclient.jar and BASE2WSClient.jar." |
---|
146 | > |
---|
147 | <echo> |
---|
148 | ------------------------------------------------------- |
---|
149 | NOTE! You may specifiy a different download location by |
---|
150 | creating the file './build.properties' and |
---|
151 | setting 'depend.jars' to the URL to download from. |
---|
152 | ------------------------------------------------------- |
---|
153 | </echo> |
---|
154 | <download-lib file="BASE2Core.jar" /> |
---|
155 | <download-lib file="BASE2Webclient.jar" /> |
---|
156 | <download-lib file="BASE2WSClient.jar" /> |
---|
157 | </target> |
---|
158 | |
---|
159 | <macrodef name="download-lib" description="Download BASE core JAR files"> |
---|
160 | <attribute name="file" /> |
---|
161 | <sequential> |
---|
162 | <get |
---|
163 | dest="lib/compile/@{file}" |
---|
164 | src="${depend.jars}/@{file}" |
---|
165 | usetimestamp="true" |
---|
166 | verbose="true" |
---|
167 | ignoreerrors="true" |
---|
168 | /> |
---|
169 | </sequential> |
---|
170 | </macrodef> |
---|
171 | |
---|
172 | <target name="update-version"> |
---|
173 | <echo>Setting version to: ${version}</echo> |
---|
174 | |
---|
175 | <echo>Reggie.java</echo> |
---|
176 | <replaceregexp |
---|
177 | file="${src}/net/sf/basedb/reggie/Reggie.java" |
---|
178 | match="public static final String VERSION = ".*";" |
---|
179 | replace="public static final String VERSION = "${version}";" |
---|
180 | encoding="UTF-8" |
---|
181 | /> |
---|
182 | |
---|
183 | <echo>extensions.xml</echo> |
---|
184 | <replaceregexp |
---|
185 | file="META-INF/extensions.xml" |
---|
186 | match="<version>.*</version>" |
---|
187 | replace="<version>${version}</version>" |
---|
188 | encoding="UTF-8" |
---|
189 | /> |
---|
190 | |
---|
191 | <echo>Don't forget to commit the changes to the subversion repository!</echo> |
---|
192 | </target> |
---|
193 | |
---|
194 | </project> |
---|