Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tag: 1.0.0RC1
Fetching contributors…

Cannot retrieve contributors at this time

550 lines (490 sloc) 22.807 kb
<?xml version="1.0" encoding="UTF-8"?>
<project basedir="." default="jar" name="JRuby">
<description>JRuby is a pure Java implementation of a Ruby interpreter.</description>
<!-- First try to load machine-specific properties. -->
<property file="build.properties"/>
<!-- And then load the defaults. It seems backwards to set defaults AFTER
setting local overrides, but that's how Ant works. -->
<property file="default.build.properties"/>
<path id="build.classpath">
<fileset dir="${lib.dir}" includes="*.jar" excludes="jruby.jar"/>
</path>
<!-- directory that contains emma.jar and emma_ant.jar: -->
<property name="emma.dir" value="${lib.dir}" />
<path id="emma.classpath">
<pathelement location="${emma.dir}/emma.jar" />
<pathelement location="${emma.dir}/emma_ant.jar" />
</path>
<patternset id="java.src.pattern">
<include name="**/*.java"/>
<exclude unless="bsf.present" name="org/jruby/javasupport/bsf/**/*.java"/>
<exclude unless="jdk1.4+" name="**/XmlAstMarshal.java"/>
<exclude unless="jdk1.4+" name="**/AstPersistenceDelegates.java"/>
</patternset>
<patternset id="ruby.src.pattern">
<include name="**/*.rb"/>
</patternset>
<patternset id="other.src.pattern">
<include name="**/*.properties"/>
</patternset>
<target name="init" description="initialize the build">
<xmlproperty file="build-config.xml" keepRoot="false" collapseAttributes="true"/>
<tstamp><format property="build.date" pattern="yyyy-MM-dd"/></tstamp>
<property environment="env"/>
<property name="version.ruby" value="${version.ruby.major}.${version.ruby.minor}"/>
<!-- if ruby.home is not set, use env var -->
<condition property="ruby.home" value="${env.RUBY_HOME}">
<not><isset property="ruby.home"/></not>
</condition>
</target>
<target name="prepare" depends="init"
description="Creates the directories needed for building">
<mkdir dir="${build.dir}"/>
<mkdir dir="${classes.dir}"/>
<mkdir dir="${jruby.classes.dir}"/>
<mkdir dir="${test.classes.dir}"/>
<mkdir dir="${test.results.dir}"/>
<mkdir dir="${html.test.results.dir}"/>
<mkdir dir="${docs.dir}"/>
<mkdir dir="${api.docs.dir}"/>
</target>
<target name="ragel" description="Standalone target that generates all our ragel based source files. Requires ragel and rlgen-java to be on the classpath">
<exec executable="ragel" output="__ragel_out">
<arg line="-J"/>
<arg line="${src.dir}/org/jvyamlb/resolver_scanner.rl"/>
</exec>
<exec executable="rlgen-java" input="__ragel_out">
<arg line="-o ${src.dir}/org/jvyamlb/ResolverScanner.java"/>
</exec>
<delete file="__ragel_out" quiet="true"/>
</target>
<target name="check-for-optional-java4-packages"
description="check if specific libs and versions are avaiable"
depends="init">
<available property="jdk1.4+" classname="java.lang.CharSequence"/>
<available property="jdk1.5+" classname="java.lang.StringBuilder"/>
<available property="bsf.present" classname="org.apache.bsf.BSFManager"
classpathref="build.classpath"/>
<available property="junit.present" classname="junit.framework.TestCase"
classpathref="build.classpath"/>
<available property="cglib.present"
classname="net.sf.cglib.reflect.FastClass"
classpathref="build.classpath"/>
</target>
<target name="check-for-optional-packages" if="jdk1.5+"
description="check if specific libs and versions are avaiable"
depends="check-for-optional-java4-packages">
</target>
<target name="compile.tasks" depends="prepare"
description="Builds the Ant tasks that we need later on in the build">
<javac destdir="${jruby.classes.dir}" debug="true" srcdir="${src.dir}"
includes="org/jruby/util/ant/**/*.java" source="${javac.version}">
<classpath refid="build.classpath"/>
</javac>
<taskdef name="jruby-serialize" classname="org.jruby.util.ant.JRubySerialize">
<classpath path="${jruby.classes.dir}"/>
</taskdef>
<copy todir="${jruby.classes.dir}">
<fileset dir="${src.dir}">
<include name="**/*.rb"/>
<exclude name="builtin/**/*.rb"/>
</fileset>
</copy>
<tstamp>
<format property="build.date" pattern="yyyy-MM-dd"/>
</tstamp>
<copy todir="${jruby.classes.dir}" overwrite="true">
<fileset dir="${src.dir}">
<include name="**/*.properties"/>
</fileset>
<filterset>
<filter token="os.arch" value="${os.arch}"/>
<filter token="java.specification.version" value="${java.specification.version}"/>
<filter token="javac.version" value="${javac.version}"/>
<filter token="build.date" value="${build.date}"/>
</filterset>
</copy>
</target>
<target name="compile-jruby" depends="compile.tasks, check-for-optional-packages">
<javac destdir="${jruby.classes.dir}" debug="true" source="${javac.version}">
<classpath refid="build.classpath"/>
<src path="${src.dir}"/>
<patternset refid="java.src.pattern"/>
</javac>
</target>
<target name="compile" depends="compile-jruby"
description="Compile the source files for the project.">
</target>
<target name="serialize" depends="compile"
description="Serializes builting Ruby libraries into Java format">
<jruby-serialize destdir="${jruby.classes.dir}">
<fileset dir="${src.dir}">
<include name="builtin/**/*.rb"/>
</fileset>
</jruby-serialize>
</target>
<target name="generate-method-classes" depends="serialize">
<touch file="${build.dir}/__empty.rb"/>
<java classname="org.jruby.Main" fork="true">
<classpath refid="build.classpath"/>
<classpath path="${jruby.classes.dir}"/>
<sysproperty key="jruby.dump_invocations" value="${jruby.classes.dir}"/>
<arg value="-rjava"/>
<arg value="${build.dir}/__empty.rb"/>
</java>
<delete file="${build.dir}/__empty.rb" quiet="true"/>
</target>
<target name="serialize.rubylib" depends="compile"
description="Serializes the core Ruby library into Java format">
<jruby-serialize destdir="${jruby.classes.dir}" verbose="true">
<fileset dir="${ruby.home}/lib/ruby/1.8">
<patternset refid="ruby.src.pattern"/>
</fileset>
</jruby-serialize>
</target>
<target name="jar-jruby" depends="generate-method-classes">
<jar destfile="${lib.dir}/jruby.jar" compress="true">
<fileset dir="${jruby.classes.dir}">
<exclude name="org/jruby/util/ant/**/*.class"/>
</fileset>
<manifest>
<attribute name="Built-By" value="${user.name}"/>
<attribute name="Main-Class" value="org.jruby.Main"/>
<attribute name="Class-Path" value="asm-2.2.3.jar asm-commons-2.2.3.jar jline-0.9.91.jar bsf.jar backport-util-concurrent.jar"/>
</manifest>
</jar>
</target>
<target name="jar-complete" depends="generate-method-classes" description="Create the 'complete' JRuby jar. Pass 'mainclass' and 'filename' to adjust.">
<property name="mainclass" value="org.jruby.Main"/>
<property name="filename" value="jruby-complete.jar"/>
<taskdef name="jarjar" classname="com.tonicsystems.jarjar.JarJarTask" classpath="${lib.dir}/jarjar-0.7.jar"/>
<jarjar destfile="${lib.dir}/${filename}">
<fileset dir="${jruby.classes.dir}">
<exclude name="org/jruby/util/ant/**/*.class"/>
</fileset>
<fileset dir="${basedir}/lib/ruby/1.8">
<include name="**/*.rb"/>
</fileset>
<zipfileset src="${lib.dir}/asm-2.2.3.jar"/>
<zipfileset src="${lib.dir}/asm-commons-2.2.3.jar"/>
<zipfileset src="${lib.dir}/jline-0.9.91.jar"/>
<zipfileset src="${lib.dir}/backport-util-concurrent.jar"/>
<rule pattern="org.objectweb.asm.**" result="jruby.objectweb.asm.@1"/>
<zipfileset dir="${basedir}" prefix="META-INF/jruby.home">
<include name="bin/*"/>
<include name="lib/ruby/gems/1.8/cache/sources*.gem"/>
<include name="lib/ruby/gems/1.8/gems/sources*/**/*"/>
<include name="lib/ruby/gems/1.8/specifications/sources*.gemspec"/>
<include name="lib/ruby/site_ruby/**/*"/>
</zipfileset>
<manifest>
<attribute name="Built-By" value="${user.name}"/>
<attribute name="Main-Class" value="${mainclass}"/>
</manifest>
</jarjar>
</target>
<target name="jar-light" depends="generate-method-classes" description="Create the 'light' JRuby jar. Pass 'mainclass' and 'filename' to adjust.">
<property name="mainclass" value="org.jruby.Main"/>
<property name="filename" value="jruby-light.jar"/>
<taskdef name="jarjar" classname="com.tonicsystems.jarjar.JarJarTask" classpath="${lib.dir}/jarjar-0.7.jar"/>
<jarjar destfile="${lib.dir}/${filename}">
<fileset dir="${jruby.classes.dir}">
<include name="**/*.class"/>
<include name="**/*.properties"/>
<include name="**/*.rb.ast.ser"/>
<exclude name="org/jruby/util/ant/**/*.class"/>
</fileset>
<fileset dir="${basedir}/lib/ruby/1.8">
<include name="**/*.rb"/>
<exclude name="**/rdoc/**"/>
<exclude name="**/cgi/**"/>
<exclude name="**/bigdecimal/**"/>
<exclude name="**/drb/**"/>
<exclude name="**/io/**"/>
<exclude name="**/net/**"/>
<exclude name="**/racc/**"/>
<exclude name="**/rexml/**"/>
<exclude name="**/rinda/**"/>
<exclude name="**/runit/**"/>
<exclude name="**/shell/**"/>
<exclude name="**/soap/**"/>
<exclude name="**/test/**"/>
<exclude name="**/uri/**"/>
<exclude name="**/webrick/**"/>
<exclude name="**/xmlrpc/**"/>
<exclude name="**/xsd/**"/>
</fileset>
<zipfileset src="${lib.dir}/asm-2.2.3.jar"/>
<zipfileset src="${lib.dir}/asm-commons-2.2.3.jar"/>
<zipfileset src="${lib.dir}/jline-0.9.91.jar"/>
<zipfileset src="${lib.dir}/backport-util-concurrent.jar"/>
<manifest>
<attribute name="Built-By" value="${user.name}"/>
<attribute name="Main-Class" value="${mainclass}"/>
</manifest>
</jarjar>
</target>
<target name="jar-console" depends="generate-method-classes" description="Create the jruby graphical console jar">
<antcall target="jar-light">
<param name="mainclass" value="org.jruby.demo.IRBConsole"/>
<param name="filename" value="jruby-console.jar"/>
</antcall>
</target>
<target name="jar" depends="jar-jruby" description="Create the jruby.jar file">
</target>
<target name="jar.standalone" depends="generate-method-classes, serialize.rubylib, jar"
description="Create a standalone jruby.jar file using libraries from RUBY_HOME/lib/ruby/1.8"/>
<target name="compile-test" depends="jar" description="Compile the unit tests">
<javac destdir="${test.classes.dir}" deprecation="true" debug="true"
source="${javac.version}">
<classpath>
<path refid="build.classpath"/>
<pathelement path="${jruby.classes.dir}"/>
<pathelement path="${lib.dir}/jruby.jar"/>
</classpath>
<src path="${test.dir}"/>
<patternset refid="java.src.pattern"/>
</javac>
</target>
<target name="copy-test-files" depends="compile-test"
description="Make tests fails available as resources">
<copy todir="${test.classes.dir}">
<fileset dir="${test.dir}" includes="org/**/*.rb"/>
</copy>
</target>
<target name="emma" description="turns on EMMA instrumentation/reporting" >
<available property="emma.present"
classname="com.vladium.app.IAppVersion"
classpathref="emma.classpath"/>
<taskdef resource="emma_ant.properties" classpathref="emma.classpath" />
<property name="emma.enabled" value="true" />
<path id="classes_to_instrument" >
<pathelement location="${jruby.classes.dir}" />
</path>
</target>
<target name="instrument" if="emma.present">
<emma enabled="${emma.enabled}" >
<instr instrpathref="classes_to_instrument"
destdir="${jruby.instrumented.classes.dir}"
metadatafile="${test.results.dir}/metadata.emma"
merge="false" />
</emma>
</target>
<target name="coverage-report" if="emma.present">
<emma enabled="${emma.enabled}" >
<report sourcepath="${src.dir}" >
<fileset dir="${test.results.dir}" >
<include name="*.emma" />
</fileset>
<html outfile="${html.test.coverage.results.dir}/coverage.html" />
</report>
</emma>
</target>
<!-- This now has enabled the compiler by default; we may want to run both with and without compilation later -->
<target name="test" depends="copy-test-files,instrument,run-junit-compiled,run-junit-interpreted,coverage-report"/>
<target name="test-compiled" depends="copy-test-files,run-junit-compiled"/>
<target name="test-interpreted" depends="copy-test-files,run-junit-interpreted"/>
<target name="run-junit-interpreted" description="runs junit tests">
<taskdef name="junit" classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask" classpath="${lib.dir}/junit.jar"/>
<junit fork="yes" haltonfailure="true" dir="${basedir}" maxmemory="384M">
<classpath>
<pathelement location="${jruby.instrumented.classes.dir}" />
<path refid="build.classpath"/>
<pathelement path="${java.class.path}"/>
<pathelement path="${lib.dir}/jruby.jar"/>
<pathelement location="${test.classes.dir}"/>
<pathelement path="${test.dir}/requireTest.jar"/>
<pathelement location="${test.dir}"/>
</classpath>
<sysproperty key="java.awt.headless" value="true"/>
<sysproperty key="jruby.base" value="${basedir}"/>
<sysproperty key="jruby.home" value="${basedir}"/>
<sysproperty key="jruby.lib" value="${lib.dir}"/>
<sysproperty key="jruby.jit.enabled" value="false"/>
<sysproperty key="emma.coverage.out.file" value="${test.results.dir}/coverage.emma" />
<sysproperty key="emma.coverage.out.merge" value="true" />
<formatter type="xml"/>
<formatter type="brief" usefile="false"/>
<test name="org.jruby.test.MainTestSuite" todir="${test.results.dir}"/>
<test name="org.jruby.test.ScriptTestSuite" todir="${test.results.dir}"/>
<test name="org.jruby.test.TestUnitTestSuite" todir="${test.results.dir}"/>
<test name="org.jvyamlb.YAMLLoadTest" todir="${test.results.dir}"/>
<test name="org.jvyamlb.YAMLDumpTest" todir="${test.results.dir}"/>
</junit>
</target>
<target name="run-junit-compiled" description="runs junit tests">
<taskdef name="junit" classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask" classpath="${lib.dir}/junit.jar"/>
<junit fork="yes" haltonfailure="true" dir="${basedir}" maxmemory="384M">
<classpath>
<pathelement location="${jruby.instrumented.classes.dir}" />
<path refid="build.classpath"/>
<pathelement path="${java.class.path}"/>
<pathelement path="${lib.dir}/jruby.jar"/>
<pathelement location="${test.classes.dir}"/>
<pathelement path="${test.dir}/requireTest.jar"/>
<pathelement location="${test.dir}"/>
</classpath>
<sysproperty key="java.awt.headless" value="true"/>
<sysproperty key="jruby.base" value="${basedir}"/>
<sysproperty key="jruby.home" value="${basedir}"/>
<sysproperty key="jruby.lib" value="${lib.dir}"/>
<sysproperty key="jruby.jit.enabled" value="true"/>
<sysproperty key="jruby.jit.threshold" value="0"/>
<sysproperty key="emma.coverage.out.file" value="${test.results.dir}/coverage.emma" />
<sysproperty key="emma.coverage.out.merge" value="true" />
<formatter type="xml"/>
<formatter type="brief" usefile="false"/>
<test name="org.jruby.test.MainTestSuite" todir="${test.results.dir}"/>
<test name="org.jruby.test.ScriptTestSuite" todir="${test.results.dir}"/>
<test name="org.jruby.test.TestUnitTestSuite" todir="${test.results.dir}"/>
<test name="org.jvyamlb.YAMLLoadTest" todir="${test.results.dir}"/>
<test name="org.jvyamlb.YAMLDumpTest" todir="${test.results.dir}"/>
</junit>
<junitreport todir="${test.results.dir}">
<fileset dir="${test.results.dir}" includes="TEST-*.xml"/>
<report format="frames" todir="${html.test.results.dir}"/>
</junitreport>
</target>
<target name="create-apidocs" depends="prepare"
description="Creates the Java API docs">
<javadoc destdir="${api.docs.dir}" author="true" version="true" use="true"
windowtitle="JRuby API" source="${javac.version}">
<fileset dir="${src.dir}">
<include name="**/*.java"/>
</fileset>
<fileset dir="${test.dir}">
<include name="**/*.java"/>
</fileset>
<doctitle><![CDATA[<h1>JRuby</h1>]]></doctitle>
<bottom><![CDATA[<i>Copyright &#169; 2002-2006 JRuby Team. All Rights Reserved.</i>]]></bottom>
</javadoc>
</target>
<!-- dist-bin and dist-src use a very common tarfileset... Can tarfileset be
referenced? -->
<target name="dist-bin" depends="jar">
<tar destfile="jruby-bin-${version.jruby}.tar.gz" compression="gzip">
<tarfileset dir="." mode="755" prefix="jruby-${version.jruby}">
<include name="bin/**"/>
</tarfileset>
<tarfileset dir="." prefix="jruby-${version.jruby}">
<include name="lib/**"/>
<include name="samples/**"/>
<include name="docs/**"/>
<include name="COPYING*"/>
<include name="README"/>
<exclude name="lib/ant.jar"/>
</tarfileset>
</tar>
<zip destfile="jruby-bin-${version.jruby}.zip">
<zipfileset dir="." filemode="755" prefix="jruby-${version.jruby}">
<include name="bin/**"/>
</zipfileset>
<zipfileset dir="." prefix="jruby-${version.jruby}">
<include name="lib/**"/>
<include name="samples/**"/>
<include name="docs/**"/>
<include name="COPYING*"/>
<include name="README"/>
<exclude name="lib/ant.jar"/>
</zipfileset>
</zip>
</target>
<target name="dist-src" depends="jar">
<tar destfile="jruby-src-${version.jruby}.tar.gz" compression="gzip">
<tarfileset dir="." mode="755" prefix="jruby-${version.jruby}">
<include name="bin/**"/>
</tarfileset>
<tarfileset dir="." prefix="jruby-${version.jruby}">
<include name="lib/**"/>
<include name="samples/**"/>
<include name="docs/**"/>
<include name="src/**"/>
<include name="test/**"/>
<include name="build.xml"/>
<include name="build-config.xml"/>
<include name="COPYING*"/>
<include name="README"/>
<include name=".project"/>
<include name=".classpath"/>
<include name="default.build.properties"/>
<exclude name="lib/jruby.jar"/>
</tarfileset>
</tar>
<zip destfile="jruby-src-${version.jruby}.zip">
<zipfileset dir="." filemode="755" prefix="jruby-${version.jruby}">
<include name="bin/**"/>
</zipfileset>
<zipfileset dir="." prefix="jruby-${version.jruby}">
<include name="lib/**"/>
<include name="samples/**"/>
<include name="docs/**"/>
<include name="src/**"/>
<include name="test/**"/>
<include name="build.xml"/>
<include name="build-config.xml"/>
<include name="COPYING*"/>
<include name="README"/>
<include name=".project"/>
<include name=".classpath"/>
<include name="default.build.properties"/>
<exclude name="lib/jruby.jar"/>
</zipfileset>
</zip>
</target>
<target name="dist" depends="dist-bin,dist-src"/>
<target name="clean" depends="init" description="clean almost everything">
<delete dir="${build.dir}"/>
<delete quiet="false">
<fileset dir="${lib.dir}" includes="jruby*.jar"/>
</delete>
<delete dir="${api.docs.dir}"/>
</target>
<target name="profile-gem-install-rake" depends="jar" description="Profile a local gem installation of Rake">
<fail unless="netbeans.home">This target can only run inside the NetBeans IDE.</fail>
<nbprofiledirect>
<classpath> <pathelement location="... specify ..."/> </classpath>
</nbprofiledirect>
<java classname="org.jruby.Main" maxmemory="256M" fork="true">
<classpath>
<pathelement location="${jruby.instrumented.classes.dir}" />
<path refid="build.classpath"/>
<pathelement path="${lib.dir}/jruby.jar"/>
<pathelement path="${test.classes.dir}"/>
<pathelement path="${test.dir}/requireTest.jar"/>
</classpath>
<jvmarg value="-Djruby.base=${basedir}"/>
<jvmarg value="-Djruby.home=${basedir}"/>
<jvmarg value="-Djruby.lib=${lib.dir}"/>
<jvmarg value="-Djruby.shell=/bin/sh"/>
<jvmarg value="-Djruby.script=jruby"/>
<jvmarg value="${profiler.info.jvmargs.agent}"/>
<arg value="bin/gem"/>
<arg value="install"/>
<arg value="lib/ruby/gems/1.8/cache/rake-0.7.1.gem"/>
</java>
</target>
<target name="profile-rails-server" depends="jar" description="Profile a local gem installation of Rake">
<fail unless="netbeans.home">This target can only run inside the NetBeans IDE.</fail>
<nbprofiledirect>
<classpath> <pathelement location="... specify ..."/> </classpath>
</nbprofiledirect>
<java classname="org.jruby.Main" maxmemory="256M" fork="true">
<classpath>
<pathelement location="${jruby.instrumented.classes.dir}" />
<path refid="build.classpath"/>
<pathelement path="${lib.dir}/jruby.jar"/>
<pathelement path="${test.classes.dir}"/>
<pathelement path="${test.dir}/requireTest.jar"/>
</classpath>
<jvmarg value="-Djruby.base=${basedir}"/>
<jvmarg value="-Djruby.home=${basedir}"/>
<jvmarg value="-Djruby.lib=${lib.dir}"/>
<jvmarg value="-Djruby.shell=/bin/sh"/>
<jvmarg value="-Djruby.script=jruby"/>
<jvmarg value="-Djruby.thread.pooling=true"/>
<jvmarg value="-server"/>
<jvmarg value="${profiler.info.jvmargs.agent}"/>
<arg value="testapp/script/server"/>
</java>
</target>
</project>
Jump to Line
Something went wrong with that request. Please try again.