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 <!-- First try to load machine-specific properties. -->
7 <property file="build.properties"/>
8 <!-- Load revision number for the ruby specs, in a known good state.
9 There should be no spec failures with such revision. -->
10 <property file="rubyspecs.revision"/>
12 <!-- And then load the defaults. It seems backwards to set defaults AFTER
13 setting local overrides, but that's how Ant works. -->
14 <property file="default.build.properties"/>
16 <path id="build.classpath">
17 <fileset dir="${build.lib.dir}" includes="*.jar"/>
18 <fileset dir="${lib.dir}" includes="bsf.jar"/>
21 <!-- directory that contains emma.jar and emma_ant.jar: -->
22 <property name="emma.dir" value="${build.lib.dir}" />
24 <path id="emma.classpath">
25 <pathelement location="${emma.dir}/emma.jar" />
26 <pathelement location="${emma.dir}/emma_ant.jar" />
29 <patternset id="java.src.pattern">
30 <include name="**/*.java"/>
31 <exclude unless="bsf.present" name="org/jruby/javasupport/bsf/**/*.java"/>
32 <exclude unless="jdk1.4+" name="**/XmlAstMarshal.java"/>
33 <exclude unless="jdk1.4+" name="**/AstPersistenceDelegates.java"/>
34 <exclude unless="sun-misc-signal" name="**/SunSignalFacade.java"/>
37 <patternset id="ruby.src.pattern">
38 <include name="**/*.rb"/>
41 <patternset id="other.src.pattern">
42 <include name="**/*.properties"/>
45 <taskdef name="retro" classname="net.sourceforge.retroweaver.ant.RetroWeaverTask" classpathref="build.classpath"/>
47 <import file="netbeans-ant.xml" optional="true"/>
49 <!-- Initializes the build -->
51 <xmlproperty file="build-config.xml" keepRoot="false" collapseAttributes="true"/>
52 <tstamp><format property="build.date" pattern="yyyy-MM-dd"/></tstamp>
53 <property environment="env"/>
54 <property name="version.ruby" value="${version.ruby.major}.${version.ruby.minor}"/>
55 <!-- if ruby.home is not set, use env var -->
56 <condition property="ruby.home" value="${env.RUBY_HOME}">
57 <not><isset property="ruby.home"/></not>
59 <property name="rdoc.archive" value="docs/rdocs.tar.gz"/>
60 <uptodate property="docsNotNeeded" srcfile="${rdoc.archive}" targetfile="${basedir}/share/ri"/>
63 <target name="extract-rdocs" depends="init" unless="docsNotNeeded">
64 <untar src="${rdoc.archive}" dest="${basedir}" compression="gzip"/>
67 <!-- Creates the directories needed for building -->
68 <target name="prepare" depends="extract-rdocs">
69 <mkdir dir="${build.dir}"/>
70 <mkdir dir="${classes.dir}"/>
71 <mkdir dir="${jruby.classes.dir}"/>
72 <mkdir dir="${test.classes.dir}"/>
73 <mkdir dir="${test.results.dir}"/>
74 <mkdir dir="${html.test.results.dir}"/>
75 <mkdir dir="${docs.dir}"/>
76 <mkdir dir="${api.docs.dir}"/>
79 <!-- Checks if specific libs and versions are avaiable -->
80 <target name="check-for-optional-java4-packages"
82 <available property="jdk1.4+" classname="java.lang.CharSequence"/>
83 <available property="jdk1.5+" classname="java.lang.StringBuilder"/>
84 <available property="bsf.present" classname="org.apache.bsf.BSFManager"
85 classpathref="build.classpath"/>
86 <available property="junit.present" classname="junit.framework.TestCase"
87 classpathref="build.classpath"/>
88 <available property="cglib.present"
89 classname="net.sf.cglib.reflect.FastClass"
90 classpathref="build.classpath"/>
93 <!-- Checks if specific libs and versions are avaiable -->
94 <target name="check-for-optional-packages" if="jdk1.5+"
95 depends="check-for-optional-java4-packages">
96 <available property="sun-misc-signal"
97 classname="sun.misc.Signal"/>
100 <!-- Builds the Ant tasks that we need later on in the build -->
101 <target name="compile-tasks" depends="prepare">
102 <copy todir="${jruby.classes.dir}">
103 <fileset dir="${src.dir}">
104 <include name="**/*.rb"/>
107 <copy todir="${jruby.classes.dir}/builtin">
108 <fileset dir="${lib.dir}/ruby/site_ruby/1.8/builtin">
109 <include name="**/*.rb"/>
114 <format property="build.date" pattern="yyyy-MM-dd"/>
117 <copy todir="${jruby.classes.dir}" overwrite="true">
118 <fileset dir="${src.dir}">
119 <include name="**/*.properties"/>
122 <filter token="os.arch" value="${os.arch}"/>
123 <filter token="java.specification.version" value="${java.specification.version}"/>
124 <filter token="javac.version" value="${javac.version}"/>
125 <filter token="build.date" value="${build.date}"/>
130 <target name="compile-annotation-binder">
131 <mkdir dir="${basedir}/src_gen"/>
133 <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">
134 <include name="org/jruby/anno/FrameField.java"/>
135 <include name="org/jruby/anno/AnnotationBinder.java"/>
136 <include name="org/jruby/anno/JRubyMethod.java"/>
137 <include name="org/jruby/anno/FrameField.java"/>
138 <include name="org/jruby/CompatVersion.java"/>
139 <include name="org/jruby/runtime/Visibility.java"/>
140 <include name="org/jruby/util/CodegenUtils.java"/>
144 <target name="compile-jruby" depends="compile-tasks, compile-annotation-binder, check-for-optional-packages">
145 <!-- Generate binding logic ahead of time -->
146 <apt factory="org.jruby.anno.AnnotationBinder" destdir="${jruby.classes.dir}" debug="true" source="${javac.version}" target="${javac.version}" deprecation="true" encoding="UTF-8">
147 <classpath refid="build.classpath"/>
148 <classpath path="${jruby.classes.dir}"/>
149 <src path="${src.dir}"/>
150 <patternset refid="java.src.pattern"/>
154 <target name="compile" depends="compile-jruby"
155 description="Compile the source files for the project.">
158 <target name="generate-method-classes" depends="compile">
159 <echo message="Generating invokers..."/>
160 <java classname="org.jruby.anno.InvokerGenerator" fork="true" failonerror="true">
161 <classpath refid="build.classpath"/>
162 <classpath path="${jruby.classes.dir}"/>
163 <arg value="src_gen/annotated_classes.txt"/>
164 <arg value="${jruby.classes.dir}"/>
167 <echo message="Compiling populators..."/>
168 <javac destdir="${jruby.classes.dir}" debug="true" source="${javac.version}" target="${javac.version}" deprecation="true" encoding="UTF-8">
169 <classpath refid="build.classpath"/>
170 <classpath path="${jruby.classes.dir}"/>
171 <src path="src_gen"/>
172 <patternset refid="java.src.pattern"/>
176 <target name="jar-jruby" unless="jar-up-to-date">
177 <antcall target="generate-method-classes" inheritall="true"/>
178 <taskdef name="jarjar" classname="com.tonicsystems.jarjar.JarJarTask" classpath="${build.lib.dir}/jarjar-1.0rc7.jar"/>
179 <jarjar destfile="${lib.dir}/jruby.jar">
180 <fileset dir="${jruby.classes.dir}">
181 <exclude name="org/jruby/util/ant/**/*.class"/>
183 <zipfileset src="${build.lib.dir}/asm-3.0.jar"/>
184 <zipfileset src="${build.lib.dir}/asm-commons-3.0.jar"/>
185 <zipfileset src="${build.lib.dir}/asm-util-3.0.jar"/>
186 <zipfileset src="${build.lib.dir}/asm-analysis-3.0.jar"/>
187 <zipfileset src="${build.lib.dir}/asm-tree-3.0.jar"/>
188 <zipfileset src="${build.lib.dir}/bytelist-0.1.jar"/>
189 <zipfileset src="${build.lib.dir}/jvyamlb-0.1.1.jar"/>
190 <zipfileset src="${build.lib.dir}/jline-0.9.93.jar"/>
191 <zipfileset src="${build.lib.dir}/joni.jar"/>
192 <zipfileset src="${build.lib.dir}/jna-posix.jar"/>
193 <zipfileset src="${build.lib.dir}/jna.jar"/>
194 <zipfileset src="${build.lib.dir}/joda-time-1.5.1.jar"/>
195 <rule pattern="org.objectweb.asm.**" result="jruby.objectweb.asm.@1"/>
197 <attribute name="Built-By" value="${user.name}"/>
198 <attribute name="Main-Class" value="org.jruby.Main"/>
203 <path id="lib.classpath">
204 <pathelement location="${build.lib.dir}/retroweaver-rt-2.0.5.jar"/>
205 <pathelement location="${build.lib.dir}/backport-util-concurrent.jar"/>
206 <pathelement location="/usr/java/j2sdk1.4.2_16/jre/lib/rt.jar" />
207 <pathelement location="${lib.dir}/bsf.jar" />
210 <target name="jar-1.4" depends="jar-jruby">
211 <copy file="${lib.dir}/jruby.jar" tofile="${lib.dir}/jruby1.5.jar"/>
212 <retro inputjar="${lib.dir}/jruby1.5.jar" outputjar="${lib.dir}/jruby-weaved.jar" target="1.4" failonerror="true" verify="true">
214 <path refid="lib.classpath"/>
215 <pathelement location="${lib.dir}/jruby-weaved.jar" />
218 <taskdef name="jarjar" classname="com.tonicsystems.jarjar.JarJarTask" classpath="${build.lib.dir}/jarjar-1.0rc7.jar"/>
219 <jarjar destfile="${lib.dir}/jruby.jar">
220 <zipfileset src="${lib.dir}/jruby-weaved.jar"/>
221 <zipfileset src="${build.lib.dir}/retroweaver-rt-2.0.5.jar"/>
222 <zipfileset src="${build.lib.dir}/backport-util-concurrent.jar"/>
223 <rule pattern="edu.emory.mathcs.backport.**" result="jruby.backport.@1"/>
224 <rule pattern="org.objectweb.asm.**" result="jruby.objectweb.asm.@1"/>
226 <delete file="${lib.dir}/jruby-weaved.jar"/>
227 <delete file="${lib.dir}/jruby1.5.jar"/>
230 <target name="jar-complete-1.4" depends="jar-complete">
231 <copy file="${lib.dir}/jruby-complete.jar" tofile="${lib.dir}/jruby-complete1.5.jar"/>
232 <retro inputjar="${lib.dir}/jruby-complete1.5.jar" outputjar="${lib.dir}/jruby-complete.jar" target="1.4" failonerror="false" verify="true">
234 <path refid="lib.classpath"/>
235 <pathelement location="${lib.dir}/jruby-complete.jar" />
238 <delete file="${lib.dir}/jruby-complete1.5.jar"/>
241 <target name="jar-complete" depends="generate-method-classes" description="Create the 'complete' JRuby jar. Pass 'mainclass' and 'filename' to adjust.">
242 <property name="mainclass" value="org.jruby.Main"/>
243 <property name="filename" value="jruby-complete.jar"/>
244 <taskdef name="jarjar" classname="com.tonicsystems.jarjar.JarJarTask" classpath="${build.lib.dir}/jarjar-1.0rc7.jar"/>
245 <jarjar destfile="${lib.dir}/${filename}">
246 <fileset dir="${jruby.classes.dir}">
247 <exclude name="org/jruby/util/ant/**/*.class"/>
249 <fileset dir="${basedir}/lib/ruby/1.8">
250 <include name="**/*.rb"/>
252 <zipfileset src="${build.lib.dir}/asm-3.0.jar"/>
253 <zipfileset src="${build.lib.dir}/asm-commons-3.0.jar"/>
254 <zipfileset src="${build.lib.dir}/asm-util-3.0.jar"/>
255 <zipfileset src="${build.lib.dir}/asm-analysis-3.0.jar"/>
256 <zipfileset src="${build.lib.dir}/asm-tree-3.0.jar"/>
257 <zipfileset src="${build.lib.dir}/bytelist-0.1.jar"/>
258 <zipfileset src="${build.lib.dir}/jvyamlb-0.1.1.jar"/>
259 <zipfileset src="${build.lib.dir}/jline-0.9.93.jar"/>
260 <zipfileset src="${build.lib.dir}/joni.jar"/>
261 <zipfileset src="${build.lib.dir}/jna-posix.jar"/>
262 <zipfileset src="${build.lib.dir}/jna.jar"/>
263 <zipfileset src="${build.lib.dir}/joda-time-1.5.1.jar"/>
264 <rule pattern="org.objectweb.asm.**" result="jruby.objectweb.asm.@1"/>
265 <zipfileset dir="${basedir}" prefix="META-INF/jruby.home">
266 <include name="bin/*"/>
267 <include name="lib/ruby/gems/1.8/cache/sources*.gem"/>
268 <include name="lib/ruby/gems/1.8/gems/sources*/**/*"/>
269 <include name="lib/ruby/gems/1.8/specifications/sources*.gemspec"/>
270 <include name="lib/ruby/site_ruby/**/*"/>
273 <attribute name="Built-By" value="${user.name}"/>
274 <attribute name="Main-Class" value="${mainclass}"/>
280 <target name="jar-console" depends="generate-method-classes" description="Create the jruby graphical console jar">
281 <antcall target="jar-complete">
282 <param name="mainclass" value="org.jruby.demo.IRBConsole"/>
283 <param name="filename" value="jruby-console.jar"/>
287 <target name="jar" depends="init" description="Create the jruby.jar file">
288 <antcall target="jar-jruby" inheritall="true"/>
291 <target name="compile-test" depends="jar" description="Compile the unit tests">
292 <javac destdir="${test.classes.dir}" deprecation="true" debug="true"
293 source="${javac.version}">
295 <path refid="build.classpath"/>
296 <pathelement path="${jruby.classes.dir}"/>
297 <pathelement path="${lib.dir}/jruby.jar"/>
299 <src path="${test.dir}"/>
300 <patternset refid="java.src.pattern"/>
304 <target name="copy-test-files" depends="compile-test"
305 description="Make tests fails available as resources">
306 <copy todir="${test.classes.dir}">
307 <fileset dir="${test.dir}" includes="org/**/*.rb"/>
311 <target name="install-gems">
312 <property name="jruby.home" value="${basedir}"/>
313 <java classname="org.jruby.Main" fork="true" maxmemory="${jruby.launch.memory}" failonerror="true">
314 <classpath refid="build.classpath"/>
315 <classpath path="${jruby.classes.dir}"/>
316 <sysproperty key="jruby.home" value="${jruby.home}"/>
317 <arg value="--command"/>
318 <arg value="maybe_install_gems"/>
321 <arg value="--env-shebang"/>
325 <target name="compile-stdlib" unless="test">
326 <copy todir="${build.dir}/stdlib">
327 <fileset dir="${basedir}/lib/ruby/1.8">
328 <include name="**/*.rb"/>
331 <java classname="org.jruby.Main" fork="true" maxmemory="${jruby.launch.memory}" failonerror="true" dir="${build.dir}/stdlib">
332 <classpath refid="build.classpath"/>
333 <classpath path="${jruby.classes.dir}"/>
334 <sysproperty key="jruby.home" value="${basedir}"/>
335 <sysproperty key="jruby.objectspace.enabled" value="true"/>
336 <jvmarg value="-ea"/>
341 <arg value="jrubyc"/>
346 <target name="emma" description="turns on EMMA instrumentation/reporting" >
347 <available property="emma.present"
348 classname="com.vladium.app.IAppVersion"
349 classpathref="emma.classpath"/>
350 <taskdef resource="emma_ant.properties" classpathref="emma.classpath" />
352 <property name="emma.enabled" value="true" />
354 <path id="classes_to_instrument" >
355 <pathelement location="${jruby.classes.dir}" />
359 <target name="instrument" if="emma.present">
360 <emma enabled="${emma.enabled}" >
361 <instr instrpathref="classes_to_instrument"
362 destdir="${jruby.instrumented.classes.dir}"
363 metadatafile="${test.results.dir}/metadata.emma"
368 <target name="coverage-report" if="emma.present">
369 <emma enabled="${emma.enabled}" >
370 <report sourcepath="${src.dir}" >
371 <fileset dir="${test.results.dir}" >
372 <include name="*.emma" />
374 <html outfile="${html.test.coverage.results.dir}/coverage.html" />
379 <target name="test" depends="
383 run-junit-compiled-1.9,
384 test-security-manager,
386 description="Runs unit tests.">
389 <target name="test-compiled" depends="copy-test-files,run-junit-compiled,run-junit-precompiled"/>
390 <target name="test-compiled-1.9" depends="copy-test-files,run-junit-compiled-1.9,run-junit-precompiled-1.9"/>
391 <target name="test-interpreted" depends="copy-test-files,run-junit-interpreted"/>
392 <target name="test-interpreted-1.9" depends="copy-test-files,run-junit-interpreted-1.9"/>
393 <target name="test-reflected" depends="copy-test-files,run-junit-reflected-compiled,run-junit-reflected-precompiled,run-junit-reflected-interpreted"/>
394 <target name="test-threadpool" depends="copy-test-files,run-junit-compiled-threadpool,run-junit-precompiled-threadpool,run-junit-interpreted-threadpool"/>
396 <target name="test-all" depends="
399 test-security-manager,
400 run-junit-interpreted,
402 run-junit-precompiled,
403 run-junit-interpreted-1.9,
404 run-junit-compiled-1.9,
405 run-junit-precompiled-1.9,
406 run-junit-reflected-interpreted,
407 run-junit-reflected-compiled,
408 run-junit-reflected-precompiled,
409 run-junit-compiled-threadpool,
410 run-junit-precompiled-threadpool,
411 run-junit-interpreted-threadpool,
412 run-junit-object-persistence,
415 description="Runs unit tests in all modes."/>
417 <target name="weave-tests" description="weave the test classes">
418 <retro srcdir="${test.classes.dir}" target="1.4" failonerror="true" verify="true">
420 <path refid="lib.classpath"/>
421 <pathelement location="${lib.dir}/jruby.jar" />
422 <pathelement location="${build.lib.dir}/junit.jar" />
423 <pathelement location="${build.lib.dir}/asm-3.0.jar" />
424 <pathelement location="${test.classes.dir}" />
429 <target name="test-1.4" depends="
435 run-junit-compiled-1.9,
437 description="Runs unit tests with weaved jruby classes.">
440 <target name="test-all-1.4" depends="
445 run-junit-interpreted,
447 run-junit-precompiled,
448 run-junit-interpreted-1.9,
449 run-junit-compiled-1.9,
450 run-junit-precompiled-1.9,
451 run-junit-reflected-interpreted,
452 run-junit-reflected-compiled,
453 run-junit-reflected-precompiled,
454 run-junit-compiled-threadpool,
455 run-junit-precompiled-threadpool,
456 run-junit-interpreted-threadpool,
457 run-junit-object-persistence,
460 description="Runs unit tests in all modes with weaved jruby classes."/>
462 <!-- All junit permutations for 1.8 and 1.9 support -->
463 <target name="run-junit-interpreted"><run-junit-1.8/></target>
464 <target name="run-junit-interpreted-1.9"><run-junit-1.9/></target>
465 <target name="run-junit-reflected-interpreted"><run-junit-1.8 reflection="true"/></target>
466 <target name="run-junit-reflected-interpreted-1.9"><run-junit-1.9 reflection="true"/></target>
467 <target name="run-junit-compiled"><run-junit-1.8 compile.mode="JIT" jit.threshold="0"/></target>
468 <target name="run-junit-compiled-1.9"><run-junit-1.9 compile.mode="JIT" jit.threshold="0"/></target>
469 <target name="run-junit-reflected-compiled"><run-junit-1.8 compile.mode="JIT" jit.threshold="0" reflection="true"/></target>
470 <target name="run-junit-reflected-compiled-1.9"><run-junit-1.9 compile.mode="JIT" jit.threshold="0" reflection="true"/></target>
471 <target name="run-junit-precompiled"><run-junit-1.8 compile.mode="FORCE" jit.threshold="0"/></target>
472 <target name="run-junit-precompiled-1.9"><run-junit-1.9 compile.mode="FORCE" jit.threshold="0"/></target>
473 <target name="run-junit-reflected-precompiled"><run-junit-1.8 compile.mode="FORCE" jit.threshold="0" reflection="true"/></target>
474 <target name="run-junit-reflected-precompiled-1.9"><run-junit-1.9 compile.mode="FORCE" jit.threshold="0" reflection="true"/></target>
475 <target name="run-junit-threadpool" depends="run-junit-interpreted-threadpool,run-junit-compiled-threadpool"/>
476 <target name="run-junit-interpreted-threadpool"><run-junit-1.8 thread.pooling="true"/></target>
477 <target name="run-junit-compiled-threadpool"><run-junit-1.8 compile.mode="JIT" jit.threshold="0" thread.pooling="true"/></target>
478 <target name="run-junit-precompiled-threadpool"><run-junit-1.8 compile.mode="FORCE" jit.threshold="0" thread.pooling="true"/></target>
480 <path id="test.class.path">
481 <pathelement location="${jruby.instrumented.classes.dir}" />
482 <fileset dir="${build.lib.dir}" includes="*.jar">
483 <exclude name="joni.jar"/>
485 <pathelement path="${lib.dir}/bsf.jar"/>
486 <pathelement path="${java.class.path}"/>
487 <pathelement path="${lib.dir}/jruby.jar"/>
488 <pathelement location="${test.classes.dir}"/>
489 <pathelement path="${test.dir}/requireTest.jar"/>
490 <pathelement location="${test.dir}"/>
493 <macrodef name="run-junit">
494 <attribute name="jruby.version" default="ruby1_8"/>
495 <attribute name="compile.mode" default="OFF"/>
496 <attribute name="jit.threshold" default="20"/>
497 <attribute name="jit.max" default="-1"/>
498 <attribute name="objectspace.enabled" default="true"/>
499 <attribute name="thread.pooling" default="false"/>
500 <attribute name="reflection" default="false"/>
501 <attribute name="threadlocal" default="false"/>
502 <element name="junit-tests"/>
504 <echo message="compile=@{compile.mode}, jit.threshold=@{jit.threshold}, jit.max=@{jit.max}, objectspace=@{objectspace.enabled} threadpool=@{thread.pooling} reflection=@{reflection} version=@{jruby.version}"/>
505 <taskdef name="junit" classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask" classpath="${build.lib.dir}/junit.jar"/>
507 <junit jvm="${jruby.test.jvm}" fork="yes" forkMode="once" haltonfailure="true" dir="${basedir}" maxmemory="${jruby.test.memory}" showoutput="true" timeout="1200000">
508 <classpath refid="test.class.path"/>
510 <sysproperty key="java.awt.headless" value="true"/>
511 <sysproperty key="jruby.home" value="${basedir}"/>
512 <sysproperty key="jruby.lib" value="${lib.dir}"/>
513 <sysproperty key="jruby.compile.mode" value="@{compile.mode}"/>
514 <sysproperty key="jruby.jit.threshold" value="@{jit.threshold}"/>
515 <sysproperty key="jruby.jit.max" value="@{jit.max}"/>
516 <sysproperty key="jruby.compat.version" value="@{jruby.version}"/>
517 <sysproperty key="jruby.objectspace.enabled" value="@{objectspace.enabled}"/>
518 <sysproperty key="jruby.runtime.threadlocal" value="@{threadlocal}"/>
519 <sysproperty key="jruby.thread.pool.enabled" value="@{thread.pooling}"/>
520 <sysproperty key="jruby.reflection" value="@{reflection}"/>
521 <sysproperty key="jruby.jit.logging.verbose" value="true"/>
522 <sysproperty key="emma.coverage.out.file" value="${test.results.dir}/coverage.emma" />
523 <sysproperty key="emma.coverage.out.merge" value="true" />
525 <jvmarg value="-ea"/>
527 <formatter type="xml"/>
528 <formatter type="brief" usefile="false" />
533 <junitreport todir="${test.results.dir}">
534 <fileset dir="${test.results.dir}" includes="TEST-*.xml"/>
535 <report format="frames" todir="${html.test.results.dir}"/>
540 <!-- runs junit tests for 1.8 functionality -->
541 <macrodef name="run-junit-1.8">
542 <attribute name="compile.mode" default="OFF"/>
543 <attribute name="jit.threshold" default="20"/>
544 <attribute name="reflection" default="false"/>
545 <attribute name="thread.pooling" default="false"/>
548 <run-junit compile.mode="@{compile.mode}" jit.threshold="@{jit.threshold}" reflection="@{reflection}" thread.pooling="@{thread.pooling}">
550 <test name="${test}" if="test"/>
551 <test name="org.jruby.test.MainTestSuite" todir="${test.results.dir}" unless="test"/>
552 <test name="org.jruby.test.ScriptTestSuite" todir="${test.results.dir}" unless="test"/>
553 <test name="org.jruby.test.BFTSTestSuite" todir="${test.results.dir}" unless="test"/>
554 <test name="org.jruby.test.JRubyTestSuite" todir="${test.results.dir}" unless="test"/>
555 <test name="org.jruby.test.DubyTestSuite" todir="${test.results.dir}" unless="test"/>
556 <test name="org.jruby.test.MRITestSuite" todir="${test.results.dir}" unless="test"/>
557 <test name="org.jruby.test.RubiconTestSuite" todir="${test.results.dir}" unless="test"/>
558 <test name="org.jruby.test.RubyTestTestSuite" todir="${test.results.dir}" unless="test"/>
564 <macrodef name="run-junit-1.9">
565 <attribute name="compile.mode" default="OFF"/>
566 <attribute name="jit.threshold" default="20"/>
567 <attribute name="reflection" default="false"/>
568 <attribute name="thread.pooling" default="false"/>
571 <run-junit objectspace.enabled="false" jruby.version="ruby1_9" compile.mode="@{compile.mode}" jit.threshold="@{jit.threshold}" reflection="@{reflection}" thread.pooling="@{thread.pooling}">
573 <test name="${test}" if="test"/>
574 <test name="org.jruby.test.Ruby1_9TestSuite" todir="${test.results.dir}" unless="test"/>
580 <!-- Runs junit tests for object persistence support -->
581 <target name="run-junit-object-persistence">
582 <run-junit objectspace.enabled="false" threadlocal="true">
584 <test name="${test}" if="test"/>
585 <test name="org.jruby.test.ObjectPersistenceTestSuite" todir="${test.results.dir}" unless="test"/>
590 <target name="test-security-manager">
591 <java classname="org.jruby.Main" fork="true" failonerror="true">
592 <classpath refid="build.classpath"/>
593 <classpath path="${jruby.classes.dir}"/>
594 <sysproperty key="java.security.manager" value=""/>
595 <sysproperty key="java.security.policy" value="file:test/restricted.policy"/>
597 <arg value="puts 'Restricted policy looks ok'"/>
601 <target name="detect-stable-specs-need-update">
602 <property file="${build.dir}/rubyspecs.current.revision"/>
603 <condition property="stable-specs-need-update">
605 <not><available file="${build.dir}/rubyspec"/></not>
608 arg1="${rubyspecs.revision}"
609 arg2="${rubyspecs.current.revision}"/>
615 <target name="fetch-stable-specs" depends="prepare, detect-stable-specs-need-update" if="stable-specs-need-update">
616 <echo message="Downlodaing stable rubyspecs..."/>
617 <get src="http://git.rubini.us/?p=code;a=snapshot;h=${rubyspecs.revision};sf=tgz" dest="${build.dir}/rubyspec.tgz"/>
618 <!-- Wipe the old specs, if any -->
619 <delete dir="${build.dir}/rubyspec"/>
620 <mkdir dir="${build.dir}/rubyspec"/>
621 <untar src="${build.dir}/rubyspec.tgz" dest="${build.dir}/rubyspec" compression="gzip"/>
622 <chmod file="${build.dir}/rubyspec/code/mspec/bin/mspec" perm="755"/>
624 <!-- Write down the revision of downloaded specs -->
625 <propertyfile file="${build.dir}/rubyspecs.current.revision" comment="Revision of downloaded specs.">
626 <entry key="rubyspecs.current.revision" value="${rubyspecs.revision}"/>
630 <!-- NOTE: There are two different rubyspecs versions: stable and unstable.
631 Stable ones are in known good state, and all known JRuby failures are excluded.
632 The idea is that the stable specs runs must be clean, no failures.
633 Unstable specs are the very latest, and might have new failures.
635 Stable specs are downloaded as a snapshot of particular revision.
636 Unstable specs are downloaded as a git repo. -->
638 <!-- stable specs -->
639 <target name="spec" depends="fetch-stable-specs, run-specs"
640 description="Runs known good version of rubyspecs."/>
641 <target name="spec-all" depends="fetch-stable-specs, run-specs-all"
642 description="Runs known good version of rubyspecs without exclusions."/>
644 <!-- latest, unstable specs -->
645 <target name="spec-latest" depends="fetch-specs, run-specs"
646 description="Runs the very latest rubyspecs."/>
647 <target name="spec-latest-all" depends="fetch-specs, run-specs-all"
648 description="Runs the very latest rubyspecs without exclusions."/>
650 <target name="fetch-specs">
651 <condition property="rubyspec-repo-exists">
652 <available file="${build.dir}/rubyspec/code/.git"/>
655 <antcall target="do-fetch-specs"/>
656 <antcall target="do-update-specs"/>
659 <target name="download-specs" description="Download the specs as a tgz snapshot and unpack to build/rubyspec/code">
660 <get src="http://git.rubini.us/?p=code;a=snapshot;sf=tgz" dest="${build.dir}/rubyspec.tgz"/>
662 <mkdir dir="${build.dir}/rubyspec"/>
663 <untar src="${build.dir}/rubyspec.tgz" dest="${build.dir}/rubyspec" compression="gzip"/>
664 <chmod file="${build.dir}/rubyspec/code/mspec/bin/mspec" perm="755"/>
667 <target name="do-fetch-specs" unless="rubyspec-repo-exists">
668 <!-- Stable specs might exist, so delete them -->
669 <antcall target="clear-specs" inheritall="false"/>
670 <exec dir="${build.dir}" executable="git">
672 <arg value="--depth"/><arg value="1"/>
673 <arg value="git://git.rubini.us/code"/>
674 <arg value="rubyspec/code"/>
678 <target name="do-update-specs" if="rubyspec-repo-exists">
679 <exec dir="${build.dir}/rubyspec/code" executable="git">
684 <target name="clear-specs">
685 <delete dir="${build.dir}/rubyspec"/>
686 <delete file="${build.dir}/rubyspec.tgz"/>
687 <delete file="${build.dir}/rubyspecs.current.revision"/>
690 <target name="run-specs" depends="jar">
691 <antcall target="run-specs-precompiled"/>
692 <antcall target="run-specs-compiled"/>
693 <antcall target="run-specs-interpreted"/>
695 <target name="run-specs-all" depends="jar"><antcall target="run-specs-all-precompiled"/></target>
696 <target name="run-specs-compiled"><_run_specs_internal compile.mode="JIT" jit.threshold="0"/></target>
697 <target name="run-specs-precompiled"><_run_specs_internal compile.mode="FORCE" jit.threshold="0"/></target>
698 <target name="run-specs-all-precompiled"><_run_specs_all_internal compile.mode="FORCE" jit.threshold="0"/></target>
699 <target name="run-specs-interpreted"><_run_specs_internal/></target>
701 <target name="update-excludes">
702 <java classname="org.jruby.Main" fork="true" maxmemory="${jruby.launch.memory}" failonerror="false" dir="${build.dir}/rubyspec/code">
703 <classpath refid="build.classpath"/>
704 <classpath path="${jruby.classes.dir}"/>
705 <sysproperty key="jruby.home" value="${basedir}"/>
706 <sysproperty key="jruby.launch.inproc" value="false"/>
708 <arg line="bin/mspec tag"/>
709 <arg line="-t ${basedir}/bin/jruby"/>
710 <arg line="--add fails --fail"/>
711 <arg line="-X ${basedir}/test/spec_excludes"/>
712 <arg value="spec/ruby/1.8"/>
716 <target name="spec-show-excludes" depends="prepare"
717 description="Prints out all currently excluded rubyspecs.">
719 <available property="mspec-available"
720 file="${build.dir}/rubyspec/code/bin/mspec"/>
721 <fail unless="mspec-available"
722 message="No rubyspecs found. Download them via 'ant spec'."/>
724 <java classname="org.jruby.Main" fork="true" maxmemory="${jruby.launch.memory}" failonerror="false" dir="${build.dir}/rubyspec/code">
725 <classpath refid="build.classpath"/>
726 <classpath path="${jruby.classes.dir}"/>
727 <sysproperty key="jruby.home" value="${basedir}"/>
728 <sysproperty key="jruby.launch.inproc" value="false"/>
729 <arg line="bin/mspec"/>
730 <arg line="-t ${basedir}/bin/jruby"/>
731 <arg line="-f s -g fails --dry-run"/>
732 <arg line="-X ${basedir}/test/spec_excludes"/>
733 <arg value="spec/ruby/1.8"/>
737 <macrodef name="run-specs">
738 <attribute name="compile.mode" default="OFF"/>
739 <attribute name="jit.threshold" default="20"/>
740 <attribute name="jit.max" default="-1"/>
741 <attribute name="objectspace.enabled" default="true"/>
742 <attribute name="thread.pooling" default="false"/>
743 <attribute name="reflection" default="false"/>
744 <element name="extra-args" optional="true"/>
747 <echo message="compile=@{compile.mode}, threshold=@{jit.threshold}, objectspace=@{objectspace.enabled} threadpool=@{thread.pooling} reflection=@{reflection}"/>
749 <java classname="org.jruby.Main" fork="true" maxmemory="${jruby.launch.memory}" failonerror="true" dir="${build.dir}/rubyspec/code">
750 <classpath refid="build.classpath"/>
751 <classpath path="${jruby.classes.dir}"/>
753 <jvmarg value="-ea"/>
755 <sysproperty key="jruby.home" value="${basedir}"/>
756 <sysproperty key="jruby.launch.inproc" value="false"/>
758 <!-- properties tweaked for individual runs -->
759 <sysproperty key="jruby.compile.mode" value="@{compile.mode}"/>
760 <sysproperty key="jruby.jit.threshold" value="@{jit.threshold}"/>
761 <sysproperty key="jruby.jit.max" value="@{jit.max}"/>
762 <sysproperty key="jruby.objectspace.enabled" value="@{objectspace.enabled}"/>
763 <sysproperty key="jruby.thread.pool.enabled" value="@{thread.pooling}"/>
764 <sysproperty key="jruby.reflection" value="@{reflection}"/>
766 <arg line="bin/mspec ci"/>
767 <arg value="-t"/><arg value="${basedir}/bin/jruby"/>
768 <arg line="-T -J-ea"/>
769 <arg value="-f"/><arg value="m"/>
772 <arg value="spec/ruby/1.8"/>
777 <macrodef name="_run_specs_internal">
778 <attribute name="compile.mode" default="OFF"/>
779 <attribute name="jit.threshold" default="20"/>
782 <run-specs compile.mode="@{compile.mode}" jit.threshold="@{jit.threshold}">
784 <arg value="-X"/><arg value="${basedir}/test/spec_excludes"/>
790 <macrodef name="_run_specs_all_internal">
791 <attribute name="compile.mode" default="OFF"/>
792 <attribute name="jit.threshold" default="20"/>
795 <run-specs compile.mode="@{compile.mode}" jit.threshold="@{jit.threshold}"/>
799 <macrodef name="fixEOLs">
801 <fixcrlf srcdir="dist/bin" excludes="*.bat" eol="lf"/>
802 <fixcrlf srcdir="dist/bin" includes="*.bat" eol="crlf"/>
806 <target name="create-apidocs" depends="prepare"
807 description="Creates the Java API docs">
808 <javadoc destdir="${api.docs.dir}" author="true" version="true" use="true"
809 windowtitle="JRuby API" source="${javac.version}" useexternalfile="true">
810 <fileset dir="${src.dir}">
811 <include name="**/*.java"/>
813 <fileset dir="${test.dir}">
814 <include name="**/*.java"/>
816 <doctitle><![CDATA[<h1>JRuby</h1>]]></doctitle>
817 <bottom><![CDATA[<i>Copyright © 2002-2007 JRuby Team. All Rights Reserved.</i>]]></bottom>
821 <patternset id="dist.bindir.files">
822 <include name="bin/*jruby*"/>
823 <include name="bin/*gem*"/>
824 <include name="bin/*ri*"/>
825 <include name="bin/*rdoc*"/>
826 <include name="bin/*jirb*"/>
827 <include name="bin/generate_yaml_index.rb"/>
828 <include name="bin/testrb"/>
831 <patternset id="dist.lib.files">
832 <include name="lib/ruby/1.8/**"/>
833 <include name="lib/ruby/site_ruby/1.8/**"/>
834 <include name="lib/ruby/gems/1.8/specifications/sources-0.0.1.gemspec"/>
835 <include name="lib/ruby/gems/1.8/cache/sources-0.0.1.gem"/>
836 <include name="lib/ruby/gems/1.8/gems/sources-0.0.1/**"/>
839 <patternset id="dist.files">
840 <include name="lib/*"/>
841 <include name="samples/**"/>
842 <include name="docs/**"/>
843 <include name="COPYING*"/>
844 <include name="README"/>
845 <exclude name="lib/ruby/**"/>
848 <patternset id="dist.bin.files">
849 <patternset refid="dist.files"/>
850 <exclude name="lib/emma.jar"/>
851 <exclude name="lib/emma_ant.jar"/>
852 <exclude name="lib/junit.jar"/>
853 <exclude name="lib/jarjar-1.0rc7.jar"/>
854 <exclude name="docs/rdocs.tar.gz"/>
855 <include name="share/**"/>
858 <patternset id="dist.src.files">
859 <patternset refid="dist.files"/>
860 <exclude name="share/**"/>
861 <include name="src/**"/>
862 <include name="test/**"/>
863 <include name="build_lib/**"/>
864 <include name="Rakefile"/>
865 <include name="build.xml"/>
866 <include name="build-config.xml"/>
867 <include name="nbproject/*"/>
868 <include name=".project"/>
869 <include name=".classpath"/>
870 <include name="default.build.properties"/>
871 <exclude name="lib/jruby.jar"/>
874 <target name="dist-bin" depends="jar">
877 <fileset dir="${basedir}">
878 <patternset refid="dist.bindir.files"/>
879 <patternset refid="dist.lib.files"/>
883 <antcall target="install-gems">
884 <param name="jruby.home" value="dist"/>
886 <tar destfile="jruby-bin-${version.jruby}.tar.gz" compression="gzip">
887 <tarfileset dir="dist" mode="755" prefix="jruby-${version.jruby}">
888 <include name="bin/**"/>
890 <tarfileset dir="dist" prefix="jruby-${version.jruby}">
891 <include name="lib/**"/>
893 <tarfileset dir="${basedir}" prefix="jruby-${version.jruby}">
894 <patternset refid="dist.bin.files"/>
897 <zip destfile="jruby-bin-${version.jruby}.zip">
898 <zipfileset dir="dist" filemode="755" prefix="jruby-${version.jruby}">
899 <include name="bin/**"/>
901 <zipfileset dir="dist" prefix="jruby-${version.jruby}">
902 <include name="lib/**"/>
904 <zipfileset dir="${basedir}" prefix="jruby-${version.jruby}">
905 <patternset refid="dist.bin.files"/>
910 <target name="dist-src" depends="jar">
913 <fileset dir="${basedir}">
914 <patternset refid="dist.bindir.files"/>
915 <patternset refid="dist.lib.files"/>
918 <antcall target="install-gems">
919 <param name="jruby.home" value="dist"/>
922 <tar destfile="jruby-src-${version.jruby}.tar.gz" compression="gzip">
923 <tarfileset dir="dist" mode="755" prefix="jruby-${version.jruby}">
924 <include name="bin/**"/>
926 <tarfileset dir="dist" prefix="jruby-${version.jruby}">
927 <include name="lib/**"/>
929 <tarfileset dir="${basedir}" prefix="jruby-${version.jruby}">
930 <patternset refid="dist.src.files"/>
933 <zip destfile="jruby-src-${version.jruby}.zip">
934 <zipfileset dir="dist" filemode="755" prefix="jruby-${version.jruby}">
935 <include name="bin/**"/>
937 <zipfileset dir="dist" prefix="jruby-${version.jruby}">
938 <include name="lib/**"/>
940 <zipfileset dir="${basedir}" prefix="jruby-${version.jruby}">
941 <patternset refid="dist.src.files"/>
946 <target name="dist-snapshot" depends="jar">
947 <exec executable="${basedir}/bin/jruby" dir="${basedir}">
948 <arg value="tool/snapshot.rb"/>
949 <arg value="${jruby.classes.dir}/jruby.properties"/>
951 <jar destfile="${lib.dir}/jruby.jar" update="true">
952 <fileset dir="${jruby.classes.dir}">
953 <include name="jruby.properties"/>
956 <property name="jar-up-to-date" value="true"/>
957 <antcall target="dist-bin">
958 <param file="${jruby.classes.dir}/jruby.properties"/>
962 <target name="dist-snapshot-install-stuff">
963 <unzip dest="${snapshot.install.dir}" src="jruby-bin-${version.jruby}.zip"/>
964 <chmod perm="755" file="${snapshot.install.dir}/jruby-${version.jruby}/bin/jruby"/>
965 <exec executable="${snapshot.install.dir}/jruby-${version.jruby}/bin/jruby"
966 dir="${snapshot.install.dir}/jruby-${version.jruby}">
969 <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'"/>
973 <target name="dist-snapshot-install" depends="dist-snapshot" if="snapshot.install.dir">
974 <antcall target="dist-snapshot-install-stuff">
975 <param file="${jruby.classes.dir}/jruby.properties"/>
979 <target name="dist" depends="dist-bin,dist-src"/>
981 <target name="dist-clean">
982 <delete includeEmptyDirs="true" quiet="true">
984 <include name="jruby-*.tar.gz"/>
985 <include name="jruby-*.zip"/>
987 <fileset dir="dist" includes="**/*"/>
991 <target name="clean" depends="init" description="Cleans almost everything, leaves downloaded specs">
992 <delete includeemptydirs="true" quiet="true">
993 <fileset dir="${build.dir}" excludes="rubyspec**"/>
995 <delete dir="${dist.dir}"/>
996 <delete quiet="false">
997 <fileset dir="${lib.dir}" includes="jruby*.jar"/>
999 <delete dir="${api.docs.dir}"/>
1000 <delete dir="src_gen"/>
1003 <target name="clean-all" depends="clean" description="Cleans everything, including downloaded specs">
1004 <delete dir="${build.dir}"/>
1007 <property name="nailgun.home" value="${basedir}/tool/nailgun"/>
1009 <target name="need-ng">
1010 <condition property="should.build.ng">
1013 <not><available file="${nailgun.home}/ng"/></not>
1018 <target name="build-ng" depends="need-ng" if="should.build.ng">
1019 <exec executable="make" dir="${nailgun.home}"/>
1022 <target name="jruby-nailgun" depends="generate-method-classes,build-ng"
1023 description="Set up JRuby to be run with Nailgun (jruby-ng, jruby-ng-server)">
1024 <mkdir dir="${build.dir}/nailmain"/>
1025 <javac srcdir="${nailgun.home}/src/java" destdir="${build.dir}/nailmain"
1026 classpath="${nailgun.home}/nailgun-0.7.1.jar:${jruby.classes.dir}" debug="true"
1027 source="${javac.version}" target="${javac.version}"
1028 deprecation="true" encoding="UTF-8" />
1029 <taskdef name="jarjar" classname="com.tonicsystems.jarjar.JarJarTask"
1030 classpath="${build.lib.dir}/jarjar-1.0rc7.jar"/>
1031 <jarjar destfile="${nailgun.home}/jruby-nailgun.jar">
1032 <fileset dir="${jruby.classes.dir}">
1033 <exclude name="org/jruby/util/ant/**/*.class"/>
1035 <fileset dir="${build.dir}/nailmain"/>
1036 <zipfileset src="${build.lib.dir}/asm-3.0.jar"/>
1037 <zipfileset src="${build.lib.dir}/asm-commons-3.0.jar"/>
1038 <zipfileset src="${build.lib.dir}/asm-util-3.0.jar"/>
1039 <zipfileset src="${build.lib.dir}/asm-analysis-3.0.jar"/>
1040 <zipfileset src="${build.lib.dir}/asm-tree-3.0.jar"/>
1041 <zipfileset src="${build.lib.dir}/bytelist-0.1.jar"/>
1042 <zipfileset src="${build.lib.dir}/jvyamlb-0.1.1.jar"/>
1043 <zipfileset src="${build.lib.dir}/jline-0.9.93.jar"/>
1044 <zipfileset src="${build.lib.dir}/joni.jar"/>
1045 <zipfileset src="${build.lib.dir}/jna-posix.jar"/>
1046 <zipfileset src="${build.lib.dir}/jna.jar"/>
1047 <zipfileset src="${build.lib.dir}/joda-time-1.5.1.jar"/>
1048 <zipfileset src="${nailgun.home}/nailgun-0.7.1.jar"/>
1049 <rule pattern="org.objectweb.asm.**" result="jruby.objectweb.asm.@1"/>
1051 <attribute name="Built-By" value="${user.name}"/>
1052 <attribute name="Main-Class" value="org.jruby.Main"/>