File: build.xml

package info (click to toggle)
bcel 5.1-6
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 2,708 kB
  • ctags: 4,629
  • sloc: java: 20,880; xml: 303; makefile: 13
file content (351 lines) | stat: -rw-r--r-- 10,298 bytes parent folder | download | duplicates (2)
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
<?xml version="1.0"?>

<!--
   Build file for BCEL
   $Id: build.xml,v 1.10 2002/04/18 07:52:13 mdahm Exp $

Notes:
   This is a build file for use with the Jakarta Ant build tool.

Prerequisites:

   jakarta-ant from http://jakarta.apache.org/ant/index.html

Build Instructions:
   To build, run

   ant <target>

   in the directory where this file is located with the target you want.

Available targets:

 - compile  -> compile source classes and places result in "classes" directory
 - jar      -> Create file "lib/bcel.jar"
 - test<x>  -> Run example number x
 - test     -> Run all examples
 - mini     -> Run Mini compiler and test results
 - apidocs  -> Build API documentation (javadoc) in "docs/api"
-->

<project default="jar" basedir=".">
  
  <!-- Allow any user specific values to override the defaults -->
  <property file="${user.home}/build.properties" />
  <!-- Allow user defaults for this project -->
  <property file="build.properties" />
  <!-- Set default values for the build -->
  <property file="default.properties" />
  
  <target name="init">
    <property name="name"         value="bcel"/>
    <property name="packages"     value="org.apache.bcel.*"/>
    <property name="src.dir"      value="${basedir}/src/java"/>
    <property name="build.dir"    value="${basedir}/bin"/>
    <property name="examples.dir" value="${basedir}/examples"/>
    <property name="mini.dir"     value="${examples.dir}/Mini"/>
    <property name="docs.dir"     value="${basedir}/docs"/>
    <property name="apidocs.dir"  value="${docs.dir}/api"/>
    <property name="build.dest"   value="${build.dir}/classes"/>
    <property name="lib.dir"      value="${basedir}/lib"/>
    <property name="class.path"   value="${lib.dir}/Regex.jar:${build.dest}"/>

    <!-- Use jikes compiler, if you don't have it comment out the next lines -->
    <!-- property name="build.compiler.emacs" value="true"/ -->
    <!-- property name="build.compiler" value="jikes"/ -->
  </target>

  <!-- Compile the sources -->
  <target name="compile" depends="init">
    <mkdir dir="${build.dest}"/>
    <javac srcdir="${src.dir}" destdir="${build.dest}" classpath="${class.path}" debug="true"/>
  </target>

  <!-- Just an alias -->
  <target name="build" depends="compile"/>

  <!-- Jar the library -->
  <target name="jar" depends="examples">
    <jar jarfile="${build.dir}/${name}.jar" 
         basedir="${build.dest}"
	 manifest="${basedir}/manifest.txt"
	 includes="org/**,listclass.class"
    />
  </target>

  <!-- Compile the examples -->
  <target name="examples" depends="compile">
    <javac srcdir="${examples.dir}" destdir="${build.dest}" classpath="${class.path}" />
  </target>

  <!-- Creates the API documentation -->
  <target name="apidocs" depends="init">
    <mkdir dir="${apidocs.dir}"/>
    <javadoc packagenames="${packages}"
             sourcepath="${src.dir}"
             destdir="${apidocs.dir}"
             author="true"
             version="true"
             use="true"
             windowtitle="${name} API"
             doctitle="${name}"
    />
  </target>

  <target name="test1" depends="examples"> 
    <echo message="Display class file contents"/>

    <java classname="listclass" classpath="${class.path}">
	<arg value="-code"/>
	<arg value="java.lang.String"/>
    </java>
  </target>

  <target name="test2" depends="examples">
    <echo message="Decompile class file to Jasmin format (see java/lang/String.j)"/>

    <java classname="JasminVisitor" classpath="${class.path}">
	<arg value="java.lang.String"/>
    </java>
  </target>

  <target name="test3" depends="examples">
    <echo message="Create Hello World class from scratch"/>
    <java classname="HelloWorldBuilder" classpath="${class.path}"/>

    <echo message="Running Hello World"/>
    <java classname="HelloWorld" classpath="."/>
  </target>

  <target name="test4" depends="examples">
    <echo message="Run fancy classloader example"/>

    <java classname="org.apache.bcel.util.JavaWrapper" fork="true"
          classpath="${class.path}">
	<arg value="ProxyCreator"/>
    </java>
  </target>

  <target name="test" depends="test1,test2,test3,test4"/>

  <target name="mini" depends="examples">
    <echo message="Run Mini compiler"/>

    <java classname="Mini.MiniC" classpath="${class.path}" fork="true" dir="${mini.dir}">
	<arg value="fac.mini"/>
	<arg value="fib.mini"/>
	<arg value="max.mini"/>
    </java>

    <echo message="Faculty"/>
    <java classname="fac" classpath="${mini.dir}" />
    <echo message="Fibonacci"/>
    <java classname="fib" classpath="${mini.dir}" />
    <echo message="Maximum of numbers"/>
    <java classname="max" classpath="${mini.dir}" />
  </target>

  <!-- Clean everything up -->
  <target name="clean" depends="init">
    <delete dir="${build.dir}"/>
    <delete>
      <fileset dir="${docs.dir}"
	       includes="manual.blg,manual.bbl,manual.dvi,manual.log"/>
      <fileset dir="${docs.dir}" includes="**/*.aux"/>
      <fileset dir="${basedir}" includes="**/*~"/>
    </delete>

  </target>

  <!-- can rename this target when we get the docs sorted out -->

  <!-- ================================================================== -->
  <!-- D O C S                                                            -->
  <!-- ================================================================== -->
  
  <target 
    name="check_for_jdom">
    
    <available 
      property="jdom.present"
      classname="org.jdom.JDOMException">
      <classpath>
        <pathelement location="${jakarta.site2}/lib/${jdom.jar}"/>
      </classpath>
    </available>
  </target>
    
  <target 
    depends="check_for_jdom" 
    name="docs-prepare-error" 
    unless="jdom.present">
    
    <echo>
      The Jakarta-Site2 module is not present! Please check
      to make sure that you have checked it out from CVS.

      &lt;http://jakarta.apache.org/site/jakarta-site2.html&gt;
    </echo>
  </target>

  <target 
    name="xdocs"
    depends="docs-prepare-error"
    description="--> generates the HTML documentation"
    if="jdom.present">

    <taskdef 
      name="anakia"
      classname="org.apache.velocity.anakia.AnakiaTask">
      <classpath>
        <fileset dir="${jakarta.site2}/lib">
          <include name="*.jar"/>
        </fileset>
      </classpath>
    </taskdef>
        
    <anakia 
      basedir="${docs.src}" 
      destdir="${docs.dest}/"
      extension=".html" 
      style="./site.vsl"
      projectFile="stylesheets/project.xml"
      excludes="**/stylesheets/** empty.xml"
      includes="**/*.xml"
      lastModifiedCheck="true"
      templatePath="${jakarta.site2}/xdocs/stylesheets">
    </anakia>

    <copy 
      todir="${docs.dest}/images" 
      filtering="no">
      
      <fileset dir="${docs.src}/images">
        <include name="**/*.gif"/>
        <include name="**/*.jpeg"/>
        <include name="**/*.jpg"/>
      </fileset>
    </copy>
  </target>

  <!-- ================================================================== -->
  <!-- D I S T R I B U T I O N S                                          -->
  <!-- ================================================================== -->

  <target 
    name="dist"
    depends="init,jar,apidocs,xdocs">

    <property name="distDir" value="${build.dir}/${final.name}"/>

    <!-- B I N A R Y  D I S T R I B U T I O N -->

    <echo>
      +-------------------------------------------------------+
      | C R E A T I N G  B I N A R Y  D I S T R I B U T I O N |
      +-------------------------------------------------------+
    </echo>
    
    <mkdir dir="${distDir}"/>

    <!-- Copy README and LICENSE -->
    <copy todir="${distDir}" file="README.JustIce"/>
    <copy todir="${distDir}" file="TODO.JustIce"/>
    <copy todir="${distDir}" file="LICENSE.txt"/>

    <!-- Copy Jars -->
    <copy todir="${distDir}">
      <fileset dir="${build.dir}">
        <include name="**/*.jar"/>
      </fileset>
    </copy>

    <!-- Copy lib directory -->
    <copy todir="${distDir}/lib">
      <fileset dir="${lib.dir}">
        <include name="*.jar"/>
      </fileset>
    </copy>

    <!-- Copy documentation -->
    <copy todir="${distDir}/docs">
      <fileset dir="${docs.dest}">
        <include name="**"/>
      </fileset>
    </copy>

    <!-- Copy examples -->
    <copy todir="${distDir}/examples">
      <fileset dir="${examples.dir}">
        <include name="**/*.java"/>
      </fileset>
    </copy>

    <!-- Create a tar.gz file -->
    <tar longfile="gnu" tarfile="${final.name}.tar">
      <tarfileset dir="${build.dir}">
        <include name="${final.name}/**"/>
      </tarfileset>
    </tar>
    
    <gzip zipfile="${final.name}.tar.gz" src="${final.name}.tar"/>
    <delete file="${final.name}.tar"/>
    
    <!-- Create a zip file -->
    <zip zipfile="${final.name}.zip">
      <zipfileset dir="${build.dir}">
        <include name="${final.name}/**"/>
      </zipfileset>
    </zip>

    <!-- S O U R C E  D I S T R I B U T I O N -->

    <echo>
      +-------------------------------------------------------+
      | C R E A T I N G  S O U R C E  D I S T R I B U T I O N |
      +-------------------------------------------------------+
    </echo>

    <delete>
      <fileset dir="${distDir}">
        <include name="**/bcel*.jar"/>
      </fileset>
    </delete>
    
    <copy todir="${distDir}" file="default.properties"/>
    <copy todir="${distDir}" file="build.xml"/>

    <!-- Copy Sources -->
    <copy todir="${distDir}/src/java">
      <fileset dir="${src.dir}">
        <include name="**/*.java"/>
      </fileset>
    </copy>

    <!-- Copy examples -->
    <copy todir="${distDir}/examples">
      <fileset dir="${examples.dir}">
        <include name="**/*.java"/>
      </fileset>
    </copy>

    <!-- Create a tar.gz file -->
    <tar longfile="gnu" tarfile="${final.name}-src.tar">
      <tarfileset dir="${build.dir}">
        <include name="${final.name}/**"/>
      </tarfileset>
    </tar>
    
    <gzip zipfile="${final.name}-src.tar.gz" src="${final.name}-src.tar"/>
    <delete file="${final.name}-src.tar"/>
    
    <!-- Create a zip file -->
    <zip zipfile="${final.name}-src.zip">
      <zipfileset dir="${build.dir}">
        <include name="${final.name}/**"/>
      </zipfileset>
    </zip>

  </target>

</project>