File: build.xml

package info (click to toggle)
jruby1.0 1.0.2-4
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 28,004 kB
  • ctags: 33,860
  • sloc: ruby: 166,858; java: 90,218; yacc: 1,572; xml: 708; sh: 700; makefile: 53; ansic: 19
file content (696 lines) | stat: -rw-r--r-- 28,331 bytes parent folder | download
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
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
<?xml version="1.0" encoding="UTF-8"?>

<project basedir="." default="jar" name="JRuby">
  <description>JRuby is a pure Java implementation of a Ruby interpreter.</description>

  <!-- First try to load machine-specific properties. -->
  <property file="build.properties"/>

  <!-- And then load the defaults. It seems backwards to set defaults AFTER 
       setting local overrides, but that's how Ant works. -->
  <property file="default.build.properties"/>

  <path id="build.classpath">
    <fileset dir="${lib.dir}" includes="*.jar" excludes="jruby.jar"/>
  </path>

  <!-- directory that contains emma.jar and emma_ant.jar: -->
  <property name="emma.dir" value="${lib.dir}" />

  <path id="emma.classpath">
    <pathelement location="${emma.dir}/emma.jar" />
    <pathelement location="${emma.dir}/emma_ant.jar" />
  </path>

  <patternset id="java.src.pattern">
    <include name="**/*.java"/>
    <exclude unless="bsf.present" name="org/jruby/javasupport/bsf/**/*.java"/>
    <exclude unless="jdk1.4+" name="**/XmlAstMarshal.java"/>
    <exclude unless="jdk1.4+" name="**/AstPersistenceDelegates.java"/>
  </patternset>

  <patternset id="ruby.src.pattern">
    <include name="**/*.rb"/>
  </patternset>
  
  <patternset id="other.src.pattern">
    <include name="**/*.properties"/>
  </patternset>

  <target name="init" description="initialize the build">
    <xmlproperty file="build-config.xml" keepRoot="false" collapseAttributes="true"/>
    <tstamp><format property="build.date" pattern="yyyy-MM-dd"/></tstamp>
    <property environment="env"/>
    <property name="version.ruby" value="${version.ruby.major}.${version.ruby.minor}"/>
    <!-- if ruby.home is not set, use env var -->
    <condition property="ruby.home" value="${env.RUBY_HOME}">
      <not><isset property="ruby.home"/></not>
    </condition>
  </target>

  <target name="prepare" depends="init" 
    description="Creates the directories needed for building">
    <mkdir dir="${build.dir}"/>
    <mkdir dir="${classes.dir}"/>
    <mkdir dir="${jruby.classes.dir}"/>
    <mkdir dir="${test.classes.dir}"/>
    <mkdir dir="${test.results.dir}"/>
    <mkdir dir="${html.test.results.dir}"/>
    <mkdir dir="${docs.dir}"/>
    <mkdir dir="${api.docs.dir}"/>
  </target>

  <target name="ragel" description="Standalone target that generates all our ragel based source files. Requires ragel and rlgen-java to be on the classpath">
    <exec executable="ragel" output="__ragel_out">
      <arg line="-J"/>
      <arg line="${src.dir}/org/jvyamlb/resolver_scanner.rl"/>
    </exec>
    <exec executable="rlgen-java" input="__ragel_out">
      <arg line="-o ${src.dir}/org/jvyamlb/ResolverScanner.java"/>
    </exec>
    <delete file="__ragel_out" quiet="true"/>
  </target>

  <target name="check-for-optional-java4-packages"
          description="check if specific libs and versions are avaiable"
          depends="init">
    <available property="jdk1.4+" classname="java.lang.CharSequence"/>
    <available property="jdk1.5+" classname="java.lang.StringBuilder"/>
    <available property="bsf.present" classname="org.apache.bsf.BSFManager"
               classpathref="build.classpath"/>
    <available property="junit.present" classname="junit.framework.TestCase"
               classpathref="build.classpath"/>
    <available property="cglib.present" 
               classname="net.sf.cglib.reflect.FastClass"
               classpathref="build.classpath"/>
  </target>

  <target name="check-for-optional-packages" if="jdk1.5+"
          description="check if specific libs and versions are avaiable"
          depends="check-for-optional-java4-packages">
  </target>

  <target name="compile.tasks" depends="prepare"
    description="Builds the Ant tasks that we need later on in the build">
    <copy todir="${jruby.classes.dir}">
        <fileset dir="${src.dir}">
            <include name="**/*.rb"/>
        </fileset>
    </copy>
    <copy todir="${jruby.classes.dir}/builtin">
        <fileset dir="${lib.dir}/ruby/site_ruby/1.8/builtin">
            <include name="**/*.rb"/>
        </fileset>
    </copy>
    
    <tstamp>
        <format property="build.date" pattern="yyyy-MM-dd"/>
    </tstamp>
    
    <copy todir="${jruby.classes.dir}" overwrite="true">
        <fileset dir="${src.dir}">
            <include name="**/*.properties"/>
        </fileset>
        <filterset>
            <filter token="os.arch" value="${os.arch}"/>
            <filter token="java.specification.version" value="${java.specification.version}"/>
            <filter token="javac.version" value="${javac.version}"/>
            <filter token="build.date" value="${build.date}"/>
        </filterset>
    </copy>
  </target>

  <target name="compile-jruby" depends="compile.tasks, check-for-optional-packages">
    <javac destdir="${jruby.classes.dir}" debug="true" source="${javac.version}" deprecation="true" encoding="UTF-8">
       <classpath refid="build.classpath"/>
       <src path="${src.dir}"/>
       <patternset refid="java.src.pattern"/>
    </javac>
  </target>

  <target name="compile" depends="compile-jruby"
          description="Compile the source files for the project.">
  </target>

  <target name="generate-method-classes" depends="compile">
    <touch file="${build.dir}/__empty.rb"/>
    <java classname="org.jruby.Main" fork="true">
      <classpath refid="build.classpath"/>
      <classpath path="${jruby.classes.dir}"/>
      <sysproperty key="jruby.dump_invocations" value="${jruby.classes.dir}"/>
      <arg value="-rjava"/>
      <arg value="${build.dir}/__empty.rb"/>
    </java>
    <delete file="${build.dir}/__empty.rb" quiet="true"/>
  </target>

  <target name="jar-jruby" unless="jar-up-to-date">
    <antcall target="generate-method-classes" inheritall="true"/>
    <jar destfile="${lib.dir}/jruby.jar" compress="true">
      <fileset dir="${jruby.classes.dir}">
        <exclude name="org/jruby/util/ant/**/*.class"/>
      </fileset>
      <manifest>
        <attribute name="Built-By" value="${user.name}"/>
        <attribute name="Main-Class" value="org.jruby.Main"/>
        <attribute name="Class-Path" value="asm-2.2.3.jar asm-commons-2.2.3.jar jline-0.9.91.jar bsf.jar backport-util-concurrent.jar"/>
      </manifest>
    </jar>
  </target>


    <target name="jar-complete" depends="generate-method-classes" description="Create the 'complete' JRuby jar. Pass 'mainclass' and 'filename' to adjust.">
      <property name="mainclass" value="org.jruby.Main"/>
      <property name="filename" value="jruby-complete.jar"/>
      <taskdef name="jarjar" classname="com.tonicsystems.jarjar.JarJarTask" classpath="${lib.dir}/jarjar-0.7.jar"/>
      <jarjar destfile="${lib.dir}/${filename}">
        <fileset dir="${jruby.classes.dir}">
          <exclude name="org/jruby/util/ant/**/*.class"/>
        </fileset>
        <fileset dir="${basedir}/lib/ruby/1.8">
          <include name="**/*.rb"/>
        </fileset>
        <zipfileset src="${lib.dir}/asm-2.2.3.jar"/>
        <zipfileset src="${lib.dir}/asm-commons-2.2.3.jar"/>
        <zipfileset src="${lib.dir}/jline-0.9.91.jar"/>
      	<zipfileset src="${lib.dir}/backport-util-concurrent.jar"/>
        <rule pattern="org.objectweb.asm.**" result="jruby.objectweb.asm.@1"/>
        <zipfileset dir="${basedir}" prefix="META-INF/jruby.home">
          <include name="bin/*"/>
          <include name="lib/ruby/gems/1.8/cache/sources*.gem"/>
          <include name="lib/ruby/gems/1.8/gems/sources*/**/*"/>
          <include name="lib/ruby/gems/1.8/specifications/sources*.gemspec"/>
          <include name="lib/ruby/site_ruby/**/*"/>
        </zipfileset>
        <manifest>
          <attribute name="Built-By" value="${user.name}"/>
          <attribute name="Main-Class" value="${mainclass}"/>
        </manifest>
      </jarjar>
    </target>


    <target name="jar-light" depends="generate-method-classes" description="Create the 'light' JRuby jar. Pass 'mainclass' and 'filename' to adjust.">
        <property name="mainclass" value="org.jruby.Main"/>
        <property name="filename" value="jruby-light.jar"/>
        <taskdef name="jarjar" classname="com.tonicsystems.jarjar.JarJarTask" classpath="${lib.dir}/jarjar-0.7.jar"/>
      <jarjar destfile="${lib.dir}/${filename}">
        <fileset dir="${jruby.classes.dir}">
          <include name="**/*.class"/>
        <include name="**/*.properties"/>
          <exclude name="org/jruby/util/ant/**/*.class"/>
        </fileset>
        <fileset dir="${basedir}/lib/ruby/1.8">
          <include name="**/*.rb"/>
              <exclude name="**/rdoc/**"/>
              <exclude name="**/cgi/**"/>
              <exclude name="**/bigdecimal/**"/>
              <exclude name="**/drb/**"/>
              <exclude name="**/io/**"/>
              <exclude name="**/net/**"/>
              <exclude name="**/racc/**"/>
              <exclude name="**/rexml/**"/>
              <exclude name="**/rinda/**"/>
              <exclude name="**/runit/**"/>
              <exclude name="**/shell/**"/>
              <exclude name="**/soap/**"/>
              <exclude name="**/test/**"/>
              <exclude name="**/uri/**"/>
              <exclude name="**/webrick/**"/>
              <exclude name="**/xmlrpc/**"/>
              <exclude name="**/xsd/**"/>
        </fileset>
          <zipfileset src="${lib.dir}/asm-2.2.3.jar"/>
          <zipfileset src="${lib.dir}/asm-commons-2.2.3.jar"/>
          <zipfileset src="${lib.dir}/jline-0.9.91.jar"/>
      	  <zipfileset src="${lib.dir}/backport-util-concurrent.jar"/>
        <manifest>
          <attribute name="Built-By" value="${user.name}"/>
          <attribute name="Main-Class" value="${mainclass}"/>
        </manifest>
      </jarjar>
    </target>

    <target name="jar-console" depends="generate-method-classes" description="Create the jruby graphical console jar">
          <antcall target="jar-light">
              <param name="mainclass" value="org.jruby.demo.IRBConsole"/>
              <param name="filename" value="jruby-console.jar"/>
          </antcall>
    </target>

  <target name="jar" depends="init" description="Create the jruby.jar file">
    <antcall target="jar-jruby" inheritall="true"/>
  </target>

  <target name="jar.standalone" depends="generate-method-classes, jar"
    description="Create a standalone jruby.jar file using libraries from RUBY_HOME/lib/ruby/1.8"/>

  <target name="compile-test" depends="jar" description="Compile the unit tests">
    <javac destdir="${test.classes.dir}" deprecation="true" debug="true" 
           source="${javac.version}">
      <classpath>
        <path refid="build.classpath"/>
        <pathelement path="${jruby.classes.dir}"/>
        <pathelement path="${lib.dir}/jruby.jar"/>
      </classpath>
      <src path="${test.dir}"/>
      <patternset refid="java.src.pattern"/>
    </javac>
  </target>

  <target name="copy-test-files" depends="compile-test" 
    description="Make tests fails available as resources">
    <copy todir="${test.classes.dir}">
      <fileset dir="${test.dir}" includes="org/**/*.rb"/>
    </copy>
  </target>

  <target name="install-gems">
    <property name="jruby.home" value="${basedir}"/>
    <java classname="org.jruby.Main" fork="true" maxmemory="256M" failonerror="true">
      <classpath refid="build.classpath"/>
      <classpath path="${jruby.classes.dir}"/>
      <sysproperty key="jruby.home" value="${jruby.home}"/>
      <arg value="--command"/>
      <arg value="maybe_install_gems"/>
      <arg value="rspec"/>
      <arg value="rake"/>
      <arg value="--env-shebang"/>
    </java>
  </target>
  
  <target name="run-spec">
    <echo message="Running spec(s) located at: ${SPEC}"/>
    <java classname="org.jruby.Main" fork="true" maxmemory="256M" failonerror="true">
      <classpath refid="build.classpath"/>
      <classpath path="${jruby.classes.dir}"/>
      <sysproperty key="jruby.home" value="${basedir}"/>
      <arg value="-S"/>
      <arg value="spec"/>
      <arg value="--format"/>
      <arg value="e"/>
      <arg line="${SPEC}"/>
    	
      <jvmarg value="-ea"/>
    </java>
  </target>
  
  <target name="run-spec-compiled">
    <echo message="Running spec(s) located at: ${SPEC}"/>
    <java classname="org.jruby.Main" fork="true" failonerror="true">
      <classpath refid="build.classpath"/>
      <classpath path="${jruby.classes.dir}"/>
      <sysproperty key="jruby.home" value="${basedir}"/>
      <sysproperty key="jruby.jit.threshold" value="0"/>
      <arg value="-S"/>
      <arg value="spec"/>
      <arg value="--format"/>
      <arg value="e"/>
      <arg line="${SPEC}"/>
    	
      <jvmarg value="-ea"/>
    </java>
  </target>

  <target name="spec" depends="jar,install-gems">
    <antcall target="run-spec">
        <param name="SPEC" value="test/externals/rubinius/spec"/>
    </antcall>
  </target>

  <target name="emma" description="turns on EMMA instrumentation/reporting" >
    <available property="emma.present"
               classname="com.vladium.app.IAppVersion"
               classpathref="emma.classpath"/>
    <taskdef resource="emma_ant.properties" classpathref="emma.classpath" />
  
    <property name="emma.enabled" value="true" />

    <path id="classes_to_instrument" >
      <pathelement location="${jruby.classes.dir}" />
    </path>   
  </target>

  <target name="instrument" if="emma.present">
    <emma enabled="${emma.enabled}" >
      <instr instrpathref="classes_to_instrument"
             destdir="${jruby.instrumented.classes.dir}"  
             metadatafile="${test.results.dir}/metadata.emma"
         merge="false" />
    </emma>
  </target>

  <target name="coverage-report" if="emma.present">
    <emma enabled="${emma.enabled}" >
      <report sourcepath="${src.dir}" >
        <fileset dir="${test.results.dir}" >
      <include name="*.emma" />
        </fileset>
        <html outfile="${html.test.coverage.results.dir}/coverage.html" />
      </report>
    </emma>
  </target>

  <!-- This now has enabled the compiler by default; we may want to run both with and without compilation later -->
  <target name="test" depends="copy-test-files,instrument,run-junit-compiled,run-junit-interpreted,test-spec-compiled,test-spec-interpreted,coverage-report">
  </target>

  <target name="test-compiled" depends="copy-test-files,run-junit-compiled"/>
  <target name="test-interpreted" depends="copy-test-files,run-junit-interpreted"/>
  
  <target name="test-spec" depends="test-spec-compiled, test-spec-interpreted"/>
  
  <target name="test-spec-compiled" depends="install-gems">
    <antcall target="run-spec-compiled"><param name="SPEC" value="
test/externals/rubinius/spec/core/false_spec.rb
test/externals/rubinius/spec/core/hash_spec.rb
test/externals/rubinius/spec/core/integer_spec.rb
test/externals/rubinius/spec/core/io_spec.rb
test/externals/rubinius/spec/core/nil_spec.rb
test/externals/rubinius/spec/core/objectspace_spec.rb
test/externals/rubinius/spec/core/proc_spec.rb
test/externals/rubinius/spec/core/range_spec.rb
test/externals/rubinius/spec/core/struct_spec.rb
test/externals/rubinius/spec/core/symbol_spec.rb
test/externals/rubinius/spec/core/true_spec.rb
test/externals/rubinius/spec/language/assignment_spec.rb
test/externals/rubinius/spec/language/class_spec.rb
test/externals/rubinius/spec/language/case_spec.rb
test/externals/rubinius/spec/language/splat_spec.rb
test/externals/rubinius/spec/language/variables_spec.rb
test/externals/rubinius/spec/language/expressions/for_spec.rb
test/externals/rubinius/spec/language/expressions/if_spec.rb
test/externals/rubinius/spec/language/expressions/unless_spec.rb
test/externals/rubinius/spec/language/keywords/break_spec.rb
test/externals/rubinius/spec/language/keywords/defined_spec.rb
test/externals/rubinius/spec/language/literals
test/externals/rubinius/spec/library
test/externals/rubinius/spec/parser"/></antcall>
  </target>
  
  <target name="test-spec-interpreted" depends="install-gems">
    <antcall target="run-spec"><param name="SPEC" value="
test/externals/rubinius/spec/core/false_spec.rb
test/externals/rubinius/spec/core/hash_spec.rb
test/externals/rubinius/spec/core/integer_spec.rb
test/externals/rubinius/spec/core/io_spec.rb
test/externals/rubinius/spec/core/nil_spec.rb
test/externals/rubinius/spec/core/objectspace_spec.rb
test/externals/rubinius/spec/core/proc_spec.rb
test/externals/rubinius/spec/core/range_spec.rb
test/externals/rubinius/spec/core/struct_spec.rb
test/externals/rubinius/spec/core/symbol_spec.rb
test/externals/rubinius/spec/core/true_spec.rb
test/externals/rubinius/spec/language/assignment_spec.rb
test/externals/rubinius/spec/language/class_spec.rb
test/externals/rubinius/spec/language/case_spec.rb
test/externals/rubinius/spec/language/splat_spec.rb
test/externals/rubinius/spec/language/variables_spec.rb
test/externals/rubinius/spec/language/expressions/for_spec.rb
test/externals/rubinius/spec/language/expressions/if_spec.rb
test/externals/rubinius/spec/language/expressions/unless_spec.rb
test/externals/rubinius/spec/language/keywords/break_spec.rb
test/externals/rubinius/spec/language/keywords/defined_spec.rb
test/externals/rubinius/spec/language/literals
test/externals/rubinius/spec/library
test/externals/rubinius/spec/parser"/></antcall>
  </target>
  
  <target name="run-junit-interpreted" description="runs junit tests">
    <taskdef name="junit" classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask" classpath="${lib.dir}/junit.jar"/>
    <junit fork="yes" forkMode="once" haltonfailure="true" dir="${basedir}" maxmemory="384M" showoutput="true">
      <classpath>
        <pathelement location="${jruby.instrumented.classes.dir}" />
        <path refid="build.classpath"/>
        <pathelement path="${java.class.path}"/>
        <pathelement path="${lib.dir}/jruby.jar"/>
        <pathelement location="${test.classes.dir}"/>
        <pathelement path="${test.dir}/requireTest.jar"/>
        <pathelement location="${test.dir}"/>
      </classpath>
      <sysproperty key="java.awt.headless" value="true"/>
      <sysproperty key="jruby.base" value="${basedir}"/>
      <sysproperty key="jruby.home" value="${basedir}"/>
      <sysproperty key="jruby.lib" value="${lib.dir}"/>
      <sysproperty key="jruby.jit.enabled" value="false"/>
      <sysproperty key="emma.coverage.out.file" value="${test.results.dir}/coverage.emma" />
      <sysproperty key="emma.coverage.out.merge" value="true" />

      <jvmarg value="-ea"/>

      <formatter type="xml"/>
      <formatter type="brief" usefile="false"/>

      <test name="org.jruby.test.MainTestSuite" todir="${test.results.dir}"/>
      <test name="org.jruby.test.ScriptTestSuite" todir="${test.results.dir}"/>
      <test name="org.jruby.test.TestUnitTestSuite" todir="${test.results.dir}"/>
      <test name="org.jvyamlb.YAMLLoadTest" todir="${test.results.dir}"/>
      <test name="org.jvyamlb.YAMLDumpTest" todir="${test.results.dir}"/>
    </junit>
  </target>
  
  <target name="run-junit-compiled" description="runs junit tests">
    <taskdef name="junit" classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask" classpath="${lib.dir}/junit.jar"/>
    <junit fork="yes" forkMode="once" haltonfailure="true" dir="${basedir}" maxmemory="384M" showoutput="true">
      <classpath>
        <pathelement location="${jruby.instrumented.classes.dir}" />
        <path refid="build.classpath"/>
        <pathelement path="${java.class.path}"/>
        <pathelement path="${lib.dir}/jruby.jar"/>
        <pathelement location="${test.classes.dir}"/>
        <pathelement path="${test.dir}/requireTest.jar"/>
        <pathelement location="${test.dir}"/>
      </classpath>
      <sysproperty key="java.awt.headless" value="true"/>
      <sysproperty key="jruby.base" value="${basedir}"/>
      <sysproperty key="jruby.home" value="${basedir}"/>
      <sysproperty key="jruby.lib" value="${lib.dir}"/>
      <sysproperty key="jruby.jit.enabled" value="true"/>
      <sysproperty key="jruby.jit.threshold" value="0"/>
      <sysproperty key="emma.coverage.out.file" value="${test.results.dir}/coverage.emma" />
      <sysproperty key="emma.coverage.out.merge" value="true" />
    	
      <jvmarg value="-ea"/>

      <formatter type="xml"/>
      <formatter type="brief" usefile="false"/>

      <test name="org.jruby.test.MainTestSuite" todir="${test.results.dir}"/>
      <test name="org.jruby.test.ScriptTestSuite" todir="${test.results.dir}"/>
      <test name="org.jruby.test.TestUnitTestSuite" todir="${test.results.dir}"/>
      <test name="org.jvyamlb.YAMLLoadTest" todir="${test.results.dir}"/>
      <test name="org.jvyamlb.YAMLDumpTest" todir="${test.results.dir}"/>
    </junit>

    <junitreport todir="${test.results.dir}">
      <fileset dir="${test.results.dir}" includes="TEST-*.xml"/>
      <report format="frames" todir="${html.test.results.dir}"/>
    </junitreport>
  </target>

  <target name="create-apidocs" depends="prepare" 
          description="Creates the Java API docs">
    <javadoc destdir="${api.docs.dir}" author="true" version="true" use="true" 
             windowtitle="JRuby API" source="${javac.version}">
      <fileset dir="${src.dir}">
        <include name="**/*.java"/>
      </fileset>
      <fileset dir="${test.dir}">
    <include name="**/*.java"/>
      </fileset>
      <doctitle><![CDATA[<h1>JRuby</h1>]]></doctitle>
      <bottom><![CDATA[<i>Copyright &#169; 2002-2007 JRuby Team. All Rights Reserved.</i>]]></bottom>
    </javadoc>
  </target>

  <patternset id="dist.bindir.files">
    <include name="bin/*jruby*"/>
    <include name="bin/*gem*"/>
    <include name="bin/*jirb*"/>
    <include name="bin/generate_yaml_index.rb"/>
    <include name="bin/testrb"/>
  </patternset>

  <patternset id="dist.lib.files">
    <include name="lib/ruby/1.8/**"/>
    <include name="lib/ruby/site_ruby/1.8/**"/>
    <include name="lib/ruby/gems/1.8/specifications/sources-0.0.1.gemspec"/>
    <include name="lib/ruby/gems/1.8/cache/sources-0.0.1.gem"/>
    <include name="lib/ruby/gems/1.8/gems/sources-0.0.1/**"/>
  </patternset>

  <patternset id="dist.files">
    <include name="lib/*"/>
    <include name="samples/**"/>
    <include name="docs/**"/>
    <include name="COPYING*"/>
    <include name="README"/>
    <exclude name="lib/ruby/**"/>
  </patternset>

  <patternset id="dist.bin.files">
    <patternset refid="dist.files"/>
    <exclude name="lib/emma.jar"/>
    <exclude name="lib/emma_ant.jar"/>
    <exclude name="lib/junit.jar"/>
    <exclude name="lib/jarjar-0.7.jar"/>
  </patternset>

  <patternset id="dist.src.files">
    <patternset refid="dist.files"/>
    <include name="src/**"/>
    <include name="test/**"/>
    <include name="build.xml"/>
    <include name="build-config.xml"/>
    <include name="nbproject/*"/>
    <include name=".project"/>
    <include name=".classpath"/>
    <include name="default.build.properties"/>
    <exclude name="lib/jruby.jar"/>
  </patternset>

  <target name="dist-bin" depends="jar">
    <mkdir dir="dist"/>
    <copy todir="dist">
      <fileset dir="${basedir}">
        <patternset refid="dist.bindir.files"/>
        <patternset refid="dist.lib.files"/>
      </fileset>
    </copy>
    <antcall target="install-gems">
      <param name="jruby.home" value="dist"/>
    </antcall>
    <tar destfile="jruby-bin-${version.jruby}.tar.gz" compression="gzip">
      <tarfileset dir="dist" mode="755" prefix="jruby-${version.jruby}">
        <include name="bin/**"/>
      </tarfileset>
      <tarfileset dir="dist" prefix="jruby-${version.jruby}">
        <include name="lib/**"/>
      </tarfileset>
      <tarfileset dir="${basedir}" prefix="jruby-${version.jruby}">
        <patternset refid="dist.bin.files"/>
      </tarfileset>
    </tar>
    <zip destfile="jruby-bin-${version.jruby}.zip">
      <zipfileset dir="dist" filemode="755" prefix="jruby-${version.jruby}">
        <include name="bin/**"/>
      </zipfileset>
      <zipfileset dir="dist" prefix="jruby-${version.jruby}">
        <include name="lib/**"/>
      </zipfileset>
      <zipfileset dir="${basedir}" prefix="jruby-${version.jruby}">
        <patternset refid="dist.bin.files"/>
      </zipfileset>
    </zip>
  </target>

  <target name="dist-src" depends="jar">
    <mkdir dir="dist"/>
    <copy todir="dist">
      <fileset dir="${basedir}">
        <patternset refid="dist.bindir.files"/>
        <patternset refid="dist.lib.files"/>
      </fileset>
    </copy>
    <antcall target="install-gems">
      <param name="jruby.home" value="dist"/>
    </antcall>
    <tar destfile="jruby-src-${version.jruby}.tar.gz" compression="gzip">
      <tarfileset dir="dist" mode="755" prefix="jruby-${version.jruby}">
        <include name="bin/**"/>
      </tarfileset>
      <tarfileset dir="dist" prefix="jruby-${version.jruby}">
        <include name="lib/**"/>
      </tarfileset>
      <tarfileset dir="${basedir}" prefix="jruby-${version.jruby}">
        <patternset refid="dist.src.files"/>
      </tarfileset>
    </tar>
    <zip destfile="jruby-src-${version.jruby}.zip">
      <zipfileset dir="dist" filemode="755" prefix="jruby-${version.jruby}">
        <include name="bin/**"/>
      </zipfileset>
      <zipfileset dir="dist" prefix="jruby-${version.jruby}">
        <include name="lib/**"/>
      </zipfileset>
      <zipfileset dir="${basedir}" prefix="jruby-${version.jruby}">
        <patternset refid="dist.src.files"/>
      </zipfileset>
    </zip>
  </target>

  <target name="dist" depends="dist-bin,dist-src"/>

  <target name="dist-clean">
    <delete includeEmptyDirs="true">
      <fileset dir=".">
        <include name="jruby-*.tar.gz"/>
        <include name="jruby-*.zip"/>
      </fileset>
      <fileset dir="dist" includes="**/*"/>
    </delete>
  </target>

  <target name="clean" depends="init" description="clean almost everything">
    <delete dir="${build.dir}"/>
    <delete dir="${dist.dir}"/>
    <delete quiet="false">
        <fileset dir="${lib.dir}" includes="jruby*.jar"/>
    </delete>
    <delete dir="${api.docs.dir}"/>
  </target>
  
  <target name="profile-gem-install-rake" depends="jar" description="Profile a local gem installation of Rake">
    <fail unless="netbeans.home">This target can only run inside the NetBeans IDE.</fail>

    <nbprofiledirect>
        <classpath> <pathelement location="... specify ..."/> </classpath>
    </nbprofiledirect>

    <java classname="org.jruby.Main" maxmemory="256M" fork="true">
      <classpath>
        <pathelement location="${jruby.instrumented.classes.dir}" />
        <path refid="build.classpath"/>
        <pathelement path="${lib.dir}/jruby.jar"/>
        <pathelement path="${test.classes.dir}"/>
        <pathelement path="${test.dir}/requireTest.jar"/>
      </classpath>
      <jvmarg value="-Djruby.base=${basedir}"/>
      <jvmarg value="-Djruby.home=${basedir}"/>
      <jvmarg value="-Djruby.lib=${lib.dir}"/>
      <jvmarg value="-Djruby.shell=/bin/sh"/>
      <jvmarg value="-Djruby.script=jruby"/>
      <jvmarg value="${profiler.info.jvmargs.agent}"/>
      <arg value="bin/gem"/>
      <arg value="install"/>
      <arg value="lib/ruby/gems/1.8/cache/rake-0.7.1.gem"/>
    </java>
  </target>
  
  <target name="profile-rails-server" depends="jar" description="Profile a local gem installation of Rake">
    <fail unless="netbeans.home">This target can only run inside the NetBeans IDE.</fail>

    <nbprofiledirect>
        <classpath> <pathelement location="... specify ..."/> </classpath>
    </nbprofiledirect>

    <java classname="org.jruby.Main" maxmemory="256M" fork="true">
      <classpath>
        <pathelement location="${jruby.instrumented.classes.dir}" />
        <path refid="build.classpath"/>
        <pathelement path="${lib.dir}/jruby.jar"/>
        <pathelement path="${test.classes.dir}"/>
        <pathelement path="${test.dir}/requireTest.jar"/>
      </classpath>
      <jvmarg value="-Djruby.base=${basedir}"/>
      <jvmarg value="-Djruby.home=${basedir}"/>
      <jvmarg value="-Djruby.lib=${lib.dir}"/>
      <jvmarg value="-Djruby.shell=/bin/sh"/>
      <jvmarg value="-Djruby.script=jruby"/>
      <jvmarg value="-Djruby.thread.pooling=true"/>
      <jvmarg value="-server"/>
      <jvmarg value="${profiler.info.jvmargs.agent}"/>
      <arg value="testapp/script/server"/>
    </java>
  </target>
</project>