Fix for JRUBY-1948, support the -c syntax check flag
[jruby.git] / build.xml
blob560a51d3fb56abdd7b722ac5abf9299d51881c22
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"/>
9   <!-- And then load the defaults. It seems backwards to set defaults AFTER 
10        setting local overrides, but that's how Ant works. -->
11   <property file="default.build.properties"/>
13   <path id="build.classpath">
14     <fileset dir="${build.lib.dir}" includes="*.jar"/>
15     <fileset dir="${lib.dir}" includes="bsf.jar"/>
16   </path>
18   <!-- directory that contains emma.jar and emma_ant.jar: -->
19   <property name="emma.dir" value="${build.lib.dir}" />
21   <path id="emma.classpath">
22     <pathelement location="${emma.dir}/emma.jar" />
23     <pathelement location="${emma.dir}/emma_ant.jar" />
24   </path>
26   <patternset id="java.src.pattern">
27     <include name="**/*.java"/>
28     <exclude unless="bsf.present" name="org/jruby/javasupport/bsf/**/*.java"/>
29     <exclude unless="jdk1.4+" name="**/XmlAstMarshal.java"/>
30     <exclude unless="jdk1.4+" name="**/AstPersistenceDelegates.java"/>
31   </patternset>
33   <patternset id="ruby.src.pattern">
34     <include name="**/*.rb"/>
35   </patternset>
36   
37   <patternset id="other.src.pattern">
38     <include name="**/*.properties"/>
39   </patternset>
40   
41   <taskdef name="retro" classname="net.sourceforge.retroweaver.ant.RetroWeaverTask" classpathref="build.classpath"/>
42   
43   <import file="netbeans-ant.xml" optional="true"/>
45   <target name="init" description="initialize the build">
46     <xmlproperty file="build-config.xml" keepRoot="false" collapseAttributes="true"/>
47     <tstamp><format property="build.date" pattern="yyyy-MM-dd"/></tstamp>
48     <property environment="env"/>
49     <property name="version.ruby" value="${version.ruby.major}.${version.ruby.minor}"/>
50     <!-- if ruby.home is not set, use env var -->
51     <condition property="ruby.home" value="${env.RUBY_HOME}">
52       <not><isset property="ruby.home"/></not>
53     </condition>
54   </target>
56   <target name="prepare" depends="init" 
57     description="Creates the directories needed for building">
58     <mkdir dir="${build.dir}"/>
59     <mkdir dir="${classes.dir}"/>
60     <mkdir dir="${jruby.classes.dir}"/>
61     <mkdir dir="${test.classes.dir}"/>
62     <mkdir dir="${test.results.dir}"/>
63     <mkdir dir="${html.test.results.dir}"/>
64     <mkdir dir="${docs.dir}"/>
65     <mkdir dir="${api.docs.dir}"/>
66   </target>
68   <target name="ragel" description="Standalone target that generates all our ragel based source files. Requires ragel and rlgen-java to be on the classpath">
69     <exec executable="ragel" output="__ragel_out">
70       <arg line="-J"/>
71       <arg line="${src.dir}/org/jvyamlb/resolver_scanner.rl"/>
72     </exec>
73     <exec executable="rlgen-java" input="__ragel_out">
74       <arg line="-o ${src.dir}/org/jvyamlb/ResolverScanner.java"/>
75     </exec>
76     <delete file="__ragel_out" quiet="true"/>
77   </target>
79   <target name="check-for-optional-java4-packages"
80           description="check if specific libs and versions are avaiable"
81           depends="init">
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"/>
91   </target>
93   <target name="check-for-optional-packages" if="jdk1.5+"
94           description="check if specific libs and versions are avaiable"
95           depends="check-for-optional-java4-packages">
96   </target>
98   <target name="compile.tasks" depends="prepare"
99     description="Builds the Ant tasks that we need later on in the build">
100     <copy todir="${jruby.classes.dir}">
101         <fileset dir="${src.dir}">
102             <include name="**/*.rb"/>
103         </fileset>
104     </copy>
105     <copy todir="${jruby.classes.dir}/builtin">
106         <fileset dir="${lib.dir}/ruby/site_ruby/1.8/builtin">
107             <include name="**/*.rb"/>
108         </fileset>
109     </copy>
110     
111     <tstamp>
112         <format property="build.date" pattern="yyyy-MM-dd"/>
113     </tstamp>
114     
115     <copy todir="${jruby.classes.dir}" overwrite="true">
116         <fileset dir="${src.dir}">
117             <include name="**/*.properties"/>
118         </fileset>
119         <filterset>
120             <filter token="os.arch" value="${os.arch}"/>
121             <filter token="java.specification.version" value="${java.specification.version}"/>
122             <filter token="javac.version" value="${javac.version}"/>
123             <filter token="build.date" value="${build.date}"/>
124         </filterset>
125     </copy>
126   </target>
128   <target name="compile-jruby" depends="compile.tasks, check-for-optional-packages">
129     <javac destdir="${jruby.classes.dir}" debug="true" source="${javac.version}" target="${javac.version}" deprecation="true" encoding="UTF-8">
130        <classpath refid="build.classpath"/>
131        <src path="${src.dir}"/>
132        <patternset refid="java.src.pattern"/>
133     </javac>
134   </target>
136   <target name="compile" depends="compile-jruby"
137           description="Compile the source files for the project.">
138   </target>
140   <target name="generate-method-classes" depends="compile">
141     <touch file="${build.dir}/__empty.rb"/>
142     <!-- individual invokers -->
143     <java classname="org.jruby.Main" fork="true" failonerror="true">
144       <classpath refid="build.classpath"/>
145       <classpath path="${jruby.classes.dir}"/>
146       <sysproperty key="jruby.dump_invocations" value="${jruby.classes.dir}"/>
147       <arg value="-rjava"/>
148       <arg value="${build.dir}/__empty.rb"/>
149     </java>
150     <!-- indexed invokers -->
151     <java classname="org.jruby.Main" fork="true" failonerror="true">
152       <classpath refid="build.classpath"/>
153       <classpath path="${jruby.classes.dir}"/>
154       <sysproperty key="jruby.dump_invocations" value="${jruby.classes.dir}"/>
155       <sysproperty key="jruby.indexed.methods" value="true"/>
156       <arg value="-rjava"/>
157       <arg value="${build.dir}/__empty.rb"/>
158     </java>
159     <delete file="${build.dir}/__empty.rb" quiet="true"/>
160   </target>
162   <target name="jar-jruby" unless="jar-up-to-date">
163       <antcall target="generate-method-classes" inheritall="true"/>
164       <taskdef name="jarjar" classname="com.tonicsystems.jarjar.JarJarTask" classpath="${build.lib.dir}/jarjar-0.7.jar"/>
165       <jarjar destfile="${lib.dir}/jruby.jar">
166         <fileset dir="${jruby.classes.dir}">
167           <exclude name="org/jruby/util/ant/**/*.class"/>
168         </fileset>
169         <zipfileset src="${build.lib.dir}/asm-3.0.jar"/>
170         <zipfileset src="${build.lib.dir}/asm-commons-3.0.jar"/>
171         <zipfileset src="${build.lib.dir}/asm-util-3.0.jar"/>
172         <zipfileset src="${build.lib.dir}/asm-analysis-3.0.jar"/>
173         <zipfileset src="${build.lib.dir}/asm-tree-3.0.jar"/>
174         <zipfileset src="${build.lib.dir}/jline-0.9.91.jar"/>
175         <zipfileset src="${build.lib.dir}/joni.jar"/>
176         <zipfileset src="${build.lib.dir}/jna.jar"/>
177         <zipfileset src="${build.lib.dir}/joda-time-1.5.1.jar"/>
178         <rule pattern="org.objectweb.asm.**" result="jruby.objectweb.asm.@1"/>
179         <manifest>
180           <attribute name="Built-By" value="${user.name}"/>
181           <attribute name="Main-Class" value="org.jruby.Main"/>
182         </manifest>
183       </jarjar>
184   </target>
186   <path id="lib.classpath">
187     <pathelement location="${build.lib.dir}/retroweaver-rt-2.0.jar"/>
188     <pathelement location="${build.lib.dir}/backport-util-concurrent.jar"/>
189     <pathelement location="/usr/java/j2sdk1.4.2_16/jre/lib/rt.jar" />
190     <pathelement location="${lib.dir}/bsf.jar" />
191   </path>
193   <target name="jar-1.4" depends="jar-jruby">
194     <copy file="${lib.dir}/jruby.jar" tofile="${lib.dir}/jruby1.5.jar"/>
195     <retro inputjar="${lib.dir}/jruby1.5.jar" outputjar="${lib.dir}/jruby.jar" target="1.4" failonerror="false" verify="true">
196       <classpath>
197         <path refid="lib.classpath"/>
198         <pathelement location="${lib.dir}/jruby.jar" />
199       </classpath>
200     </retro>
201     <delete file="${lib.dir}/jruby1.5.jar"/>
202   </target>
204   <target name="jar-complete-1.4" depends="jar-complete">
205     <copy file="${lib.dir}/jruby-complete.jar" tofile="${lib.dir}/jruby-complete1.5.jar"/>
206     <retro inputjar="${lib.dir}/jruby-complete1.5.jar" outputjar="${lib.dir}/jruby-complete.jar" target="1.4" failonerror="false" verify="true">
207       <classpath>
208         <path refid="lib.classpath"/>
209         <pathelement location="${lib.dir}/jruby-complete.jar" />
210       </classpath>
211     </retro>
212     <delete file="${lib.dir}/jruby-complete1.5.jar"/>
213   </target>
215     <target name="jar-complete" depends="generate-method-classes" description="Create the 'complete' JRuby jar. Pass 'mainclass' and 'filename' to adjust.">
216       <property name="mainclass" value="org.jruby.Main"/>
217       <property name="filename" value="jruby-complete.jar"/>
218       <taskdef name="jarjar" classname="com.tonicsystems.jarjar.JarJarTask" classpath="${build.lib.dir}/jarjar-0.7.jar"/>
219       <jarjar destfile="${lib.dir}/${filename}">
220         <fileset dir="${jruby.classes.dir}">
221           <exclude name="org/jruby/util/ant/**/*.class"/>
222         </fileset>
223         <fileset dir="${basedir}/lib/ruby/1.8">
224           <include name="**/*.rb"/>
225         </fileset>
226         <zipfileset src="${build.lib.dir}/asm-3.0.jar"/>
227         <zipfileset src="${build.lib.dir}/asm-commons-3.0.jar"/>
228         <zipfileset src="${build.lib.dir}/asm-util-3.0.jar"/>
229         <zipfileset src="${build.lib.dir}/asm-analysis-3.0.jar"/>
230         <zipfileset src="${build.lib.dir}/asm-tree-3.0.jar"/>
231         <zipfileset src="${build.lib.dir}/jline-0.9.91.jar"/>
232         <zipfileset src="${build.lib.dir}/joni.jar"/>
233         <zipfileset src="${build.lib.dir}/jna.jar"/>
234         <zipfileset src="${build.lib.dir}/joda-time-1.5.1.jar"/>
235         <rule pattern="org.objectweb.asm.**" result="jruby.objectweb.asm.@1"/>
236         <zipfileset dir="${basedir}" prefix="META-INF/jruby.home">
237           <include name="bin/*"/>
238           <include name="lib/ruby/gems/1.8/cache/sources*.gem"/>
239           <include name="lib/ruby/gems/1.8/gems/sources*/**/*"/>
240           <include name="lib/ruby/gems/1.8/specifications/sources*.gemspec"/>
241           <include name="lib/ruby/site_ruby/**/*"/>
242         </zipfileset>
243         <manifest>
244           <attribute name="Built-By" value="${user.name}"/>
245           <attribute name="Main-Class" value="${mainclass}"/>
246         </manifest>
247       </jarjar>
248     </target>
251     <target name="jar-console" depends="generate-method-classes" description="Create the jruby graphical console jar">
252           <antcall target="jar-light">
253               <param name="mainclass" value="org.jruby.demo.IRBConsole"/>
254               <param name="filename" value="jruby-console.jar"/>
255           </antcall>
256     </target>
258   <target name="jar" depends="init" description="Create the jruby.jar file">
259     <antcall target="jar-jruby" inheritall="true"/>
260   </target>
262   <target name="compile-test" depends="jar" description="Compile the unit tests">
263     <javac destdir="${test.classes.dir}" deprecation="true" debug="true" 
264            source="${javac.version}">
265       <classpath>
266         <path refid="build.classpath"/>
267         <pathelement path="${jruby.classes.dir}"/>
268         <pathelement path="${lib.dir}/jruby.jar"/>
269       </classpath>
270       <src path="${test.dir}"/>
271       <patternset refid="java.src.pattern"/>
272     </javac>
273   </target>
275   <target name="copy-test-files" depends="compile-test" 
276     description="Make tests fails available as resources">
277     <copy todir="${test.classes.dir}">
278       <fileset dir="${test.dir}" includes="org/**/*.rb"/>
279     </copy>
280   </target>
282   <target name="install-gems">
283     <property name="jruby.home" value="${basedir}"/>
284     <java classname="org.jruby.Main" fork="true" maxmemory="${jruby.launch.memory}" failonerror="true">
285       <classpath refid="build.classpath"/>
286       <classpath path="${jruby.classes.dir}"/>
287       <sysproperty key="jruby.home" value="${jruby.home}"/>
288       <arg value="--command"/>
289       <arg value="maybe_install_gems"/>
290       <arg value="rspec"/>
291       <arg value="rake"/>
292       <arg value="--env-shebang"/>
293     </java>
294   </target>
295   
296   <target name="compile-stdlib" unless="test">
297     <copy todir="${build.dir}/stdlib">
298         <fileset dir="${basedir}/lib/ruby/1.8">
299           <include name="**/*.rb"/>
300         </fileset>
301     </copy>
302     <java classname="org.jruby.Main" fork="true" maxmemory="${jruby.launch.memory}" failonerror="true" dir="${build.dir}/stdlib">
303       <classpath refid="build.classpath"/>
304       <classpath path="${jruby.classes.dir}"/>
305       <sysproperty key="jruby.home" value="${basedir}"/>
306       <sysproperty key="jruby.objectspace.enabled" value="true"/>
307       <jvmarg value="-ea"/>
308       
309       <arg value="-I"/>
310       <arg value="bin/"/>
311       <arg value="-S"/>
312       <arg value="jrubyc"/>
313       <arg line="."/>
314     </java>
315   </target>
317   <target name="emma" description="turns on EMMA instrumentation/reporting" >
318     <available property="emma.present"
319                classname="com.vladium.app.IAppVersion"
320                classpathref="emma.classpath"/>
321     <taskdef resource="emma_ant.properties" classpathref="emma.classpath" />
322   
323     <property name="emma.enabled" value="true" />
325     <path id="classes_to_instrument" >
326       <pathelement location="${jruby.classes.dir}" />
327     </path>   
328   </target>
330   <target name="instrument" if="emma.present">
331     <emma enabled="${emma.enabled}" >
332       <instr instrpathref="classes_to_instrument"
333              destdir="${jruby.instrumented.classes.dir}"  
334              metadatafile="${test.results.dir}/metadata.emma"
335          merge="false" />
336     </emma>
337   </target>
339   <target name="coverage-report" if="emma.present">
340     <emma enabled="${emma.enabled}" >
341       <report sourcepath="${src.dir}" >
342         <fileset dir="${test.results.dir}" >
343       <include name="*.emma" />
344         </fileset>
345         <html outfile="${html.test.coverage.results.dir}/coverage.html" />
346       </report>
347     </emma>
348   </target>
350   <target name="test-short" depends="
351     copy-test-files,
352     instrument,
353     run-junit-interpreted,
354     run-junit-interpreted-1.9,
355     coverage-report">
356   </target>
358   <target name="test" depends="
359     copy-test-files,
360     instrument,
361     run-junit-compiled,
362     run-junit-interpreted,
363     run-junit-compiled-1.9,
364     run-junit-interpreted-1.9,
365     compile-stdlib,
366     coverage-report">
367   </target>
369   <target name="test-compiled" depends="copy-test-files,run-junit-compiled,run-junit-precompiled"/>
370   <target name="test-compiled-1.9" depends="copy-test-files,run-junit-compiled-1.9,run-junit-precompiled-1.9"/>
371   <target name="test-interpreted" depends="copy-test-files,run-junit-interpreted"/>
372   <target name="test-interpreted-1.9" depends="copy-test-files,run-junit-interpreted-1.9"/>
373   <target name="test-reflected" depends="copy-test-files,run-junit-reflected-compiled,run-junit-reflected-precompiled,run-junit-reflected-interpreted"/>
374   <target name="test-threadpool" depends="copy-test-files,run-junit-compiled-threadpool,run-junit-precompiled-threadpool,run-junit-interpreted-threadpool"/>
375   
376   <target name="test-all" depends="
377       copy-test-files,
378       instrument,
379       run-junit-interpreted,
380       run-junit-compiled,
381       run-junit-precompiled,
382       run-junit-interpreted-1.9,
383       run-junit-compiled-1.9,
384       run-junit-precompiled-1.9,
385       run-junit-reflected-interpreted,
386       run-junit-reflected-compiled,
387       run-junit-reflected-precompiled,
388       run-junit-compiled-threadpool,
389       run-junit-precompiled-threadpool,
390       run-junit-interpreted-threadpool,
391       run-junit-object-persistence,
392       compile-stdlib,
393       coverage-report
394   "/>
395   
396   <target name="run-junit-interpreted" description="runs junit tests">
397       <antcall target="run-junit-1.8" inheritall="false"/>
398   </target>
399   
400   <target name="run-junit-interpreted-1.9" description="runs junit tests">
401       <antcall target="run-junit-1.9" inheritall="false"/>
402   </target>
403   
404   <target name="run-junit-reflected-interpreted" description="runs junit tests">
405       <antcall target="run-junit-1.8" inheritall="false">
406           <param name="reflection " value="true"/>
407       </antcall>
408   </target>
409   
410   <target name="run-junit-reflected-interpreted-1.9" description="runs junit tests">
411       <antcall target="run-junit-1.9" inheritall="false">
412           <param name="reflection " value="true"/>
413       </antcall>
414   </target>
415   
416   <target name="run-junit-compiled" description="runs junit tests">
417       <antcall target="run-junit-1.8" inheritall="false">
418           <param name="compile.mode" value="JIT"/>
419           <param name="jit.threshold" value="0"/>
420       </antcall>
421   </target>
422   
423   <target name="run-junit-compiled-1.9" description="runs junit tests">
424       <antcall target="run-junit-1.9" inheritall="false">
425           <param name="compile.mode" value="JIT"/>
426           <param name="jit.threshold" value="0"/>
427       </antcall>
428   </target>
429   
430   <target name="run-junit-reflected-compiled" description="runs junit tests">
431       <antcall target="run-junit-1.8" inheritall="false">
432           <param name="compile.mode" value="JIT"/>
433           <param name="jit.threshold" value="0"/>
434           <param name="reflection" value="true"/>
435       </antcall>
436   </target>
437   
438   <target name="run-junit-reflected-compiled-1.9" description="runs junit tests">
439       <antcall target="run-junit-1.9" inheritall="false">
440           <param name="compile.mode" value="JIT"/>
441           <param name="jit.threshold" value="0"/>
442           <param name="reflection" value="true"/>
443       </antcall>
444   </target>
445   
446   <target name="run-junit-precompiled" description="runs junit tests">
447       <antcall target="run-junit-1.8" inheritall="false">
448           <param name="compile.mode" value="FORCE"/>
449           <param name="jit.threshold" value="0"/>
450       </antcall>
451   </target>
452   
453   <target name="run-junit-precompiled-1.9" description="runs junit tests">
454       <antcall target="run-junit-1.9" inheritall="false">
455           <param name="compile.mode" value="FORCE"/>
456           <param name="jit.threshold" value="0"/>
457       </antcall>
458   </target>
459   
460   <target name="run-junit-reflected-precompiled" description="runs junit tests">
461       <antcall target="run-junit-1.8" inheritall="false">
462           <param name="compile.mode" value="FORCE"/>
463           <param name="jit.threshold" value="0"/>
464           <param name="reflection" value="true"/>
465       </antcall>
466   </target>
467   
468   <target name="run-junit-reflected-precompiled-1.9" description="runs junit tests">
469       <antcall target="run-junit-1.9" inheritall="false">
470           <param name="compile.mode" value="FORCE"/>
471           <param name="jit.threshold" value="0"/>
472           <param name="reflection" value="true"/>
473       </antcall>
474   </target>
475   
476   <target name="run-junit-threadpool" depends="run-junit-interpreted-threadpool,run-junit-compiled-threadpool"/>
477   
478   <target name="run-junit-interpreted-threadpool" description="runs junit tests">
479       <antcall target="run-junit-1.8" inheritall="false">
480           <param name="thread.pooling" value="true"/>
481       </antcall>
482   </target>
483   
484   <target name="run-junit-compiled-threadpool" description="runs junit tests">
485       <antcall target="run-junit-1.8" inheritall="false">
486           <param name="compile.mode" value="JIT"/>
487           <param name="jit.threshold" value="0"/>
488           <param name="thread.pooling" value="true"/>
489       </antcall>
490   </target>
491   
492   <target name="run-junit-precompiled-threadpool" description="runs junit tests">
493       <antcall target="run-junit-1.8" inheritall="false">
494           <param name="compile.mode" value="FORCE"/>
495           <param name="jit.threshold" value="0"/>
496           <param name="thread.pooling" value="true"/>
497       </antcall>
498   </target>
499   
500   <path id="test.class.path">
501     <pathelement location="${jruby.instrumented.classes.dir}" />
502     <path refid="build.classpath"/>
503     <pathelement path="${java.class.path}"/>
504     <pathelement path="${lib.dir}/jruby.jar"/>
505     <pathelement location="${test.classes.dir}"/>
506     <pathelement path="${test.dir}/requireTest.jar"/>
507     <pathelement location="${test.dir}"/>
508   </path>
509   
510   <target name="run-junit-1.8" description="runs junit tests for 1.8 functionality">
511     <!-- set up properties that haven't been assigned -->
512     <property name="compile.mode" value="OFF"/>
513     <property name="jit.threshold" value="20"/>
514     <property name="jit.max" value="-1"/>
515     <property name="objectspace.enabled" value="true"/>
516     <property name="thread.pooling" value="false"/>
517     <property name="reflection" value="false"/>
518     <echo message="compile=${compile.mode}, jit.threshold=${jit.threshold}, jit.max=${jit.max}, objectspace=${objectspace.enabled} threadpool=${thread.pooling} reflection=${reflection}"/>
519     
520     <taskdef name="junit" classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask" classpath="${build.lib.dir}/junit.jar"/>
521     <junit fork="yes" forkMode="once" haltonfailure="true" dir="${basedir}" maxmemory="${jruby.test.memory}" showoutput="true" timeout="600000">
522       <classpath refid="test.class.path"/>
523       
524       <sysproperty key="java.awt.headless" value="true"/>
525       <sysproperty key="jruby.base" value="${basedir}"/>
526       <sysproperty key="jruby.home" value="${basedir}"/>
527       <sysproperty key="jruby.lib" value="${lib.dir}"/>
528       <sysproperty key="jruby.compile.mode" value="${compile.mode}"/>
529       <sysproperty key="jruby.jit.threshold" value="${jit.threshold}"/>
530       <sysproperty key="jruby.jit.max" value="${jit.max}"/>
531       <sysproperty key="jruby.objectspace.enabled" value="${objectspace.enabled}"/>
532       <sysproperty key="jruby.thread.pooling" value="${thread.pooling}"/>
533       <sysproperty key="jruby.reflection" value="${reflection}"/>
534       <sysproperty key="jruby.jit.logging.verbose" value="true"/>
535       <sysproperty key="emma.coverage.out.file" value="${test.results.dir}/coverage.emma" />
536       <sysproperty key="emma.coverage.out.merge" value="true" />
538       <jvmarg value="-ea"/>
540       <formatter type="xml"/>
541       <formatter type="brief" usefile="false" />
543       <test name="${test}" if="test"/>
544       <test name="org.jruby.test.MainTestSuite" todir="${test.results.dir}" unless="test"/>
545       <test name="org.jruby.test.ScriptTestSuite" todir="${test.results.dir}" unless="test"/>
546       <test name="org.jruby.test.BFTSTestSuite" todir="${test.results.dir}" unless="test"/>
547       <test name="org.jruby.test.JRubyTestSuite" todir="${test.results.dir}" unless="test"/>
548       <test name="org.jruby.test.MRITestSuite" todir="${test.results.dir}" unless="test"/>
549       <test name="org.jruby.test.RubiconTestSuite" todir="${test.results.dir}" unless="test"/>
550       <test name="org.jruby.test.RubyTestTestSuite" todir="${test.results.dir}" unless="test"/>
551       <test name="org.jvyamlb.YAMLLoadTest" todir="${test.results.dir}" unless="test"/>
552       <test name="org.jvyamlb.YAMLDumpTest" todir="${test.results.dir}" unless="test"/>
553     </junit>
555     <junitreport todir="${test.results.dir}">
556       <fileset dir="${test.results.dir}" includes="TEST-*.xml"/>
557       <report format="frames" todir="${html.test.results.dir}"/>
558     </junitreport>
559   </target>
560   
561   <target name="run-junit-1.9" description="runs junit tests">
562     <!-- set up properties that haven't been assigned -->
563     <property name="compile.mode" value="OFF"/>
564     <property name="jit.threshold" value="20"/>
565     <property name="jit.max" value="-1"/>
566     <property name="objectspace.enabled" value="false"/>
567     <property name="thread.pooling" value="false"/>
568     <property name="reflection" value="false"/>
569     <echo message="compile=${compile.mode}, jit.threshold=${jit.threshold}, jit.max=${jit.max}, objectspace=${objectspace.enabled} threadpool=${thread.pooling} reflection=${reflection}"/>
570     
571     <taskdef name="junit" classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask" classpath="${build.lib.dir}/junit.jar"/>
572     <junit fork="yes" forkMode="once" haltonfailure="true" dir="${basedir}" maxmemory="${jruby.test.memory}" showoutput="true" timeout="600000">
573       <classpath refid="test.class.path"/>
574       
575       <sysproperty key="java.awt.headless" value="true"/>
576       <sysproperty key="jruby.base" value="${basedir}"/>
577       <sysproperty key="jruby.home" value="${basedir}"/>
578       <sysproperty key="jruby.lib" value="${lib.dir}"/>
579       <sysproperty key="jruby.compile.mode" value="${compile.mode}"/>
580       <sysproperty key="jruby.jit.threshold" value="${jit.threshold}"/>
581       <sysproperty key="jruby.jit.max" value="${jit.max}"/>
582       <sysproperty key="jruby.objectspace.enabled" value="${objectspace.enabled}"/>
583       <sysproperty key="jruby.thread.pooling" value="${thread.pooling}"/>
584       <sysproperty key="jruby.reflection" value="${reflection}"/>
585       <sysproperty key="jruby.compat.version" value="ruby1_9"/>
586       <sysproperty key="jruby.jit.logging.verbose" value="true"/>
587       <sysproperty key="emma.coverage.out.file" value="${test.results.dir}/coverage.emma" />
588       <sysproperty key="emma.coverage.out.merge" value="true" />
590       <jvmarg value="-ea"/>
592       <formatter type="xml"/>
593       <formatter type="brief" usefile="false"/>
595       <test name="${test}" if="test"/>
596       <test name="org.jruby.test.Ruby1_9TestSuite" todir="${test.results.dir}"  unless="test"/>
597     </junit>
599     <junitreport todir="${test.results.dir}">
600       <fileset dir="${test.results.dir}" includes="TEST-*.xml"/>
601       <report format="frames" todir="${html.test.results.dir}"/>
602     </junitreport>
603   </target>
604   
605   <target name="run-junit-object-persistence" description="runs junit tests for object persistence support">
606     <!-- set up properties that haven't been assigned -->
607     <property name="compile.mode" value="OFF"/>
608     <property name="jit.threshold" value="20"/>
609     <property name="objectspace.enabled" value="false"/>
610     <property name="thread.pooling" value="false"/>
611     <property name="reflection" value="false"/>
612     <echo message="compile=${compile.mode}, threshold=${jit.threshold}, objectspace=${objectspace.enabled} threadpool=${thread.pooling} reflection=${reflection}"/>
613     
614     <taskdef name="junit" classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask" classpath="${build.lib.dir}/junit.jar"/>
615     <junit fork="yes" forkMode="once" haltonfailure="true" dir="${basedir}" maxmemory="${jruby.test.memory}" showoutput="true" timeout="600000">
616       <classpath refid="test.class.path"/>
617       
618       <sysproperty key="java.awt.headless" value="true"/>
619       <sysproperty key="jruby.base" value="${basedir}"/>
620       <sysproperty key="jruby.home" value="${basedir}"/>
621       <sysproperty key="jruby.lib" value="${lib.dir}"/>
622       <sysproperty key="jruby.runtime.threadlocal" value="true"/>
623       <sysproperty key="emma.coverage.out.file" value="${test.results.dir}/coverage.emma" />
624       <sysproperty key="emma.coverage.out.merge" value="true" />
626       <jvmarg value="-ea"/>
628       <formatter type="xml"/>
629       <formatter type="brief" usefile="false"/>
631       <test name="${test}" if="test"/>
632       <test name="org.jruby.test.ObjectPersistenceTestSuite" todir="${test.results.dir}" unless="test"/>
633     </junit>
635     <junitreport todir="${test.results.dir}">
636       <fileset dir="${test.results.dir}" includes="TEST-*.xml"/>
637       <report format="frames" todir="${html.test.results.dir}"/>
638     </junitreport>
639   </target>
640   
641   <target name="spec" depends="fetch-specs, run-specs"/>
642   
643   <target name="spec-all" depends="fetch-specs, run-specs-all"/>
644   
645   <target name="fetch-specs">
646       <condition property="rubinius-repo-exists">
647           <available file="${build.dir}/rubinius"/>
648       </condition>
649       
650       <antcall target="do-fetch-specs"/>
651       <antcall target="do-update-specs"/>
652   </target>
653   
654   <target name="do-fetch-specs" unless="rubinius-repo-exists">
655       <exec dir="${build.dir}" executable="git">
656           <arg value="clone"/>
657           <arg value="--depth"/><arg value="1"/>
658           <arg value="git://git.rubini.us/code"/>
659           <arg value="rubinius"/>
660       </exec>
661   </target>
662   
663   <target name="do-update-specs" if="rubinius-repo-exists">
664       <exec dir="${build.dir}/rubinius" executable="git">
665           <arg value="pull"/>
666       </exec>
667   </target>
668   
669   <target name="clear-specs">
670       <delete dir="${build.dir}/rubinius"/>
671   </target>
672   
673   <target name="run-specs">
674       <antcall target="run-specs-precompiled"/>
675       <antcall target="run-specs-compiled"/>
676       <antcall target="run-specs-interpreted"/>
677   </target>
678   
679   <target name="run-specs-all">
680       <antcall target="run-specs-all-precompiled"/>
681   </target>
682   
683   <target name="run-specs-compiled">
684       <antcall target="_run_specs_internal_" inheritall="false">
685           <param name="compile.mode" value="JIT"/>
686           <param name="jit.threshold" value="0"/>
687           <param name="SPEC" value="${working.rubinius.specs}"/>
688       </antcall>
689   </target>
690   
691   <target name="run-specs-precompiled">
692       <antcall target="_run_specs_internal_" inheritall="false">
693           <param name="compile.mode" value="FORCE"/>
694           <param name="jit.threshold" value="0"/>
695           <param name="SPEC" value="${working.rubinius.specs}"/>
696       </antcall>
697   </target>
698   
699   <target name="run-specs-all-precompiled">
700       <antcall target="_run_specs_all_internal_" inheritall="false">
701           <param name="compile.mode" value="FORCE"/>
702           <param name="jit.threshold" value="0"/>
703           <param name="SPEC" value="${working.rubinius.specs}"/>
704       </antcall>
705   </target>
706   
707   <target name="run-specs-interpreted">
708       <antcall target="_run_specs_internal_" inheritall="false">
709           <param name="compile.mode" value="OFF"/>
710           <param name="jit.threshold" value="0"/>
711           <param name="SPEC" value="${working.rubinius.specs}"/>
712       </antcall>
713   </target>
714   
715   <target name="update-excludes">
716     <java classname="org.jruby.Main" fork="true" maxmemory="${jruby.launch.memory}" failonerror="false" dir="${build.dir}/rubinius">
717       <classpath refid="build.classpath"/>
718       <classpath path="${jruby.classes.dir}"/>
719       <sysproperty key="jruby.home" value="${basedir}"/>
720       <sysproperty key="jruby.launch.inproc" value="false"/>
721       
722       <arg value="bin/ci"/>
723       <arg value="-t"/><arg value="${basedir}/bin/jruby"/>
724       <arg value="-c"/>
725       <arg value="-E"/><arg value="${basedir}/test/spec_excludes"/>
726       <arg value="spec/ruby/1.8"/>
727     </java>
728   </target>
729   
730   <target name="_run_specs_internal_">
731     <!-- set up properties that haven't been assigned -->
732     <property name="compile.mode" value="OFF"/>
733     <property name="jit.threshold" value="20"/>
734     <property name="jit.max" value="-1"/>
735     <property name="objectspace.enabled" value="true"/>
736     <property name="thread.pooling" value="false"/>
737     <property name="reflection" value="false"/>
738     <echo message="compile=${compile.mode}, threshold=${jit.threshold}, objectspace=${objectspace.enabled} threadpool=${thread.pooling} reflection=${reflection}"/>
739     
740     <java classname="org.jruby.Main" fork="true" maxmemory="${jruby.launch.memory}" failonerror="true" dir="${build.dir}/rubinius">
741       <classpath refid="build.classpath"/>
742       <classpath path="${jruby.classes.dir}"/>
743       
744       <jvmarg value="-ea"/>
745       
746       <sysproperty key="jruby.home" value="${basedir}"/>
747       <sysproperty key="jruby.launch.inproc" value="false"/>
748       
749       <!-- properties tweaked for individual runs -->
750       <sysproperty key="jruby.compile.mode" value="${compile.mode}"/>
751       <sysproperty key="jruby.jit.threshold" value="${jit.threshold}"/>
752       <sysproperty key="jruby.jit.max" value="${jit.max}"/>
753       <sysproperty key="jruby.objectspace.enabled" value="${objectspace.enabled}"/>
754       <sysproperty key="jruby.thread.pooling" value="${thread.pooling}"/>
755       <sysproperty key="jruby.reflection" value="${reflection}"/>
756       <sysproperty key="jruby.compat.version" value="ruby1_8"/>
757       
758       <arg value="bin/ci"/>
759       <arg value="-t"/><arg value="${basedir}/bin/jruby"/>
760       <arg value="-f"/><arg value="m"/>
761       <arg value="-E"/><arg value="${basedir}/test/spec_excludes"/>
762       <arg value="spec/ruby/1.8"/>
763     </java>
764   </target>
765   
766   <target name="_run_specs_all_internal_">
767     <!-- set up properties that haven't been assigned -->
768     <property name="compile.mode" value="OFF"/>
769     <property name="jit.threshold" value="20"/>
770     <property name="jit.max" value="-1"/>
771     <property name="objectspace.enabled" value="true"/>
772     <property name="thread.pooling" value="false"/>
773     <property name="reflection" value="false"/>
774     <echo message="compile=${compile.mode}, threshold=${jit.threshold}, objectspace=${objectspace.enabled} threadpool=${thread.pooling} reflection=${reflection}"/>
775     
776     <java classname="org.jruby.Main" fork="true" maxmemory="${jruby.launch.memory}" failonerror="true" dir="${build.dir}/rubinius">
777       <classpath refid="build.classpath"/>
778       <classpath path="${jruby.classes.dir}"/>
779       
780       <jvmarg value="-ea"/>
781       
782       <sysproperty key="jruby.home" value="${basedir}"/>
783       <sysproperty key="jruby.launch.inproc" value="false"/>
784       
785       <!-- properties tweaked for individual runs -->
786       <sysproperty key="jruby.compile.mode" value="${compile.mode}"/>
787       <sysproperty key="jruby.jit.threshold" value="${jit.threshold}"/>
788       <sysproperty key="jruby.jit.max" value="${jit.max}"/>
789       <sysproperty key="jruby.objectspace.enabled" value="${objectspace.enabled}"/>
790       <sysproperty key="jruby.thread.pooling" value="${thread.pooling}"/>
791       <sysproperty key="jruby.reflection" value="${reflection}"/>
792       <sysproperty key="jruby.compat.version" value="ruby1_8"/>
793       
794       <arg value="bin/mspec"/>
795       <arg value="-t"/><arg value="${basedir}/bin/jruby"/>
796       <arg value="-V"/>
797       <arg value="spec/ruby/1.8"/>
798     </java>
799   </target>
801   <target name="create-apidocs" depends="prepare" 
802           description="Creates the Java API docs">
803     <javadoc destdir="${api.docs.dir}" author="true" version="true" use="true" 
804              windowtitle="JRuby API" source="${javac.version}" useexternalfile="true">
805       <fileset dir="${src.dir}">
806         <include name="**/*.java"/>
807       </fileset>
808       <fileset dir="${test.dir}">
809     <include name="**/*.java"/>
810       </fileset>
811       <doctitle><![CDATA[<h1>JRuby</h1>]]></doctitle>
812       <bottom><![CDATA[<i>Copyright &#169; 2002-2007 JRuby Team. All Rights Reserved.</i>]]></bottom>
813     </javadoc>
814   </target>
816   <patternset id="dist.bindir.files">
817     <include name="bin/*jruby*"/>
818     <include name="bin/*gem*"/>
819     <include name="bin/*jirb*"/>
820     <include name="bin/generate_yaml_index.rb"/>
821     <include name="bin/testrb"/>
822   </patternset>
824   <patternset id="dist.lib.files">
825     <include name="lib/ruby/1.8/**"/>
826     <include name="lib/ruby/site_ruby/1.8/**"/>
827     <include name="lib/ruby/gems/1.8/specifications/sources-0.0.1.gemspec"/>
828     <include name="lib/ruby/gems/1.8/cache/sources-0.0.1.gem"/>
829     <include name="lib/ruby/gems/1.8/gems/sources-0.0.1/**"/>
830   </patternset>
832   <patternset id="dist.files">
833     <include name="lib/*"/>
834     <include name="samples/**"/>
835     <include name="docs/**"/>
836     <include name="COPYING*"/>
837     <include name="README"/>
838     <exclude name="lib/ruby/**"/>
839   </patternset>
841   <patternset id="dist.bin.files">
842     <patternset refid="dist.files"/>
843     <exclude name="lib/emma.jar"/>
844     <exclude name="lib/emma_ant.jar"/>
845     <exclude name="lib/junit.jar"/>
846     <exclude name="lib/jarjar-0.7.jar"/>
847   </patternset>
849   <patternset id="dist.src.files">
850     <patternset refid="dist.files"/>
851     <include name="src/**"/>
852     <include name="test/**"/>
853     <include name="build_lib/**"/>
854     <include name="build.xml"/>
855     <include name="build-config.xml"/>
856     <include name="nbproject/*"/>
857     <include name=".project"/>
858     <include name=".classpath"/>
859     <include name="default.build.properties"/>
860     <exclude name="lib/jruby.jar"/>
861   </patternset>
863   <target name="dist-bin" depends="jar">
864     <mkdir dir="dist"/>
865     <copy todir="dist">
866       <fileset dir="${basedir}">
867         <patternset refid="dist.bindir.files"/>
868         <patternset refid="dist.lib.files"/>
869       </fileset>
870     </copy>
871     <antcall target="install-gems">
872       <param name="jruby.home" value="dist"/>
873     </antcall>
874     <tar destfile="jruby-bin-${version.jruby}.tar.gz" compression="gzip">
875       <tarfileset dir="dist" mode="755" prefix="jruby-${version.jruby}">
876         <include name="bin/**"/>
877       </tarfileset>
878       <tarfileset dir="dist" prefix="jruby-${version.jruby}">
879         <include name="lib/**"/>
880       </tarfileset>
881       <tarfileset dir="${basedir}" prefix="jruby-${version.jruby}">
882         <patternset refid="dist.bin.files"/>
883       </tarfileset>
884     </tar>
885     <zip destfile="jruby-bin-${version.jruby}.zip">
886       <zipfileset dir="dist" filemode="755" prefix="jruby-${version.jruby}">
887         <include name="bin/**"/>
888       </zipfileset>
889       <zipfileset dir="dist" prefix="jruby-${version.jruby}">
890         <include name="lib/**"/>
891       </zipfileset>
892       <zipfileset dir="${basedir}" prefix="jruby-${version.jruby}">
893         <patternset refid="dist.bin.files"/>
894       </zipfileset>
895     </zip>
896   </target>
898   <target name="dist-src" depends="jar">
899     <mkdir dir="dist"/>
900     <copy todir="dist">
901       <fileset dir="${basedir}">
902         <patternset refid="dist.bindir.files"/>
903         <patternset refid="dist.lib.files"/>
904       </fileset>
905     </copy>
906     <antcall target="install-gems">
907       <param name="jruby.home" value="dist"/>
908     </antcall>
909     <tar destfile="jruby-src-${version.jruby}.tar.gz" compression="gzip">
910       <tarfileset dir="dist" mode="755" prefix="jruby-${version.jruby}">
911         <include name="bin/**"/>
912       </tarfileset>
913       <tarfileset dir="dist" prefix="jruby-${version.jruby}">
914         <include name="lib/**"/>
915       </tarfileset>
916       <tarfileset dir="${basedir}" prefix="jruby-${version.jruby}">
917         <patternset refid="dist.src.files"/>
918       </tarfileset>
919     </tar>
920     <zip destfile="jruby-src-${version.jruby}.zip">
921       <zipfileset dir="dist" filemode="755" prefix="jruby-${version.jruby}">
922         <include name="bin/**"/>
923       </zipfileset>
924       <zipfileset dir="dist" prefix="jruby-${version.jruby}">
925         <include name="lib/**"/>
926       </zipfileset>
927       <zipfileset dir="${basedir}" prefix="jruby-${version.jruby}">
928         <patternset refid="dist.src.files"/>
929       </zipfileset>
930     </zip>
931   </target>
933   <target name="dist-snapshot" depends="jar">
934     <exec executable="${basedir}/bin/jruby" dir="${basedir}">
935       <arg value="tool/snapshot.rb"/>
936       <arg value="${jruby.classes.dir}/jruby.properties"/>
937     </exec>
938     <jar destfile="${lib.dir}/jruby.jar" update="true">
939       <fileset dir="${jruby.classes.dir}">
940         <include name="jruby.properties"/>
941       </fileset>
942     </jar>
943     <property name="jar-up-to-date" value="true"/>
944     <antcall target="dist-bin">
945       <param file="${jruby.classes.dir}/jruby.properties"/>
946     </antcall>
947   </target>
949   <target name="dist-snapshot-install-stuff">
950     <unzip dest="${snapshot.install.dir}" src="jruby-bin-${version.jruby}.zip"/>
951     <chmod perm="755" file="${snapshot.install.dir}/jruby-${version.jruby}/bin/jruby"/>
952     <exec executable="${snapshot.install.dir}/jruby-${version.jruby}/bin/jruby"
953       dir="${snapshot.install.dir}/jruby-${version.jruby}">
954       <arg value="-v"/>
955       <arg value="-e"/>
956       <arg value="system('rm -f ${snapshot.install.dir}/current &amp;&amp; ln -s ${snapshot.install.dir}/jruby-${version.jruby} ${snapshot.install.dir}/current'); puts 'Successfully installed snapshot'"/>
957     </exec>
958   </target>
960   <target name="dist-snapshot-install" depends="dist-snapshot" if="snapshot.install.dir">
961     <antcall target="dist-snapshot-install-stuff">
962       <param file="${jruby.classes.dir}/jruby.properties"/>
963     </antcall>
964   </target>
966   <target name="dist" depends="dist-bin,dist-src"/>
968   <target name="dist-clean">
969     <delete includeEmptyDirs="true" quiet="true">
970       <fileset dir=".">
971         <include name="jruby-*.tar.gz"/>
972         <include name="jruby-*.zip"/>
973       </fileset>
974       <fileset dir="dist" includes="**/*"/>
975     </delete>
976   </target>
978   <target name="clean" depends="init" description="clean almost everything">
979     <delete dir="${build.dir}"/>
980     <delete dir="${dist.dir}"/>
981     <delete quiet="false">
982         <fileset dir="${lib.dir}" includes="jruby*.jar"/>
983     </delete>
984     <delete dir="${api.docs.dir}"/>
985   </target>  
987   <property name="nailgun.home" value="${basedir}/tool/nailgun"/>
989   <target name="need-ng">
990     <condition property="should.build.ng">
991       <and>
992         <os family="unix"/>
993         <not><available file="${nailgun.home}/ng"/></not>
994       </and>
995     </condition>
996   </target>
998   <target name="build-ng" depends="need-ng" if="should.build.ng">
999     <exec executable="make" dir="${nailgun.home}"/>
1000   </target>
1002   <target name="jruby-nailgun" depends="generate-method-classes,build-ng"
1003     description="Set up JRuby to be run with Nailgun (jruby-ng, jruby-ng-server)">
1004     <mkdir dir="${build.dir}/nailmain"/>
1005     <javac srcdir="${nailgun.home}/src/java" destdir="${build.dir}/nailmain"
1006       classpath="${nailgun.home}/nailgun-0.7.1.jar:${jruby.classes.dir}" debug="true"
1007       source="${javac.version}" target="${javac.version}"
1008       deprecation="true" encoding="UTF-8" />
1009     <taskdef name="jarjar" classname="com.tonicsystems.jarjar.JarJarTask"
1010       classpath="${build.lib.dir}/jarjar-0.7.jar"/>
1011     <jarjar destfile="${nailgun.home}/jruby-nailgun.jar">
1012       <fileset dir="${jruby.classes.dir}">
1013         <exclude name="org/jruby/util/ant/**/*.class"/>
1014       </fileset>
1015       <fileset dir="${build.dir}/nailmain"/>
1016       <zipfileset src="${build.lib.dir}/asm-3.0.jar"/>
1017       <zipfileset src="${build.lib.dir}/asm-commons-3.0.jar"/>
1018       <zipfileset src="${build.lib.dir}/asm-util-3.0.jar"/>
1019       <zipfileset src="${build.lib.dir}/asm-analysis-3.0.jar"/>
1020       <zipfileset src="${build.lib.dir}/asm-tree-3.0.jar"/>
1021       <zipfileset src="${build.lib.dir}/jline-0.9.91.jar"/>
1022       <zipfileset src="${build.lib.dir}/joni.jar"/>
1023       <zipfileset src="${build.lib.dir}/jna.jar"/>
1024       <zipfileset src="${build.lib.dir}/joda-time-1.5.1.jar"/>
1025       <zipfileset src="${nailgun.home}/nailgun-0.7.1.jar"/>
1026       <rule pattern="org.objectweb.asm.**" result="jruby.objectweb.asm.@1"/>
1027       <manifest>
1028         <attribute name="Built-By" value="${user.name}"/>
1029         <attribute name="Main-Class" value="org.jruby.Main"/>
1030       </manifest>
1031     </jarjar>
1032   </target>
1033 </project>