forked from dogtagpki/idm-console-framework
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
335 lines (300 loc) · 14.5 KB
/
build.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
<!--
BEGIN COPYRIGHT BLOCK
Copyright (C) 2005 Red Hat, Inc.
All rights reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation version
2.1 of the License.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
END COPYRIGHT BLOCK
-->
<project name="console" default="build_jars" basedir=".">
<!-- Load properties -->
<property file="build.properties"/>
<!-- Paths -->
<property name="built.dir" value="${console.root}/../built"/>
<property name="built.classdir" value="${built.dir}/classes"/>
<property name="release.dir" value="${built.dir}/release"/>
<property name="built.jardir" value="${release.dir}/jars"/>
<property name="package.dir" value="${release.dir}/package"/>
<property name="dist.dir" value="${release.dir}/dist"/>
<property name="lib.dir" value="${package.dir}/lib"/>
<property name="java.dir" value="${package.dir}/java"/>
<property name="javadoc.dir" value="${built.dir}/doc"/>
<property name="imports.dir" value="${console.root}/../imports"/>
<property name="java.src.dir" value="src/main/java"/>
<property environment="env"/>
<!-- Prepare -->
<target name="prepare_build" depends="prepare_imports">
<!-- Create directories -->
<mkdir dir="${built.classdir}"/>
<!-- Classdest is the location you intend to install the Console jars -->
<property name="classdest" value="/usr/share/java"/>
<!-- Override these properties to use components from other system locations -->
<property name="ldapjdk.local.location" value="/usr/share/java"/>
<property name="jss.local.location" value="/usr/lib/java"/>
<property name="jsslib.local.location" value="/usr/lib"/>
<property name="nss.local.location" value="/usr/lib"/>
<property name="nspr.local.location" value="/usr/lib"/>
<!-- Construct classpath -->
<path id="console.classpath">
<pathelement location="${ldapjdk.local.location}/${ldapjdk.jar.name}"/>
<pathelement location="${jss.local.location}/${jss.jar.name}"/>
</path>
<!-- Generate version property file -->
<exec executable="${console.root}/buildnum.pl" vmlauncher="true">
<arg line="-p ${built.dir}"/>
</exec>
<exec executable="${console.root}/src/main/java/com/netscape/management/client/console/genverinfo.sh">
<arg value="${console.root}/src/main/java/com/netscape/management/client/console/versioninfo.properties"/>
<arg value="${console.dotversion}"/>
<arg value="${console.dotgenversion}"/>
<arg value="${built.dir}/buildnum.dat"/>
</exec>
</target>
<target name="prepare_imports" if="imports.file">
<mkdir dir="${imports.dir}"/>
<!-- Load imports file -->
<fail message="Imports file does not exist. (${imports.file})">
<condition>
<not>
<available file="${imports.file}"/>
</not>
</condition>
</fail>
<property file="${imports.file}"/>
<!-- Set local component locations -->
<property name="ldapjdk.local.location" value="${imports.dir}/ldapjdk"/>
<property name="jss.local.location" value="${imports.dir}/jss"/>
<property name="jsslib.local.location" value="${imports.dir}/jss/lib"/>
<property name="nss.local.location" value="${imports.dir}/nss/lib"/>
<property name="nspr.local.location" value="${imports.dir}/nspr/lib"/>
<!-- Check if components exist -->
<available file="${imports.dir}/ldapjdk/${ldapjdk.import}" property="ldapjdk.import.exists"/>
<available file="${imports.dir}/jss/${jss.jar.import}" property="jss.jar.import.exists"/>
<available file="${imports.dir}/jss/${jss.lib.import}" property="jss.lib.import.exists"/>
<available file="${imports.dir}/nss/${nss.import}" property="nss.import.exists"/>
<available file="${imports.dir}/nspr/${nspr.import}" property="nspr.import.exists"/>
</target>
<target name="prepare_jars">
<!-- Create directories -->
<mkdir dir="${package.dir}"/>
<mkdir dir="${built.jardir}"/>
</target>
<target name="prepare_package">
<!-- Create directories -->
<mkdir dir="${lib.dir}"/>
<mkdir dir="${dist.dir}"/>
</target>
<target name="prepare_doc">
<!-- Create directories -->
<mkdir dir="${javadoc.dir}"/>
</target>
<!-- Imports -->
<target name="import_ldapjdk" depends="prepare_imports" if="imports.file" unless="ldapjdk.import.exists">
<mkdir dir="${imports.dir}/ldapjdk"/>
<get src="${ldapjdk.location}/${ldapjdk.import}"
dest="${imports.dir}/ldapjdk/${ldapjdk.import}"/>
</target>
<target name="import_jss_jar" depends="prepare_imports" if="imports.file" unless="jss.jar.import.exists">
<mkdir dir="${imports.dir}/jss"/>
<get src="${jss.jar.location}/${jss.jar.import}"
dest="${imports.dir}/jss/${jss.jar.import}"/>
<copy file="${imports.dir}/jss/${jss.jar.import}" tofile="${imports.dir}/jss/${jss.jar.name}"/>
</target>
<target name="import_jss_lib" depends="prepare_imports" if="imports.file" unless="jss.lib.import.exists">
<mkdir dir="${imports.dir}/jss"/>
<get src="${jss.lib.location}/${jss.lib.import}"
dest="${imports.dir}/jss/${jss.lib.import}"/>
<unjar src="${imports.dir}/jss/${jss.lib.import}" dest="${imports.dir}/jss"/>
</target>
<target name="import_nss_lib" depends="prepare_imports" if="imports.file" unless="nss.import.exists">
<mkdir dir="${imports.dir}/nss"/>
<get src="${nss.location}/${nss.import}"
dest="${imports.dir}/nss/${nss.import}"/>
<unjar src="${imports.dir}/nss/${nss.import}" dest="${imports.dir}/nss"/>
</target>
<target name="import_nspr_lib" depends="prepare_imports" if="imports.file" unless="nspr.import.exists">
<mkdir dir="${imports.dir}/nspr"/>
<get src="${nspr.location}/${nspr.import}"
dest="${imports.dir}/nspr/${nspr.import}"/>
<unjar src="${imports.dir}/nspr/${nspr.import}" dest="${imports.dir}/nspr"/>
</target>
<!-- Build -->
<target name="build" depends="prepare_build, import_ldapjdk, import_jss_jar">
<!-- Verify that the required jars exist -->
<fail message="LDAP JDK (${ldapjdk.jar.name}) does not exist in ${ldapjdk.local.location}">
Please set the correct location with -Dldapjdk.local.location=[path]
<condition>
<not>
<available file="${ldapjdk.local.location}/${ldapjdk.jar.name}"/>
</not>
</condition>
</fail>
<fail message="JSS (${jss.jar.name}) does not exist in ${jss.local.location}">
Please set the correct location with -Djss.local.location=[path]
<condition>
<not>
<available file="${jss.local.location}/${jss.jar.name}"/>
</not>
</condition>
</fail>
<!-- compile regular java code -->
<javac srcdir="${java.src.dir}"
destdir="${built.classdir}"
debug="${compile.debug}"
debuglevel="lines,vars,source"
deprecation="${compile.deprecation}"
optimize="${compile.optimize}"
verbose="no"
fork="true"
excludes="**/CVS/**"
source="1.8"
target="1.8">
<classpath refid="console.classpath" />
</javac>
</target>
<!-- Package -->
<target name="build_jars" depends="build,prepare_jars">
<!-- Create jar files -->
<jar jarfile="${built.jardir}/${mcc.core}.jar" >
<fileset dir="${built.classdir}">
<include name="com/netscape/management/client/**/*.class" />
<include name="sun/net/www/protocol/https/**/*.class" />
<exclude name="com/netscape/management/client/topology/IServerObject.class"/>
<exclude name="com/netscape/management/client/topology/IRemovableServerObject.class"/>
<exclude name="com/netscape/management/client/topology/IProductObject.class"/>
<exclude name="com/netscape/management/client/topology/AbstractServerObject.class"/>
<exclude name="com/netscape/management/client/topology/ServerNode.class"/>
<exclude name="com/netscape/management/client/IPage.class"/>
<exclude name="com/netscape/management/client/IFramework.class"/>
<exclude name="com/netscape/management/client/IFrameworkInitializer.class"/>
<exclude name="com/netscape/management/client/FrameworkInitializer.class"/>
<exclude name="com/netscape/management/client/IResourceObject.class"/>
<exclude name="com/netscape/management/client/ResourceObject.class"/>
<exclude name="com/netscape/management/client/util/ClassLoaderUtil.class"/>
<exclude name="com/netscape/management/client/util/LocalJarClassLoader.class"/>
<exclude name="com/netscape/management/client/util/KingpinClassLoader.class"/>
<exclude name="com/netscape/management/client/util/UtilConsoleGlobals.class"/>
<exclude name="com/netscape/management/client/console/ConsoleInfo.class"/>
<exclude name="com/netscape/management/client/console/VersionInfo.class"/>
</fileset>
</jar>
<jar jarfile="${built.jardir}/${mcc.core}_${lang}.jar" >
<fileset dir="${java.src.dir}">
<include name="com/netscape/management/client/**/*.properties" />
<include name="com/netscape/management/client/**/*.gif" />
<include name="com/netscape/management/client/**/*.jpg" />
</fileset>
</jar>
<jar jarfile="${built.jardir}/${nmclf.core}.jar" >
<fileset dir="${built.classdir}">
<include name="com/netscape/management/nmclf/**/*.class" />
</fileset>
</jar>
<jar jarfile="${built.jardir}/${nmclf.core}_${lang}.jar" >
<fileset dir="${java.src.dir}">
<include name="com/netscape/management/nmclf/**/*.properties" />
<include name="com/netscape/management/nmclf/**/*.gif" />
<include name="com/netscape/management/nmclf/**/*.jpg" />
</fileset>
</jar>
<jar jarfile="${built.jardir}/${base.core}.jar" >
<fileset dir="${built.classdir}">
<include name="com/netscape/management/client/topology/IServerObject.class"/>
<include name="com/netscape/management/client/topology/IRemovableServerObject.class"/>
<include name="com/netscape/management/client/topology/IProductObject.class"/>
<include name="com/netscape/management/client/topology/AbstractServerObject.class"/>
<include name="com/netscape/management/client/topology/ServerNode.class"/>
<include name="com/netscape/management/client/IPage.class"/>
<include name="com/netscape/management/client/IFramework.class"/>
<include name="com/netscape/management/client/IFrameworkInitializer.class"/>
<include name="com/netscape/management/client/FrameworkInitializer.class"/>
<include name="com/netscape/management/client/IResourceObject.class"/>
<include name="com/netscape/management/client/ResourceObject.class"/>
<include name="com/netscape/management/client/util/ClassLoaderUtil.class"/>
<include name="com/netscape/management/client/util/LocalJarClassLoader.class"/>
<include name="com/netscape/management/client/util/KingpinClassLoader.class"/>
<include name="com/netscape/management/client/util/UtilConsoleGlobals.class"/>
<include name="com/netscape/management/client/console/ConsoleInfo.class"/>
<include name="com/netscape/management/client/console/VersionInfo.class"/>
</fileset>
</jar>
</target>
<!-- Package -->
<target name="package" depends="build_jars,prepare_package,import_jss_lib,import_nss_lib,import_nspr_lib">
<!-- Copy built jars to packaging area -->
<copy file="${built.jardir}/${mcc.core}.jar" todir="${java.dir}"/>
<copy file="${built.jardir}/${mcc.core}_${lang}.jar" todir="${java.dir}"/>
<copy file="${built.jardir}/${nmclf.core}.jar" todir="${java.dir}"/>
<copy file="${built.jardir}/${nmclf.core}_${lang}.jar" todir="${java.dir}"/>
<copy file="${built.jardir}/${base.core}.jar" todir="${java.dir}"/>
<!-- Copy components into packaging area -->
<copy file="${ldapjdk.local.location}/${ldapjdk.jar.name}" todir="${java.dir}"/>
<copy file="${jss.local.location}/${jss.jar.name}" todir="${java.dir}"/>
<copy todir="${lib.dir}">
<fileset dir="${jsslib.local.location}">
<include name="libjss*"/>
</fileset>
<fileset dir="${nss.local.location}">
<include name="libnss*"/>
<include name="libssl*"/>
<include name="libsmime*"/>
<include name="libsoftokn*"/>
<include name="libfreebl*"/>
<exclude name="libnssckbi*"/>
<exclude name="lib*.a"/>
</fileset>
<fileset dir="${nspr.local.location}">
<include name="libnspr*"/>
<include name="libpl*"/>
<exclude name="lib*.a"/>
</fileset>
</copy>
<!-- Copy start script into packaging area -->
<copy file="startconsole-sandbox" tofile="${package.dir}/startconsole"/>
<chmod file="${package.dir}/startconsole" perm="755"/>
<!-- Create a bundle of the Console -->
<tar destfile="${dist.dir}/${console.brand}-console-${console.dotversion}.tar.gz"
compression="gzip">
<tarfileset dir="${package.dir}"
prefix="${console.brand}-console-${console.dotversion}"
mode="755">
<include name="startconsole"/>
</tarfileset>
<tarfileset dir="${package.dir}"
prefix="${console.brand}-console-${console.dotversion}">
<include name="**"/>
<exclude name="startconsole"/>
</tarfileset>
</tar>
</target>
<!-- Javadoc -->
<target name="javadoc" depends="prepare_doc">
<javadoc
packagenames="com.netscape.management.*"
sourcepath="src/main/java"
destdir="${javadoc.dir}"
author="true"
version="true"
use="true"
windowtitle="Console API"
doctitle="Console API" />
</target>
<!-- Cleanup -->
<target name="clean_all" depends="clean,clean_imports"/>
<target name="clean">
<delete dir="${built.dir}"/>
<delete file="${console.root}/src/main/java/com/netscape/management/client/console/versioninfo.properties"/>
</target>
<target name="clean_imports">
<delete dir="${imports.dir}"/>
</target>
</project>