legacy-svn-scala/build.xml

1181 lines
44 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<!-- $Id$ -->
<project name="scala-core" default="build">
<description>
I am SABBUS for Scala core, the build system for the Scala compiler and core
library. Please check the 'docs/README' file for more information about me.
</description>
<echo level="info" message="Running SABBUS for ${ant.project.name}..."/>
<!-- ===========================================================================
PROPERTIES
============================================================================ -->
<property environment="env"/>
<!-- Prevents system classpath from being used -->
<property name="build.sysclasspath" value="ignore"/>
<!-- Defines the repository layout -->
<property name="docs.dir" value="${basedir}/docs"/>
<property name="lib.dir" value="${basedir}/lib"/>
<property name="src.dir" value="${basedir}/src"/>
<property name="test.dir" value="${basedir}/test"/>
<!-- Loads custom properties definitions -->
<property name="properties.file" value="${basedir}/build.properties"/>
<property file="${properties.file}"/>
<!-- Defines the product being built -->
<property name="vendor.name" value="LAMP/EPFL"/>
<property name="copyright.string" value="(c) 2002-2007 ${vendor.name}"/>
<property name="number.file" value="${basedir}/build.number"/>
<!-- Configuring how the compiler is run -->
<property name="nsc.log-files" value="no"/>
<property name="nsc.excludes.file" value="${basedir}/build.excludes"/>
<property name="nsc.params" value=""/>
<!-- Sets location of pre-compiled libraries -->
<property name="lib.starr.jar" value="${lib.dir}/scala-library.jar"/>
<property name="comp.starr.jar" value="${lib.dir}/scala-compiler.jar"/>
<property name="fjbg.jar" value="${lib.dir}/fjbg.jar"/>
<property name="msil.jar" value="${lib.dir}/msil.jar"/>
<property name="ant.jar" value="${ant.home}/lib/ant.jar"/>
<property name="ant-contrib.jar" value="${lib.dir}/ant-contrib.jar"/>
<!-- Sets location of build folders -->
<property name="build.dir" value="${basedir}/build"/>
<property name="locker.dir" value="${build.dir}/locker"/>
<property name="quick.dir" value="${build.dir}/quick"/>
<property name="strap.dir" value="${build.dir}/strap"/>
<property name="api-lib.dir" value="${build.dir}/api-library"/>
<property name="api-comp.dir" value="${build.dir}/api-compiler"/>
<property name="tooldocs.dir" value="${build.dir}/tooldocs"/>
<property name="examples.dir" value="${build.dir}/examples"/>
<property name="msil.dir" value="${build.dir}/msil"/>
<!-- Sets location and structure of the distribution -->
<property name="dist.dir" value="${basedir}/dists"/>
<property name="lib.jar.name" value="scala-library.jar"/>
<property name="dbc.jar.name" value="scala-dbc.jar"/>
<property name="actors.jar.name" value="scala-actors.jar"/>
<property name="comp.jar.name" value="scala-compiler.jar"/>
<property name="libsrc.jar.name" value="scala-library-src.jar"/>
<property name="dbcsrc.jar.name" value="scala-dbc-src.jar"/>
<property name="compsrc.jar.name" value="scala-compiler-src.jar"/>
<property name="actorssrc.jar.name" value="scala-actors-src.jar"/>
<property name="scala.exec.name" value="scala"/>
<property name="scalac.exec.name" value="scalac"/>
<property name="scaladoc.exec.name" value="scaladoc"/>
<property name="fsc.exec.name" value="fsc"/>
<property name="comp.prop.name" value="compiler.properties"/>
<!-- ===========================================================================
INITIALISATION
============================================================================ -->
<target name="init" unless="init.avail">
<!-- Making sure lib/ contains everything that is needed -->
<fail message="A required library is missing in 'lib/'. The README file describes what should be there.">
<condition><not><and>
<available file="${lib.starr.jar}"/>
<available file="${comp.starr.jar}"/>
<available file="${fjbg.jar}"/>
<available file="${msil.jar}"/>
<available file="${ant-contrib.jar}"/>
</and></not></condition>
</fail>
<!-- Setting-up Ant contrib tasks -->
<taskdef resource="net/sf/antcontrib/antlib.xml"
classpath="${ant-contrib.jar}"/>
<fail message="External library ${ant-contrib.jar} requires the optional Ant tasks to be installed">
<condition><not><and>
<available file="${ant.home}/lib/ant-nodeps.jar"/>
</and></not></condition>
</fail>
<!-- Making sure enough memory is available -->
<propertyregex
property="memory.set" input="${env.ANT_OPTS}" select="\1"
regexp="-Xmx([1-9][0-9]{3,}|[6-9][0-9]{2}|5[2-9][0-9]|51[2-9])(M|m)"/>
<fail
unless="memory.set"
message="SABBUS requires additional memory. Please set the 'ANT_OPTS' environment property to '-Xmx512M' or more."/>
<!-- This is the start time for the distribution -->
<stopwatch name="timer.dist"/>
<tstamp prefix="time">
<format property="human" pattern="EEEE, d MMMM yyyy, HH:mm:ss (zz)"/>
<format property="short" pattern="yyyyMMdd-HHmmss"/>
</tstamp>
<!-- Creating class-pathes -->
<path id="starr.classpath">
<pathelement location="${lib.starr.jar}"/>
<pathelement location="${comp.starr.jar}"/>
</path>
<!-- Finding out what system architecture is being used -->
<condition property="os.win"><os family="windows"/></condition>
<if><isset property="os.win"/><then>
<exec
executable="cygpath" vmlauncher="no"
errorproperty="cygpath.err" outputproperty="cygpath.out">
<arg value="--windir"/>
</exec>
<condition property="os.cygwin">
<equals arg1="${cygpath.err}" arg2=""/>
</condition>
</then></if>
<condition property="os.unix"><or>
<os family="unix"/>
<os family="mac"/>
<isset property="os.cygwin"/>
</or></condition>
<if><isset property="os.cygwin"/>
<then><property name="os.type" value="Cygwin"/></then>
<elseif><isset property="os.win"/>
<then><property name="os.type" value="Windows"/></then>
</elseif>
<elseif><isset property="os.unix"/>
<then><property name="os.type" value="UNIX"/></then>
</elseif>
<else><fail>System environment could not be determined</fail></else>
</if>
<!-- Setting flag for Java versions 1.4.x -->
<condition property="java14">
<contains string="${java.version}" substring="1.4"/>
</condition>
<!-- Finding out SVN revision -->
<loadfile
property="entries"
srcFile="${basedir}/.svn/entries"
failonerror="false"/>
<propertyregex
property="svn.number" input="${entries}" select="\1"
regexp="revision=\042([0-9]*)\042\.*"
defaultValue="x"/>
<property name="init.avail" value="yes"/>
<!-- Printing out some information about what environment I am running in -->
<echo level="info"
message="OS: ${os.type} (${os.name} ${os.arch} ${os.version});"/>
<echo level="info"
message="Java: ${java.version} ('${java.home}');"/>
<echo level="info"
message="JVM: ${java.vm.name} ${java.vm.version};"/>
<echo level="info"
message="Ant: ${ant.version}."/>
</target>
<!-- ===========================================================================
SETUP
============================================================================ -->
<target name="setup" depends="init">
<!-- Creating boot-level tasks -->
<taskdef
name="starr"
classname="scala.tools.ant.Scalac"
classpathref="starr.classpath"/>
<taskdef
name="starrtool"
classname="scala.tools.ant.ScalaTool"
classpathref="starr.classpath" />
<!-- Removing any outdated stuff -->
<if>
<and>
<available file="${locker.dir}/complete"/>
<not><uptodate targetfile="${locker.dir}/complete">
<srcfiles dir="${lib.dir}" includes="scala-*.jar"/>
</uptodate></not>
</and>
<then>
<echo level="warning"
message="STARR updated: LOCKER is obsolete and will be rebuilt."/>
<runtarget target="clean.build"/>
</then>
</if>
<!-- Finding out what is available -->
<available property="excludes.avail" file="${nsc.excludes.file}"/>
<condition property="locker.avail">
<available file="${locker.dir}/complete"/>
</condition>
<!-- Generating version number -->
<property file="${number.file}"/>
<property
name="version.number"
value="${version.major}.${version.minor}.${version.patch}.${svn.number}.${time.short}"/>
<!-- And print-out what we are building -->
<echo level="info" message="Build number is '${version.number}'"/>
<echo level="info" message="Built ${time.human} from SVN revision ${svn.number}"/>
</target>
<target name="setup.locker" depends="setup, build.locker">
<path id="locker.classpath">
<pathelement location="${locker.dir}/lib/library"/>
<pathelement location="${locker.dir}/lib/compiler"/>
<pathelement location="${fjbg.jar}"/>
<pathelement location="${msil.jar}"/>
</path>
<taskdef
name="locker"
classname="scala.tools.ant.Scalac"
classpathref="locker.classpath"/>
</target>
<target name="setup.quick" depends="setup, build">
<path id="quick.classpath">
<pathelement location="${quick.dir}/lib/library"/>
<pathelement location="${quick.dir}/lib/compiler"/>
<pathelement location="${fjbg.jar}"/>
<pathelement location="${msil.jar}"/>
</path>
<taskdef
name="quick" classname="scala.tools.ant.Scalac"
classpathref="quick.classpath"/>
<taskdef
name="quicksbaz" classname="scala.tools.ant.ScalaBazaar"
classpathref="quick.classpath"/>
<taskdef
name="quickdoc" classname="scala.tools.ant.Scaladoc"
classpathref="quick.classpath"/>
</target>
<!-- ===========================================================================
BUILD SUPPORT MACROS
============================================================================ -->
<macrodef name="build.support">
<attribute name="build.dir"/>
<sequential>
<copy todir="@{build.dir}/lib/library">
<fileset dir="${src.dir}/library">
<include name="**/*.tmpl"/>
<include name="**/*.xml"/>
<include name="**/*.js"/>
<include name="**/*.css"/>
</fileset>
</copy>
<copy todir="@{build.dir}/lib/compiler">
<fileset dir="${src.dir}/compiler">
<include name="**/*.tmpl"/>
<include name="**/*.xml"/>
<include name="**/*.js"/>
<include name="**/*.css"/>
</fileset>
</copy>
</sequential>
</macrodef>
<macrodef name="build.links">
<attribute name="build.dir"/>
<sequential>
<if><not><available file="@{build.dir}/lib/fjbg.jar"/></not><then>
<if><isset property="os.win"/><then>
<copy file="${fjbg.jar}" tofile="@{build.dir}/lib/fjbg.jar"/>
</then><else>
<symlink
link="@{build.dir}/lib/fjbg.jar"
resource="${fjbg.jar}" overwrite="yes" failonerror="no"/>
</else></if>
</then></if>
<if><not><available file="@{build.dir}/lib/msil.jar"/></not><then>
<if><isset property="os.win"/><then>
<copy file="${msil.jar}" tofile="@{build.dir}/lib/msil.jar"/>
</then><else>
<symlink
link="@{build.dir}/lib/msil.jar"
resource="${msil.jar}" overwrite="yes" failonerror="no"/>
</else></if>
</then></if>
</sequential>
</macrodef>
<!-- ===========================================================================
BUILD LOCAL REFERENCE (LOCKER) LAYER
============================================================================ -->
<target name="newlocker"
depends="clean.unfreeze, build.locker"
description="Rebuilds LOCKER from the current sources"/>
<target name="build.locker" depends="setup" unless="locker.avail">
<property name="built.locker" value="yes"/>
<stopwatch name="timer.locker"/>
<!-- Build library -->
<mkdir dir="${locker.dir}/lib/library"/>
<javac
srcdir="${src.dir}/library"
destdir="${locker.dir}/lib/library"
source="1.4" target="1.4" deprecation="yes"
classpath="${locker.dir}/lib/library"
includes="**/*.java"/>
<starr
srcdir="${src.dir}/library"
destdir="${locker.dir}/lib/library"
usepredefs="no" deprecation="yes"
classpath="${locker.dir}/lib/library"
includes="scala/Predef.scala"/>
<starr
srcdir="${src.dir}/library"
destdir="${locker.dir}/lib/library"
deprecation="yes"
classpath="${locker.dir}/lib/library">
<include name="**/*.scala"/>
<exclude name="scala/Predef.scala"/>
<exclude name="scala/dbc/**"/>
<exclude name="scala/actors/**"/>
<excludesfile name="${nsc.excludes.file}" if="excludes.avail"/>
</starr>
<!-- Build compiler -->
<mkdir dir="${locker.dir}/lib/compiler"/>
<starr
srcdir="${src.dir}/compiler"
destdir="${locker.dir}/lib/compiler"
deprecation="yes">
<classpath>
<pathelement location="${locker.dir}/lib/library"/>
<pathelement location="${locker.dir}/lib/compiler"/>
<pathelement location="${fjbg.jar}"/>
<pathelement location="${msil.jar}"/>
<pathelement location="${ant.jar}"/>
</classpath>
<include name="**/*.scala"/>
<excludesfile name="${nsc.excludes.file}" if="excludes.avail"/>
</starr>
<echo
file="${locker.dir}/lib/compiler/${comp.prop.name}"
message="version.number=${version.number}${line.separator}"
append="false"
/>
<echo
file="${locker.dir}/lib/compiler/${comp.prop.name}"
message="copyright.string=${copyright.string}${line.separator}"
append="true"
/>
<!-- Timing the build -->
<stopwatch name="timer.locker" action="total"/>
<!-- Copy support files to build folder and links external libraries-->
<build.support build.dir="${locker.dir}"/>
<build.links build.dir="${locker.dir}"/>
<!-- Build executable files -->
<taskdef
name="lockertool"
classname="scala.tools.ant.ScalaTool"
classpathref="locker.classpath"/>
<mkdir dir="${locker.dir}/bin"/>
<lockertool
file="${locker.dir}/bin/${scala.exec.name}"
version="${version.number}"
copyright="${copyright.string}"
name="Scala code runner"
class="scala.tools.nsc.MainGenericRunner"
javaFlags="-Xmx256M -Xms16M"/>
<lockertool
file="${locker.dir}/bin/${scalac.exec.name}"
name="Scala compiler"
class="scala.tools.nsc.Main"
version="${version.number}"
copyright="${copyright.string}"
javaFlags="-Xmx256M -Xms16M"/>
<lockertool
file="${locker.dir}/bin/${scaladoc.exec.name}"
name="Scala doc generator"
class="scala.tools.nsc.Main"
toolflags="-doc"
version="${version.number}"
copyright="${copyright.string}"
javaFlags="-Xmx256M -Xms16M"/>
<lockertool
file="${locker.dir}/bin/${fsc.exec.name}"
name="Fast Scala compiler"
class="scala.tools.nsc.CompileClient"
version="${version.number}"
copyright="${copyright.string}"
javaFlags="-Xmx256M -Xms16M"/>
<chmod perm="ugo+rx"
file="${locker.dir}/bin/${scalac.exec.name}"/>
<chmod perm="ugo+rx"
file="${locker.dir}/bin/${scala.exec.name}"/>
<chmod perm="ugo+rx"
file="${locker.dir}/bin/${scaladoc.exec.name}"/>
<chmod perm="ugo+rx"
file="${locker.dir}/bin/${fsc.exec.name}"/>
<fixcrlf
srcdir="${locker.dir}/bin"
eol="dos"
includes="**/*.bat"/>
<!-- Mark LOCKER as being completely built -->
<touch file="${locker.dir}/complete" verbose="no"/>
</target>
<!-- ===========================================================================
BUILD QUICK-TEST LAYER
============================================================================ -->
<target name="build" depends="setup.locker"
description="Builds a quick-test (QUICK) version of the compiler">
<stopwatch name="timer.quick"/>
<!-- Build library -->
<mkdir dir="${quick.dir}/lib/library"/>
<javac
srcdir="${src.dir}/library"
destdir="${quick.dir}/lib/library"
source="1.4" target="1.4" deprecation="yes"
classpath="${quick.dir}/lib/library"
includes="**/*.java"/>
<locker
srcdir="${src.dir}/library"
destdir="${quick.dir}/lib/library"
usepredefs="no" addparams="${nsc.params}" deprecation="yes"
scalacdebugging="${nsc.log-files}"
classpath="${quick.dir}/lib/library"
includes="scala/Predef.scala"/>
<locker
srcdir="${src.dir}/library"
destdir="${quick.dir}/lib/library"
addparams="${nsc.params}" deprecation="yes"
scalacdebugging="${nsc.log-files}"
classpath="${quick.dir}/lib/library">
<include name="**/*.scala"/>
<exclude name="scala/Predef.scala"/>
<exclude name="scala/dbc/**"/>
<exclude name="scala/actors/**"/>
<excludesfile name="${nsc.excludes.file}" if="excludes.avail"/>
</locker>
<!-- Build DBC -->
<mkdir dir="${quick.dir}/lib/dbc"/>
<locker
srcdir="${src.dir}/dbc"
destdir="${quick.dir}/lib/dbc"
addparams="${nsc.params}" deprecation="yes"
scalacdebugging="${nsc.log-files}">
<classpath>
<pathelement location="${quick.dir}/lib/library"/>
<pathelement location="${quick.dir}/lib/dbc"/>
</classpath>
<include name="scala/dbc/**/*.scala"/>
<excludesfile name="${nsc.excludes.file}" if="excludes.avail"/>
</locker>
<!-- Build actors library -->
<mkdir dir="${quick.dir}/lib/actors"/>
<javac
srcdir="${src.dir}/actors"
destdir="${quick.dir}/lib/actors"
source="1.4" target="1.4" deprecation="yes"
classpath="${quick.dir}/lib/actors"
includes="scala/actors/**/*.java"/>
<locker
srcdir="${src.dir}/actors"
destdir="${quick.dir}/lib/actors"
addparams="${nsc.params}" deprecation="yes"
scalacdebugging="${nsc.log-files}">
<classpath>
<pathelement location="${quick.dir}/lib/library"/>
<pathelement location="${quick.dir}/lib/actors"/>
</classpath>
<include name="scala/actors/**/*.scala"/>
<exclude name="scala/actors/ThreadPoolScheduler.scala" if="java14"/>
<excludesfile name="${nsc.excludes.file}" if="excludes.avail"/>
</locker>
<!-- Build compiler -->
<mkdir dir="${quick.dir}/lib/compiler"/>
<locker
srcdir="${src.dir}/compiler"
destdir="${quick.dir}/lib/compiler"
addparams="${nsc.params}" deprecation="yes"
scalacdebugging="${nsc.log-files}">
<classpath>
<pathelement location="${quick.dir}/lib/library"/>
<pathelement location="${quick.dir}/lib/compiler"/>
<pathelement location="${fjbg.jar}"/>
<pathelement location="${msil.jar}"/>
<pathelement location="${ant.jar}"/>
</classpath>
<include name="**/*.scala"/>
<excludesfile name="${nsc.excludes.file}" if="excludes.avail"/>
</locker>
<echo
file="${quick.dir}/lib/compiler/${comp.prop.name}"
message="version.number=${version.number}${line.separator}"
append="false"
/>
<echo
file="${quick.dir}/lib/compiler/${comp.prop.name}"
message="copyright.string=${copyright.string}${line.separator}"
append="true"
/>
<!-- Timing the build -->
<stopwatch name="timer.quick" action="total"/>
<!-- Copy support files to build folder and links external libraries-->
<build.support build.dir="${quick.dir}"/>
<build.links build.dir="${quick.dir}"/>
<!-- Build executable files -->
<taskdef
name="quicktool"
classname="scala.tools.ant.ScalaTool"
classpathref="quick.classpath"/>
<mkdir dir="${quick.dir}/bin"/>
<quicktool
file="${quick.dir}/bin/${scala.exec.name}"
version="${version.number}"
copyright="${copyright.string}"
name="Scala code runner"
class="scala.tools.nsc.MainGenericRunner"
javaFlags="-Xmx256M -Xms16M"/>
<quicktool
file="${quick.dir}/bin/${scalac.exec.name}"
name="Scala compiler"
class="scala.tools.nsc.Main"
version="${version.number}"
copyright="${copyright.string}"
javaFlags="-Xmx256M -Xms16M"/>
<quicktool
file="${quick.dir}/bin/${scaladoc.exec.name}"
name="Scala doc generator"
class="scala.tools.nsc.Main"
toolflags="-doc"
version="${version.number}"
copyright="${copyright.string}"
javaFlags="-Xmx256M -Xms16M"/>
<quicktool
file="${quick.dir}/bin/${fsc.exec.name}"
name="Fast Scala compiler"
class="scala.tools.nsc.CompileClient"
version="${version.number}"
copyright="${copyright.string}"/>
<chmod perm="ugo+rx"
file="${quick.dir}/bin/${scalac.exec.name}"/>
<chmod perm="ugo+rx"
file="${quick.dir}/bin/${scala.exec.name}"/>
<chmod perm="ugo+rx"
file="${quick.dir}/bin/${scaladoc.exec.name}"/>
<chmod perm="ugo+rx"
file="${quick.dir}/bin/${fsc.exec.name}"/>
<fixcrlf
srcdir="${quick.dir}/bin"
eol="dos"
includes="**/*.bat"/>
</target>
<target name="test.quick" depends="build">
<echo level="info"
message="Ant test bench is not available yet."/>
</target>
<!-- ===========================================================================
MSIL
============================================================================ -->
<target name="msil.sources">
<mkdir dir="${msil.dir}/src"/>
<copy todir="${msil.dir}/src">
<fileset dir="${src.dir}/library" includes="**/*.scala">
<not>
<present targetdir="${src.dir}/dotnet-library"/>
</not>
</fileset>
</copy>
<copy todir="${msil.dir}/src">
<fileset dir="${src.dir}/dotnet-library">
<include name="**/*.scala"/>
</fileset>
</copy>
</target>
<target name="msil" depends="setup.quick, msil.sources">
<quick srcdir="${msil.dir}/src" usepredefs="no" target="msil"
assemname="${msil.dir}/predef" assemrefs="${lib.dir}">
<include name="scala/Predef.scala" />
<include name="scala/Console.scala" />
<include name="scala/Application.scala" />
<include name="scala/ByNameFunction.scala" />
<include name="scala/*Attribute.scala" />
<include name="scala/Function*.scala" />
<include name="scala/Tuple*.scala" />
<include name="scala/Product*.scala" />
<include name="scala/deprecated.scala" />
<include name="scala/serializable.scala" />
<include name="scala/transient.scala" />
<include name="scala/cloneable.scala" />
<include name="scala/transient.scala" />
<include name="scala/runtime/*.scala" />
</quick>
</target>
<!-- ===========================================================================
TEST
============================================================================ -->
<target name="test" depends="clean.build, test.stability, test.strap"
description="Tests the build for stability (rebuilds everything)"/>
<!-- Build the bootstrap layer -->
<target name="build.strap" depends="setup.quick">
<stopwatch name="timer.strap"/>
<!-- Build library -->
<mkdir dir="${strap.dir}/lib/library"/>
<javac
srcdir="${src.dir}/library"
destdir="${strap.dir}/lib/library"
source="1.4" target="1.4" deprecation="yes"
classpath="${strap.dir}/lib/library"
includes="**/*.java"/>
<quick
srcdir="${src.dir}/library"
destdir="${strap.dir}/lib/library"
usepredefs="no" addparams="${nsc.params}" deprecation="yes"
classpath="${strap.dir}/lib/library"
includes="scala/Predef.scala"/>
<quick
srcdir="${src.dir}/library"
destdir="${strap.dir}/lib/library"
addparams="${nsc.params}" deprecation="yes"
classpath="${strap.dir}/lib/library">
<include name="**/*.scala"/>
<exclude name="scala/Predef.scala"/>
<exclude name="scala/dbc/**"/>
<exclude name="scala/actors/**"/>
<excludesfile name="${nsc.excludes.file}" if="excludes.avail"/>
</quick>
<!-- Build DBC -->
<mkdir dir="${strap.dir}/lib/dbc"/>
<quick
srcdir="${src.dir}/dbc"
destdir="${strap.dir}/lib/dbc"
addparams="${nsc.params}" deprecation="yes">
<classpath>
<pathelement location="${strap.dir}/lib/library"/>
<pathelement location="${strap.dir}/lib/dbc"/>
</classpath>
<include name="scala/dbc/**/*.scala"/>
<excludesfile name="${nsc.excludes.file}" if="excludes.avail"/>
</quick>
<!-- Build actors library -->
<mkdir dir="${strap.dir}/lib/actors"/>
<javac
srcdir="${src.dir}/actors"
destdir="${strap.dir}/lib/actors"
source="1.4" target="1.4" deprecation="yes"
classpath="${strap.dir}/lib/actors"
includes="scala/actors/**/*.java"/>
<quick
srcdir="${src.dir}/actors"
destdir="${strap.dir}/lib/actors"
addparams="${nsc.params}">
<classpath>
<pathelement location="${strap.dir}/lib/library"/>
<pathelement location="${strap.dir}/lib/actors"/>
</classpath>
<include name="scala/actors/**/*.scala"/>
<exclude name="scala/actors/ThreadPoolScheduler.scala" if="java14"/>
<excludesfile name="${nsc.excludes.file}" if="excludes.avail"/>
</quick>
<!-- Build compiler -->
<mkdir dir="${strap.dir}/lib/compiler"/>
<quick
srcdir="${src.dir}/compiler"
destdir="${strap.dir}/lib/compiler"
addparams="${nsc.params}">
<classpath>
<pathelement location="${strap.dir}/lib/library"/>
<pathelement location="${strap.dir}/lib/compiler"/>
<pathelement location="${fjbg.jar}"/>
<pathelement location="${msil.jar}"/>
<pathelement location="${ant.jar}"/>
</classpath>
<include name="**/*.scala"/>
<excludesfile name="${nsc.excludes.file}" if="excludes.avail"/>
</quick>
<echo
file="${strap.dir}/lib/compiler/${comp.prop.name}"
message="version.number=${version.number}${line.separator}"
append="false"
/>
<echo
file="${strap.dir}/lib/compiler/${comp.prop.name}"
message="copyright.string=${copyright.string}${line.separator}"
append="true"
/>
<!-- Timing the build -->
<stopwatch name="timer.strap" action="total"/>
<!-- Copy support files to build folder and links external libraries-->
<build.support build.dir="${strap.dir}"/>
<build.links build.dir="${strap.dir}"/>
<!-- Build executable files -->
<taskdef
name="straptool"
classname="scala.tools.ant.ScalaTool"
classpathref="quick.classpath"/>
<mkdir dir="${strap.dir}/bin"/>
<straptool
file="${strap.dir}/bin/${scala.exec.name}"
version="${version.number}"
copyright="${copyright.string}"
name="Scala code runner"
class="scala.tools.nsc.MainGenericRunner"
javaFlags="-Xmx256M -Xms16M"/>
<straptool
file="${strap.dir}/bin/${scalac.exec.name}"
name="Scala compiler"
class="scala.tools.nsc.Main"
version="${version.number}"
copyright="${copyright.string}"
javaFlags="-Xmx256M -Xms16M"/>
<straptool
file="${strap.dir}/bin/${scaladoc.exec.name}"
name="Scala doc generator"
class="scala.tools.nsc.Main"
toolflags="-doc"
version="${version.number}"
copyright="${copyright.string}"
javaFlags="-Xmx256M -Xms16M"/>
<straptool
file="${strap.dir}/bin/${fsc.exec.name}"
name="Fast Scala compiler"
class="scala.tools.nsc.CompileClient"
version="${version.number}"
copyright="${copyright.string}"/>
<chmod perm="ugo+rx"
file="${strap.dir}/bin/${scalac.exec.name}"/>
<chmod perm="ugo+rx"
file="${strap.dir}/bin/${scala.exec.name}"/>
<chmod perm="ugo+rx"
file="${strap.dir}/bin/${scaladoc.exec.name}"/>
<chmod perm="ugo+rx"
file="${strap.dir}/bin/${fsc.exec.name}"/>
<fixcrlf
srcdir="${strap.dir}/bin"
eol="dos"
includes="**/*.bat"/>
</target>
<!-- Compares quick and test level -->
<target name="test.stability" depends="build.strap">
<checksum totalproperty="quick.md5">
<fileset dir="${quick.dir}/lib">
<include name="library/**"/>
<include name="compiler/**"/>
</fileset>
</checksum>
<delete quiet="yes" failonerror="no">
<fileset dir="${quick.dir}" includes="**/*.MD5"/>
</delete>
<checksum totalproperty="strap.md5">
<fileset dir="${strap.dir}/lib">
<include name="library/**"/>
<include name="compiler/**"/>
</fileset>
</checksum>
<delete quiet="yes" failonerror="no">
<fileset dir="${strap.dir}" includes="**/*.MD5"/>
</delete>
<fail message="Build ${version.number} is not stable">
<condition><not>
<equals arg1="${quick.md5}" arg2="${strap.md5}"/>
</not></condition>
</fail>
<echo level="info" message="Build ${version.number} is stable."/>
</target>
<target name="test.strap" depends="build.strap">
<echo level="info" message="Ant test bench is not available yet."/>
</target>
<!-- ===========================================================================
DOCUMENTATION
============================================================================ -->
<target name="docs" depends="setup.quick"
description="Generated the API for library sources">
<mkdir dir="${api-lib.dir}"/>
<quickdoc
srcdir="${src.dir}"
destdir="${api-lib.dir}"
sourcepath=""
windowtitle="Scala Library Documentation"
documenttitle="&lt;div&gt;Scala ${version.number}&lt;/div&gt;"
classpath="${quick.dir}/lib/library${path.separator}${quick.dir}/lib/actors">
<include name="dbc/**/*.scala"/>
<include name="actors/**/*.scala"/>
<exclude name="actors/scala/actors/ThreadPoolScheduler.scala" if="java14"/>
<include name="library/**/*.scala"/>
<excludesfile name="${nsc.excludes.file}" if="excludes.avail"/>
</quickdoc>
</target>
<target name="docs.compiler" depends="setup.quick"
description="Generated the API for compiler sources">
<mkdir dir="${api-comp.dir}"/>
<quickdoc
srcdir="${src.dir}/compiler"
destdir="${api-comp.dir}"
sourcepath=""
windowtitle="Scala Compiler Documentation"
documenttitle="&lt;div&gt;Scala ${version.number}&lt;/div&gt;">
<classpath>
<pathelement location="${quick.dir}/lib/library"/>
<pathelement location="${quick.dir}/lib/compiler"/>
<pathelement location="${fjbg.jar}"/>
<pathelement location="${msil.jar}"/>
<pathelement location="${ant.jar}"/>
</classpath>
<include name="**/*.scala"/>
<excludesfile name="${nsc.excludes.file}" if="excludes.avail"/>
</quickdoc>
</target>
<target name="docs.manual" depends="setup.quick"
description="Generated the manual for the Scala tools">
<mkdir dir="${tooldocs.dir}/classes"/>
<path id="manual.classpath">
<pathelement location="${quick.dir}/lib/library"/>
<pathelement location="${tooldocs.dir}/classes"/>
</path>
<quick
srcdir="${src.dir}/manual"
destdir="${tooldocs.dir}/classes"
classpathref="manual.classpath">
<include name="**/*.scala"/>
</quick>
<emit command="fsc"/>
<emit command="sbaz"/>
<emit command="scala"/>
<emit command="scalac"/>
<emit command="scaladoc"/>
<emit command="scalap"/>
<fixcrlf srcdir="${tooldocs.dir}" eol="unix" includes="**/*.1"/>
<copy todir="${tooldocs.dir}">
<fileset dir="${src.dir}/manual/scala/tools/docutil/resources">
<include name="**/*.html"/>
<include name="**/*.css"/>
<include name="**/*.gif"/>
<include name="**/*.png"/>
</fileset>
</copy>
</target>
<macrodef name="emit">
<attribute name="command"/>
<sequential>
<java classname="scala.tools.docutil.EmitHtml"
output="${tooldocs.dir}/@{command}.html"
classpathref="manual.classpath"
fork="true" logError="yes"
>
<arg value="scala.man1.@{command}"/>
</java>
<java classname="scala.tools.docutil.EmitManPage"
output="${tooldocs.dir}/@{command}.1"
classpathref="manual.classpath"
fork="true" logError="yes"
>
<arg value="scala.man1.@{command}"/>
</java>
</sequential>
</macrodef>
<!-- ===========================================================================
GENERATES A DISTRIBUTION
============================================================================ -->
<target name="dist.devel" depends="init">
<property file="${number.file}"/>
<property name="version.number"
value="${version.major}.${version.minor}.${version.patch}.${svn.number}"/>
<runtarget target="pack"/>
</target>
<target name="dist.patch" depends="init">
<propertyfile file="${number.file}">
<entry key="version.patch" type="int" default="0" operation="+"/>
</propertyfile>
<property file="${number.file}"/>
<property name="version.number"
value="${version.major}.${version.minor}.${version.patch}"/>
<runtarget target="pack"/>
</target>
<target name="dist.minor" depends="init">
<propertyfile file="${number.file}">
<entry key="version.minor" type="int" default="0" operation="+"/>
<entry key="version.patch" type="int" value="0"/>
</propertyfile>
<property file="${number.file}"/>
<property name="version.number"
value="${version.major}.${version.minor}.${version.patch}"/>
<runtarget target="pack"/>
</target>
<target name="dist"
depends="build.dist"
description="Creates a complete Scala distribution"/>
<target name="pack"
depends="build.archive, build.sbaz"
description="Packs a distribution for SBaz and ZIP/TAR"/>
<target name="binaries"
depends="test"
description="Creates a binary Scala distribution">
<property name="dist.current.dir"
value="${dist.dir}/scala-${version.number}"/>
<mkdir dir="${dist.current.dir}"/>
<!-- Copy all requires libraries -->
<mkdir dir="${dist.current.dir}/lib"/>
<jar destfile="${dist.current.dir}/lib/${comp.jar.name}">
<fileset dir="${strap.dir}/lib/compiler"/>
<zipfileset src="${fjbg.jar}"/>
<zipfileset src="${msil.jar}"/>
<manifest>
<attribute name="Signature-Version" value="${version.number}"/>
<attribute name="Built-By" value="${user.name}"/>
<attribute name="Class-Path" value="${lib.jar.name}"/>
<section name="scala/tools/nsc">
<attribute name="Extension-Name" value="scala.tools.nsc"/>
<attribute name="Specification-Title" value="Scala Compiler"/>
<attribute name="Specification-Version" value="${version.number}"/>
<attribute name="Specification-Vendor" value="${vendor.name}"/>
<attribute name="Implementation-Title" value="scala.tools.nsc"/>
<attribute name="Implementation-Version" value="${version.number}"/>
<attribute name="Implementation-Vendor" value="${vendor.name}"/>
</section>
</manifest>
</jar>
<jar destfile="${dist.current.dir}/lib/${lib.jar.name}">
<fileset dir="${strap.dir}/lib/library"/>
<manifest>
<attribute name="Signature-Version" value="${version.number}"/>
<attribute name="Built-By" value="${user.name}"/>
<section name="scala">
<attribute name="Extension-Name" value="scala"/>
<attribute name="Specification-Title" value="Scala Library"/>
<attribute name="Specification-Version" value="${version.number}"/>
<attribute name="Specification-Vendor" value="${vendor.name}"/>
<attribute name="Implementation-Title" value="scala"/>
<attribute name="Implementation-Version" value="${version.number}"/>
<attribute name="Implementation-Vendor" value="${vendor.name}"/>
</section>
</manifest>
</jar>
<jar destfile="${dist.current.dir}/lib/${dbc.jar.name}">
<fileset dir="${strap.dir}/lib/dbc"/>
<manifest>
<attribute name="Signature-Version" value="${version.number}"/>
<attribute name="Built-By" value="${user.name}"/>
<attribute name="Class-Path" value="${lib.jar.name}"/>
<section name="scala/dbc">
<attribute name="Extension-Name" value="scala.dbc"/>
<attribute name="Specification-Title" value="Scala DBC Library"/>
<attribute name="Specification-Version" value="${version.number}"/>
<attribute name="Specification-Vendor" value="${vendor.name}"/>
<attribute name="Implementation-Title" value="scala.dbc"/>
<attribute name="Implementation-Version" value="${version.number}"/>
<attribute name="Implementation-Vendor" value="${vendor.name}"/>
</section>
</manifest>
</jar>
<jar destfile="${dist.current.dir}/lib/${actors.jar.name}">
<fileset dir="${strap.dir}/lib/actors"/>
<manifest>
<attribute name="Signature-Version" value="${version.number}"/>
<attribute name="Built-By" value="${user.name}"/>
<attribute name="Class-Path" value="${lib.jar.name}"/>
<section name="scala/actors">
<attribute name="Extension-Name" value="scala.actors"/>
<attribute name="Specification-Title" value="Scala Actors Library"/>
<attribute name="Specification-Version" value="${version.number}"/>
<attribute name="Specification-Vendor" value="${vendor.name}"/>
<attribute name="Implementation-Title" value="scala.actors"/>
<attribute name="Implementation-Version" value="${version.number}"/>
<attribute name="Implementation-Vendor" value="${vendor.name}"/>
</section>
</manifest>
</jar>
<!-- build source jars -->
<jar
destfile="${dist.current.dir}/lib/${libsrc.jar.name}"
basedir="${src.dir}/library"
includes="**/*.scala"
/>
<jar
destfile="${dist.current.dir}/lib/${dbcsrc.jar.name}"
basedir="${src.dir}/dbc"
includes="**/*.scala"
/>
<jar
destfile="${dist.current.dir}/lib/${compsrc.jar.name}"
basedir="${src.dir}/compiler"
includes="**/*.scala"
/>
<jar
destfile="${dist.current.dir}/lib/${actorssrc.jar.name}"
basedir="${src.dir}/actors"
includes="**/*.scala"
/>
<!-- Copy executable files -->
<mkdir dir="${dist.current.dir}/bin"/>
<copy todir="${dist.current.dir}/bin">
<fileset dir="${strap.dir}/bin"/>
</copy>
<chmod perm="ugo+rx" file="${dist.current.dir}/bin/${scalac.exec.name}"/>
<chmod perm="ugo+rx" file="${dist.current.dir}/bin/${scala.exec.name}"/>
<chmod perm="ugo+rx" file="${dist.current.dir}/bin/${scaladoc.exec.name}"/>
<chmod perm="ugo+rx" file="${dist.current.dir}/bin/${fsc.exec.name}"/>
<!-- Recreate the 'latest' link to point to this distribution -->
<if><isset property="os.win"/>
<then>
<copy todir="${dist.dir}/latest">
<fileset dir="${dist.current.dir}"/>
</copy>
</then>
<else>
<symlink
link="${dist.dir}/latest"
resource="${dist.current.dir}"
overwrite="yes" failonerror="no"/>
</else>
</if>
</target>
<target name="build.dist"
depends="binaries,docs,docs.manual"
description="Creates the latest Scala distribution">
<!-- Copy the API, examples and man -->
<copy todir="${dist.current.dir}/doc/scala">
<fileset dir="${docs.dir}" includes="README,LICENSE"/>
</copy>
<copy todir="${dist.current.dir}/doc/scala/api">
<fileset dir="${api-lib.dir}"/>
</copy>
<copy todir="${dist.current.dir}/doc/scala/examples">
<fileset dir="${docs.dir}/examples"/>
</copy>
<copy todir="${dist.current.dir}/man/man1">
<fileset dir="${tooldocs.dir}" includes="**/*.1"/>
</copy>
<copy todir="${dist.current.dir}/doc/scala/tools">
<fileset dir="${tooldocs.dir}">
<include name="**/*.html"/>
<include name="**/*.css"/>
<include name="**/*.gif"/>
<include name="**/*.png"/>
</fileset>
</copy>
<stopwatch name="timer.dist" action="total"/>
</target>
<!-- Create the SBaz packages -->
<target name="build.sbaz" depends="build.dist">
<property name="sbaz.universe" value="http://scala.epfl.ch/downloads/packages"/>
<mkdir dir="${dist.dir}"/>
<!-- Create the Scala library package -->
<quicksbaz
file="${dist.dir}/scala-library-${version.number}.sbp"
adfile="${dist.dir}/scala-library-${version.number}.advert"
name="scala-library"
version="${version.number}"
desc="The Scala library. This is the minimal requirement to run any Scala program."
link="${sbaz.universe}/scala-library-${version.number}.sbp">
<libset dir="${dist.current.dir}/lib" includes="${lib.jar.name},${dbc.jar.name},${actors.jar.name}"/>
<srcset dir="${dist.current.dir}/lib" includes="${libsrc.jar.name},${dbcsrc.jar.name},${actorssrc.jar.name}"/>
</quicksbaz>
<!-- Create the Scala developper package -->
<quicksbaz
file="${dist.dir}/scala-devel-${version.number}.sbp"
adfile="${dist.dir}/scala-devel-${version.number}.advert"
name="scala-devel"
version="${version.number}"
desc="The Scala developper tools. This contains everything that is required to write, test and document new Scala programs, as well as all developper documentation."
depends="scala-library"
link="${sbaz.universe}/scala-devel-${version.number}.sbp">
<binset dir="${dist.current.dir}/bin" includes="**"/>
<docset dir="${dist.current.dir}/doc" includes="**"/>
<libset dir="${dist.current.dir}/lib" includes="${comp.jar.name}"/>
<srcset dir="${dist.current.dir}/lib" includes="${compsrc.jar.name}"/>
<manset dir="${dist.current.dir}/man" includes="**"/>
</quicksbaz>
<!-- Creates the empty umbrella Scala package -->
<quicksbaz
file="${dist.dir}/scala-${version.number}.sbp"
adfile="${dist.dir}/scala-${version.number}.advert"
name="scala"
version="${version.number}"
desc="The base Scala package that contains everything needed to start using Scala."
depends="scala-library,scala-devel"
link="${sbaz.universe}/scala-${version.number}.sbp"/>
<!-- Creates the Scala test package -->
<quicksbaz
file="${dist.dir}/scala-test-${version.number}.sbp"
adfile="${dist.dir}/scala-test-${version.number}.advert"
name="scala-test"
version="${version.number}"
desc="The Scala test package contains everything needed to test Scala."
link="${sbaz.universe}/scala-test-${version.number}.sbp">
<binset dir="${basedir}/test"
includes="clitest,diff/diff.*,diff/lib*.dll,scalatest,scalatest.bat"/>
<miscset
dir="${basedir}/test"
includes="files/**/*.args,files/**/*.check,files/**/*.jar,files/**/*.java,files/**/*.scala,files/cli/**/*.check.*"/>
</quicksbaz>
</target>
<target name="build.archive" depends="build.dist">
<tar
destfile="${dist.dir}/scala-${version.number}.tgz"
compression="gzip">
<tarfileset dir="${dist.current.dir}" includes="bin/**" mode="755"/>
<tarfileset dir="${dist.current.dir}" excludes="bin/**"/>
</tar>
<checksum
file="${dist.dir}/scala-${version.number}.tgz"
forceOverwrite="yes"
fileext=".md5"/>
<!-- Create zip archive -->
<zip
basedir="${dist.current.dir}"
destfile="${dist.dir}/scala-${version.number}.zip"/>
<checksum
file="${dist.dir}/scala-${version.number}.zip"
forceOverwrite="yes"
fileext=".md5"/>
</target>
<!-- ===========================================================================
CLEAN
============================================================================ -->
<macrodef name="remove">
<attribute name="dir"/>
<sequential>
<delete dir="@{dir}" includeemptydirs="yes" quiet="yes" failonerror="no"/>
</sequential>
</macrodef>
<target name="clean" description="Removes QUICK, STRAP and API build products">
<remove dir="${quick.dir}"/>
<remove dir="${strap.dir}"/>
<remove dir="${api.dir}"/>
</target>
<target name="clean.build" description="Removes all build products">
<remove dir="${build.dir}"/>
</target>
<target name="clean.msil" description="Removes all MSIL build products">
<remove dir="${msil.dir}"/>
</target>
<target name="clean.all"
description="Removes all build products and distributions">
<remove dir="${build.dir}"/>
<remove dir="${dist.dir}"/>
</target>
<target name="clean.unfreeze" depends="init">
<delete file="${locker.dir}/complete" quiet="yes" failonerror="no"/>
<remove dir="${quick.dir}"/>
</target>
</project>