summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGilles Dubochet <gilles.dubochet@epfl.ch>2008-04-09 13:16:56 +0000
committerGilles Dubochet <gilles.dubochet@epfl.ch>2008-04-09 13:16:56 +0000
commit07b35f671e36a681583548c6abc209913c07fec5 (patch)
treeaf59598c45e9c7a6cfd24ef10097921ca18670f8
parented01acd9713e834142e17b68e4ab05fc2bcd347c (diff)
downloadscala-07b35f671e36a681583548c6abc209913c07fec5.tar.gz
scala-07b35f671e36a681583548c6abc209913c07fec5.tar.bz2
scala-07b35f671e36a681583548c6abc209913c07fec5.zip
Refactored SuperSabbus' targets to be finer gra...
Refactored SuperSabbus' targets to be finer grained and permit better dependency management (with JVM 1.4 and MSIL support in mind). First effort of refactoring the classpath handling: tools are run with the scala library on the classpath, not on the bootclasspath.
-rw-r--r--lib/ant/ant-contrib.jar.desired.sha11
-rw-r--r--lib/ant/vizant.jar.desired.sha11
-rw-r--r--lib/sabbus.jar.desired.sha12
-rw-r--r--sabbus.xml756
-rw-r--r--src/compiler/scala/tools/ant/ScalaTool.scala243
-rw-r--r--src/compiler/scala/tools/ant/templates/tool-unix.tmpl31
-rw-r--r--src/compiler/scala/tools/ant/templates/tool-windows.tmpl28
-rw-r--r--src/compiler/scala/tools/nsc/Settings.scala2
8 files changed, 578 insertions, 486 deletions
diff --git a/lib/ant/ant-contrib.jar.desired.sha1 b/lib/ant/ant-contrib.jar.desired.sha1
new file mode 100644
index 0000000000..56745657c5
--- /dev/null
+++ b/lib/ant/ant-contrib.jar.desired.sha1
@@ -0,0 +1 @@
+943cd5c8802b2a3a64a010efb86ec19bac142e40 ?ant-contrib.jar
diff --git a/lib/ant/vizant.jar.desired.sha1 b/lib/ant/vizant.jar.desired.sha1
new file mode 100644
index 0000000000..00ff17d159
--- /dev/null
+++ b/lib/ant/vizant.jar.desired.sha1
@@ -0,0 +1 @@
+2c61d6e9a912b3253194d5d6d3e1db7e2545ac4b ?vizant.jar
diff --git a/lib/sabbus.jar.desired.sha1 b/lib/sabbus.jar.desired.sha1
index 12474b24ec..a5e24c2cdc 100644
--- a/lib/sabbus.jar.desired.sha1
+++ b/lib/sabbus.jar.desired.sha1
@@ -1 +1 @@
-a855651b0b649f061b8e35504091d75ff9a83b65 ?sabbus.jar
+e82686ff2820b9db1813ee5d00fe657d31d91c52 ?sabbus.jar
diff --git a/sabbus.xml b/sabbus.xml
index 344b5453e7..e89da3ddd7 100644
--- a/sabbus.xml
+++ b/sabbus.xml
@@ -3,24 +3,29 @@
<project name="sabbus" default="build">
<description>
- I am SuperSabbus for Scala core, the fast but simple version of Sabbus.
+ SuperSabbus for Scala core, builds the scala library and compiler. It can also package it as a simple distribution,
+ tests it for stable bootstrapping and against the Scala test suite. Use PackSabbus to package it for different install
+ management tools such as Sbaz.
</description>
<!-- ===========================================================================
END-USER TARGETS
============================================================================ -->
- <target name="build" depends="pack.load"
- description="Builds the Scala compiler and library. Executables are in 'build/quick/bin'."/>
+ <target name="build" depends="pack.done"
+ description="Builds the Scala compiler and library. Executables are in 'build/pack/bin'."/>
<target name="clean" depends="quick.clean"
description="Removes binaries of compiler and library. Distributions are untouched."/>
- <target name="test" depends="suite.test, stability.test"
+ <target name="test" depends="test.done"
description="Runs test suite and bootstrapping test on Scala compiler and library."/>
- <target name="docs" depends=""
- description="Builds documentation for Scala library. Scaladoc is in 'build/scaladoc'."/>
+ <target name="docs" depends="docs.done"
+ description="Builds documentation for the Scala library. Scaladoc is in 'build/scaladoc/library'."/>
+
+ <target name="docscomp" depends="docs.comp"
+ description="Builds documentation for the Scala compiler and library. Scaladoc is in 'build/scaladoc'."/>
<target name="docsclean" depends="docs.clean"
description="Removes generated documentation. Distributions are untouched."/>
@@ -29,28 +34,26 @@ END-USER TARGETS
description="Makes a new distribution and tests it. Will remove existing binaries and documentation.">
<antcall target="locker.clean"/>
<antcall target="docs.clean"/>
- <antcall target="dist.load">
- <param name="dist.expected" value="yes"/>
- </antcall>
+ <antcall target="all.done"/>
</target>
- <target name="distclean" depends="dists.clean"
+ <target name="distclean" depends="dist.clean"
description="Removes all distributions. Binaries and documentation are untouched."/>
<target name="newstarr"
description="Replaces the Starr compiler and library by one built from current sources and tests it.">
<antcall target="locker.clean"/>
- <antcall target="starr.build"/>
+ <antcall target="starr.done"/>
<antcall target="locker.clean"/>
- <antcall target="test"/>
+ <antcall target="test.done"/>
</target>
<target name="newlocker"
description="Replaces the Locker compiler and library by one built from current sources.">
<antcall target="locker.clean"/>
- <antcall target="locker.build"/>
+ <antcall target="locker.done"/>
</target>
-
+
<!-- ===========================================================================
PROPERTIES
============================================================================ -->
@@ -63,6 +66,7 @@ PROPERTIES
<!-- Defines the repository layout -->
<property name="docs.dir" value="${basedir}/docs"/>
<property name="lib.dir" value="${basedir}/lib"/>
+ <property name="lib-ant.dir" value="${lib.dir}/ant"/>
<property name="src.dir" value="${basedir}/src"/>
<property name="test.dir" value="${basedir}/test"/>
@@ -83,8 +87,8 @@ PROPERTIES
<property name="build.dir" value="${basedir}/build"/>
<property name="build-locker.dir" value="${build.dir}/locker"/>
<property name="build-quick.dir" value="${build.dir}/quick"/>
+ <property name="build-pack.dir" value="${build.dir}/pack"/>
<property name="build-strap.dir" value="${build.dir}/strap"/>
- <property name="build-partest.dir" value="${build.dir}/partest"/>
<property name="build-docs.dir" value="${build.dir}/scaladoc"/>
<property name="dists.dir" value="${basedir}/dists"/>
@@ -127,13 +131,7 @@ INITIALISATION
<!-- And print-out what we are building -->
<echo level="info" message="Build number is '${version.number}'"/>
<echo level="info" message="Built ${time.human} from revision ${svn.number} with Java ${java.vm.version}"/>
- </target>
-
-<!-- ===========================================================================
-LOAD STABLE REFERENCE (STARR) LAYER
-============================================================================ -->
-
- <target name="starr.load" depends="init">
+ <!-- Define tasks that can be run with Starr -->
<path id="starr.classpath">
<pathelement location="${lib.starr.jar}"/>
<pathelement location="${comp.starr.jar}"/>
@@ -145,18 +143,23 @@ LOAD STABLE REFERENCE (STARR) LAYER
</target>
<!-- ===========================================================================
-BUILD LOCAL REFERENCE (LOCKER) LAYER
+LOCAL REFERENCE BUILD (LOCKER)
============================================================================ -->
-
- <target name="locker.init" depends="starr.load">
+
+ <target name="locker.start" depends="init">
<condition property="locker.available">
- <available file="${build-locker.dir}/build.complete"/>
+ <available file="${build-locker.dir}/all.complete"/>
+ </condition>
+ </target>
+
+ <target name="locker.pre-lib" depends="locker.start" unless="locker.available">
+ <condition property="locker.lib.needed">
+ <not><available file="${build-locker.dir}/library.complete"/></not>
</condition>
</target>
- <target name="locker.build" depends="locker.init" unless="locker.available">
- <stopwatch name="locker.timer"/>
- <!-- Build library -->
+ <target name="locker.lib" depends="locker.pre-lib" if="locker.lib.needed">
+ <stopwatch name="locker.lib.timer"/>
<mkdir dir="${build-locker.dir}/classes/library"/>
<javac
srcdir="${src.dir}/library"
@@ -193,7 +196,18 @@ BUILD LOCAL REFERENCE (LOCKER) LAYER
</fileset>
</copy>
<sabbreak id="starr.lib.scalac"/>
- <!-- Build compiler -->
+ <touch file="${build-locker.dir}/library.complete" verbose="no"/>
+ <stopwatch name="locker.lib.timer" action="total"/>
+ </target>
+
+ <target name="locker.pre-comp" depends="locker.lib" unless="locker.available">
+ <condition property="locker.comp.needed">
+ <not><available file="${build-locker.dir}/compiler.complete"/></not>
+ </condition>
+ </target>
+
+ <target name="locker.comp" depends="locker.pre-comp" if="locker.comp.needed">
+ <stopwatch name="locker.comp.timer"/>
<mkdir dir="${build-locker.dir}/classes/compiler"/>
<sabmake id="starr.comp.scalac"
destdir="${build-locker.dir}/classes/compiler"
@@ -224,12 +238,12 @@ BUILD LOCAL REFERENCE (LOCKER) LAYER
</fileset>
</copy>
<sabbreak id="starr.comp.scalac"/>
- <!-- Timing the build -->
- <touch file="${build-locker.dir}/build.complete" verbose="no"/>
- <stopwatch name="locker.timer" action="total"/>
+ <touch file="${build-locker.dir}/compiler.complete" verbose="no"/>
+ <stopwatch name="locker.comp.timer" action="total"/>
</target>
- <target name="locker.load" depends="locker.build">
+ <target name="locker.done" depends="locker.comp">
+ <touch file="${build-locker.dir}/all.complete" verbose="no"/>
<path id="locker.classpath">
<pathelement location="${build-locker.dir}/classes/library"/>
<pathelement location="${build-locker.dir}/classes/compiler"/>
@@ -237,25 +251,29 @@ BUILD LOCAL REFERENCE (LOCKER) LAYER
<pathelement location="${ant.jar}"/>
</path>
</target>
+
+ <target name="locker.clean" depends="quick.clean">
+ <delete dir="${build-locker.dir}" includeemptydirs="yes" quiet="yes" failonerror="no"/>
+ </target>
<!-- ===========================================================================
-BUILD QUICK LAYER
+QUICK BUILD (QUICK)
============================================================================ -->
- <target name="quick.init" depends="locker.load">
- <uptodate property="quick.available" targetfile="${build-quick.dir}/build.complete">
+ <target name="quick.start" depends="locker.done"/>
+
+ <target name="quick.pre-lib" depends="quick.start">
+ <uptodate property="quick.lib.available" targetfile="${build-quick.dir}/library.complete">
<srcfiles dir="${src.dir}">
<include name="library/**"/>
- <include name="compiler/**"/>
<include name="dbc/**"/>
<include name="actors/**"/>
</srcfiles>
</uptodate>
</target>
- <target name="quick.build" depends="quick.init" unless="quick.available">
- <stopwatch name="quick.timer"/>
- <!-- Build library -->
+ <target name="quick.lib" depends="quick.pre-lib" unless="quick.lib.available">
+ <stopwatch name="quick.lib.timer"/>
<mkdir dir="${build-quick.dir}/classes/library"/>
<javac
srcdir="${src.dir}/library"
@@ -278,6 +296,17 @@ BUILD QUICK LAYER
<sabuse id="locker.lib.scalac" srcdir="${src.dir}/library">
<include name="scala/Predef.scala"/>
</sabuse>
+ <!-- -->
+ <sabbreak id="locker.lib.scalac"/>
+ <sabmake id="locker.lib.scalac"
+ destdir="${build-quick.dir}/classes/library"
+ compilerpathref="locker.classpath"
+ srcpath="${src.dir}/library">
+ <compilationpath>
+ <pathelement location="${build-quick.dir}/classes/library"/>
+ </compilationpath>
+ </sabmake>
+ <!-- -->
<sabuse id="locker.lib.scalac" srcdir="${src.dir}/library">
<include name="**/*.scala"/>
<exclude name="scala/Predef.scala"/>
@@ -301,7 +330,18 @@ BUILD QUICK LAYER
</fileset>
</copy>
<sabbreak id="locker.lib.scalac"/>
- <!-- Build compiler -->
+ <touch file="${build-quick.dir}/library.complete" verbose="no"/>
+ <stopwatch name="quick.lib.timer" action="total"/>
+ </target>
+
+ <target name="quick.pre-comp" depends="quick.lib">
+ <uptodate property="quick.comp.available" targetfile="${build-quick.dir}/compiler.complete">
+ <srcfiles dir="${src.dir}/compiler"/>
+ </uptodate>
+ </target>
+
+ <target name="quick.comp" depends="quick.pre-comp" unless="quick.comp.available">
+ <stopwatch name="quick.comp.timer"/>
<mkdir dir="${build-quick.dir}/classes/compiler"/>
<sabmake id="locker.comp.scalac"
destdir="${build-quick.dir}/classes/compiler"
@@ -332,39 +372,234 @@ BUILD QUICK LAYER
</fileset>
</copy>
<sabbreak id="locker.comp.scalac"/>
- <!-- Timing the build -->
- <touch file="${build-quick.dir}/build.complete" verbose="no"/>
- <stopwatch name="quick.timer" action="total"/>
+ <touch file="${build-quick.dir}/compiler.complete" verbose="no"/>
+ <stopwatch name="quick.comp.timer" action="total"/>
</target>
- <target name="quick.load" depends="quick.build">
- <path id="quick.classpath">
- <pathelement location="${build-quick.dir}/classes/library"/>
- <pathelement location="${build-quick.dir}/classes/compiler"/>
+ <target name="quick.pre-partest" depends="quick.comp">
+ <uptodate property="quick.partest.available" targetfile="${build-quick.dir}/partest.complete">
+ <srcfiles dir="${src.dir}/partest"/>
+ </uptodate>
+ </target>
+
+ <target name="quick.partest" depends="quick.pre-partest" unless="quick.partest.available">
+ <stopwatch name="quick.partest.timer"/>
+ <mkdir dir="${build-quick.dir}/classes/partest"/>
+ <javac
+ srcdir="${src.dir}/partest"
+ destdir="${build-quick.dir}/classes/partest">
+ <classpath>
+ <pathelement location="${build-quick.dir}/classes/library"/>
+ <pathelement location="${build-quick.dir}/classes/compiler"/>
+ <pathelement location="${build-quick.dir}/classes/partest"/>
+ </classpath>
+ <include name="**/*.java"/>
+ </javac>
+ <sabmake id="locker.partest.scalac"
+ destdir="${build-quick.dir}/classes/partest"
+ compilerpathref="locker.classpath"
+ srcpath="${src.dir}/paartest">
+ <compilationpath>
+ <pathelement location="${build-quick.dir}/classes/library"/>
+ <pathelement location="${build-quick.dir}/classes/compiler"/>
+ <pathelement location="${build-quick.dir}/classes/partest"/>
+ <pathelement location="${ant.jar}"/>
+ </compilationpath>
+ </sabmake>
+ <sabuse id="locker.partest.scalac" srcdir="${src.dir}/partest">
+ <include name="**/*.scala"/>
+ </sabuse>
+ <copy todir="${build-quick.dir}/classes/partest">
+ <fileset dir="${src.dir}/partest">
+ <include name="**/*.xml"/>
+ </fileset>
+ </copy>
+ <sabbreak id="locker.partest.scalac"/>
+ <touch file="${build-quick.dir}/partest.complete" verbose="no"/>
+ <stopwatch name="quick.partest.timer" action="total"/>
+ </target>
+
+ <target name="quick.pre-bin" depends="quick.partest">
+ <condition property="quick.bin.available">
+ <isset property="quick.comp.available"/>
+ </condition>
+ <path id="quick.bin.classpath">
+ <pathelement location="${build-quick.dir}/classes/library"/>
+ <pathelement location="${build-quick.dir}/classes/compiler"/>
<pathelement location="${fjbg.jar}"/>
+ <pathelement location="${jline.jar}"/>
+ </path>
+ </target>
+
+ <target name="quick.bin" depends="quick.pre-bin" unless="quick.bin.available">
+ <mkdir dir="${build-quick.dir}/bin"/>
+ <taskdef name="quick-bin" classname="scala.tools.ant.ScalaTool">
+ <classpath>
+ <pathelement location="${build-quick.dir}/classes/library"/>
+ <pathelement location="${build-quick.dir}/classes/compiler"/>
+ </classpath>
+ </taskdef>
+ <quick-bin
+ file="${build-quick.dir}/bin/scala"
+ class="scala.tools.nsc.MainGenericRunner"
+ javaFlags="${java.flags}"
+ classpathref="quick.bin.classpath"/>
+ <quick-bin
+ file="${build-quick.dir}/bin/scalac"
+ class="scala.tools.nsc.Main"
+ javaFlags="${java.flags}"
+ classpathref="quick.bin.classpath"/>
+ <quick-bin
+ file="${build-quick.dir}/bin/scaladoc"
+ class="scala.tools.nsc.ScalaDoc"
+ javaFlags="${java.flags}"
+ classpathref="quick.bin.classpath"/>
+ <quick-bin
+ file="${build-quick.dir}/bin/fsc"
+ class="scala.tools.nsc.CompileClient"
+ javaFlags="${java.flags}"
+ classpathref="quick.bin.classpath"/>
+ <chmod perm="ugo+rx" file="${build-quick.dir}/bin/scala"/>
+ <chmod perm="ugo+rx" file="${build-quick.dir}/bin/scalac"/>
+ <chmod perm="ugo+rx" file="${build-quick.dir}/bin/scaladoc"/>
+ <chmod perm="ugo+rx" file="${build-quick.dir}/bin/fsc"/>
+ <touch file="${build-quick.dir}/bin.complete" verbose="no"/>
+ </target>
+
+ <target name="quick.done" depends="quick.bin"/>
+
+ <target name="quick.clean" depends="pack.clean">
+ <delete dir="${build-quick.dir}" includeemptydirs="yes" quiet="yes" failonerror="no"/>
+ </target>
+
+<!-- ===========================================================================
+PACKED QUICK BUILD (PACK)
+============================================================================ -->
+
+ <target name="pack.start" depends="quick.done"/>
+
+ <target name="pack.pre-lib" depends="pack.start">
+ <uptodate
+ property="pack.lib.available"
+ targetfile="${build-pack.dir}/lib/scala-library.jar"
+ srcfile="${build-quick.dir}/library.complete"/>
+ </target>
+
+ <target name="pack.lib" depends="pack.pre-lib" unless="pack.lib.available">
+ <mkdir dir="${build-pack.dir}/lib"/>
+ <jar destfile="${build-pack.dir}/lib/scala-library.jar">
+ <fileset dir="${build-quick.dir}/classes/library">
+ <exclude name="scala/dbc/**"/>
+ </fileset>
+ </jar>
+ <jar destfile="${build-pack.dir}/lib/scala-dbc.jar">
+ <fileset dir="${build-quick.dir}/classes/library">
+ <include name="scala/dbc/**"/>
+ </fileset>
+ </jar>
+ </target>
+
+ <target name="pack.pre-comp" depends="pack.lib">
+ <uptodate
+ property="pack.comp.available"
+ targetfile="${build-pack.dir}/lib/scala-compiler.jar"
+ srcfile="${build-quick.dir}/compiler.complete"/>
+ </target>
+
+ <target name="pack.comp" depends="pack.pre-comp" unless="pack.comp.available">
+ <mkdir dir="${build-pack.dir}/lib"/>
+ <jar destfile="${build-pack.dir}/lib/scala-compiler.jar">
+ <fileset dir="${build-quick.dir}/classes/compiler"/>
+ <zipfileset src="${fjbg.jar}"/>
+ <zipfileset src="${msil.jar}"/>
+ </jar>
+ </target>
+
+ <target name="pack.pre-partest" depends="pack.comp">
+ <uptodate
+ property="pack.partest.available"
+ targetfile="${build-pack.dir}/lib/scala-partest.jar"
+ srcfile="${build-quick.dir}/partest.complete"/>
+ </target>
+
+ <target name="pack.partest" depends="pack.pre-partest" unless="pack.partest.available">
+ <mkdir dir="${build-pack.dir}/lib"/>
+ <jar destfile="${build-pack.dir}/lib/scala-partest.jar">
+ <fileset dir="${build-quick.dir}/classes/partest"/>
+ </jar>
+ </target>
+
+ <target name="pack.pre-bin" depends="pack.partest">
+ <uptodate
+ property="pack.bin.available"
+ srcfile="${build-pack.dir}/lib/scala-compiler.jar"
+ targetfile="${build-pack.dir}/bin.complete"/>
+ <taskdef name="pack-bin" classname="scala.tools.ant.ScalaTool">
+ <classpath>
+ <pathelement location="${build-pack.dir}/lib/scala-library.jar"/>
+ <pathelement location="${build-pack.dir}/lib/scala-compiler.jar"/>
+ </classpath>
+ </taskdef>
+ </target>
+
+ <target name="pack.bin" depends="pack.pre-bin" unless="pack.bin.available">
+ <mkdir dir="${build-pack.dir}/bin"/>
+ <pack-bin
+ file="${build-pack.dir}/bin/scala"
+ class="scala.tools.nsc.MainGenericRunner"
+ javaFlags="${java.flags}"/>
+ <pack-bin
+ file="${build-pack.dir}/bin/scalac"
+ class="scala.tools.nsc.Main"
+ javaFlags="${java.flags}"/>
+ <pack-bin
+ file="${build-pack.dir}/bin/scaladoc"
+ class="scala.tools.nsc.ScalaDoc"
+ javaFlags="${java.flags}"/>
+ <pack-bin
+ file="${build-pack.dir}/bin/fsc"
+ class="scala.tools.nsc.CompileClient"
+ javaFlags="${java.flags}"/>
+ <chmod perm="ugo+rx" file="${build-pack.dir}/bin/scala"/>
+ <chmod perm="ugo+rx" file="${build-pack.dir}/bin/scalac"/>
+ <chmod perm="ugo+rx" file="${build-pack.dir}/bin/scaladoc"/>
+ <chmod perm="ugo+rx" file="${build-pack.dir}/bin/fsc"/>
+ <touch file="${build-pack.dir}/bin.complete" verbose="no"/>
+ </target>
+
+ <target name="pack.done" depends="pack.bin">
+ <path id="pack.classpath">
+ <pathelement location="${build-pack.dir}/lib/scala-library.jar"/>
+ <pathelement location="${build-pack.dir}/lib/scala-compiler.jar"/>
+ <pathelement location="${build-pack.dir}/lib/scala-partest.jar"/>
<pathelement location="${ant.jar}"/>
</path>
- <taskdef resource="scala/tools/ant/antlib.xml" classpathref="quick.classpath"/>
+ <taskdef resource="scala/tools/ant/antlib.xml" classpathref="pack.classpath"/>
+ <taskdef resource="scala/tools/partest/antlib.xml" classpathref="pack.classpath"/>
+ </target>
+
+ <target name="pack.clean" depends="strap.clean">
+ <delete dir="${build-pack.dir}" includeemptydirs="yes" quiet="yes" failonerror="no"/>
</target>
<!-- ===========================================================================
-BUILD STRAP LAYER
+BOOTSTRAPPING BUILD (STRAP)
============================================================================ -->
- <target name="strap.init" depends="quick.load">
- <uptodate property="strap.available" targetfile="${build-strap.dir}/build.complete">
+ <target name="strap.start" depends="pack.done"/>
+
+ <target name="strap.pre-lib" depends="strap.start">
+ <uptodate property="strap.lib.available" targetfile="${build-strap.dir}/library.complete">
<srcfiles dir="${src.dir}">
<include name="library/**"/>
- <include name="compiler/**"/>
<include name="dbc/**"/>
<include name="actors/**"/>
</srcfiles>
</uptodate>
</target>
- <target name="strap.build" depends="strap.init" unless="strap.available">
- <stopwatch name="strap.timer"/>
- <!-- Build library -->
+ <target name="strap.lib" depends="strap.pre-lib" unless="strap.lib.available">
+ <stopwatch name="strap.lib.timer"/>
<mkdir dir="${build-strap.dir}/classes/library"/>
<javac
srcdir="${src.dir}/library"
@@ -376,27 +611,32 @@ BUILD STRAP LAYER
destdir="${build-strap.dir}/classes/library"
classpath="${build-strap.dir}/classes/library"
includes="**/*.java"/>
- <sabmake id="quick.lib.scalac"
+ <scalac
+ srcdir="${src.dir}/library"
destdir="${build-strap.dir}/classes/library"
- compilerpathref="quick.classpath"
- srcpath="${src.dir}/library">
- <compilationpath>
- <pathelement location="${build-strap.dir}/classes/library"/>
- </compilationpath>
- </sabmake>
- <sabuse id="quick.lib.scalac" srcdir="${src.dir}/library">
+ classpath="${build-strap.dir}/classes/library"
+ sourcepath="${src.dir}/library">
<include name="scala/Predef.scala"/>
- </sabuse>
- <sabuse id="quick.lib.scalac" srcdir="${src.dir}/library">
+ </scalac>
+ <scalac
+ srcdir="${src.dir}/library"
+ destdir="${build-strap.dir}/classes/library"
+ classpath="${build-strap.dir}/classes/library">
<include name="**/*.scala"/>
<exclude name="scala/Predef.scala"/>
- </sabuse>
- <sabuse id="quick.lib.scalac" srcdir="${src.dir}/actors">
+ </scalac>
+ <scalac
+ srcdir="${src.dir}/actors"
+ destdir="${build-strap.dir}/classes/library"
+ classpath="${build-strap.dir}/classes/library">
<include name="**/*.scala"/>
- </sabuse>
- <sabuse id="quick.lib.scalac" srcdir="${src.dir}/dbc">
+ </scalac>
+ <scalac
+ srcdir="${src.dir}/dbc"
+ destdir="${build-strap.dir}/classes/library"
+ classpath="${build-strap.dir}/classes/library">
<include name="**/*.scala"/>
- </sabuse>
+ </scalac>
<propertyfile file="${build-strap.dir}/classes/library/library.properties">
<entry key="version.number" value="${version.number}"/>
<entry key="copyright.string" value="${copyright.string}"/>
@@ -409,25 +649,32 @@ BUILD STRAP LAYER
<include name="**/*.css"/>
</fileset>
</copy>
- <sabbreak id="quick.lib.scalac"/>
- <!-- Build compiler -->
+ <touch file="${build-strap.dir}/library.complete" verbose="no"/>
+ <stopwatch name="strap.lib.timer" action="total"/>
+ </target>
+
+ <target name="strap.pre-comp" depends="strap.lib">
+ <uptodate property="strap.comp.available" targetfile="${build-strap.dir}/compiler.complete">
+ <srcfiles dir="${src.dir}/compiler"/>
+ </uptodate>
+ </target>
+
+ <target name="strap.comp" depends="strap.pre-comp" unless="strap.comp.available">
+ <stopwatch name="strap.comp.timer"/>
<mkdir dir="${build-strap.dir}/classes/compiler"/>
- <sabmake id="quick.comp.scalac"
- destdir="${build-strap.dir}/classes/compiler"
- compilerpathref="quick.classpath"
- srcpath="${src.dir}/compiler">
- <compilationpath>
- <pathelement location="${build-strap.dir}/classes/library"/>
- <pathelement location="${build-strap.dir}/classes/compiler"/>
+ <scalac
+ srcdir="${src.dir}/compiler"
+ destdir="${build-strap.dir}/classes/compiler">
+ <include name="**/*.scala"/>
+ <classpath>
+ <pathelement location="${build-strap.dir}/classes/library"/>
+ <pathelement location="${build-strap.dir}/classes/compiler"/>
<pathelement location="${fjbg.jar}"/>
<pathelement location="${msil.jar}"/>
<pathelement location="${jline.jar}"/>
<pathelement location="${ant.jar}"/>
- </compilationpath>
- </sabmake>
- <sabuse id="quick.comp.scalac" srcdir="${src.dir}/compiler">
- <include name="**/*.scala"/>
- </sabuse>
+ </classpath>
+ </scalac>
<propertyfile file="${build-strap.dir}/classes/compiler/compiler.properties">
<entry key="version.number" value="${version.number}"/>
<entry key="copyright.string" value="${copyright.string}"/>
@@ -440,140 +687,71 @@ BUILD STRAP LAYER
<include name="**/*.css"/>
</fileset>
</copy>
- <sabbreak id="quick.comp.scalac"/>
- <!-- Timing the build -->
- <touch file="${build-strap.dir}/build.complete" verbose="no"/>
- <stopwatch name="strap.timer" action="total"/>
+ <touch file="${build-strap.dir}/compiler.complete" verbose="no"/>
+ <stopwatch name="strap.comp.timer" action="total"/>
</target>
- <target name="strap.load" depends="strap.build"/>
-
-<!-- ===========================================================================
-BUILD PARTEST
-============================================================================ -->
-
- <target name="partest.init" depends="quick.load">
- <uptodate property="partest.available" targetfile="${build-partest.dir}/build.complete">
+ <target name="strap.pre-partest" depends="strap.comp">
+ <uptodate property="strap.partest.available" targetfile="${build-strap.dir}/partest.complete">
<srcfiles dir="${src.dir}/partest"/>
</uptodate>
</target>
- <target name="partest.build" depends="partest.init" unless="partest.available">
- <mkdir dir="${build-partest.dir}/classes"/>
+ <target name="strap.partest" depends="strap.pre-partest" unless="strap.partest.available">
+ <stopwatch name="strap.partest.timer"/>
+ <mkdir dir="${build-strap.dir}/classes/partest"/>
<javac
srcdir="${src.dir}/partest"
- destdir="${build-partest.dir}/classes">
+ destdir="${build-strap.dir}/classes/partest">
<classpath>
- <path refid="quick.classpath"/>
- <pathelement location="${build-partest.dir}/classes"/>
+ <pathelement location="${build-strap.dir}/classes/library"/>
+ <pathelement location="${build-strap.dir}/classes/compiler"/>
+ <pathelement location="${build-strap.dir}/classes/partest"/>
</classpath>
<include name="**/*.java"/>
</javac>
<scalac
srcdir="${src.dir}/partest"
- destdir="${build-partest.dir}/classes">
+ destdir="${build-strap.dir}/classes/partest">
+ <include name="**/*.scala"/>
<classpath>
- <path refid="quick.classpath"/>
- <pathelement location="${build-partest.dir}/classes"/>
+ <pathelement location="${build-strap.dir}/classes/library"/>
+ <pathelement location="${build-strap.dir}/classes/compiler"/>
+ <pathelement location="${build-strap.dir}/classes/partest"/>
+ <pathelement location="${ant.jar}"/>
</classpath>
- <include name="**/*.scala"/>
</scalac>
- <copy todir="${build-partest.dir}/classes">
+ <copy todir="${build-strap.dir}/classes/partest">
<fileset dir="${src.dir}/partest">
<include name="**/*.xml"/>
</fileset>
</copy>
- <touch file="${build-partest.dir}/build.complete" verbose="no"/>
+ <touch file="${build-strap.dir}/partest.complete" verbose="no"/>
+ <stopwatch name="strap.partest.timer" action="total"/>
</target>
- <target name="partest.load" depends="partest.build"/>
+ <target name="strap.done" depends="strap.partest"/>
+
+ <target name="strap.clean">
+ <delete dir="${build-strap.dir}" includeemptydirs="yes" quiet="yes" failonerror="no"/>
+ </target>
<!-- ===========================================================================
-MAKE MODEL DISTRIBUTION
+DOCUMENTATION
============================================================================ -->
- <target name="pack.init" depends="quick.load, partest.load">
- <uptodate property="pack.available" targetfile="${build-quick.dir}/pack.complete">
- <srcfiles dir="${build.dir}">
- <include name="*/build.complete"/>
+ <target name="docs.start" depends="pack.done">
+ <uptodate property="docs.available" targetfile="${build-docs.dir}/build.complete">
+ <srcfiles dir="${src.dir}">
+ <include name="library/**"/>
+ <include name="dbc/**"/>
+ <include name="actors/**"/>
</srcfiles>
</uptodate>
</target>
-
- <target name="pack.build" depends="pack.init" unless="pack.available">
- <!-- Packages libraries -->
- <mkdir dir="${build-quick.dir}/lib"/>
- <jar destfile="${build-quick.dir}/lib/scala-library.jar">
- <fileset dir="${build-quick.dir}/classes/library">
- <exclude name="scala/dbc/**"/>
- </fileset>
- </jar>
- <jar destfile="${build-quick.dir}/lib/scala-dbc.jar">
- <fileset dir="${build-quick.dir}/classes/library">
- <include name="scala/dbc/**"/>
- </fileset>
- </jar>
- <jar destfile="${build-quick.dir}/lib/scala-compiler.jar">
- <fileset dir="${build-quick.dir}/classes/compiler"/>
- <zipfileset src="${fjbg.jar}"/>
- <zipfileset src="${msil.jar}"/>
- </jar>
- <jar destfile="${build-quick.dir}/lib/scala-partest.jar">
- <fileset dir="${build-partest.dir}/classes"/>
- </jar>
- <!-- Make executables -->
- <mkdir dir="${build-quick.dir}/bin"/>
- <scalatool
- file="${build-quick.dir}/bin/scala"
- name="Scala code runner"
- class="scala.tools.nsc.MainGenericRunner"
- version="${version.number}"
- copyright="${copyright.string}"
- javaFlags="${java.flags}"/>
- <scalatool
- file="${build-quick.dir}/bin/scalac"
- name="Scala compiler"
- class="scala.tools.nsc.Main"
- version="${version.number}"
- copyright="${copyright.string}"
- javaFlags="${java.flags}"/>
- <scalatool
- file="${build-quick.dir}/bin/scaladoc"
- name="Scala doc generator"
- class="scala.tools.nsc.ScalaDoc"
- version="${version.number}"
- copyright="${copyright.string}"
- javaFlags="${java.flags}"/>
- <scalatool
- file="${build-quick.dir}/bin/fsc"
- name="Fast Scala compiler"
- class="scala.tools.nsc.CompileClient"
- version="${version.number}"
- copyright="${copyright.string}"
- javaFlags="${java.flags}"/>
- <chmod perm="ugo+rx" file="${build-quick.dir}/bin/scala"/>
- <chmod perm="ugo+rx" file="${build-quick.dir}/bin/scalac"/>
- <chmod perm="ugo+rx" file="${build-quick.dir}/bin/scaladoc"/>
- <chmod perm="ugo+rx" file="${build-quick.dir}/bin/fsc"/>
- <!-- Point to latest -->
- <touch file="${build-quick.dir}/pack.complete" verbose="no"/>
- </target>
- <target name="pack.load" depends="pack.build">
- <path id="pack.classpath">
- <pathelement location="${build-quick.dir}/lib/scala-library.jar"/>
- <pathelement location="${build-quick.dir}/lib/scala-compiler.jar"/>
- <pathelement location="${build-quick.dir}/lib/scala-partest.jar"/>
- <pathelement location="${ant.jar}"/>
- </path>
- </target>
-
-<!-- ===========================================================================
-BUILD DOCUMENTATION
-============================================================================ -->
-
- <target name="docs.init" depends="quick.load">
- <uptodate property="docs.available" targetfile="${build-docs.dir}/build.complete">
+ <target name="docs.pre-lib" depends="docs.start">
+ <uptodate property="docs.lib.available" targetfile="${build-docs.dir}/library.complete">
<srcfiles dir="${src.dir}">
<include name="library/**"/>
<include name="dbc/**"/>
@@ -582,14 +760,14 @@ BUILD DOCUMENTATION
</uptodate>
</target>
- <target name="docs.build" depends="docs.init" unless="docs.available">
- <stopwatch name="docs.timer"/>
- <mkdir dir="${build-docs.dir}"/>
+ <target name="docs.lib" depends="docs.pre-lib" unless="docs.lib.available">
+ <stopwatch name="docs.lib.timer"/>
+ <mkdir dir="${build-docs.dir}/library"/>
<scaladoc
- destdir="${build-docs.dir}"
+ destdir="${build-docs.dir}/library"
windowtitle="Scala Library"
doctitle="Scala ${version.number} API"
- classpathref="quick.classpath">
+ classpathref="pack.classpath">
<src>
<files includes="${src.dir}/dbc"/>
<files includes="${src.dir}/actors"/>
@@ -597,27 +775,50 @@ BUILD DOCUMENTATION
</src>
<include name="**/*.scala"/>
</scaladoc>
- <touch file="${build-docs.dir}/build.complete" verbose="no"/>
- <stopwatch name="docs.timer" action="total"/>
+ <touch file="${build-docs.dir}/lib.complete" verbose="no"/>
+ <stopwatch name="docs.lib.timer" action="total"/>
</target>
- <target name="docs.load" depends="docs.build"/>
+ <target name="docs.pre-comp" depends="docs.lib">
+ <uptodate property="docs.comp.available" targetfile="${build-docs.dir}/compiler.complete">
+ <srcfiles dir="${src.dir}/compiler"/>
+ </uptodate>
+ </target>
+ <target name="docs.comp" depends="docs.pre-comp" unless="docs.comp.available">
+ <stopwatch name="docs.comp.timer"/>
+ <mkdir dir="${build-docs.dir}/compiler"/>
+ <scaladoc
+ destdir="${build-docs.dir}/compiler"
+ windowtitle="Scala Compiler"
+ doctitle="Scala Compiler ${version.number} API"
+ classpathref="pack.classpath"
+ srcdir="${src.dir}/compiler">
+ <include name="**/*.scala"/>
+ </scaladoc>
+ <touch file="${build-docs.dir}/comp.complete" verbose="no"/>
+ <stopwatch name="docs.comp.timer" action="total"/>
+ </target>
+
+ <target name="docs.done" depends="docs.lib"/>
+
+ <target name="docs.clean">
+ <delete dir="${build-docs.dir}" includeemptydirs="yes" quiet="yes" failonerror="no"/>
+ </target>
+
<!-- ===========================================================================
BOOTRAPING TEST AND TEST SUITE
============================================================================ -->
-
- <target name="stability.test" depends="strap.load">
+
+ <target name="test.stability" depends="strap.done">
<same dir="${build-quick.dir}" todir="${build-strap.dir}" failondifferent="no">
<exclude name="**/*.properties"/>
<exclude name="bin/**"/>
- <exclude name="lib/**"/>
- <exclude name="pack.complete"/>
+ <exclude name="*.complete"/>
</same>
</target>
- <target name="suite.test" depends="partest.load, pack.load">
- <taskdef resource="scala/tools/partest/antlib.xml" classpathref="pack.classpath"/>
+ <target name="test.suite" depends="pack.done">
<partest showlog="yes" erroronfailed="yes">
<classpath>
<path refid="pack.classpath"/>
@@ -633,61 +834,40 @@ BOOTRAPING TEST AND TEST SUITE
<residenttests dir="${test.dir}/files/res" includes="*.res"/>
</partest>
</target>
-
-<!-- ===========================================================================
-MAKE SABBUS JAR (to remove once sabbus is part of starr library)
-============================================================================ -->
- <target name="sabbus.build" depends="starr.load">
- <taskdef resource="scala/tools/ant/antlib.xml" classpathref="starr.classpath"/>
- <mkdir dir="${build.dir}/sabbus"/>
- <scalac
- srcdir="${src.dir}/compiler/scala/tools/ant/sabbus/"
- destdir="${build.dir}/sabbus">
- <include name="*.scala"/>
- <classpath>
- <pathelement location="${lib.starr.jar}"/>
- <pathelement location="${comp.starr.jar}"/>
- <pathelement location="${ant.jar}"/>
- </classpath>
- </scalac>
- <copy
- file="${src.dir}/compiler/scala/tools/ant/sabbus/antlib.xml"
- todir="${build.dir}/sabbus/scala/tools/ant/sabbus"/>
- <jar
- destfile="${lib.dir}/sabbus.jar"
- basedir="${build.dir}/sabbus"/>
- </target>
-
- <target name="sabbus.load" depends="sabbus.build"/>
+ <target name="test.done" depends="test.suite, test.stability"/>
<!-- ===========================================================================
-MAKE ACTUAL DISTRIBUTION
+DISTRIBUTION
============================================================================ -->
- <target name="dist.init" depends="docs.load, pack.load"/>
-
- <target name="dist.build" depends="dist.init" unless="dist.available">
+ <target name="dist.start" depends="docs.done, pack.done">
<property name="dist.dir" value="${dists.dir}/scala-${version.number}"/>
- <!-- Copy model -->
+ </target>
+
+ <target name="dist.base" depends="dist.start">
<mkdir dir="${dist.dir}/lib"/>
<copy toDir="${dist.dir}/lib">
- <fileset dir="${build-quick.dir}/lib"/>
+ <fileset dir="${build-pack.dir}/lib"/>
</copy>
<mkdir dir="${dist.dir}/bin"/>
<copy toDir="${dist.dir}/bin">
- <fileset dir="${build-quick.dir}/bin"/>
+ <fileset dir="${build-pack.dir}/bin"/>
</copy>
<chmod perm="ugo+rx" file="${dist.dir}/bin/scala"/>
<chmod perm="ugo+rx" file="${dist.dir}/bin/scalac"/>
<chmod perm="ugo+rx" file="${dist.dir}/bin/scaladoc"/>
<chmod perm="ugo+rx" file="${dist.dir}/bin/fsc"/>
- <!-- Packages doc -->
+ </target>
+
+ <target name="dist.doc" depends="dist.base">
<mkdir dir="${dist.dir}/doc/api"/>
<copy toDir="${dist.dir}/doc/api">
- <fileset dir="${build-docs.dir}"/>
+ <fileset dir="${build-docs.dir}/library"/>
</copy>
- <!-- Packages source -->
+ </target>
+
+ <target name="dist.src" depends="dist.doc">
<mkdir dir="${dist.dir}/src"/>
<jar destfile="${dist.dir}/src/scala-library-src.jar">
<fileset dir="${src.dir}/library"/>
@@ -701,56 +881,102 @@ MAKE ACTUAL DISTRIBUTION
</jar>
</target>
- <target name="dist.latest" depends="dist.build" unless="os.win">
+ <target name="dist.latest" depends="dist.src" unless="os.win">
<symlink link="${dists.dir}/latest" resource="${dist.dir}" overwrite="yes"/>
</target>
- <target name="dist.load" depends="stability.test, suite.test, dist.latest"/>
+ <target name="dist.done" depends="dist.latest"/>
+
+ <target name="dist.clean">
+ <delete dir="${dists.dir}" includeemptydirs="yes" quiet="yes" failonerror="no"/>
+ </target>
+
+<!-- ===========================================================================
+TEST AND DISTRIBUTION BUNDLE (ALL)
+============================================================================ -->
+
+ <target name="all.done" depends="dist.done, test.done"/>
+
+ <target name="all.clean" depends="locker.clean, docs.clean, dist.clean"/>
<!-- ===========================================================================
-MAKE NEW STARR
+STABLE REFERENCE (STARR)
============================================================================ -->
- <target name="starr.init" depends="pack.load"/>
+ <target name="starr.start" depends="pack.done"/>
- <target name="starr.build" depends="starr.init">
+ <target name="starr.clean" depends="locker.clean, starr.start">
<delete file="${lib.starr.jar}"/>
<delete file="${comp.starr.jar}"/>
<delete file="${lib.dir}/scala-library-src.jar"/>
+ </target>
+
+ <target name="starr.lib" depends="starr.clean">
<copy file="${build-quick.dir}/lib/scala-library.jar" toFile="${lib.starr.jar}"/>
- <copy file="${build-quick.dir}/lib/scala-compiler.jar" toFile="${comp.starr.jar}"/>
+ </target>
+
+ <target name="starr.comp" depends="starr.lib">
+ <jar destfile="${comp.starr.jar}">
+ <fileset dir="${build-quick.dir}/classes/compiler"/>
+ </jar>
+ </target>
+
+ <target name="starr.src" depends="starr.comp">
<jar destfile="${lib.dir}/scala-library-src.jar">
<fileset dir="${src.dir}/library"/>
<fileset dir="${src.dir}/actors"/>
</jar>
</target>
+
+ <target name="starr.done" depends="starr.src"/>
<!-- ===========================================================================
-CLEAN
+MISCELLANEOUS
============================================================================ -->
-
- <target name="locker.clean" depends="quick.clean">
- <delete dir="${build-locker.dir}" includeemptydirs="yes" quiet="yes" failonerror="no"/>
- </target>
-
- <target name="quick.clean" depends="strap.clean, partest.clean">
- <delete dir="${build-quick.dir}" includeemptydirs="yes" quiet="yes" failonerror="no"/>
+
+ <target name="graph.init">
+ <taskdef name="vizant" classname="vizant.Vizant" classpath="${lib-ant.dir}/vizant.jar"/>
</target>
-
- <target name="strap.clean">
- <delete dir="${build-strap.dir}" includeemptydirs="yes" quiet="yes" failonerror="no"/>
+
+ <target name="graph.clean" depends="graph.init">
+ <vizant antfile="${ant.file}" outfile="${ant.project.name}.dot" from="starr.clean"/>
</target>
-
- <target name="partest.clean">
- <delete dir="${build-partest.dir}" includeemptydirs="yes" quiet="yes" failonerror="no"/>
+
+ <target name="graph.all" depends="graph.init">
+ <vizant antfile="${ant.file}" outfile="${ant.project.name}.dot" from="all.done"/>
</target>
-
- <target name="docs.clean">
- <delete dir="${build-docs.dir}" includeemptydirs="yes" quiet="yes" failonerror="no"/>
+
+ <target name="graph.sabbus" depends="graph.init">
+ <vizant antfile="${ant.file}" outfile="${ant.project.name}.dot"/>
</target>
- <target name="dists.clean">
- <delete dir="${dists.dir}" includeemptydirs="yes" quiet="yes" failonerror="no"/>
+<!-- ===========================================================================
+MAKE SABBUS JAR (to remove once sabbus is part of starr library)
+============================================================================ -->
+
+ <target name="sabbus.start" depends="init"/>
+
+ <target name="sabbus.build" depends="sabbus.start">
+ <taskdef resource="scala/tools/ant/antlib.xml" classpathref="starr.classpath"/>
+ <mkdir dir="${build.dir}/sabbus"/>
+ <scalac
+ srcdir="${src.dir}/compiler/scala/tools/ant/sabbus/"
+ destdir="${build.dir}/sabbus">
+ <include name="*.scala"/>
+ <classpath>
+ <pathelement location="${lib.starr.jar}"/>
+ <pathelement location="${comp.starr.jar}"/>
+ <pathelement location="${ant.jar}"/>
+ </classpath>
+ </scalac>
+ <copy
+ file="${src.dir}/compiler/scala/tools/ant/sabbus/antlib.xml"
+ todir="${build.dir}/sabbus/scala/tools/ant/sabbus"/>
+ <jar
+ destfile="${lib.dir}/sabbus.jar"
+ basedir="${build.dir}/sabbus"/>
</target>
-
+
+ <target name="sabbus.done" depends="sabbus.build"/>
+
</project>
diff --git a/src/compiler/scala/tools/ant/ScalaTool.scala b/src/compiler/scala/tools/ant/ScalaTool.scala
index f53363623c..bfd78ae4d5 100644
--- a/src/compiler/scala/tools/ant/ScalaTool.scala
+++ b/src/compiler/scala/tools/ant/ScalaTool.scala
@@ -10,39 +10,31 @@
package scala.tools.ant
-import scala.collection.immutable.{Map, ListMap}
-
import java.io.{File, InputStream, FileWriter}
import org.apache.tools.ant.BuildException
import org.apache.tools.ant.taskdefs.MatchingTask
-import org.apache.tools.ant.types.Path
-import org.apache.tools.ant.util.FileUtils
+import org.apache.tools.ant.types.{Path, Reference}
/** <p>
* An Ant task that generates a shell or batch script to execute a
- * <a href="http://scala-lang.org/" target="_top">Scala</a> program.
+ * Scala program.
* This task can take the following parameters as attributes:
* </p><ul>
* <li>file (mandatory),</li>
- * <li>name,</li>
* <li>class (mandatory),</li>
* <li>platforms,</li>
- * <li>version,</li>
- * <li>copyright,</li>
- * <li>bootclasspath,</li>
- * <li>extclasspath,</li>
+ * <li>classpath,</li>
* <li>properties,</li>
* <li>javaflags,</li>
* <li>toolflags.</li></ul>
*
* @author Gilles Dubochet
- * @version 1.0
+ * @version 1.1
*/
class ScalaTool extends MatchingTask {
- /** The unique Ant file utilities instance to use in this task. */
- private val fileUtils = FileUtils.newFileUtils()
+ private def emptyPath = new Path(getProject)
/*============================================================================*\
** Ant user-properties **
@@ -60,89 +52,49 @@ class ScalaTool extends MatchingTask {
}
/** The path to the exec script file. ".bat" will be appended for the
- * Windows BAT file, if generated.
- */
+ * Windows BAT file, if generated. */
private var file: Option[File] = None
/** The main class to run. */
private var mainClass: Option[String] = None
- /** The name of this tool. Can only be set when a main class is defined,
- * default this is equal to the file name.
- */
- private var name: Option[String] = None
-
/** Supported platforms for the script. Either "unix" or "windows".
- * Defaults to both.
- */
- private var platforms: List[String] = Nil
-
- /** The optional version number. If set, when "-version" is passed to the
- * script, this value will be printed.
- */
- private var version: String = ""
-
- /** The optional copyright notice, that will be printed in the script. */
- private var copyright: String = "This file is copyrighted by its owner"
-
- /** The optional boot classpath */
- private var bootclasspath: List[String] = Nil
+ * Defaults to both. */
+ private var platforms: List[String] = List("unix", "windows")
/** An (optional) path to all JARs that this script depend on. Paths must be
- * relative to the scala home directory. If not set, all JAR archives in
- * "lib/" are automatically added.
- */
- private var extclasspath: List[String] = Nil
+ * relative to the scala home directory. If not set, all JAR archives and
+ * folders in "lib/" are automatically added. */
+ private var classpath: Option[Path] = None
/** Comma-separated Java system properties to pass to the JRE. Properties
- * are formated as name=value. Properties scala.home, scala.tool.name and
- * scala.tool.version are always set.
- */
- private var properties: List[Pair[String,String]] = Nil
+ * are formated as name=value. Properties scala.home, scala.tool.name and
+ * scala.tool.version are always set. */
+ private var properties: List[(String, String)] = Nil
/** Additional flags passed to the JRE ("java [javaFlags] class"). */
private var javaFlags: String = ""
/** Additional flags passed to the tool ("java class [toolFlags]"). Can only
- * be set when a main class is defined.
- */
+ * be set when a main class is defined. */
private var toolFlags: String = ""
/*============================================================================*\
** Properties setters **
\*============================================================================*/
- /** Sets the file attribute.
- * Used by <a href="http://ant.apache.org/" target="_top">Ant</a>.
- *
- * @param input The value of <code>file</code>.
- */
+ /** Sets the file attribute. */
def setFile(input: File) =
file = Some(input)
- /** Sets the file attribute.
- * Used by <a href="http://ant.apache.org/" target="_top">Ant</a>.
- *
- * @param input The value of <code>file</code>.
- */
- def setName(input: String) =
- name = Some(input)
-
- /** Sets the main class attribute.
- * Used by <a href="http://ant.apache.org/" target="_top">Ant</a>.
- *
- * @param input The value of <code>mainClass</code>.
- */
+ /** Sets the main class attribute. */
def setClass(input: String) =
mainClass = Some(input)
- /** Sets the platforms attribute. Used by Ant.
- *
- * @param input The value for <code>platforms</code>.
- */
+ /** Sets the platforms attribute. */
def setPlatforms(input: String) = {
platforms = List.fromArray(input.split(",")).flatMap { s: String =>
- val st = s.trim()
+ val st = s.trim
if (Platforms.isPermissible(st))
(if (input != "") List(st) else Nil)
else {
@@ -152,102 +104,55 @@ class ScalaTool extends MatchingTask {
}
}
- /** Sets the version attribute.
- * Used by <a href="http://ant.apache.org/" target="_top">Ant</a>.
- *
- * @param input The value of <code>version</code>.
- */
- def setVersion(input: String) =
- version = input
-
- /** Sets the copyright attribute.
- * Used by <a href="http://ant.apache.org/" target="_top">Ant</a>.
- *
- * @param input The value of <code>copyright</code>.
- */
- def setCopyright(input: String) =
- copyright = input
-
- /** Sets the boot classpath attribute.
- * Used by <a href="http://ant.apache.org/" target="_top">Ant</a>.
- *
- * @param input The value of <code>bootclasspath</code>.
- */
- def setBootclasspath(input: String) =
- bootclasspath = bootclasspath ::: List.fromArray(input.split(":"))
-
- /** Sets the extension classpath attribute.
- * Used by <a href="http://ant.apache.org/" target="_top">Ant</a>.
- *
- * @param input The value of <code>extclasspath</code>.
- */
- def setExtclasspath(input: String) =
- extclasspath = extclasspath ::: List.fromArray(input.split(":"))
-
- /** Sets the properties attribute.
- * Used by <a href="http://ant.apache.org/" target="_top">Ant</a>.
- *
- * @param input The value for <code>properties</code>.
- */
+ /** Sets the classpath with which to run the tool. */
+ def setClassPath(input: Path): Unit =
+ if (classpath.isEmpty)
+ classpath = Some(input)
+ else
+ classpath.get.append(input)
+ def createClassPath: Path = {
+ if (classpath.isEmpty) classpath = Some(emptyPath)
+ classpath.get.createPath()
+ }
+ def setClassPathRef(input: Reference): Unit =
+ createClassPath.setRefid(input)
+
+ /** Sets JVM properties that will be set whilst running the tool. */
def setProperties(input: String) = {
properties = List.fromArray(input.split(",")).flatMap { s: String =>
- val st = s.trim(); val stArray = st.split("=", 2)
+ val st = s.trim
+ val stArray = st.split("=", 2)
if (stArray.length == 2) {
if (input != "") List(Pair(stArray(0), stArray(1))) else Nil
- } else error("Property " + st + " does not conform to specification.")
+ }
+ else
+ error("Property " + st + " is not formatted properly.")
}
}
- /** Sets the version attribute.
- * Used by <a href="http://ant.apache.org/" target="_top">Ant</a>.
- *
- * @param input The value of <code>version</code>.
- */
+ /** Sets flags to be passed to the Java interpreter. */
def setJavaflags(input: String) =
- javaFlags = input
+ javaFlags = input.trim
- /** Sets the version attribute.
- * Used by <a href="http://ant.apache.org/" target="_top">Ant</a>.
- *
- * @param input The value of <code>version</code>.
- */
+ /** Sets flags to be passed to the tool. */
def setToolflags(input: String) =
- toolFlags = input
+ toolFlags = input.trim
/*============================================================================*\
** Properties getters **
\*============================================================================*/
- /** Gets the value of the file attribute in a Scala-friendly form.
- * @returns The file as a file. */
- private def getFile: File =
- if (file.isEmpty) error("Member 'file' is empty.")
- else getProject().resolveFile(file.get.toString)
-
- /** Gets the value of the bootclasspath attribute in a Scala-friendly form.
- * @returns The boot class path as a list of files. */
- private def getUnixBootClasspath: String =
- bootclasspath.mkString("", ":", "")
-
- /** Gets the value of the bootclasspath attribute in a Scala-friendly form.
- * @returns The boot class path as a list of files. */
- private def getWinBootClasspath: String =
- bootclasspath.map(_.replace('/', '\\')).
- mkString("", ";", "")
-
/** Gets the value of the classpath attribute in a Scala-friendly form.
* @returns The class path as a list of files. */
- private def getUnixExtClasspath: String =
- extclasspath.mkString("", ":", "")
+ private def getUnixclasspath: String =
+ classpath.getOrElse(emptyPath).list.mkString("", ":", "")
/** Gets the value of the classpath attribute in a Scala-friendly form.
* @returns The class path as a list of files. */
- private def getWinExtClasspath: String =
- extclasspath.map(_.replace('/', '\\')).
+ private def getWinclasspath: String =
+ classpath.getOrElse(emptyPath).list.map(_.replace('/', '\\')).
mkString("", ";", "")
- /** Gets the value of the classpath attribute in a Scala-friendly form.
- * @returns The class path as a list of files. */
private def getProperties: String =
properties.map({
case Pair(name,value) => "-D" + name + "=\"" + value + "\""
@@ -264,9 +169,7 @@ class ScalaTool extends MatchingTask {
private def error(message: String): Nothing =
throw new BuildException(message, getLocation())
- private def readResource(resource: String,
- tokens: Map[String, String]
- ): String = {
+ private def readAndPatchResource(resource: String, tokens: Map[String, String]): String = {
val chars = new Iterator[Char] {
private val stream =
this.getClass().getClassLoader().getResourceAsStream(resource)
@@ -315,47 +218,35 @@ class ScalaTool extends MatchingTask {
private def expandWinVar(vars: Map[String,String]): Map[String,String] =
vars transform { (x, vari) => vari.replaceAll("#([^#]*)#", "%_$1%") }
- private def pipeTemplate(template: String, patches: Map[String,String]) = {
- val resourceRoot = "scala/tools/ant/templates/"
- if (platforms.contains("unix")) {
- val unixPatches = expandUnixVar(patches.
- update("bootclasspath", getUnixBootClasspath).
- update("extclasspath", getUnixExtClasspath))
- val unixTemplateResource = resourceRoot + template + "-unix.tmpl"
- val unixTemplate = readResource(unixTemplateResource, unixPatches)
- writeFile(getFile, unixTemplate)
- }
- if (platforms.contains("windows")) {
- val winPatches = expandWinVar(patches.
- update("bootclasspath", getWinBootClasspath).
- update("extclasspath", getWinExtClasspath))
- val winTemplateResource = resourceRoot + template + "-windows.tmpl"
- val winTemplate = readResource(winTemplateResource, winPatches)
- writeFile(new File(getFile.getAbsolutePath() + ".bat"), winTemplate)
- }
- }
-
/*============================================================================*\
** The big execute method **
\*============================================================================*/
- /** Performs the compilation. */
+ /** Performs the tool creation. */
override def execute() = {
// Tests if all mandatory attributes are set and valid.
if (file.isEmpty) error("Attribute 'file' is not set.")
if (mainClass.isEmpty) error("Main class must be set.")
- if (platforms.isEmpty) platforms = Platforms.values
- if (name.isEmpty) name = Some(file.get.getName)
- val patches = ListMap.empty.
- update("name", name.get).
- update("class", mainClass.get).
- update("version", version).
- update("copyright", copyright).
- update("properties", getProperties).
- update("javaflags", javaFlags).
- update("toolflags", toolFlags)
- pipeTemplate("tool", patches)
+ val resourceRoot = "scala/tools/ant/templates/"
+ val patches = Map (
+ ("class", mainClass.get),
+ ("properties", getProperties),
+ ("javaflags", javaFlags),
+ ("toolflags", toolFlags)
+ )
+ if (platforms.contains("unix")) {
+ val unixPatches = patches + (("classpath", getUnixclasspath))
+ val unixTemplateResource = resourceRoot + "tool-unix.tmpl"
+ val unixTemplate = readAndPatchResource(unixTemplateResource, unixPatches)
+ writeFile(file.get, unixTemplate)
+ }
+ if (platforms.contains("windows")) {
+ val winPatches = patches + (("classpath", getWinclasspath))
+ val winTemplateResource = resourceRoot + "tool-windows.tmpl"
+ val winTemplate = readAndPatchResource(winTemplateResource, winPatches)
+ writeFile(new File(file.get.getAbsolutePath() + ".bat"), winTemplate)
+ }
}
}
diff --git a/src/compiler/scala/tools/ant/templates/tool-unix.tmpl b/src/compiler/scala/tools/ant/templates/tool-unix.tmpl
index d963d18873..0f7cfa7447 100644
--- a/src/compiler/scala/tools/ant/templates/tool-unix.tmpl
+++ b/src/compiler/scala/tools/ant/templates/tool-unix.tmpl
@@ -1,9 +1,7 @@
#!/bin/sh
##############################################################################
-# @name@ @version@
-##############################################################################
-# @copyright@
+# Copyright 2002-2008, LAMP/EPFL
#
# This is free software; see the distribution for copying conditions.
# There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
@@ -11,10 +9,8 @@
##############################################################################
cygwin=false;
-darwin=false;
case "`uname`" in
CYGWIN*) cygwin=true ;;
- Darwin*) darwin=true ;;
esac
# Finding the root folder for this Scala distribution
@@ -38,27 +34,17 @@ if $cygwin; then
fi
# Constructing the extension classpath
-EXTENSION_CLASSPATH="@extclasspath@"
-if [ -z "$EXTENSION_CLASSPATH" ] ; then
+TOOL_CLASSPATH="@classpath@"
+if [ -z "$TOOL_CLASSPATH" ] ; then
for ext in `ls -d "$SCALA_HOME"/lib/*` ; do
- if [ -z "$EXTENSION_CLASSPATH" ] ; then
- EXTENSION_CLASSPATH="$ext"
+ if [ -z "$TOOL_CLASSPATH" ] ; then
+ TOOL_CLASSPATH="$ext"
else
- EXTENSION_CLASSPATH="$EXTENSION_CLASSPATH:$ext"
+ TOOL_CLASSPATH="$TOOL_CLASSPATH:$ext"
fi
done
fi
-# Setting the boot class-path to be the standard library (either as a JAR or a folder)
-BOOT_CLASSPATH="@bootclasspath@"
-if [ -z "$BOOT_CLASSPATH" ] ; then
- if [ -f "$SCALA_HOME/lib/scala-library.jar" ] ; then
- BOOT_CLASSPATH="$SCALA_HOME/lib/scala-library.jar"
- elif [ -d "$SCALA_HOME/lib/library" ] ; then
- BOOT_CLASSPATH="$SCALA_HOME/lib/library"
- fi
-fi
-
if $cygwin; then
if [ "$OS" = "Windows_NT" ] && cygpath -m .>/dev/null 2>/dev/null ; then
format=mixed
@@ -66,11 +52,10 @@ if $cygwin; then
format=windows
fi
SCALA_HOME=`cygpath --$format "$SCALA_HOME"`
- EXTENSION_CLASSPATH=`cygpath --path --$format "$EXTENSION_CLASSPATH"`
- BOOT_CLASSPATH=`cygpath --path --$format "$BOOT_CLASSPATH"`
+ TOOL_CLASSPATH=`cygpath --path --$format "$TOOL_CLASSPATH"`
fi
# Reminder: substitution ${JAVA_OPTS:=-Xmx256M -Xms16M} DO NOT work on Solaris
[ -n "$JAVA_OPTS" ] || JAVA_OPTS="@javaflags@"
-${JAVACMD:=java} $JAVA_OPTS -Xbootclasspath/a:"$BOOT_CLASSPATH" -cp "$EXTENSION_CLASSPATH" -Dscala.home="$SCALA_HOME" -Denv.classpath="$CLASSPATH" -Denv.emacs="$EMACS" @properties@ @class@ @toolflags@ "$@@"
+${JAVACMD:=java} $JAVA_OPTS -cp "$TOOL_CLASSPATH" -Dscala.home="$SCALA_HOME" -Denv.classpath="$CLASSPATH" -Denv.emacs="$EMACS" @properties@ @class@ @toolflags@ "$@@"
diff --git a/src/compiler/scala/tools/ant/templates/tool-windows.tmpl b/src/compiler/scala/tools/ant/templates/tool-windows.tmpl
index 7c16d8d873..11deb440b7 100644
--- a/src/compiler/scala/tools/ant/templates/tool-windows.tmpl
+++ b/src/compiler/scala/tools/ant/templates/tool-windows.tmpl
@@ -1,9 +1,7 @@
@@echo off
rem ##########################################################################
-rem # @name@ @version@
-rem ##########################################################################
-rem # @copyright@
+rem # Copyright 2002-2008, LAMP/EPFL
rem #
rem # This is free software; see the distribution for copying conditions.
rem # There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
@@ -34,38 +32,28 @@ rem We use the value of the JAVA_OPTS environment variable if defined
set _JAVA_OPTS=%JAVA_OPTS%
if "%_JAVA_OPTS%"=="" set _JAVA_OPTS=@javaflags@
-set _EXTENSION_CLASSPATH=@extclasspath@
-if "%_EXTENSION_CLASSPATH%"=="" (
+set _TOOL_CLASSPATH=@extclasspath@
+if "%_TOOL_CLASSPATH%"=="" (
for %%f in ("%_SCALA_HOME%\lib\*") do call :add_cpath "%%f"
if "%OS%"=="Windows_NT" (
for /d %%f in ("%_SCALA_HOME%\lib\*") do call :add_cpath "%%f"
)
)
-set _BOOT_CLASSPATH=@bootclasspath@
-if "%_BOOT_CLASSPATH%"=="" (
- if exist "%_SCALA_HOME%\lib\scala-library.jar" (
- set _BOOT_CLASSPATH=%_SCALA_HOME%\lib\scala-library.jar
- )
- if exist "%_SCALA_HOME%\lib\library" (
- set _BOOT_CLASSPATH=%_SCALA_HOME%\lib\library
- )
-)
-
set _PROPS=-Dscala.home="%_SCALA_HOME%" -Denv.classpath="%CLASSPATH%" -Denv.emacs="%EMACS%" @properties@
-rem echo %_JAVACMD% -Xbootclasspath/a:"%_BOOT_CLASSPATH%" %_JAVA_OPTS% %_PROPS% -cp "%_EXTENSION_CLASSPATH%" @class@ @toolflags@ %_ARGS%
-%_JAVACMD% -Xbootclasspath/a:"%_BOOT_CLASSPATH%" %_JAVA_OPTS% %_PROPS% -cp "%_EXTENSION_CLASSPATH%" @class@ @toolflags@ %_ARGS%
+rem echo %_JAVACMD% %_JAVA_OPTS% %_PROPS% -cp "%_TOOL_CLASSPATH%" @class@ @toolflags@ %_ARGS%
+%_JAVACMD% %_JAVA_OPTS% %_PROPS% -cp "%_TOOL_CLASSPATH%" @class@ @toolflags@ %_ARGS%
goto end
rem ##########################################################################
rem # subroutines
:add_cpath
- if "%_EXTENSION_CLASSPATH%"=="" (
- set _EXTENSION_CLASSPATH=%~1
+ if "%_TOOL_CLASSPATH%"=="" (
+ set _TOOL_CLASSPATH=%~1
) else (
- set _EXTENSION_CLASSPATH=%_EXTENSION_CLASSPATH%;%~1
+ set _TOOL_CLASSPATH=%_TOOL_CLASSPATH%;%~1
)
goto :eof
diff --git a/src/compiler/scala/tools/nsc/Settings.scala b/src/compiler/scala/tools/nsc/Settings.scala
index 9b1567d145..9665a8bf00 100644
--- a/src/compiler/scala/tools/nsc/Settings.scala
+++ b/src/compiler/scala/tools/nsc/Settings.scala
@@ -66,7 +66,7 @@ class Settings(error: String => Unit) {
val guessJar = new File(new File(new File(scalaHome), "lib"), "scala-library.jar")
if (guessJar.isFile()) guessJar.getPath()
else {
- val guessDir = new File(new File(new File(scalaHome), "lib"), "library")
+ val guessDir = new File(new File(new File(scalaHome), "classes"), "library")
if (guessDir.isDirectory()) guessDir.getPath() else null
}
} else null