Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

435 lines (378 sloc) 17.741 kb
<?xml version="1.0" encoding="UTF-8"?>
<project basedir="." default="jar" name="JRuby">
<description>JRuby is a Java implementation of a Ruby runtime.</description>
<!-- First try to load machine-specific properties. -->
<property file="build.properties"/>
<!-- Then set defaults for any values not set by build.properties -->
<property file="default.build.properties"/>
<patternset id="java.src.pattern">
<include name="**/*.java"/>
<exclude unless="sun-misc-signal" name="**/SunSignalFacade.java"/>
</patternset>
<import file="netbeans-ant.xml" optional="true"/>
<import file="ivy/build.xml"/>
<import file="antlib/test.xml"/>
<import file="antlib/spec.xml"/>
<import file="antlib/util.xml"/>
<condition property="dev.null" value="/dev/null">
<os family="unix"/>
</condition>
<condition property="dev.null" value="NUL">
<os family="windows"/>
</condition>
<condition property="dev.null" value="dev_null">
<not>
<or>
<os family="unix"/>
<os family="windows"/>
</or>
</not>
</condition>
<!-- test launching: force encoding to UTF-8 because of stupid Macroman on OS X -->
<condition property="test.sysprops.set" value="test.sysprops.mac">
<equals arg1="${java.vendor}" arg2="Apple Inc."/>
</condition>
<condition property="test.sysprops.set" value="test.sysprops.other">
<not>
<equals arg1="${java.vendor}" arg2="Apple Inc."/>
</not>
</condition>
<property name="mac.file.encoding" value="UTF-8"/>
<propertyset id="test.sysprops.mac">
<propertyref name="mac.file.encoding"/>
</propertyset>
<propertyset id="test.sysprops.other">
</propertyset>
<propertyset id="test.sysproperties">
<propertyset refid="${test.sysprops.set}"/>
<mapper type="glob" from="mac.*" to="*"/>
</propertyset>
<!-- if ruby.home is not set, use env var -->
<condition property="ruby.home" value="${env.RUBY_HOME}">
<not>
<isset property="ruby.home"/>
</not>
</condition>
<condition property="is.windows" value="true">
<os family="windows"/>
</condition>
<tstamp>
<format property="build.date" pattern="yyyy-MM-dd"/>
</tstamp>
<property environment="env"/>
<!-- Use JAVA_OPTS env var if set, -ea (supported by all JVMs) otherwise -->
<condition property="java.opts" value="${env.JAVA_OPTS}">
<isset property="env.JAVA_OPTS"/>
</condition>
<condition property="java.opts" value="-ea">
<not>
<isset property="java.opts"/>
</not>
</condition>
<!-- sets up a "make" command from ENV, if available -->
<condition property="make.cmd" value="${env.MAKE}">
<isset property="env.MAKE"/>
</condition>
<condition property="make.cmd" value="make">
<not>
<isset property="make.cmd"/>
</not>
</condition>
<property name="version.ruby" value="${version.ruby.major}.${version.ruby.minor}"/>
<!-- Initializes the build -->
<target name="init" unless="init.hasrun">
<!-- set appropriate spec tag filter if on windows -->
<condition property="spec.windows.flag" value="-g windows">
<os family="windows"/>
</condition>
<!-- if bin/jruby does not exist, copy from bin/jruby.bash -->
<condition property="prepare-bin-jruby.hasrun" value="true">
<available file="bin/jruby"/>
</condition>
<antcall target="prepare-bin-jruby"/>
<!-- Checks if specific libs and versions are avaiable -->
<available property="sun-misc-signal"
classname="sun.misc.Signal"/>
<property name="init.hasrun" value="true"/>
</target>
<!-- Prepares a bin/jruby executable from bin/jruby.bash -->
<target name="prepare-bin-jruby" unless="prepare-bin-jruby.hasrun">
<exec executable="/bin/sh" osfamily="unix">
<arg line="-c 'test -f &quot;${basedir}/bin/jruby&quot; || cp &quot;${basedir}/bin/jruby.bash&quot; &quot;${basedir}/bin/jruby&quot;'"/>
</exec>
<chmod perm="755" file="bin/jruby"/>
</target>
<!-- Creates the directories needed for building -->
<target name="prepare" depends="init, create-dirs, copy-resources">
</target>
<target name="create-dirs" unless="create-dirs.hasrun">
<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}"/>
<property name="create-dirs.hasrun" value="true"/>
</target>
<target name="copy-resources" unless="copy-resources.hasrun">
<copy todir="${jruby.classes.dir}" preservelastmodified="true">
<fileset dir="${src.dir}">
<include name="**/*.rb"/>
</fileset>
</copy>
<property name="copy-resources.hasrun" value="true"/>
</target>
<target name="jar-jruby-dist" depends="jar-jruby">
<antcall target="_osgify-jar_">
<param name="bndfile" value="jruby.bnd"/>
<param name="jar.wrap" value="${lib.dir}/jruby.jar"/>
<param name="bar.wrap" value="${lib.dir}/jruby.bar"/>
</antcall>
</target>
<!-- Use Bnd to wrap the JAR generated by in above task -->
<target name="_osgify-jar_">
<filter token="JRUBY_VERSION" value="${version.jruby}"/>
<copy file="jruby.bnd.template" tofile="${build.dir}/${bndfile}" filtering="true"/>
<taskdef resource="aQute/bnd/ant/taskdef.properties"
classpath="target/bnd.jar"/>
<bndwrap definitions="${build.dir}" output="${dest.lib.dir}">
<fileset file="${jar.wrap}"/>
</bndwrap>
<move file="${bar.wrap}" tofile="${jar.wrap}"
overwrite="true"/>
</target>
<target name="jar-jruby-stdlib" depends="copy-resources, compile" unless="jar-jruby-stdlib.hasrun"
description="Create the 'sdtlib' JRuby jar. Pass 'filename' to adjust.">
<property name="mainclass" value="org.jruby.Main"/>
<property name="filename" value="jruby-stdlib.jar"/>
<property name="bilename" value="jruby-stdlib.bar"/>
<property name="jar-stdlib-home" value="${build.dir}/jar-stdlib/META-INF/jruby.home"/>
<mkdir dir="${jar-stdlib-home}"/>
<copy todir="${jar-stdlib-home}">
<fileset dir="${basedir}">
<patternset refid="dist.bindir.files"/>
<patternset refid="dist.lib.files"/>
</fileset>
</copy>
<java classname="${mainclass}" fork="true" maxmemory="${jruby.launch.memory}" failonerror="true">
<classpath>
<pathelement location="lib/jruby.jar"/>
<pathelement location="${build.dir}/jar-stdlib"/>
</classpath>
<sysproperty key="jruby.home" value="${jar-stdlib-home}"/>
<env key="RUBYOPT" value=""/>
<env key="GEM_HOME" value="${basedir}${jar-stdlib-home}/lib/ruby/gems/shared"/>
<jvmarg line="${java.opts}"/>
<arg line="-S gem install --no-ri --no-rdoc --ignore-dependencies --env-shebang --local ${complete.jar.gems}"/>
</java>
<delete dir="${jar-stdlib-home}/lib/ruby/gems/shared/cache"/>
<jar destfile="${dest.lib.dir}/${filename}">
<fileset dir="${build.dir}/jar-stdlib"/>
<manifest>
<attribute name="Built-By" value="${user.name}"/>
</manifest>
</jar>
<antcall target="_osgify-jar_">
<param name="bndfile" value="jruby-stdlib.bnd"/>
<param name="jar.wrap" value="${dest.lib.dir}/${filename}"/>
<param name="bar.wrap" value="${dest.lib.dir}/${bilename}"/>
</antcall>
<property name="jar-jruby-stdlib.hasrun" value="true"/>
</target>
<target name="jar-jruby-complete" depends="jar-jruby" unless="jar-jruby-complete.hasrun"
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"/>
<property name="bilename" value="jruby-complete.bar"/>
<property name="jar-complete-home" value="${build.dir}/jar-complete/META-INF/jruby.home"/>
<mkdir dir="${jar-complete-home}"/>
<copy todir="${jar-complete-home}">
<fileset dir="${basedir}">
<patternset refid="dist.bindir.files"/>
<patternset refid="dist.lib.files"/>
</fileset>
</copy>
<java classname="${mainclass}" fork="true" maxmemory="${jruby.launch.memory}" failonerror="true">
<classpath>
<pathelement location="lib/jruby.jar"/>
<pathelement location="${build.dir}/jar-complete"/>
</classpath>
<sysproperty key="jruby.home" value="${jar-complete-home}"/>
<env key="RUBYOPT" value=""/>
<env key="GEM_HOME" value="${basedir}/${jar-complete-home}/lib/ruby/gems/shared"/>
<jvmarg line="${java.opts}"/>
<arg line="-S gem install --no-ri --no-rdoc --ignore-dependencies --env-shebang ${complete.jar.gems}"/>
</java>
<delete dir="${jar-complete-home}/lib/ruby/gems/shared/cache"/>
<jar destfile="${dest.lib.dir}/${filename}">
<zipfileset src="lib/jruby.jar"/>
<fileset dir="${build.dir}/jar-complete"/>
<manifest>
<attribute name="Built-By" value="${user.name}"/>
<attribute name="Main-Class" value="${mainclass}"/>
</manifest>
</jar>
<antcall target="_osgify-jar_">
<param name="bndfile" value="jruby-complete.bnd"/>
<param name="jar.wrap" value="${dest.lib.dir}/${filename}"/>
<param name="bar.wrap" value="${dest.lib.dir}/${bilename}"/>
</antcall>
<property name="jar-jruby-complete.hasrun" value="true"/>
</target>
<target name="jar-console" depends="jar-jruby-complete" description="Create the jruby graphical console jar">
<!-- roll the readline and jline jars into jruby-console.jar -->
<jar destfile="lib/jruby-console.jar" update="true" compress="true">
<manifest>
<attribute name="Main-Class" value="org.jruby.demo.readline.IRBConsole"/>
</manifest>
<zipfileset src="${lib.dir}/jruby-complete.jar"/>
<zipfileset src="${lib.dir}/ruby/shared/readline/readline.jar"/>
<zipfileset src="${build.lib.dir}/jline-${jline.version}.jar"/>
</jar>
</target>
<target name="jar" depends="init" description="Create the jruby.jar file. Used during dev.">
<antcall target="jar-jruby" inheritall="true"/>
</target>
<target name="jar-dist" depends="init"
description="Create the jruby.jar file for distribution.">
<antcall target="jar-jruby-dist" inheritall="true"/>
</target>
<target name="jar-stdlib" depends="init" description="Create the jruby-stdlib.jar file.">
<antcall target="jar-jruby-stdlib" inheritall="true"/>
</target>
<target name="jar-complete" depends="init"
description="Create the jruby-complete.jar file.">
<antcall target="jar-jruby-complete" inheritall="true"/>
</target>
<target name="jar-no-encryption-complete" depends="init"
description="Create the jruby-complete.jar file just like jar-complete, but refrains from including anything with encryption algorithms">
<property name="exclude_openssl" value="true"/>
<antcall target="jar-jruby-complete" inheritall="true"/>
</target>
<target name="compile-stdlib" unless="test">
<mkdir dir="${build.dir}/stdlib"/>
<echo message="Compiling 1.8 stdlib..."/>
<java classname="org.jruby.Main" fork="true" maxmemory="${jruby.launch.memory}" failonerror="true">
<classpath path="lib/jruby.jar"/>
<sysproperty key="jruby.home" value="${basedir}"/>
<jvmarg line="-ea ${java.opts}"/>
<arg line="--1.8 -I bin/ -S jrubyc --target ${build.dir}/stdlib lib/ruby/1.8"/>
</java>
<echo message="Compiling 1.9 stdlib..."/>
<java classname="org.jruby.Main" fork="true" maxmemory="${jruby.launch.memory}" failonerror="true">
<classpath path="lib/jruby.jar"/>
<sysproperty key="jruby.home" value="${basedir}"/>
<jvmarg line="-ea ${java.opts}"/>
<arg line="--1.9 -I bin/ -S jrubyc --target ${build.dir}/stdlib lib/ruby/1.9"/>
</java>
</target>
<target name="bootstrap">
<exec executable="mvn">
<arg line="-q -Pbootstrap"/>
</exec>
</target>
<target name="apidocs" depends="prepare"
description="Creates the Java API docs">
<!-- Run the package_docs.rb script to generate package.html files -->
<java classname="org.jruby.Main" fork="true" maxmemory="${jruby.launch.memory}" failonerror="true"
dir="${basedir}">
<classpath path="lib/jruby.jar"/>
<sysproperty key="jruby.home" value="${basedir}"/>
<arg line="tool/package_docs.rb"/>
</java>
<javadoc destdir="${api.docs.dir}" author="true" version="true" use="true"
windowtitle="JRuby API" source="${javac.version}" useexternalfile="true"
encoding="UTF-8" maxmemory="256m">
<fileset dir="${src.dir}">
<include name="**/*.java"/>
</fileset>
<arg value="-J-Dfile.encoding=UTF-8"/>
<classpath path="lib/jruby.jar"/>
<doctitle><![CDATA[<h1>JRuby</h1>]]></doctitle>
<bottom><![CDATA[<i>Copyright &#169; 2002-2009 JRuby Team. All Rights Reserved.</i>]]></bottom>
</javadoc>
</target>
<target name="installer">
<rake task="installer"/>
</target>
<target name="clean" depends="init" description="Cleans almost everything, leaves downloaded specs">
<delete dir="${build.dir}"/>
<delete dir="${dist.dir}"/>
<delete quiet="false">
<fileset dir="${lib.dir}" includes="jruby*.jar"/>
</delete>
<delete dir="${api.docs.dir}"/>
<delete dir="build/src_gen"/>
<antcall target="clean-ng"/>
<exec executable="mvn">
<arg line="-q"/>
<arg line="clean"/>
</exec>
</target>
<property name="nailgun.home" value="tool/nailgun"/>
<target name="need-ng">
<condition property="should.build.ng">
<and>
<os family="unix"/>
<not>
<available file="${nailgun.home}/ng"/>
</not>
</and>
</condition>
</target>
<target name="build-ng" depends="need-ng" if="should.build.ng">
<echo message="Configuring ng client in ${nailgun.home}"/>
<exec executable="./configure" osfamily="unix" dir="${nailgun.home}" failonerror="true" output="${dev.null}"/>
<echo message="Building ng client in ${nailgun.home}"/>
<exec executable="${make.cmd}" osfamily="unix" dir="${nailgun.home}" output="${dev.null}"/>
</target>
<target name="need-clean-ng">
<condition property="should-clean-ng">
<and>
<os family="unix"/>
<available file="${nailgun.home}/Makefile"/>
<available file="${nailgun.home}/ng"/>
</and>
</condition>
</target>
<target name="clean-ng" depends="need-clean-ng" if="should-clean-ng">
<exec executable="${make.cmd}" dir="${nailgun.home}" osfamily="unix" failifexecutionfails="false"
output="${dev.null}">
<arg value="clean"/>
</exec>
</target>
<target name="jruby-nailgun" depends="compile, build-ng"
description="Set up JRuby to be run with Nailgun (jruby-ng, jruby-ng-server)">
<mkdir dir="${build.dir}/nailmain"/>
</target>
<target name="bench-language" depends="jar">
<rake task="bench:language"/>
</target>
<target name="ci-matrix" depends="clean,jar" description="Run a matrix configuration job from Hudson.">
<property name="testtype" value="test"/>
<echo>Running ${testtype} build with JDK ${jdk}</echo>
<antcall target="${testtype}"/>
</target>
<!--
***************************************************************************
Targets below this line are now handled by maven, and should not be edited.
***************************************************************************
-->
<target name="jar-jruby" depends="init" unless="jar-up-to-date, jar-jruby.hasrun">
<exec executable="mvn" failonerror="true">
<arg line="-q"/>
<arg line="-Ptest"/>
<arg line="-DskipTests"/>
<arg line="package"/>
</exec>
<property name="jar-jruby.hasrun" value="true"/>
</target>
<target name="compile" description="Compile the source files for the project.">
<exec executable="mvn" failonerror="true">
<arg line="-q"/>
<arg line="compile"/>
</exec>
</target>
</project>
Jump to Line
Something went wrong with that request. Please try again.