File: build.xml

package info (click to toggle)
libcommons-modeler-java 2.0.1-6
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd, wheezy
  • size: 800 kB
  • ctags: 843
  • sloc: java: 5,961; xml: 1,431; makefile: 11
file content (456 lines) | stat: -rw-r--r-- 18,321 bytes parent folder | download | duplicates (4)
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
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
<!--
   Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
-->
<project name="Modeler" default="compile" basedir=".">


<!--
        "Modeler" component of the Jakarta Commons Subproject
        $Id: build.xml 549645 2007-06-21 23:20:58Z niallp $
-->


<!-- ========== Initialize Properties ===================================== -->


  <property file="build.properties"/>                <!-- Component local   -->
  <property file="../build.properties"/>             <!-- Commons local     -->
  <property file="${user.home}/build.properties"/>   <!-- User local        -->
  <property file="build.properties.default"/>        <!-- Defaults          -->


<!-- ========== External Dependencies ===================================== -->


  <!-- The directories corresponding to your necessary dependencies -->
  <property name="base.path"               value="/usr/local" />
  <property name="jaxp.home"               value="${base.path}/jaxp-1.1"/>
  <property name="junit.home"              value="${base.path}/junit3.7"/>
  <property name="digester.home"           value="${commons.home}/digester"/>
  <property name="jmx.home"                value="${base.path}/jmx-ri_1.0.1/jmx"/>
  <property name="logging.home"            value="${commons.home}/logging"/>

<!-- ========== Derived Values ============================================ -->


  <!-- The locations of necessary jar files -->
  <property name="ant.jar"                 value="${ant.home}/lib/ant.jar"/>
  <property name="jaxp.jaxp.jar"           value="${jaxp.home}/jaxp.jar"/>
  <property name="jaxp.parser.jar"         value="${jaxp.home}/crimson.jar"/>
  <property name="jaxp.xalan.jar"          value="${jaxp.home}/xalan.jar"/>
  <property name="jmx.jar"                 value="${jmx.home}/lib/jmxri.jar"/>
  <property name="junit.jar"               value="${junit.home}/junit.jar"/>
  <property name="commons-digester.jar"    value="${digester.home}/dist/commons-digester.jar"/>
  <property name="commons-logging.jar"     value="${logging.home}/target/commons-logging.jar"/>


<!-- ========== Component Declarations ==================================== -->


  <!-- The name of this component -->
  <property name="component.name"          value="modeler"/>

  <!-- The title of this component -->
  <property name="component.title"         value="Model MBeans Support Package"/>

  <!-- The current version number of this component -->
  <property name="component.version"       value="2.0.1"/>

  <!-- The base directory for compilation targets -->
  <property name="build.home"              value="target"/>

  <!-- The base directory for component configuration files -->
  <property name="conf.home"               value="src/conf"/>

  <!-- The base directory for distribution targets -->
  <property name="dist.home"               value="dist"/>

  <!-- The base directory for component sources -->
  <property name="source.home"             value="src/java"/>

  <!-- The base directory for unit test sources -->
  <property name="test.home"               value="src/test"/>

  <property name="commons-modeler.jar" value="${dist.home}/commons-${component.name}.jar"/>

<!-- ========== Compiler Defaults ========================================= -->


  <!-- Should Java compilations set the 'debug' compiler option? -->
  <property name="compile.debug"           value="true"/>

  <!-- Should Java compilations set the 'deprecation' compiler option? -->
  <property name="compile.deprecation"     value="false"/>

  <!-- Should Java compilations set the 'optimize' compiler option? -->
  <property name="compile.optimize"        value="true"/>

  <!-- Construct compile classpath -->
  <path id="compile.classpath">
    <pathelement location="${build.home}/classes"/>
    <pathelement location="${ant.jar}"/>
    <pathelement location="${jaxp.jaxp.jar}"/>
    <pathelement location="${jaxp.parser.jar}"/>
    <pathelement location="${jaxp.xalan.jar}"/>
    <pathelement location="${commons-digester.jar}"/>
    <pathelement location="${commons-logging.jar}"/>
    <pathelement location="${jmx.jar}"/>
  </path>


<!-- ========== Test Execution Defaults =================================== -->


  <!-- Construct unit test classpath -->
  <path id="test.classpath">
    <pathelement location="${build.home}/classes"/>
    <pathelement location="${build.home}/tests"/>
    <pathelement location="${ant.jar}"/>
    <pathelement location="${jaxp.jaxp.jar}"/>
    <pathelement location="${jaxp.parser.jar}"/>
    <pathelement location="${jaxp.xalan.jar}"/>
    <pathelement location="${commons-digester.jar}"/>
    <pathelement location="${commons-logging.jar}"/>
    <pathelement location="${jmx.jar}"/>
    <pathelement location="${junit.jar}"/>
  </path>

  <!-- Should all tests fail if one does? -->
  <property name="test.failonerror"        value="true"/>

  <!-- The test runner to execute -->
  <property name="test.runner"             value="junit.textui.TestRunner"/>


<!-- ========== Executable Targets ======================================== -->

  <target name="init"
   description="Initialize and evaluate conditionals">
    <echo message="-------- ${component.name} ${component.version} --------"/>
    <filter  token="name"                  value="${component.name}"/>
    <filter  token="version"               value="${component.version}"/>
  </target>


  <target name="prepare" depends="init"
   description="Prepare build directory">
    <mkdir dir="${build.home}"/>
    <mkdir dir="${build.home}/classes"/>
    <mkdir dir="${build.home}/conf"/>
    <mkdir dir="${build.home}/tests"/>
  </target>


  <target name="static" depends="prepare"
   description="Copy static files to build directory">
    <tstamp/>
    <copy  todir="${build.home}/conf" filtering="on">
      <fileset dir="${conf.home}" includes="*.MF"/>
    </copy>
  </target>


  <target name="compile-only" >
    <available property="ant16.available"  classname="org.apache.tools.ant.PropertyHelper" classpathref="compile.classpath" />
    <available property="digester.available"  classname="org.apache.commons.digester.Digester" classpathref="compile.classpath" />

    <javac  srcdir="${source.home}"
           destdir="${build.home}/classes"
             debug="${compile.debug}"
       deprecation="${compile.deprecation}"
          optimize="${compile.optimize}" source="1.3" target="1.3">
      <classpath refid="compile.classpath"/>
      <exclude name="org/apache/commons/modeler/ant/*PropertyHelper.java" unless="ant16.available" />
      <exclude name="org/apache/commons/modeler/modules/MbeansDescriptorsDigesterSource.java" unless="digester.available" />
    </javac>
    <copy    todir="${build.home}/classes" filtering="on">
      <fileset dir="${source.home}"
          excludes="**/*.java org/apache/commons/modeler/demo/**"/>
    </copy>
  </target>

  <target name="compile" depends="static,compile-only"
   description="Compile shareable components" />

  <target name="clean"
   description="Clean build and distribution directories">
    <delete    dir="${build.home}"/>
    <delete    dir="${dist.home}"/>
  </target>

  <target name="init-dist"
    description="Create distribution directory">
    <mkdir      dir="${dist.home}"/>
  </target>

  <target name="dist-lite" depends="init-dist,compile,jar"
          description="Dist without javadoc" />

  <target name="all" depends="clean,compile"
   description="Clean and compile all components"/>

  <target name="javadoc" depends="compile" unless="docs-uptodate"
   description="Create component Javadoc documentation">
    <mkdir      dir="${dist.home}"/>
    <mkdir      dir="${dist.home}/docs"/>
    <mkdir      dir="${dist.home}/docs/api"/>
    <javadoc sourcepath="${source.home}"
                destdir="${dist.home}/docs/api"
           packagenames="org.apache.commons.*"
                 author="true"
                private="true"
                version="true"
               doctitle="&lt;h1&gt;${component.title} (Version ${component.version})&lt;/h1&gt;"
            windowtitle="${component.title} (Version ${component.version})"
                 bottom="Copyright (c) 2001-2003 - Apache Software Foundation"
           classpathref="compile.classpath" />
  </target>

  <target name="jar" depends="compile,init-dist" > 
    <mkdir      dir="${build.home}/classes/META-INF"/>
    <copy      file="src/java/org/apache/commons/modeler/ant/ant.properties"
             tofile="${build.home}/classes/META-INF/ant.properties"/>
    <copy      file="LICENSE.txt"
             tofile="${build.home}/classes/META-INF/LICENSE.txt"/>
    <copy      file="NOTICE.txt"
             tofile="${build.home}/classes/META-INF/NOTICE.txt"/>
    <jar jarfile="${dist.home}/commons-${component.name}.jar"
         index="true"
         basedir="${build.home}/classes"
         manifest="src/conf/MANIFEST.MF">
       <include name="org/apache/commons/modeler/**" />
       <include name="META-INF/ant.properties" />
       <include name="META-INF/LICENSE.txt" />
       <include name="META-INF/NOTICE.txt" />
    </jar>
  </target>

  <target name="dist" depends="dist-lite,javadoc"
    description="Create binary distribution">
    <copy      file="LICENSE.txt"
              tofile="${dist.home}/LICENSE.txt"/>
    <copy todir="${dist.home}" >
       <fileset dir="." includes="RELEASE-NOTES**"/>
    </copy>

    <!-- some helpers to quickly build -->
    <copy todir="${dist.home}" >
       <fileset dir=".">
           <include name="build.xml"/>
           <include name="build.properties.sample"/>
       </fileset>
    </copy>

    <!-- the src is similar with the JDK sources - and very useful for users of
         IDEs, where the jar can be "mounted" and used when debugging -->
    <jar file="${dist.home}/commons-modeler-src.jar"
         manifest="src/conf/MANIFEST.MF">
         <fileset dir="src/java" includes="**/*.java" />
         <fileset dir="src/java" includes="**/*.dtd" />
         <fileset dir="src/java" includes="**/*.properties" />
         <fileset dir="." includes="LICENSE.txt" />
         <fileset dir="." includes="NOTICE.txt" />
     </jar>
 
     <copy      file="src/java/org/apache/commons/modeler/mbeans-descriptors.dtd"
              todir="${dist.home}"/>
  </target>

  <!-- Experimental for now. If people download the dist, they should be able to 
       do a quick build and to make small fixes -->
  <target name="dist-build-prepare" description="Allow dist users to unpack the sources" >
     <mkdir dir="src/java" />
     <mkdir dir="src/conf" />
     <unjar src="commons-modeler-src.jar" dest="src/java" />
     <copy file="src/java/MANIFEST.MF" todir="src/conf" />
  </target>
  
  <!-- Why is this target here? -->
  <target name="check-deps" >
  </target>

  <target name="dist-build"
    description="Buid target for the dist"
    depends="dist-build-prepare,check-deps,compile">
     <antcall target="jar" >
        <param name="commons-modeler.jar" location="commons-modeler.jar" />
        <param name="build.home" location="target" />
     </antcall>
  </target>

<!-- ========== Unit Test Targets ========================================= -->


  <target name="compile.tests" depends="compile"
   description="Compile unit test cases">
    <javac  srcdir="${test.home}"
           destdir="${build.home}/tests"
             debug="${compile.debug}"
       deprecation="${compile.deprecation}"
          optimize="${compile.optimize}">
      <classpath refid="test.classpath"/>
    </javac>
    <copy    todir="${build.home}/tests" filtering="on">
      <fileset dir="${test.home}" excludes="**/*.java"/>
    </copy>
  </target>


  <target name="test"  depends="compile.tests,
                                test.Registry"
   description="Run all unit test cases">
  </target>


  <target name="test.Registry">
    <echo message="Running Registry tests ..."/>
    <java classname="${test.runner}" fork="yes"
        failonerror="${test.failonerror}">
      <arg value="org.apache.commons.modeler.RegistryTestCase"/>
      <classpath refid="test.classpath"/>
    </java>
  </target>

<!-- ========== Demonstration Targets ===================================== -->


  <target name="demo" depends="compile.tests"
   description="Run demostration application">
    <java classname="org.apache.commons.modeler.demo.Demo" fork="yes">
      <classpath refid="test.classpath"/>
    </java>
  </target>

<!-- ========== Release Targets ===================================== -->

  <target name="release" description="Create the release">
    <property name="ver" value="2.1-dev" />
    <property name="tag" value="MODELER_2_1_DEV" />
    <delete dir="release" />
    <mkdir dir="release" />
    <cvs command="checkout" 
         package="jakarta-commons/modeler" 
         cvsroot=":pserver:anoncvs@cvs.apache.org:/home/cvspublic"
         dest="release" 
         tag="${tag}"/> 
    <rename src="release/jakarta-commons/modeler" dest="release/commons-modeler-${ver}-src" />
    <delete dir="release/jakarta-commons"/>
    <zip file="release/commons-modeler-${ver}-src.zip" >
       <fileset dir="release" includes="commons-modeler-${ver}-src/**"/>
    </zip>
    <tar  tarfile="release/commons-modeler-${ver}-src.tar" >
       <tarfileset dir="release" includes="commons-modeler-${ver}-src/**"/>
    </tar> 
    <gzip zipfile="release/commons-modeler-${ver}-src.tar.gz" src="release/commons-modeler-${ver}-src.tar"/>
    <delete file="release/commons-modeler-${ver}-src.tar" />

<!--
    <ant dir="release/commons-modeler-${ver}-src" target="download" />
-->
    
    <ant dir="release/commons-modeler-${ver}-src" target="dist"  />

    <mkdir dir="release/commons-modeler-${ver}" />
    <copy todir="release/commons-modeler-${ver}" >
       <fileset dir="release/commons-modeler-${ver}-src/dist" includes="**"/>
    </copy>
    <copy file="release/commons-modeler-${ver}/commons-modeler.jar" tofile="release/commons-modeler-${ver}.jar" />
    <zip file="release/commons-modeler-${ver}.zip" >
       <fileset dir="release" includes="commons-modeler-${ver}/**"/>
    </zip>
    <tar  tarfile="release/commons-modeler-${ver}.tar" >
       <tarfileset dir="release" includes="commons-modeler-${ver}/**"/>
    </tar> 
    <gzip zipfile="release/commons-modeler-${ver}.tar.gz" src="release/commons-modeler-${ver}.tar"/>
    <ant dir="release/commons-modeler-${ver}-src" target="test"  />
    
  </target>

<!-- ========== Network/Utility Targets ===================================== -->

  <target name="proxyflags" description="Checks whether to use proxy">
    <!-- check proxy parameters. -->
    <condition property="useproxy">
      <equals arg1="${proxy.use}" arg2="on" />
    </condition>
  </target>

  <target name="setproxy" if="useproxy"
    description="Sets the prixy host, port for downloading">
    <taskdef name="setproxy"
      classname="org.apache.tools.ant.taskdefs.optional.net.SetProxy" />
    <setproxy proxyhost="${proxy.host}" proxyport="${proxy.port}"/> 
    <echo message="Using ${proxy.host}:${proxy.port} to download ${sourcefile}"/>
  </target>

  <target name="testexist" description="Tests if a file exists">
    <echo message="Testing  for ${destfile}"/>
    <available file="${destfile}" property="exist"/>
  </target>

  <target name="downloadzip"
    unless="exist"
    depends="setproxy,testexist"
    description="Downloads and extracts a package">
    <!-- Download and extract the package -->
    <get src="${sourcefile}" dest="${base.path}/file.zip" />
    <mkdir dir="${destdir}" />
    <unzip src="${base.path}/file.zip" dest="${destdir}"/>
    <delete file="${base.path}/file.zip"/>
  </target>

  <target name="downloadgz" unless="exist" depends="setproxy,testexist">
    <!-- Download and extract the package -->
    <get src="${sourcefile}" dest="${base.path}/file.tar.gz" />
    <gunzip src="${base.path}/file.tar.gz" dest="${base.path}/file.tar"/>
    <untar src="${base.path}/file.tar" dest="${base.path}"/>
    <delete file="${base.path}/file.tar"/>
    <delete file="${base.path}/file.tar.gz"/>
  </target>

  <target name="downloadfile" unless="exist" depends="setproxy,testexist">
    <!-- Download extract the file -->
    <mkdir dir="${destdir}" />
    <get src="${sourcefile}" dest="${destfile}" />
  </target>

  <target name="download" depends="proxyflags" 
          description="Download binary packages" >
    <mkdir dir="${base.path}" />
    
    <antcall target="downloadgz">
      <param name="sourcefile" value="${commons-logging.loc}"/>
      <param name="destfile" value="${commons-logging.jar}"/>
    </antcall>
    <antcall target="downloadgz">
      <param name="sourcefile" value="${commons-digester.loc}"/>
      <param name="destfile" value="${commons-digester.jar}"/>
    </antcall>

    <antcall target="downloadgz">
      <param name="sourcefile" value="${jmx.loc}"/>
      <param name="destfile" value="${jmx.jar}"/>
    </antcall>

    <antcall target="downloadzip">
      <param name="sourcefile" value="${junit.loc}"/>
      <param name="destfile" value="${junit.jar}"/>
      <param name="destdir" value="${base.path}"/>
    </antcall>

  </target>

</project>