1 <?xml version="1.0" encoding="UTF-8"?>
3 <project basedir="." default="jar" name="JRuby">
4 <description>JRuby is a pure Java implementation of a Ruby interpreter.</description>
6 <property name="base.dir" location="${basedir}"/>
8 <!-- First try to load machine-specific properties. -->
9 <property file="build.properties"/>
10 <!-- Load revision number for the ruby specs, in a known good state.
11 There should be no spec failures with such revision. -->
12 <property file="rubyspecs.revision"/>
14 <!-- And then load the defaults. It seems backwards to set defaults AFTER
15 setting local overrides, but that's how Ant works. -->
16 <property file="default.build.properties"/>
18 <path id="build.classpath">
19 <fileset dir="${build.lib.dir}" includes="*.jar"/>
20 <fileset dir="${lib.dir}" includes="bsf.jar"/>
23 <!-- directory that contains emma.jar and emma_ant.jar: -->
24 <property name="emma.dir" value="${build.lib.dir}" />
26 <path id="emma.classpath">
27 <pathelement location="${emma.dir}/emma.jar" />
28 <pathelement location="${emma.dir}/emma_ant.jar" />
31 <patternset id="java.src.pattern">
32 <include name="**/*.java"/>
33 <exclude unless="bsf.present" name="org/jruby/javasupport/bsf/**/*.java"/>
34 <exclude unless="jdk1.4+" name="**/XmlAstMarshal.java"/>
35 <exclude unless="jdk1.4+" name="**/AstPersistenceDelegates.java"/>
36 <exclude unless="sun-misc-signal" name="**/SunSignalFacade.java"/>
39 <patternset id="ruby.src.pattern">
40 <include name="**/*.rb"/>
43 <patternset id="other.src.pattern">
44 <include name="**/*.properties"/>
47 <taskdef name="retro" classname="net.sourceforge.retroweaver.ant.RetroWeaverTask" classpathref="build.classpath"/>
49 <import file="netbeans-ant.xml" optional="true"/>
51 <!-- Initializes the build -->
53 <xmlproperty file="build-config.xml" keepRoot="false" collapseAttributes="true"/>
54 <tstamp><format property="build.date" pattern="yyyy-MM-dd"/></tstamp>
55 <property environment="env"/>
56 <property name="version.ruby" value="${version.ruby.major}.${version.ruby.minor}"/>
57 <!-- if ruby.home is not set, use env var -->
58 <condition property="ruby.home" value="${env.RUBY_HOME}">
59 <not><isset property="ruby.home"/></not>
61 <property name="rdoc.archive" value="docs/rdocs.tar.gz"/>
62 <uptodate property="docsNotNeeded" srcfile="${rdoc.archive}" targetfile="${basedir}/share/ri"/>
65 <target name="extract-rdocs" depends="init" unless="docsNotNeeded">
66 <untar src="${rdoc.archive}" dest="${basedir}" compression="gzip"/>
69 <!-- Creates the directories needed for building -->
70 <target name="prepare" depends="extract-rdocs">
71 <mkdir dir="${build.dir}"/>
72 <mkdir dir="${classes.dir}"/>
73 <mkdir dir="${jruby.classes.dir}"/>
74 <mkdir dir="${test.classes.dir}"/>
75 <mkdir dir="${test.results.dir}"/>
76 <mkdir dir="${html.test.results.dir}"/>
77 <mkdir dir="${docs.dir}"/>
78 <mkdir dir="${api.docs.dir}"/>
81 <!-- Checks if specific libs and versions are avaiable -->
82 <target name="check-for-optional-java4-packages"
84 <available property="jdk1.4+" classname="java.lang.CharSequence"/>
85 <available property="jdk1.5+" classname="java.lang.StringBuilder"/>
86 <available property="bsf.present" classname="org.apache.bsf.BSFManager"
87 classpathref="build.classpath"/>
88 <available property="junit.present" classname="junit.framework.TestCase"
89 classpathref="build.classpath"/>
90 <available property="cglib.present"
91 classname="net.sf.cglib.reflect.FastClass"
92 classpathref="build.classpath"/>
95 <!-- Checks if specific libs and versions are avaiable -->
96 <target name="check-for-optional-packages" if="jdk1.5+"
97 depends="check-for-optional-java4-packages">
98 <available property="sun-misc-signal"
99 classname="sun.misc.Signal"/>
102 <!-- Builds the Ant tasks that we need later on in the build -->
103 <target name="compile-tasks" depends="prepare">
104 <copy todir="${jruby.classes.dir}">
105 <fileset dir="${src.dir}">
106 <include name="**/*.rb"/>
109 <copy todir="${jruby.classes.dir}/builtin">
110 <fileset dir="${lib.dir}/ruby/site_ruby/1.8/builtin">
111 <include name="**/*.rb"/>
116 <format property="build.date" pattern="yyyy-MM-dd"/>
119 <copy todir="${jruby.classes.dir}" overwrite="true">
120 <fileset dir="${src.dir}">
121 <include name="**/*.properties"/>
124 <filter token="os.arch" value="${os.arch}"/>
125 <filter token="java.specification.version" value="${java.specification.version}"/>
126 <filter token="javac.version" value="${javac.version}"/>
127 <filter token="build.date" value="${build.date}"/>
132 <target name="compile-annotation-binder">
133 <mkdir dir="${basedir}/src_gen"/>
135 <javac destdir="${jruby.classes.dir}" debug="true" srcdir="${src.dir}" sourcepath="" classpathref="build.classpath" source="${javac.version}" target="${javac.version}" deprecation="true" encoding="UTF-8">
136 <include name="org/jruby/anno/FrameField.java"/>
137 <include name="org/jruby/anno/AnnotationBinder.java"/>
138 <include name="org/jruby/anno/JRubyMethod.java"/>
139 <include name="org/jruby/anno/FrameField.java"/>
140 <include name="org/jruby/CompatVersion.java"/>
141 <include name="org/jruby/runtime/Visibility.java"/>
142 <include name="org/jruby/util/CodegenUtils.java"/>
146 <target name="compile-jruby" depends="compile-tasks, compile-annotation-binder, check-for-optional-packages">
147 <!-- Generate binding logic ahead of time -->
148 <apt factory="org.jruby.anno.AnnotationBinder" destdir="${jruby.classes.dir}" debug="true" source="${javac.version}" target="${javac.version}" deprecation="true" encoding="UTF-8">
149 <classpath refid="build.classpath"/>
150 <classpath path="${jruby.classes.dir}"/>
151 <src path="${src.dir}"/>
152 <patternset refid="java.src.pattern"/>
153 <compilerarg line="-XDignore.symbol.file=true"/>
157 <target name="compile" depends="compile-jruby"
158 description="Compile the source files for the project.">
161 <target name="generate-method-classes" depends="compile">
162 <echo message="Generating invokers..."/>
163 <java classname="org.jruby.anno.InvokerGenerator" fork="true" failonerror="true">
164 <classpath refid="build.classpath"/>
165 <classpath path="${jruby.classes.dir}"/>
166 <arg value="src_gen/annotated_classes.txt"/>
167 <arg value="${jruby.classes.dir}"/>
170 <echo message="Compiling populators..."/>
171 <javac destdir="${jruby.classes.dir}" debug="true" source="${javac.version}" target="${javac.version}" deprecation="true" encoding="UTF-8">
172 <classpath refid="build.classpath"/>
173 <classpath path="${jruby.classes.dir}"/>
174 <src path="src_gen"/>
175 <patternset refid="java.src.pattern"/>
179 <target name="jar-jruby" unless="jar-up-to-date">
180 <antcall target="generate-method-classes" inheritall="true"/>
181 <taskdef name="jarjar" classname="com.tonicsystems.jarjar.JarJarTask" classpath="${build.lib.dir}/jarjar-1.0rc7.jar"/>
182 <jarjar destfile="${lib.dir}/jruby.jar">
183 <fileset dir="${jruby.classes.dir}">
184 <exclude name="org/jruby/util/ant/**/*.class"/>
186 <zipfileset src="${build.lib.dir}/asm-3.0.jar"/>
187 <zipfileset src="${build.lib.dir}/asm-commons-3.0.jar"/>
188 <zipfileset src="${build.lib.dir}/asm-util-3.0.jar"/>
189 <zipfileset src="${build.lib.dir}/asm-analysis-3.0.jar"/>
190 <zipfileset src="${build.lib.dir}/asm-tree-3.0.jar"/>
191 <zipfileset src="${build.lib.dir}/bytelist-0.1.jar"/>
192 <zipfileset src="${build.lib.dir}/jvyamlb-0.1.4.jar"/>
193 <zipfileset src="${build.lib.dir}/jline-0.9.93.jar"/>
194 <zipfileset src="${build.lib.dir}/joni.jar"/>
195 <zipfileset src="${build.lib.dir}/jna-posix.jar"/>
196 <zipfileset src="${build.lib.dir}/jna.jar"/>
197 <zipfileset src="${build.lib.dir}/joda-time-1.5.1.jar"/>
198 <rule pattern="org.objectweb.asm.**" result="jruby.objectweb.asm.@1"/>
200 <attribute name="Built-By" value="${user.name}"/>
201 <attribute name="Main-Class" value="org.jruby.Main"/>
206 <path id="lib.classpath">
207 <pathelement location="${build.lib.dir}/retroweaver-rt-2.0.5.jar"/>
208 <pathelement location="${build.lib.dir}/backport-util-concurrent.jar"/>
209 <pathelement location="/usr/java/j2sdk1.4.2_16/jre/lib/rt.jar" />
210 <pathelement location="${lib.dir}/bsf.jar" />
213 <target name="jar-1.4" depends="jar-jruby">
214 <copy file="${lib.dir}/jruby.jar" tofile="${lib.dir}/jruby1.5.jar"/>
215 <retro inputjar="${lib.dir}/jruby1.5.jar" outputjar="${lib.dir}/jruby-weaved.jar" target="1.4" failonerror="true" verify="true">
217 <path refid="lib.classpath"/>
218 <pathelement location="${lib.dir}/jruby-weaved.jar" />
221 <taskdef name="jarjar" classname="com.tonicsystems.jarjar.JarJarTask" classpath="${build.lib.dir}/jarjar-1.0rc7.jar"/>
222 <jarjar destfile="${lib.dir}/jruby.jar">
223 <zipfileset src="${lib.dir}/jruby-weaved.jar"/>
224 <zipfileset src="${build.lib.dir}/retroweaver-rt-2.0.5.jar"/>
225 <zipfileset src="${build.lib.dir}/backport-util-concurrent.jar"/>
226 <rule pattern="edu.emory.mathcs.backport.**" result="jruby.backport.@1"/>
227 <rule pattern="org.objectweb.asm.**" result="jruby.objectweb.asm.@1"/>
229 <delete file="${lib.dir}/jruby-weaved.jar"/>
230 <delete file="${lib.dir}/jruby1.5.jar"/>
233 <target name="jar-complete-1.4" depends="jar-complete">
234 <copy file="${lib.dir}/jruby-complete.jar" tofile="${lib.dir}/jruby-complete1.5.jar"/>
235 <retro inputjar="${lib.dir}/jruby-complete1.5.jar" outputjar="${lib.dir}/jruby-complete.jar" target="1.4" failonerror="false" verify="true">
237 <path refid="lib.classpath"/>
238 <pathelement location="${lib.dir}/jruby-complete.jar" />
241 <delete file="${lib.dir}/jruby-complete1.5.jar"/>
244 <target name="jar-complete" depends="generate-method-classes" description="Create the 'complete' JRuby jar. Pass 'mainclass' and 'filename' to adjust.">
245 <property name="mainclass" value="org.jruby.Main"/>
246 <property name="filename" value="jruby-complete.jar"/>
247 <taskdef name="jarjar" classname="com.tonicsystems.jarjar.JarJarTask" classpath="${build.lib.dir}/jarjar-1.0rc7.jar"/>
248 <property name="jar-complete-home" value="${build.dir}/jar-complete/META-INF/jruby.home"/>
249 <mkdir dir="${jar-complete-home}"/>
250 <copy todir="${jar-complete-home}">
251 <fileset dir="${basedir}">
252 <patternset refid="dist.bindir.files"/>
253 <patternset refid="dist.lib.files"/>
256 <copy todir="${build.dir}/jar-complete">
257 <fileset dir="lib/ruby/1.8" includes="**/*"/>
260 <java classname="${mainclass}" fork="true" maxmemory="${jruby.launch.memory}" failonerror="true">
262 <pathelement location="${jruby.classes.dir}"/>
263 <pathelement location="${build.dir}/jar-complete"/>
264 <path refid="build.classpath"/>
266 <sysproperty key="jruby.home" value="${build.dir}/jar-complete/META-INF/jruby.home"/>
269 <arg value="install"/>
272 <arg value="--no-ri"/>
273 <arg value="--no-rdoc"/>
274 <arg value="--env-shebang"/>
276 <jarjar destfile="${lib.dir}/${filename}">
277 <fileset dir="${jruby.classes.dir}">
278 <exclude name="org/jruby/util/ant/**/*.class"/>
280 <fileset dir="${build.dir}/jar-complete">
281 <exclude name="META-INF/jruby.home/lib/ruby/1.8/**"/>
283 <zipfileset src="${build.lib.dir}/asm-3.0.jar"/>
284 <zipfileset src="${build.lib.dir}/asm-commons-3.0.jar"/>
285 <zipfileset src="${build.lib.dir}/asm-util-3.0.jar"/>
286 <zipfileset src="${build.lib.dir}/asm-analysis-3.0.jar"/>
287 <zipfileset src="${build.lib.dir}/asm-tree-3.0.jar"/>
288 <zipfileset src="${build.lib.dir}/bytelist-0.1.jar"/>
289 <zipfileset src="${build.lib.dir}/jvyamlb-0.1.4.jar"/>
290 <zipfileset src="${build.lib.dir}/jline-0.9.93.jar"/>
291 <zipfileset src="${build.lib.dir}/joni.jar"/>
292 <zipfileset src="${build.lib.dir}/jna-posix.jar"/>
293 <zipfileset src="${build.lib.dir}/jna.jar"/>
294 <zipfileset src="${build.lib.dir}/joda-time-1.5.1.jar"/>
295 <rule pattern="org.objectweb.asm.**" result="jruby.objectweb.asm.@1"/>
297 <attribute name="Built-By" value="${user.name}"/>
298 <attribute name="Main-Class" value="${mainclass}"/>
303 <target name="jar-console" depends="generate-method-classes" description="Create the jruby graphical console jar">
304 <antcall target="jar-complete">
305 <param name="mainclass" value="org.jruby.demo.IRBConsole"/>
306 <param name="filename" value="jruby-console.jar"/>
310 <target name="jar" depends="init" description="Create the jruby.jar file">
311 <antcall target="jar-jruby" inheritall="true"/>
314 <target name="compile-test" depends="jar" description="Compile the unit tests">
315 <javac destdir="${test.classes.dir}" deprecation="true" debug="true"
316 source="${javac.version}">
318 <path refid="build.classpath"/>
319 <pathelement path="${jruby.classes.dir}"/>
320 <pathelement path="${lib.dir}/jruby.jar"/>
322 <src path="${test.dir}"/>
323 <src path="${spec.dir}"/>
324 <patternset refid="java.src.pattern"/>
328 <target name="copy-test-files" depends="compile-test"
329 description="Make tests fails available as resources">
330 <copy todir="${test.classes.dir}">
331 <fileset dir="${test.dir}" includes="org/**/*.rb"/>
335 <target name="install-gems">
336 <property name="jruby.home" value="${basedir}"/>
337 <java classname="org.jruby.Main" fork="true" maxmemory="${jruby.launch.memory}" failonerror="true">
338 <classpath refid="build.classpath"/>
339 <classpath path="${jruby.classes.dir}"/>
340 <sysproperty key="jruby.home" value="${jruby.home}"/>
341 <arg value="--command"/>
342 <arg value="maybe_install_gems"/>
345 <arg value="--env-shebang"/>
349 <target name="compile-stdlib" unless="test">
350 <copy todir="${build.dir}/stdlib">
351 <fileset dir="${basedir}/lib/ruby/1.8">
352 <include name="**/*.rb"/>
355 <java classname="org.jruby.Main" fork="true" maxmemory="${jruby.launch.memory}" failonerror="true" dir="${build.dir}/stdlib">
356 <classpath refid="build.classpath"/>
357 <classpath path="${jruby.classes.dir}"/>
358 <sysproperty key="jruby.home" value="${basedir}"/>
359 <sysproperty key="jruby.objectspace.enabled" value="true"/>
360 <jvmarg value="-ea"/>
365 <arg value="jrubyc"/>
370 <target name="emma" description="turns on EMMA instrumentation/reporting" >
371 <available property="emma.present"
372 classname="com.vladium.app.IAppVersion"
373 classpathref="emma.classpath"/>
374 <taskdef resource="emma_ant.properties" classpathref="emma.classpath" />
376 <property name="emma.enabled" value="true" />
378 <path id="classes_to_instrument" >
379 <pathelement location="${jruby.classes.dir}" />
383 <target name="instrument" if="emma.present">
384 <emma enabled="${emma.enabled}" >
385 <instr instrpathref="classes_to_instrument"
386 destdir="${jruby.instrumented.classes.dir}"
387 metadatafile="${test.results.dir}/metadata.emma"
392 <target name="coverage-report" if="emma.present">
393 <emma enabled="${emma.enabled}" >
394 <report sourcepath="${src.dir}" >
395 <fileset dir="${test.results.dir}" >
396 <include name="*.emma" />
398 <html outfile="${html.test.coverage.results.dir}/coverage.html" />
403 <target name="test" depends="
407 run-junit-compiled-1.9,
408 test-security-manager,
410 description="Runs unit tests.">
413 <target name="test-compiled" depends="copy-test-files,run-junit-compiled,run-junit-precompiled"/>
414 <target name="test-compiled-1.9" depends="copy-test-files,run-junit-compiled-1.9,run-junit-precompiled-1.9"/>
415 <target name="test-interpreted" depends="copy-test-files,run-junit-interpreted"/>
416 <target name="test-interpreted-1.9" depends="copy-test-files,run-junit-interpreted-1.9"/>
417 <target name="test-reflected" depends="copy-test-files,run-junit-reflected-compiled,run-junit-reflected-precompiled,run-junit-reflected-interpreted"/>
418 <target name="test-threadpool" depends="copy-test-files,run-junit-compiled-threadpool,run-junit-precompiled-threadpool,run-junit-interpreted-threadpool"/>
420 <target name="test-all" depends="
423 test-security-manager,
424 run-junit-interpreted,
426 run-junit-precompiled,
427 run-junit-interpreted-1.9,
428 run-junit-compiled-1.9,
429 run-junit-precompiled-1.9,
430 run-junit-reflected-interpreted,
431 run-junit-reflected-compiled,
432 run-junit-reflected-precompiled,
433 run-junit-compiled-threadpool,
434 run-junit-precompiled-threadpool,
435 run-junit-interpreted-threadpool,
436 run-junit-object-persistence,
439 description="Runs unit tests in all modes."/>
441 <target name="weave-tests" description="weave the test classes">
442 <retro srcdir="${test.classes.dir}" target="1.4" failonerror="true" verify="true">
444 <path refid="lib.classpath"/>
445 <pathelement location="${lib.dir}/jruby.jar" />
446 <pathelement location="${build.lib.dir}/junit.jar" />
447 <pathelement location="${build.lib.dir}/asm-3.0.jar" />
448 <pathelement location="${test.classes.dir}" />
453 <target name="test-1.4" depends="
459 run-junit-compiled-1.9,
461 description="Runs unit tests with weaved jruby classes.">
464 <target name="test-all-1.4" depends="
469 run-junit-interpreted,
471 run-junit-precompiled,
472 run-junit-interpreted-1.9,
473 run-junit-compiled-1.9,
474 run-junit-precompiled-1.9,
475 run-junit-reflected-interpreted,
476 run-junit-reflected-compiled,
477 run-junit-reflected-precompiled,
478 run-junit-compiled-threadpool,
479 run-junit-precompiled-threadpool,
480 run-junit-interpreted-threadpool,
481 run-junit-object-persistence,
484 description="Runs unit tests in all modes with weaved jruby classes."/>
486 <!-- All junit permutations for 1.8 and 1.9 support -->
487 <target name="run-junit-interpreted"><run-junit-1.8/></target>
488 <target name="run-junit-interpreted-1.9"><run-junit-1.9/></target>
489 <target name="run-junit-reflected-interpreted"><run-junit-1.8 reflection="true"/></target>
490 <target name="run-junit-reflected-interpreted-1.9"><run-junit-1.9 reflection="true"/></target>
491 <target name="run-junit-compiled"><run-junit-1.8 compile.mode="JIT" jit.threshold="0"/></target>
492 <target name="run-junit-compiled-1.9"><run-junit-1.9 compile.mode="JIT" jit.threshold="0"/></target>
493 <target name="run-junit-reflected-compiled"><run-junit-1.8 compile.mode="JIT" jit.threshold="0" reflection="true"/></target>
494 <target name="run-junit-reflected-compiled-1.9"><run-junit-1.9 compile.mode="JIT" jit.threshold="0" reflection="true"/></target>
495 <target name="run-junit-precompiled"><run-junit-1.8 compile.mode="FORCE" jit.threshold="0"/></target>
496 <target name="run-junit-precompiled-1.9"><run-junit-1.9 compile.mode="FORCE" jit.threshold="0"/></target>
497 <target name="run-junit-reflected-precompiled"><run-junit-1.8 compile.mode="FORCE" jit.threshold="0" reflection="true"/></target>
498 <target name="run-junit-reflected-precompiled-1.9"><run-junit-1.9 compile.mode="FORCE" jit.threshold="0" reflection="true"/></target>
499 <target name="run-junit-threadpool" depends="run-junit-interpreted-threadpool,run-junit-compiled-threadpool"/>
500 <target name="run-junit-interpreted-threadpool"><run-junit-1.8 thread.pooling="true"/></target>
501 <target name="run-junit-compiled-threadpool"><run-junit-1.8 compile.mode="JIT" jit.threshold="0" thread.pooling="true"/></target>
502 <target name="run-junit-precompiled-threadpool"><run-junit-1.8 compile.mode="FORCE" jit.threshold="0" thread.pooling="true"/></target>
504 <path id="test.class.path">
505 <pathelement location="${jruby.instrumented.classes.dir}" />
506 <fileset dir="${build.lib.dir}" includes="*.jar">
507 <exclude name="joni.jar"/>
509 <pathelement path="${lib.dir}/bsf.jar"/>
510 <pathelement path="${java.class.path}"/>
511 <pathelement path="${lib.dir}/jruby.jar"/>
512 <pathelement location="${test.classes.dir}"/>
513 <pathelement path="${test.dir}/requireTest.jar"/>
514 <pathelement location="${test.dir}"/>
517 <macrodef name="run-junit">
518 <attribute name="jruby.version" default="ruby1_8"/>
519 <attribute name="compile.mode" default="OFF"/>
520 <attribute name="jit.threshold" default="20"/>
521 <attribute name="jit.max" default="-1"/>
522 <attribute name="objectspace.enabled" default="true"/>
523 <attribute name="thread.pooling" default="false"/>
524 <attribute name="reflection" default="false"/>
525 <attribute name="threadlocal" default="false"/>
526 <element name="junit-tests"/>
528 <echo message="compile=@{compile.mode}, jit.threshold=@{jit.threshold}, jit.max=@{jit.max}, objectspace=@{objectspace.enabled} threadpool=@{thread.pooling} reflection=@{reflection} version=@{jruby.version}"/>
529 <taskdef name="junit" classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask" classpath="${build.lib.dir}/junit.jar"/>
531 <junit jvm="${jruby.test.jvm}" fork="yes" forkMode="once" haltonfailure="true" dir="${basedir}" maxmemory="${jruby.test.memory}" showoutput="true" timeout="1200000">
532 <classpath refid="test.class.path"/>
534 <sysproperty key="java.awt.headless" value="true"/>
535 <sysproperty key="jruby.home" value="${basedir}"/>
536 <sysproperty key="jruby.lib" value="${lib.dir}"/>
537 <sysproperty key="jruby.compile.mode" value="@{compile.mode}"/>
538 <sysproperty key="jruby.jit.threshold" value="@{jit.threshold}"/>
539 <sysproperty key="jruby.jit.max" value="@{jit.max}"/>
540 <sysproperty key="jruby.compat.version" value="@{jruby.version}"/>
541 <sysproperty key="jruby.objectspace.enabled" value="@{objectspace.enabled}"/>
542 <sysproperty key="jruby.runtime.threadlocal" value="@{threadlocal}"/>
543 <sysproperty key="jruby.thread.pool.enabled" value="@{thread.pooling}"/>
544 <sysproperty key="jruby.reflection" value="@{reflection}"/>
545 <sysproperty key="jruby.jit.logging.verbose" value="true"/>
546 <sysproperty key="emma.coverage.out.file" value="${test.results.dir}/coverage.emma" />
547 <sysproperty key="emma.coverage.out.merge" value="true" />
549 <jvmarg value="-ea"/>
551 <formatter type="xml"/>
552 <formatter type="brief" usefile="false" />
557 <junitreport todir="${test.results.dir}">
558 <fileset dir="${test.results.dir}" includes="TEST-*.xml"/>
559 <report format="frames" todir="${html.test.results.dir}"/>
564 <!-- runs junit tests for 1.8 functionality -->
565 <macrodef name="run-junit-1.8">
566 <attribute name="compile.mode" default="OFF"/>
567 <attribute name="jit.threshold" default="20"/>
568 <attribute name="reflection" default="false"/>
569 <attribute name="thread.pooling" default="false"/>
572 <run-junit compile.mode="@{compile.mode}" jit.threshold="@{jit.threshold}" reflection="@{reflection}" thread.pooling="@{thread.pooling}">
574 <test name="${test}" if="test"/>
575 <test name="org.jruby.test.MainTestSuite" todir="${test.results.dir}" unless="test"/>
576 <test name="org.jruby.test.ScriptTestSuite" todir="${test.results.dir}" unless="test"/>
577 <test name="org.jruby.test.BFTSTestSuite" todir="${test.results.dir}" unless="test"/>
578 <test name="org.jruby.test.JRubyTestSuite" todir="${test.results.dir}" unless="test"/>
579 <test name="org.jruby.test.DubyTestSuite" todir="${test.results.dir}" unless="test"/>
580 <test name="org.jruby.test.MRITestSuite" todir="${test.results.dir}" unless="test"/>
581 <test name="org.jruby.test.RubiconTestSuite" todir="${test.results.dir}" unless="test"/>
582 <test name="org.jruby.test.RubyTestTestSuite" todir="${test.results.dir}" unless="test"/>
588 <macrodef name="run-junit-1.9">
589 <attribute name="compile.mode" default="OFF"/>
590 <attribute name="jit.threshold" default="20"/>
591 <attribute name="reflection" default="false"/>
592 <attribute name="thread.pooling" default="false"/>
595 <run-junit objectspace.enabled="false" jruby.version="ruby1_9" compile.mode="@{compile.mode}" jit.threshold="@{jit.threshold}" reflection="@{reflection}" thread.pooling="@{thread.pooling}">
597 <test name="${test}" if="test"/>
598 <test name="org.jruby.test.Ruby1_9TestSuite" todir="${test.results.dir}" unless="test"/>
604 <!-- Runs junit tests for object persistence support -->
605 <target name="run-junit-object-persistence">
606 <run-junit objectspace.enabled="false" threadlocal="true">
608 <test name="${test}" if="test"/>
609 <test name="org.jruby.test.ObjectPersistenceTestSuite" todir="${test.results.dir}" unless="test"/>
614 <target name="test-security-manager">
615 <java classname="org.jruby.Main" fork="true" failonerror="true">
616 <classpath refid="build.classpath"/>
617 <classpath path="${jruby.classes.dir}"/>
618 <sysproperty key="java.security.manager" value=""/>
619 <sysproperty key="java.security.policy" value="file:test/restricted.policy"/>
621 <arg value="puts 'Restricted policy looks ok'"/>
625 <target name="detect-stable-specs-need-update">
626 <property file="${spec.dir}/rubyspecs.current.revision"/>
627 <condition property="stable-specs-need-update">
629 <not> <available file="${rubyspec.dir}"/> </not>
630 <not> <available file="${mspec.dir}"/> </not>
633 arg1="${rubyspecs.revision}"
634 arg2="${rubyspecs.current.revision}"/>
638 arg1="${mspec.revision}"
639 arg2="${mspec.current.revision}"/>
645 <target name="fetch-stable-specs" depends="prepare, detect-stable-specs-need-update" if="stable-specs-need-update">
646 <echo message="Downlodaing stable mspec..."/>
647 <get src="http://github.com/rubyspec/mspec/tarball/${mspec.revision}" dest="${build.dir}/mspec.tgz"/>
648 <echo message="Downlodaing stable rubyspecs..."/>
649 <get src="http://github.com/rubyspec/rubyspec/tarball/${rubyspecs.revision}" dest="${build.dir}/rubyspec.tgz"/>
651 <!-- Wipe the old mspec/rubyspecs, if any, and exctract new ones -->
653 <delete dir="${mspec.dir}"/>
654 <mkdir dir="${mspec.dir}"/>
655 <!-- TODO: We use 'tar' binary since Ant doesn't understand tarballs from GitHub,
656 at least in cases when long file names are present
657 <untar src="${build.dir}/mspec.tgz" dest="${mspec.dir}" compression="gzip">
658 <globmapper from="rubyspec-mspec-${mspec.revision}/*" to="*"/>
660 <exec executable="tar" dir="${mspec.dir}" failonerror="true">
661 <arg line="-xzf ${build.dir}/mspec.tgz --strip-components=1"/>
663 <chmod file="${mspec.dir}/bin/mspec" perm="755"/>
665 <delete dir="${rubyspec.dir}"/>
666 <mkdir dir="${rubyspec.dir}"/>
667 <!-- TODO: disabled 'untar' due to problem, see comment above
668 <untar src="${build.dir}/rubyspec.tgz" dest="${rubyspec.dir}" compression="gzip">
669 <globmapper from="rubyspec-rubyspec-${rubyspecs.revision}/*" to="*"/>
671 <exec executable="tar" dir="${rubyspec.dir}" failonerror="true">
672 <arg line="-xzf ${build.dir}/rubyspec.tgz --strip-components=1"/>
675 <!-- Write down the revision of downloaded specs -->
676 <propertyfile file="${spec.dir}/rubyspecs.current.revision" comment="Revision of downloaded specs.">
677 <entry key="rubyspecs.current.revision" value="${rubyspecs.revision}"/>
678 <entry key="mspec.current.revision" value="${mspec.revision}"/>
682 <!-- NOTE: There are two different rubyspecs versions: stable and unstable.
683 Stable ones are in known good state, and all known JRuby failures are excluded.
684 The idea is that the stable specs runs must be clean, no failures.
685 Unstable specs are the very latest, and might have new failures.
687 Stable specs are downloaded as a snapshot of particular revision.
688 Unstable specs are downloaded as a git repo. -->
690 <!-- stable specs -->
691 <target name="spec" depends="fetch-stable-specs, run-specs"
692 description="Runs known good version of rubyspecs."/>
693 <target name="spec-all" depends="fetch-stable-specs, run-specs-all"
694 description="Runs known good version of rubyspecs without exclusions."/>
696 <!-- latest, unstable specs -->
697 <target name="spec-latest" depends="fetch-specs, run-specs"
698 description="Runs the very latest rubyspecs."/>
699 <target name="spec-latest-all" depends="fetch-specs, run-specs-all"
700 description="Runs the very latest rubyspecs without exclusions."/>
702 <target name="fetch-specs">
703 <condition property="rubyspec-repo-exists">
704 <available file="${rubyspec.dir}/.git"/>
707 <antcall target="do-fetch-specs"/>
708 <antcall target="do-update-specs"/>
711 <target name="do-fetch-specs" unless="rubyspec-repo-exists">
712 <!-- Stable specs might exist, so delete them -->
713 <antcall target="clear-specs" inheritall="false"/>
715 <echo message="Cloning rubyspec repo to: ${rubyspec.dir}"/>
716 <exec dir="${spec.dir}" executable="git">
718 <arg value="--depth"/><arg value="1"/>
719 <arg value="git://github.com/rubyspec/rubyspec.git"/>
720 <arg value="${rubyspec.dir}"/>
723 <echo message="Cloning mspec repo to: ${mspec.dir}"/>
724 <exec dir="${spec.dir}" executable="git">
726 <arg value="--depth"/><arg value="1"/>
727 <arg value="git://github.com/rubyspec/mspec.git"/>
728 <arg value="${mspec.dir}"/>
732 <target name="do-update-specs" if="rubyspec-repo-exists">
733 <echo message="Updading rubyspec repo -- ${rubyspec.dir}"/>
734 <exec dir="${rubyspec.dir}" executable="git">
737 <echo message="Updading mspec repo -- ${mspec.dir}"/>
738 <exec dir="${mspec.dir}" executable="git">
743 <target name="clear-specs">
744 <delete dir="${rubyspec.dir}"/>
745 <delete dir="${mspec.dir}"/>
746 <delete file="${build.dir}/rubyspec.tgz"/>
747 <delete file="${build.dir}/mspec.tgz"/>
748 <delete file="${spec.dir}/rubyspecs.current.revision"/>
751 <target name="run-specs" depends="jar">
752 <antcall target="run-specs-precompiled"/>
753 <antcall target="run-specs-compiled"/>
754 <antcall target="run-specs-interpreted"/>
756 <target name="run-specs-all" depends="jar"><antcall target="run-specs-all-precompiled"/></target>
757 <target name="run-specs-compiled"><_run_specs_internal compile.mode="JIT" jit.threshold="0"/></target>
758 <target name="run-specs-precompiled"><_run_specs_internal compile.mode="FORCE" jit.threshold="0"/></target>
759 <target name="run-specs-all-precompiled"><_run_specs_all_internal compile.mode="FORCE" jit.threshold="0"/></target>
760 <target name="run-specs-interpreted"><_run_specs_internal/></target>
762 <target name="update-excludes">
763 <java classname="org.jruby.Main" fork="true" maxmemory="${jruby.launch.memory}" failonerror="false" dir="${spec.dir}">
764 <classpath refid="build.classpath"/>
765 <classpath path="${jruby.classes.dir}"/>
766 <sysproperty key="jruby.home" value="${basedir}"/>
767 <sysproperty key="jruby.launch.inproc" value="false"/>
769 <arg line="${mspec.dir}/bin/mspec tag"/>
770 <arg line="-t ${basedir}/bin/jruby"/>
771 <arg line="--add fails --fail"/>
772 <arg line="-X ${spec.tags.dir}"/>
773 <arg value="${rubyspec.dir}/1.8"/>
777 <target name="spec-show-excludes" depends="prepare"
778 description="Prints out all currently excluded rubyspecs.">
780 <available property="mspec-available"
781 file="${mspec.dir}/bin/mspec"/>
782 <fail unless="mspec-available"
783 message="No rubyspecs found. Download them via 'ant spec'."/>
785 <java classname="org.jruby.Main" fork="true" maxmemory="${jruby.launch.memory}" failonerror="false" dir="${spec.dir}">
786 <classpath refid="build.classpath"/>
787 <classpath path="${jruby.classes.dir}"/>
788 <sysproperty key="jruby.home" value="${basedir}"/>
789 <sysproperty key="jruby.launch.inproc" value="false"/>
790 <arg line="${mspec.dir}/bin/mspec"/>
791 <arg line="-t ${basedir}/bin/jruby"/>
792 <arg line="-f s -g fails --dry-run"/>
793 <arg line="-X ${spec.tags.dir}"/>
794 <arg value="${rubyspec.dir}/1.8"/>
798 <macrodef name="run-specs">
799 <attribute name="compile.mode" default="OFF"/>
800 <attribute name="jit.threshold" default="20"/>
801 <attribute name="jit.max" default="-1"/>
802 <attribute name="objectspace.enabled" default="true"/>
803 <attribute name="thread.pooling" default="false"/>
804 <attribute name="reflection" default="false"/>
805 <element name="extra-args" optional="true"/>
808 <echo message="compile=@{compile.mode}, threshold=@{jit.threshold}, objectspace=@{objectspace.enabled} threadpool=@{thread.pooling} reflection=@{reflection}"/>
810 <java classname="org.jruby.Main" fork="true" maxmemory="${jruby.launch.memory}" failonerror="true" dir="${base.dir}">
811 <classpath refid="build.classpath"/>
812 <classpath path="${jruby.classes.dir}"/>
814 <jvmarg value="-ea"/>
816 <sysproperty key="jruby.home" value="${basedir}"/>
817 <sysproperty key="jruby.launch.inproc" value="false"/>
819 <!-- properties tweaked for individual runs -->
820 <sysproperty key="jruby.compile.mode" value="@{compile.mode}"/>
821 <sysproperty key="jruby.jit.threshold" value="@{jit.threshold}"/>
822 <sysproperty key="jruby.jit.max" value="@{jit.max}"/>
823 <sysproperty key="jruby.objectspace.enabled" value="@{objectspace.enabled}"/>
824 <sysproperty key="jruby.thread.pool.enabled" value="@{thread.pooling}"/>
825 <sysproperty key="jruby.reflection" value="@{reflection}"/>
827 <arg line="${mspec.dir}/bin/mspec ci"/>
828 <arg value="-t"/><arg value="${basedir}/bin/jruby"/>
829 <arg line="-T -J-ea"/>
830 <arg value="-f"/><arg value="m"/>
833 <arg value="-B ${spec.dir}/default.mspec"/>
838 <macrodef name="_run_specs_internal">
839 <attribute name="compile.mode" default="OFF"/>
840 <attribute name="jit.threshold" default="20"/>
843 <echo message="Excludes: ${spec.tags.dir}"/>
844 <run-specs compile.mode="@{compile.mode}" jit.threshold="@{jit.threshold}">
846 <arg value="-X"/><arg value="${spec.tags.dir}"/>
852 <macrodef name="_run_specs_all_internal">
853 <attribute name="compile.mode" default="OFF"/>
854 <attribute name="jit.threshold" default="20"/>
857 <run-specs compile.mode="@{compile.mode}" jit.threshold="@{jit.threshold}"/>
861 <macrodef name="fixEOLs">
863 <fixcrlf srcdir="dist/bin" excludes="*.bat" eol="lf"/>
864 <fixcrlf srcdir="dist/bin" includes="*.bat" eol="crlf"/>
868 <target name="create-apidocs" depends="prepare"
869 description="Creates the Java API docs">
870 <javadoc destdir="${api.docs.dir}" author="true" version="true" use="true"
871 windowtitle="JRuby API" source="${javac.version}" useexternalfile="true">
872 <fileset dir="${src.dir}">
873 <include name="**/*.java"/>
875 <fileset dir="${test.dir}">
876 <include name="**/*.java"/>
878 <doctitle><![CDATA[<h1>JRuby</h1>]]></doctitle>
879 <bottom><![CDATA[<i>Copyright © 2002-2007 JRuby Team. All Rights Reserved.</i>]]></bottom>
883 <patternset id="dist.bindir.files">
884 <include name="bin/*jruby*"/>
885 <include name="bin/*gem*"/>
886 <include name="bin/*ri*"/>
887 <include name="bin/*rdoc*"/>
888 <include name="bin/*jirb*"/>
889 <include name="bin/generate_yaml_index.rb"/>
890 <include name="bin/testrb"/>
893 <patternset id="dist.lib.files">
894 <include name="lib/ruby/1.8/**"/>
895 <include name="lib/ruby/site_ruby/1.8/**"/>
896 <include name="lib/ruby/gems/1.8/specifications/sources-0.0.1.gemspec"/>
897 <include name="lib/ruby/gems/1.8/cache/sources-0.0.1.gem"/>
898 <include name="lib/ruby/gems/1.8/gems/sources-0.0.1/**"/>
901 <patternset id="dist.files">
902 <include name="lib/*"/>
903 <include name="samples/**"/>
904 <include name="docs/**"/>
905 <include name="COPYING*"/>
906 <include name="README"/>
907 <exclude name="lib/ruby/**"/>
910 <patternset id="dist.bin.files">
911 <patternset refid="dist.files"/>
912 <exclude name="lib/emma.jar"/>
913 <exclude name="lib/emma_ant.jar"/>
914 <exclude name="lib/junit.jar"/>
915 <exclude name="lib/jarjar-1.0rc7.jar"/>
916 <exclude name="docs/rdocs.tar.gz"/>
917 <include name="share/**"/>
920 <patternset id="dist.src.files">
921 <patternset refid="dist.files"/>
922 <exclude name="share/**"/>
923 <include name="src/**"/>
924 <include name="test/**"/>
925 <include name="build_lib/**"/>
926 <include name="Rakefile"/>
927 <include name="build.xml"/>
928 <include name="build-config.xml"/>
929 <include name="nbproject/*"/>
930 <include name=".project"/>
931 <include name=".classpath"/>
932 <include name="default.build.properties"/>
933 <exclude name="lib/jruby.jar"/>
936 <target name="dist-bin" depends="jar">
939 <fileset dir="${basedir}">
940 <patternset refid="dist.bindir.files"/>
941 <patternset refid="dist.lib.files"/>
945 <antcall target="install-gems">
946 <param name="jruby.home" value="dist"/>
948 <tar destfile="jruby-bin-${version.jruby}.tar.gz" compression="gzip">
949 <tarfileset dir="dist" mode="755" prefix="jruby-${version.jruby}">
950 <include name="bin/**"/>
952 <tarfileset dir="dist" prefix="jruby-${version.jruby}">
953 <include name="lib/**"/>
955 <tarfileset dir="${basedir}" prefix="jruby-${version.jruby}">
956 <patternset refid="dist.bin.files"/>
959 <zip destfile="jruby-bin-${version.jruby}.zip">
960 <zipfileset dir="dist" filemode="755" prefix="jruby-${version.jruby}">
961 <include name="bin/**"/>
963 <zipfileset dir="dist" prefix="jruby-${version.jruby}">
964 <include name="lib/**"/>
966 <zipfileset dir="${basedir}" prefix="jruby-${version.jruby}">
967 <patternset refid="dist.bin.files"/>
972 <target name="dist-src" depends="jar">
975 <fileset dir="${basedir}">
976 <patternset refid="dist.bindir.files"/>
977 <patternset refid="dist.lib.files"/>
980 <antcall target="install-gems">
981 <param name="jruby.home" value="dist"/>
984 <tar destfile="jruby-src-${version.jruby}.tar.gz" compression="gzip">
985 <tarfileset dir="dist" mode="755" prefix="jruby-${version.jruby}">
986 <include name="bin/**"/>
988 <tarfileset dir="dist" prefix="jruby-${version.jruby}">
989 <include name="lib/**"/>
991 <tarfileset dir="${basedir}" prefix="jruby-${version.jruby}">
992 <patternset refid="dist.src.files"/>
995 <zip destfile="jruby-src-${version.jruby}.zip">
996 <zipfileset dir="dist" filemode="755" prefix="jruby-${version.jruby}">
997 <include name="bin/**"/>
999 <zipfileset dir="dist" prefix="jruby-${version.jruby}">
1000 <include name="lib/**"/>
1002 <zipfileset dir="${basedir}" prefix="jruby-${version.jruby}">
1003 <patternset refid="dist.src.files"/>
1008 <target name="dist-snapshot" depends="jar">
1009 <exec executable="${basedir}/bin/jruby" dir="${basedir}">
1010 <arg value="tool/snapshot.rb"/>
1011 <arg value="${jruby.classes.dir}/org/jruby/jruby.properties"/>
1013 <jar destfile="${lib.dir}/jruby.jar" update="true">
1014 <fileset dir="${jruby.classes.dir}">
1015 <include name="org/jruby/jruby.properties"/>
1018 <property name="jar-up-to-date" value="true"/>
1019 <antcall target="dist-bin">
1020 <param file="${jruby.classes.dir}/org/jruby/jruby.properties"/>
1024 <target name="dist-snapshot-install-stuff">
1025 <unzip dest="${snapshot.install.dir}" src="jruby-bin-${version.jruby}.zip"/>
1026 <chmod perm="755" file="${snapshot.install.dir}/jruby-${version.jruby}/bin/jruby"/>
1027 <exec executable="${snapshot.install.dir}/jruby-${version.jruby}/bin/jruby"
1028 dir="${snapshot.install.dir}/jruby-${version.jruby}">
1031 <arg value="system('rm -f ${snapshot.install.dir}/current && ln -s ${snapshot.install.dir}/jruby-${version.jruby} ${snapshot.install.dir}/current'); puts 'Successfully installed snapshot'"/>
1035 <target name="dist-snapshot-install" depends="dist-snapshot" if="snapshot.install.dir">
1036 <antcall target="dist-snapshot-install-stuff">
1037 <param file="${jruby.classes.dir}/org/jruby/jruby.properties"/>
1041 <target name="dist" depends="dist-bin,dist-src"/>
1043 <target name="dist-clean">
1044 <delete includeEmptyDirs="true" quiet="true">
1046 <include name="jruby-*.tar.gz"/>
1047 <include name="jruby-*.zip"/>
1049 <fileset dir="dist" includes="**/*"/>
1053 <target name="clean" depends="init" description="Cleans almost everything, leaves downloaded specs">
1054 <delete dir="${build.dir}"/>
1055 <delete dir="${dist.dir}"/>
1056 <delete quiet="false">
1057 <fileset dir="${lib.dir}" includes="jruby*.jar"/>
1059 <delete dir="${api.docs.dir}"/>
1060 <delete dir="src_gen"/>
1063 <target name="clean-all" depends="clean, clear-specs" description="Cleans everything, including downloaded specs">
1066 <property name="nailgun.home" value="${basedir}/tool/nailgun"/>
1068 <target name="need-ng">
1069 <condition property="should.build.ng">
1072 <not><available file="${nailgun.home}/ng"/></not>
1077 <target name="build-ng" depends="need-ng" if="should.build.ng">
1078 <exec executable="make" dir="${nailgun.home}"/>
1081 <target name="jruby-nailgun" depends="generate-method-classes,build-ng"
1082 description="Set up JRuby to be run with Nailgun (jruby-ng, jruby-ng-server)">
1083 <mkdir dir="${build.dir}/nailmain"/>
1084 <javac srcdir="${nailgun.home}/src/java" destdir="${build.dir}/nailmain"
1085 classpath="${nailgun.home}/nailgun-0.7.1.jar:${jruby.classes.dir}" debug="true"
1086 source="${javac.version}" target="${javac.version}"
1087 deprecation="true" encoding="UTF-8" />
1088 <taskdef name="jarjar" classname="com.tonicsystems.jarjar.JarJarTask"
1089 classpath="${build.lib.dir}/jarjar-1.0rc7.jar"/>
1090 <jarjar destfile="${nailgun.home}/jruby-nailgun.jar">
1091 <fileset dir="${jruby.classes.dir}">
1092 <exclude name="org/jruby/util/ant/**/*.class"/>
1094 <fileset dir="${build.dir}/nailmain"/>
1095 <zipfileset src="${build.lib.dir}/asm-3.0.jar"/>
1096 <zipfileset src="${build.lib.dir}/asm-commons-3.0.jar"/>
1097 <zipfileset src="${build.lib.dir}/asm-util-3.0.jar"/>
1098 <zipfileset src="${build.lib.dir}/asm-analysis-3.0.jar"/>
1099 <zipfileset src="${build.lib.dir}/asm-tree-3.0.jar"/>
1100 <zipfileset src="${build.lib.dir}/bytelist-0.1.jar"/>
1101 <zipfileset src="${build.lib.dir}/jvyamlb-0.1.4.jar"/>
1102 <zipfileset src="${build.lib.dir}/jline-0.9.93.jar"/>
1103 <zipfileset src="${build.lib.dir}/joni.jar"/>
1104 <zipfileset src="${build.lib.dir}/jna-posix.jar"/>
1105 <zipfileset src="${build.lib.dir}/jna.jar"/>
1106 <zipfileset src="${build.lib.dir}/joda-time-1.5.1.jar"/>
1107 <zipfileset src="${nailgun.home}/nailgun-0.7.1.jar"/>
1108 <rule pattern="org.objectweb.asm.**" result="jruby.objectweb.asm.@1"/>
1110 <attribute name="Built-By" value="${user.name}"/>
1111 <attribute name="Main-Class" value="org.jruby.Main"/>