legacy-svn-scala/build.xml

1124 lines
37 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<!-- $Id$ -->
<project name="scala-core" default="build">
<description>
I am SABBUS for ${ant.project.name}, 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"/>
<!-- Base properties -->
<property name="docs.dir" value="${basedir}/docs"/>
<property name="examples.dir" value="${docs.dir}/examples"/>
<property name="lib.dir" value="${basedir}/lib"/>
<property name="src.dir" value="${basedir}/src"/>
<property name="test.dir" value="${basedir}/test"/>
<property name="properties" value="${basedir}/build.properties"/>
<echo level="verbose" message="properties=${properties}"/>
<!-- User properties -->
<property file="${properties}"/>
<!-- General properties -->
<property name="number.file" value="${basedir}/build.number"/>
<property name="copyright" value="(c) 2002-2006 LAMP/EPFL"/>
<property name="logs.dir" value="${basedir}/logs"/>
<!-- NSC configuration properties -->
<property name="nsc.logging" value="none"/>
<property name="nsc.log-files" value="no"/>
<property name="nsc.excludes" value="${basedir}/build.excludes"/>
<property name="nsc.params" value=""/>
<property name="nsc.timers" value="${logs.dir}/build.timers"/>
<!-- SVN configuration properties -->
<property name="svn.entries" value="${basedir}/.svn/entries"/>
<!-- Location of pre-compiled libraries properties -->
<property name="starr.lib.jar" value="${lib.dir}/scala-library.jar"/>
<property name="starr.comp.jar" value="${lib.dir}/scala-compiler.jar"/>
<property name="jaco.jar" value="${lib.dir}/jaco.jar"/>
<property name="fjbg.name" value="fjbg.jar"/>
<property name="fjbg.jar" value="${lib.dir}/${fjbg.name}"/>
<property name="ant.jar" value="${ant.home}/lib/ant.jar"/>
<property name="ant-contrib.jar" value="${lib.dir}/ant-contrib.jar"/>
<!-- Location of build products properties -->
<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.dir" value="${build.dir}/api"/>
<!-- Location of source and build elements names properties -->
<property name="lib.dir.name" value="library"/>
<property name="comp.dir.name" value="compiler"/>
<property name="dbc.dir.name" value="dbc"/>
<property name="exec.dir.name" value="exec"/>
<!-- Location of structure of the distribution properties -->
<property name="dist.dir" value="${basedir}/dists"/>
<property name="dist.latest.dir" value="${dist.dir}/latest"/>
<property name="dist.sbaz.dir" value="${dist.dir}/sbaz"/>
<property name="dist.name" value="scala"/>
<property name="lib.jar.name" value="${dist.name}-${lib.dir.name}.jar"/>
<property name="lib-dbc.jar.name" value="${dist.name}-dbc.jar"/>
<property name="comp.jar.name" value="${dist.name}-${comp.dir.name}.jar"/>
<property name="scala.exec.name" value="${dist.name}"/>
<property name="scalai.exec.name" value="scalai"/>
<property name="scalac.exec.name" value="scalac"/>
<property name="scaladoc.exec.name" value="scaladoc"/>
<property name="scalaint.exec.name" value="scalaint"/>
<property name="scalatok.exec.name" value="scalatok"/>
<!-- Shorcut names -->
<property name="locker.lib.dir" value="${locker.dir}/${lib.dir.name}"/>
<property name="locker.comp.dir" value="${locker.dir}/${comp.dir.name}"/>
<property name="quick.lib.dir" value="${quick.dir}/${lib.dir.name}"/>
<property name="quick.comp.dir" value="${quick.dir}/${comp.dir.name}"/>
<property name="quick.dbc.dir" value="${quick.dir}/${dbc.dir.name}"/>
<property name="quick.exec.dir" value="${quick.dir}/${exec.dir.name}"/>
<property name="strap.lib.dir" value="${strap.dir}/${lib.dir.name}"/>
<property name="strap.comp.dir" value="${strap.dir}/${comp.dir.name}"/>
<property name="strap.dbc.dir" value="${strap.dir}/${dbc.dir.name}"/>
<property name="strap.exec.dir" value="${strap.dir}/${exec.dir.name}"/>
<property name="api.lib.dir" value="${api.dir}/${lib.dir.name}"/>
<property name="api.comp.dir" value="${api.dir}/${comp.dir.name}"/>
<!-- sbaz properties -->
<property name="sbaz.lib.name" value="${dist.name}-library"/>
<property name="sbaz.dev.name" value="${dist.name}-devel"/>
<property name="sbaz.scala.name" value="${dist.name}"/>
<property name="sbaz.univ.link" value="http://scala-webapps.epfl.ch/sbaz/scala-dev"/>
<!-- ===========================================================================
INITIALISATION
============================================================================ -->
<target name="init" unless="init.avail">
<tstamp prefix="time">
<format
property="human"
pattern="EEEE, d MMMM yyyy, HH:mm:ss (zz)"
/>
<format
property="short"
pattern="yyyyMMdd-HHmmss"
/>
</tstamp>
<!-- Testing if everything is in place -->
<echo level="verbose" message="starr.lib.jar=${starr.lib.jar}"/>
<fail message="STARR library in 'lib/' is not available">
<condition><not><and>
<available
classname="scala.Predef"
classpath="${starr.lib.jar}"
/>
<available
classname="scala.List"
classpath="${starr.lib.jar}"
/>
<available
classname="scala.runtime.ObjectRef"
classpath="${starr.lib.jar}"
/>
</and></not></condition>
</fail>
<echo level="verbose" message="starr.comp.jar=${starr.comp.jar}"/>
<fail message="STARR compiler in 'lib/' is not available">
<condition><not>
<available
classname="scala.tools.ant.Scalac"
classpath="${starr.comp.jar}:${starr.lib.jar}"
/>
</not></condition>
</fail>
<echo level="verbose" message="fjbg.jar=${fjbg.jar}"/>
<fail message="FJBG library in 'lib/' is not available">
<condition><not>
<available
classname="ch.epfl.lamp.fjbg.JCode"
classpath="${fjbg.jar}"
/>
</not></condition>
</fail>
<echo level="verbose" message="jaco.jar=${jaco.jar}"/>
<fail message="JaCo compiler in 'lib/' is not available">
<condition><not>
<available classname="jaco.pizza.Main" classpath="${jaco.jar}"/>
</not></condition>
</fail>
<echo level="verbose" message="ant.jar=${ant.jar}"/>
<echo level="verbose" message="ant-contrib.jar=${ant-contrib.jar}"/>
<fail message="Additional Ant tasks in 'lib/' is not available">
<condition><not>
<available
classname="net.sf.antcontrib.AntContribVersion"
classpath="${ant-contrib.jar}"
/>
</not></condition>
</fail>
<!-- Creating class-pathes -->
<path id="common.classpath">
<pathelement location="${fjbg.jar}"/>
</path>
<path id="starr.classpath">
<pathelement location="${starr.lib.jar}"/>
<pathelement location="${starr.comp.jar}"/>
<path refid="common.classpath"/>
</path>
<!-- Setting-up Ant contrib tasks -->
<taskdef resource="net/sf/antcontrib/antlib.xml">
<classpath>
<pathelement location="${ant-contrib.jar}"/>
</classpath>
</taskdef>
<!-- Making sure enough memory is available -->
<propertyregex
property="memory.set"
input="${env.ANT_OPTS}"
regexp="-Xmx([1-9][0-9]{3,}|[6-9][0-9]{2}|5[2-9][0-9]|51[2-9])(M|m)"
select="\1"
/>
<fail unless="memory.set">
SABBUS requires additional memory. Please set the 'ANT_OPTS' environment
property to '-Xmx512M' or more.
</fail>
<!-- 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>
<!-- 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}."
/>
<!-- Finding out SVN revision -->
<loadfile
property="entries"
srcFile="${svn.entries}"
failonerror="false"
/>
<propertyregex
property="svn.revision"
input="${entries}"
regexp="revision=\042([0-9]*)\042\.*"
select="\1"
defaultValue="x"
/>
<property name="init.avail" value="yes"/>
</target>
<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"
/>
<taskdef
name="pico"
classname="jaco.pizza.ant.Pico"
classpath="${jaco.jar}"
/>
<!-- 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}"/>
<echo level="verbose" message="excludes.avail=${excludes.avail}"/>
<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.revision}.${time.short}"
/>
<echo level="verbose" message="version.number=${version.number}"/>
<!-- Setup timer -->
<mkdir dir="${logs.dir}"/>
<echo
file="${nsc.timers}"
append="true"
message="${line.separator}Revision ${svn.revision};${line.separator} built ${time.human};${line.separator} by ${java.vm.name} ${java.vm.version};${line.separator} on ${os.name} ${os.arch} ${os.version}:${line.separator}"
/>
</target>
<target name="setup.locker" depends="setup, build.locker">
<path id="locker.classpath">
<pathelement location="${locker.dir}/${lib.dir.name}"/>
<pathelement location="${locker.dir}/${comp.dir.name}"/>
<path refid="common.classpath"/>
</path>
<taskdef
name="locker"
classname="scala.tools.ant.Scalac"
classpathref="locker.classpath"
/>
<taskdef
name="lockertool"
classname="scala.tools.ant.ScalaTool"
classpathref="locker.classpath"
/>
</target>
<target name="setup.quick" depends="setup, build">
<path id="quick.classpath">
<pathelement location="${quick.dir}/${lib.dir.name}"/>
<pathelement location="${quick.dir}/${comp.dir.name}"/>
<path refid="common.classpath"/>
</path>
<taskdef
name="quick"
classname="scala.tools.ant.Scalac"
classpathref="quick.classpath"
/>
<taskdef
name="quicktool"
classname="scala.tools.ant.ScalaTool"
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.dir.name}">
<fileset dir="${src.dir}/${lib.dir.name}">
<include name="**/*.tmpl"/>
<include name="**/*.xml"/>
<include name="**/*.js"/>
<include name="**/*.css"/>
</fileset>
</copy>
<copy todir="@{build.dir}/${comp.dir.name}">
<fileset dir="${src.dir}/${comp.dir.name}">
<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><and>
<available file="@{build.dir}/${fjbg.name}"/>
</and></not>
<then>
<if><isset property="os.unix"/>
<then>
<symlink
link="@{build.dir}/${fjbg.name}"
resource="${fjbg.jar}"
overwrite="yes"
failonerror="no"
/>
</then>
<else>
<copy file="${fjbg.jar}" tofile="@{build.dir}/${fjbg.name}"/>
</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.lib.dir}"/>
<pico
srcdir="${src.dir}/${lib.dir.name}"
destdir="${locker.lib.dir}"
scalahack="yes"
>
<classpath>
<pathelement location="${locker.lib.dir}"/>
</classpath>
<include name="**/*.java"/>
</pico>
<starr
srcdir="${src.dir}/${lib.dir.name}"
destdir="${locker.lib.dir}"
usepredefs="no"
>
<classpath>
<pathelement location="${locker.lib.dir}"/>
</classpath>
<include name="scala/Predef.scala"/>
<include name="scala/runtime/ScalaRunTime.scala"/>
</starr>
<starr
srcdir="${src.dir}/${lib.dir.name}"
destdir="${locker.lib.dir}"
>
<classpath>
<pathelement location="${locker.lib.dir}"/>
</classpath>
<include name="**/*.scala"/>
<exclude name="scala/Predef.scala"/>
<exclude name="scala/runtime/ScalaRunTime.scala"/>
<exclude name="scala/dbc/**"/>
<excludesfile name="${nsc.excludes}" if="excludes.avail"/>
</starr>
<!-- Build compiler -->
<mkdir dir="${locker.comp.dir}"/>
<pico
srcdir="${src.dir}/${comp.dir.name}"
destdir="${locker.comp.dir}"
scalahack="yes"
>
<classpath>
<pathelement location="${locker.lib.dir}"/>
<pathelement location="${locker.comp.dir}"/>
</classpath>
<include name="**/*.java"/>
</pico>
<starr
srcdir="${src.dir}/${comp.dir.name}"
destdir="${locker.comp.dir}"
>
<classpath>
<pathelement location="${locker.lib.dir}"/>
<pathelement location="${locker.comp.dir}"/>
<path refid="starr.classpath"/>
<pathelement location="${ant.jar}"/>
</classpath>
<include name="**/*.scala"/>
<excludesfile name="${nsc.excludes}" if="excludes.avail"/>
</starr>
<stopwatch name="timer.locker" action="total"/>
<echo
file="${nsc.timers}"
append="true"
message=" building LOCKER: ${timer.locker};${line.separator}"
/>
<!-- Copy support files to build folder and links external libraries-->
<build.support build.dir="${locker.dir}"/>
<!-- 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.lib.dir}"/>
<pico
srcdir="${src.dir}/${lib.dir.name}"
destdir="${quick.lib.dir}"
scalahack="yes"
>
<classpath>
<pathelement location="${quick.lib.dir}"/>
</classpath>
<include name="**/*.java"/>
</pico>
<locker
srcdir="${src.dir}/${lib.dir.name}"
destdir="${quick.lib.dir}"
usepredefs="no"
addparams="${nsc.params}"
scalacdebugging="${nsc.log-files}"
>
<classpath>
<pathelement location="${quick.lib.dir}"/>
</classpath>
<include name="scala/Predef.scala"/>
<include name="scala/runtime/ScalaRunTime.scala"/>
</locker>
<locker
srcdir="${src.dir}/${lib.dir.name}"
destdir="${quick.lib.dir}"
addparams="${nsc.params}"
scalacdebugging="${nsc.log-files}"
>
<classpath>
<pathelement location="${quick.lib.dir}"/>
</classpath>
<include name="**/*.scala"/>
<exclude name="scala/Predef.scala"/>
<exclude name="scala/runtime/ScalaRunTime.scala"/>
<exclude name="scala/dbc/**"/>
<excludesfile name="${nsc.excludes}" if="excludes.avail"/>
</locker>
<mkdir dir="${quick.dbc.dir}"/>
<locker
srcdir="${src.dir}/${dbc.dir.name}"
destdir="${quick.dbc.dir}"
addparams="${nsc.params}"
scalacdebugging="${nsc.log-files}"
>
<classpath>
<pathelement location="${quick.lib.dir}"/>
<pathelement location="${quick.dbc.dir}"/>
</classpath>
<include name="scala/dbc/**/*.scala"/>
<excludesfile name="${nsc.excludes}" if="excludes.avail"/>
</locker>
<!-- Build compiler -->
<mkdir dir="${quick.comp.dir}"/>
<pico
srcdir="${src.dir}/${comp.dir.name}"
destdir="${quick.comp.dir}"
scalahack="yes"
>
<classpath>
<pathelement location="${quick.lib.dir}"/>
<pathelement location="${quick.comp.dir}"/>
</classpath>
<include name="**/*.java"/>
</pico>
<locker
srcdir="${src.dir}/${comp.dir.name}"
destdir="${quick.comp.dir}"
addparams="${nsc.params}"
scalacdebugging="${nsc.log-files}"
>
<classpath>
<pathelement location="${quick.lib.dir}"/>
<pathelement location="${quick.comp.dir}"/>
<path refid="locker.classpath"/>
<pathelement location="${ant.jar}"/>
</classpath>
<include name="**/*.scala"/>
<excludesfile name="${nsc.excludes}" if="excludes.avail"/>
</locker>
<stopwatch name="timer.quick" action="total"/>
<echo
file="${nsc.timers}"
append="true"
message=" building QUICK: ${timer.quick};${line.separator}"
/>
<!-- Copy support files to build folder and links external libraries-->
<build.support build.dir="${quick.dir}"/>
<build.links build.dir="${quick.dir}"/>
<echo>${quick.dir}/${exec.dir.name}</echo>
<!-- Build executable files -->
<mkdir dir="${quick.dir}/${exec.dir.name}"/>
<lockertool
file="${quick.dir}/${exec.dir.name}/${scala.exec.name}"
version="${version.number}"
copyright="${copyright}"
extclasspath="#SCALA_HOME#/${lib.dir.name}:#SCALA_HOME#/${dbc.dir.name}"
javaFlags="-Xmx256M -Xms16M"
/>
<lockertool
file="${quick.dir}/${exec.dir.name}/${scalac.exec.name}"
name="Scala compiler"
class="scala.tools.nsc.Main"
version="${version.number}"
copyright="${copyright}"
extclasspath="#SCALA_HOME#/${lib.dir.name}:#SCALA_HOME#/${comp.dir.name}:#SCALA_HOME#/${fjbg.name}:#SCALA_HOME#/${dbc.dir.name}"
javaFlags="-Xmx256M -Xms16M"
/>
<lockertool
file="${quick.dir}/${exec.dir.name}/${scaladoc.exec.name}"
name="Scala doc generator"
class="scala.tools.nsc.Main"
toolflags="-doc"
version="${version.number}"
copyright="${copyright}"
extclasspath="#SCALA_HOME#/${lib.dir.name}:#SCALA_HOME#/${comp.dir.name}:#SCALA_HOME#/${fjbg.name}:#SCALA_HOME#/${dbc.dir.name}"
javaFlags="-Xmx256M -Xms16M"
/>
<lockertool
file="${quick.dir}/${exec.dir.name}/${scalaint.exec.name}"
name="Scala interpreter"
class="scala.tools.nsc.MainInterpreter"
version="${version.number}"
copyright="${copyright}"
extclasspath="#SCALA_HOME#/${lib.dir.name}:#SCALA_HOME#/${comp.dir.name}:#SCALA_HOME#/${fjbg.name}:#SCALA_HOME#/${dbc.dir.name}"
/>
<chmod
file="${quick.dir}/${exec.dir.name}/${scalac.exec.name}"
perm="ugo+rx"
/>
<chmod
file="${quick.dir}/${exec.dir.name}/${scala.exec.name}"
perm="ugo+rx"
/>
<chmod
file="${quick.dir}/${exec.dir.name}/${scaladoc.exec.name}"
perm="ugo+rx"
/>
<chmod
file="${quick.dir}/${exec.dir.name}/${scalaint.exec.name}"
perm="ugo+rx"
/>
</target>
<target name="test.quick" depends="build">
<echo
level="error"
message="Ant test bench is not available yet."
/>
</target>
<!-- ===========================================================================
TEST
============================================================================ -->
<target name="test"
depends="clean.build, test.stability, test.strap"
description="Tests the build for stability (rebuilds everything)"
/>
<target name="build.strap" depends="setup.quick">
<!-- Build the bootstrap layer -->
<stopwatch name="timer.strap"/>
<!-- Build library -->
<mkdir dir="${strap.lib.dir}"/>
<pico
srcdir="${src.dir}/${lib.dir.name}"
destdir="${strap.lib.dir}"
scalahack="yes"
>
<classpath>
<pathelement location="${strap.lib.dir}"/>
</classpath>
<include name="**/*.java"/>
</pico>
<quick
srcdir="${src.dir}/${lib.dir.name}"
destdir="${strap.lib.dir}"
usepredefs="no"
addparams="${nsc.params}"
>
<classpath>
<pathelement location="${strap.lib.dir}"/>
</classpath>
<include name="scala/Predef.scala"/>
<include name="scala/runtime/ScalaRunTime.scala"/>
</quick>
<quick
srcdir="${src.dir}/${lib.dir.name}"
destdir="${strap.lib.dir}"
addparams="${nsc.params}"
>
<classpath>
<pathelement location="${strap.lib.dir}"/>
</classpath>
<include name="**/*.scala"/>
<exclude name="scala/Predef.scala"/>
<exclude name="scala/runtime/ScalaRunTime.scala"/>
<exclude name="scala/dbc/**"/>
<excludesfile name="${nsc.excludes}" if="excludes.avail"/>
</quick>
<mkdir dir="${strap.dbc.dir}"/>
<quick
srcdir="${src.dir}/${dbc.dir.name}"
destdir="${strap.dbc.dir}"
addparams="${nsc.params}"
>
<classpath>
<pathelement location="${strap.lib.dir}"/>
<pathelement location="${strap.dbc.dir}"/>
</classpath>
<include name="scala/dbc/**/*.scala"/>
<excludesfile name="${nsc.excludes}" if="excludes.avail"/>
</quick>
<!-- Build compiler -->
<mkdir dir="${strap.comp.dir}"/>
<pico
srcdir="${src.dir}/${comp.dir.name}"
destdir="${strap.comp.dir}"
scalahack="yes"
>
<classpath>
<pathelement location="${strap.lib.dir}"/>
<pathelement location="${strap.comp.dir}"/>
</classpath>
<include name="**/*.java"/>
</pico>
<quick
srcdir="${src.dir}/${comp.dir.name}"
destdir="${strap.comp.dir}"
addparams="${nsc.params}"
>
<classpath>
<pathelement location="${strap.lib.dir}"/>
<pathelement location="${strap.comp.dir}"/>
<path refid="quick.classpath"/>
<pathelement location="${ant.jar}"/>
</classpath>
<include name="**/*.scala"/>
<excludesfile name="${nsc.excludes}" if="excludes.avail"/>
</quick>
<stopwatch name="timer.strap" action="total"/>
<echo
file="${nsc.timers}"
append="true"
message=" building STRAP: ${timer.strap}.${line.separator}"
/>
<!-- 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 -->
<mkdir dir="${strap.dir}/${exec.dir.name}"/>
<quicktool
file="${strap.dir}/${exec.dir.name}/${scala.exec.name}"
version="${version.number}"
copyright="${copyright}"
extclasspath="#SCALA_HOME#/${lib.dir.name}:#SCALA_HOME#/${dbc.dir.name}"
javaFlags="-Xmx256M -Xms16M"
/>
<quicktool
file="${strap.dir}/${exec.dir.name}/${scalac.exec.name}"
name="Scala compiler"
class="scala.tools.nsc.Main"
version="${version.number}"
copyright="${copyright}"
extclasspath="#SCALA_HOME#/${lib.dir.name}:#SCALA_HOME#/${comp.dir.name}:#SCALA_HOME#/${fjbg.name}:#SCALA_HOME#/${dbc.dir.name}"
javaFlags="-Xmx256M -Xms16M"
/>
<quicktool
file="${strap.dir}/${exec.dir.name}/${scaladoc.exec.name}"
name="Scala doc generator"
class="scala.tools.nsc.Main"
toolflags="-doc"
version="${version.number}"
copyright="${copyright}"
extclasspath="#SCALA_HOME#/${lib.dir.name}:#SCALA_HOME#/${comp.dir.name}:#SCALA_HOME#/${fjbg.name}:#SCALA_HOME#/${dbc.dir.name}"
javaFlags="-Xmx256M -Xms16M"
/>
<quicktool
file="${strap.dir}/${exec.dir.name}/${scalaint.exec.name}"
name="Scala interpreter"
class="scala.tools.nsc.MainInterpreter"
version="${version.number}"
copyright="${copyright}"
extclasspath="#SCALA_HOME#/${lib.dir.name}:#SCALA_HOME#/${comp.dir.name}:#SCALA_HOME#/${fjbg.name}:#SCALA_HOME#/${dbc.dir.name}"
/>
<chmod
file="${strap.dir}/${exec.dir.name}/${scalac.exec.name}"
perm="ugo+rx"
/>
<chmod
file="${strap.dir}/${exec.dir.name}/${scala.exec.name}"
perm="ugo+rx"
/>
<chmod
file="${strap.dir}/${exec.dir.name}/${scaladoc.exec.name}"
perm="ugo+rx"
/>
<chmod
file="${strap.dir}/${exec.dir.name}/${scalaint.exec.name}"
perm="ugo+rx"
/>
</target>
<target name="test.stability" depends="build.strap">
<!-- Compares quick and test level -->
<checksum totalproperty="quick.md5">
<fileset dir="${quick.dir}">
<include name="${lib.dir.name}/**"/>
<include name="${comp.dir.name}/**"/>
</fileset>
</checksum>
<delete quiet="yes" failonerror="no">
<fileset dir="${quick.dir}" includes="**/*.MD5"/>
</delete>
<checksum totalproperty="strap.md5">
<fileset dir="${strap.dir}">
<include name="${lib.dir.name}/**"/>
<include name="${comp.dir.name}/**"/>
</fileset>
</checksum>
<delete quiet="yes" failonerror="no">
<fileset dir="${strap.dir}" includes="**/*.MD5"/>
</delete>
<fail message="Build is not stable">
<condition><not>
<equals arg1="${quick.md5}" arg2="${strap.md5}"/>
</not></condition>
</fail>
<echo level="info" message="Build is stable."/>
</target>
<target name="test.strap" depends="build.strap">
<echo level="error" message="Ant test bench is not available yet."/>
</target>
<!-- ===========================================================================
DOCUMENTATION
============================================================================ -->
<target name="docs"
description="Generated the API for library sources"
depends="setup.quick"
>
<mkdir dir="${api.lib.dir}"/>
<quickdoc
srcdir="${src.dir}/${lib.dir.name}"
destdir="${api.lib.dir}"
sourcepath=""
>
<classpath>
<pathelement location="${quick.lib.dir}"/>
</classpath>
<include name="**/*.scala"/>
<excludesfile name="${nsc.excludes}" if="excludes.avail"/>
</quickdoc>
</target>
<target name="docs.compiler"
description="Generated the API for compiler sources"
depends="setup.quick"
>
<mkdir dir="${api.comp.dir}"/>
<quickdoc
srcdir="${src.dir}/${comp.dir.name}"
destdir="${api.comp.dir}"
sourcepath=""
>
<classpath>
<pathelement location="${quick.lib.dir}"/>
<pathelement location="${quick.comp.dir}"/>
<path refid="quick.classpath"/>
<pathelement location="${ant.jar}"/>
</classpath>
<include name="**/*.scala"/>
<excludesfile name="${nsc.excludes}" if="excludes.avail"/>
</quickdoc>
</target>
<!-- ===========================================================================
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.revision}"
/>
<runtarget target="dist"/>
</target>
<target name="dist.patch" depends="init">
<propertyfile
file="${number.file}"
comment="Version last updated on ${time.human}"
>
<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="dist"/>
</target>
<target name="dist.minor" depends="init">
<propertyfile
file="${number.file}"
comment="Version last updated on ${time.human}"
>
<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="dist"/>
</target>
<target name="dist"
depends="test, docs"
description="Creates a complete Scala distribution"
>
<property
name="dist.current.dir"
value="${dist.dir}/${dist.name}-${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.comp.dir}"/>
<zipfileset src="${fjbg.jar}"/>
<manifest>
<attribute name="Signature-Version" value="${version.number}"/>
</manifest>
</jar>
<jar destfile="${dist.current.dir}/lib/${lib.jar.name}">
<fileset dir="${strap.lib.dir}"/>
<manifest>
<attribute name="Signature-Version" value="${version.number}"/>
</manifest>
</jar>
<jar destfile="${dist.current.dir}/lib/${lib-dbc.jar.name}">
<fileset dir="${strap.dbc.dir}"/>
<manifest>
<attribute name="Signature-Version" value="${version.number}"/>
</manifest>
</jar>
<mkdir dir="${dist.current.dir}/bin"/>
<!-- Build executable files -->
<mkdir dir="${dist.current.dir}/bin"/>
<quicktool
file="${dist.current.dir}/bin/${scala.exec.name}"
version="${version.number}"
copyright="${copyright}"
javaFlags="-Xmx256M -Xms16M"
/>
<quicktool
file="${dist.current.dir}/bin/${scalac.exec.name}"
name="Scala compiler"
class="scala.tools.nsc.Main"
version="${version.number}"
copyright="${copyright}"
javaFlags="-Xmx256M -Xms16M"
/>
<quicktool
file="${dist.current.dir}/bin/${scaladoc.exec.name}"
name="Scala doc generator"
class="scala.tools.nsc.Main"
toolflags="-doc"
version="${version.number}"
copyright="${copyright}"
javaFlags="-Xmx256M -Xms16M"
/>
<quicktool
file="${dist.current.dir}/bin/${scalaint.exec.name}"
name="Scala interpreter"
class="scala.tools.nsc.MainInterpreter"
version="${version.number}"
copyright="${copyright}"
/>
<chmod
file="${dist.current.dir}/bin/${scalac.exec.name}"
perm="ugo+rx"
/>
<chmod
file="${dist.current.dir}/bin/${scala.exec.name}"
perm="ugo+rx"
/>
<chmod
file="${dist.current.dir}/bin/${scaladoc.exec.name}"
perm="ugo+rx"
/>
<chmod
file="${dist.current.dir}/bin/${scalaint.exec.name}"
perm="ugo+rx"
/>
<!-- Copy the API, examples and man -->
<copy todir="${dist.current.dir}/doc/${dist.name}">
<fileset dir="${docs.dir}" includes="README,LICENSE"/>
</copy>
<copy todir="${dist.current.dir}/doc/${dist.name}/api">
<fileset dir="${api.lib.dir}"/>
</copy>
<copy todir="${dist.current.dir}/doc/${dist.name}/examples">
<fileset dir="${examples.dir}"/>
</copy>
<copy todir="${dist.current.dir}/man">
<fileset dir="${docs.dir}/man"/>
</copy>
<!-- Recreate the 'latest' link to point to this distribution -->
<if><isset property="os.win"/>
<then>
<copy todir="${dist.latest.dir}">
<fileset dir="${dist.current.dir}"/>
</copy>
</then>
<else>
<symlink
link="${dist.latest.dir}"
resource="${dist.current.dir}"
overwrite="yes"
failonerror="no"
/>
</else>
</if>
<!-- Create the SBaz packages -->
<mkdir dir="${dist.sbaz.dir}"/>
<!-- Create the Scala library package -->
<quicksbaz
file="${dist.sbaz.dir}/${sbaz.lib.name}-${version.number}.sbp"
adfile="${dist.sbaz.dir}/${sbaz.lib.name}-${version.number}.advert"
name="${sbaz.lib.name}"
version="${version.number}"
desc="The Scala library. This is the minimal requirement to run any Scala program."
link="${sbaz.univ.link}/${sbaz.lib.name}-${version.number}.sbp"
>
<libset dir="${dist.current.dir}/lib" includes="${lib.jar.name},${lib-dbc.jar.name}"/>
</quicksbaz>
<!-- Create the Scala developper package -->
<quicksbaz
file="${dist.sbaz.dir}/${sbaz.dev.name}-${version.number}.sbp"
adfile="${dist.sbaz.dir}/${sbaz.dev.name}-${version.number}.advert"
name="${sbaz.dev.name}"
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="${sbaz.lib.name}"
link="${sbaz.univ.link}/${sbaz.dev.name}-${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}"/>
<manset dir="${dist.current.dir}/man" includes="**"/>
</quicksbaz>
<!-- Creates the empty umbrella Scala package -->
<quicksbaz
file="${dist.sbaz.dir}/${sbaz.scala.name}-${version.number}.sbp"
adfile="${dist.sbaz.dir}/${sbaz.scala.name}-${version.number}.advert"
name="${sbaz.scala.name}"
version="${version.number}"
desc="The base Scala package that contains everything needed to start using Scala."
depends="${sbaz.lib.name},${sbaz.dev.name}"
link="${sbaz.univ.link}/${sbaz.scala.name}-${version.number}.sbp"
/>
</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.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>