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="4.31.3-dev" /> |
---|
13 | <property name="delivery.version" value="1" /> |
---|
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:all,-path" /> |
---|
21 | <property name="javac.source" value="11" /> |
---|
22 | <property name="javac.target" value="11" /> |
---|
23 | <property name="javac.encoding" value="UTF-8" /> |
---|
24 | <property name="depend.base-version" |
---|
25 | value="3.17.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 | <fileset dir="META-INF/lib"> |
---|
39 | <include name="**/*.jar" /> |
---|
40 | </fileset> |
---|
41 | </path> |
---|
42 | |
---|
43 | <target name="init"> |
---|
44 | <mkdir dir="${build}" /> |
---|
45 | <mkdir dir="${dist}" /> |
---|
46 | </target> |
---|
47 | |
---|
48 | <target name="clean"> |
---|
49 | <delete failonerror="false" includeemptydirs="true"> |
---|
50 | <fileset dir="${build}" defaultexcludes="no" /> |
---|
51 | <fileset dir="${dist}" defaultexcludes="no" /> |
---|
52 | <fileset dir="lib/compile" includes="base-*.jar" /> |
---|
53 | <fileset file="${jar.name}" /> |
---|
54 | <fileset file="${tar.name}" /> |
---|
55 | </delete> |
---|
56 | </target> |
---|
57 | |
---|
58 | <target |
---|
59 | name="dist" |
---|
60 | depends="clean,download-lib,build" |
---|
61 | > |
---|
62 | <copy todir="${dist}"> |
---|
63 | <fileset dir="." includes="README,LICENSE,config/*" /> |
---|
64 | <fileset file="${jar.name}" /> |
---|
65 | </copy> |
---|
66 | </target> |
---|
67 | |
---|
68 | <target |
---|
69 | name="package" |
---|
70 | depends="dist" |
---|
71 | description="Create binary distribution package" |
---|
72 | > |
---|
73 | <tar |
---|
74 | destfile="${tar.name}" |
---|
75 | longfile="gnu" |
---|
76 | compression="gzip" |
---|
77 | > |
---|
78 | <tarfileset |
---|
79 | dir="${dist}" |
---|
80 | mode="755" |
---|
81 | prefix="${tar.prefix}" |
---|
82 | preserveLeadingSlashes="true" |
---|
83 | > |
---|
84 | <include name="**/*.sh" /> |
---|
85 | </tarfileset> |
---|
86 | <tarfileset |
---|
87 | dir="${dist}" |
---|
88 | prefix="${tar.prefix}" |
---|
89 | preserveLeadingSlashes="true" |
---|
90 | > |
---|
91 | <exclude name="**/*.sh" /> |
---|
92 | </tarfileset> |
---|
93 | </tar> |
---|
94 | </target> |
---|
95 | |
---|
96 | <target |
---|
97 | name="install" |
---|
98 | depends="build" |
---|
99 | > |
---|
100 | <fail unless="base.plugins" message="base.plugins is not set to the path of BASE plug-ins directory." /> |
---|
101 | <copy todir="${base.plugins}"> |
---|
102 | <fileset file="${jar.name}" /> |
---|
103 | </copy> |
---|
104 | <echo>Copied '${jar.name}' to '${base.plugins}'.</echo> |
---|
105 | </target> |
---|
106 | |
---|
107 | |
---|
108 | <target |
---|
109 | name="build" |
---|
110 | depends="init,checkjar" |
---|
111 | description="Compiles the plugin and put in jar" |
---|
112 | > |
---|
113 | <mkdir dir="${build}" /> |
---|
114 | <javac |
---|
115 | encoding="${javac.encoding}" |
---|
116 | srcdir="${src}" |
---|
117 | destdir="${build}" |
---|
118 | debug="true" |
---|
119 | includeantruntime="false" |
---|
120 | classpathref="classpath" |
---|
121 | source="${javac.source}" |
---|
122 | target="${javac.target}" |
---|
123 | > |
---|
124 | <compilerarg value="${javac.arg}" /> |
---|
125 | </javac> |
---|
126 | <copy todir="${build}"> |
---|
127 | <fileset dir="${src}"> |
---|
128 | <include name="**/*" /> |
---|
129 | <exclude name="**/*.java" /> |
---|
130 | </fileset> |
---|
131 | </copy> |
---|
132 | <jar |
---|
133 | jarfile="${jar.name}" |
---|
134 | manifest="META-INF/MANIFEST.MF" |
---|
135 | > |
---|
136 | <fileset dir="${build}" /> |
---|
137 | <fileset dir="." includes="META-INF/**" /> |
---|
138 | <fileset dir="." includes="resources/**" /> |
---|
139 | </jar> |
---|
140 | </target> |
---|
141 | |
---|
142 | <target |
---|
143 | name="checkjar" |
---|
144 | description="Checks that required BASE JAR files exists" |
---|
145 | > |
---|
146 | <available classname="net.sf.basedb.core.Application" |
---|
147 | classpathref="classpath" property="base-core" /> |
---|
148 | <available classname="net.sf.basedb.plugins.util.Parameters" |
---|
149 | classpathref="classpath" property="base-coreplugins" /> |
---|
150 | <available classname="net.sf.basedb.clients.web.Base" |
---|
151 | classpathref="classpath" property="base-web" /> |
---|
152 | <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." /> |
---|
153 | <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." /> |
---|
154 | <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." /> |
---|
155 | <echo>Found all requried BASE core JAR files.</echo> |
---|
156 | </target> |
---|
157 | |
---|
158 | <target |
---|
159 | name="download-lib" |
---|
160 | description="Download required BASE core jar files" |
---|
161 | > |
---|
162 | <echo> |
---|
163 | ------------------------------------------------------- |
---|
164 | NOTE! You may specifiy a different download location by |
---|
165 | creating the file './build.properties' and |
---|
166 | setting 'depend.jars' to the URL to download from. |
---|
167 | ------------------------------------------------------- |
---|
168 | </echo> |
---|
169 | <download-lib file="base-core-${depend.base-version}.jar" /> |
---|
170 | <download-lib file="base-coreplugins-${depend.base-version}.jar" /> |
---|
171 | <download-lib file="base-webclient-${depend.base-version}.jar" /> |
---|
172 | </target> |
---|
173 | |
---|
174 | <macrodef name="download-lib" description="Download BASE core JAR files"> |
---|
175 | <attribute name="file" /> |
---|
176 | <sequential> |
---|
177 | <get |
---|
178 | dest="lib/compile/@{file}" |
---|
179 | src="${depend.jars}/@{file}" |
---|
180 | usetimestamp="true" |
---|
181 | verbose="true" |
---|
182 | ignoreerrors="true" |
---|
183 | /> |
---|
184 | </sequential> |
---|
185 | </macrodef> |
---|
186 | |
---|
187 | <target name="update-version"> |
---|
188 | <echo>Setting version to: ${version}</echo> |
---|
189 | |
---|
190 | <echo>Reggie.java</echo> |
---|
191 | <replaceregexp |
---|
192 | file="${src}/net/sf/basedb/reggie/Reggie.java" |
---|
193 | match="public static final String VERSION = ".*";" |
---|
194 | replace="public static final String VERSION = "${version}";" |
---|
195 | encoding="UTF-8" |
---|
196 | /> |
---|
197 | |
---|
198 | <echo>reggie-2.js</echo> |
---|
199 | <replaceregexp |
---|
200 | file="resources/reggie-2.js" |
---|
201 | match="reggie.VERSION = '.*';" |
---|
202 | replace="reggie.VERSION = '${version}';" |
---|
203 | encoding="UTF-8" |
---|
204 | /> |
---|
205 | |
---|
206 | <echo>extensions.xml</echo> |
---|
207 | <replaceregexp |
---|
208 | file="META-INF/extensions.xml" |
---|
209 | match="<version>.*</version>" |
---|
210 | replace="<version>${version}</version>" |
---|
211 | encoding="UTF-8" |
---|
212 | /> |
---|
213 | <replaceregexp |
---|
214 | file="META-INF/extensions.xml" |
---|
215 | match="<min-base-version>.*</min-base-version>" |
---|
216 | replace="<min-base-version>${depend.base-version}</min-base-version>" |
---|
217 | encoding="UTF-8" |
---|
218 | /> |
---|
219 | |
---|
220 | <echo>.classpath</echo> |
---|
221 | <replaceregexp |
---|
222 | file=".classpath" |
---|
223 | match="base-(\w+)-[0-9.]+jar" |
---|
224 | replace="base-\1-${depend.base-version}.jar" |
---|
225 | encoding="UTF-8" |
---|
226 | byline="true" |
---|
227 | /> |
---|
228 | |
---|
229 | <echo>delivery.css</echo> |
---|
230 | <replaceregexp |
---|
231 | file="resources/delivery/delivery.css" |
---|
232 | match="'SCAN-B Delivery Client v.*';" |
---|
233 | replace="'SCAN-B Delivery Client v${delivery.version}';" |
---|
234 | encoding="UTF-8" |
---|
235 | /> |
---|
236 | |
---|
237 | <echo>Don't forget to commit the changes to the subversion repository!</echo> |
---|
238 | </target> |
---|
239 | |
---|
240 | </project> |
---|