diff options
author | Gilles Dubochet <gilles.dubochet@epfl.ch> | 2005-12-21 20:31:59 +0000 |
---|---|---|
committer | Gilles Dubochet <gilles.dubochet@epfl.ch> | 2005-12-21 20:31:59 +0000 |
commit | 10322415aeea472260abd25324f707728fe55f4d (patch) | |
tree | 7772b8db4cc4a999e69ed01654363230770736d8 | |
parent | 713b176bd27f438b7870c3a69891eba0db49aaf4 (diff) | |
download | scala-10322415aeea472260abd25324f707728fe55f4d.tar.gz scala-10322415aeea472260abd25324f707728fe55f4d.tar.bz2 scala-10322415aeea472260abd25324f707728fe55f4d.zip |
1.
2. Improved the generation of a distribution.
3. 'scalanstest' works again.
-rw-r--r-- | build.xml | 75 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/Settings.scala | 38 | ||||
-rw-r--r-- | src/compiler/scala/tools/util/ClassPath.java | 98 | ||||
-rw-r--r-- | src/exec/scala-tool.unix.tmpl | 18 | ||||
-rw-r--r-- | src/exec/scala-tool.win.tmpl | 4 | ||||
-rw-r--r-- | src/exec/scala.unix.tmpl | 15 | ||||
-rw-r--r-- | src/exec/scala.win.tmpl | 11 | ||||
-rwxr-xr-x | test/scalanstest | 12 |
8 files changed, 123 insertions, 148 deletions
@@ -45,8 +45,10 @@ <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.jar" value="${lib.dir}/fjbg.jar"/> - <property name="msil.jar" value="${lib.dir}/msil.jar"/> + <property name="fjbg.name" value="fjbg.jar"/> + <property name="fjbg.jar" value="${lib.dir}/${fjbg.name}"/> + <property name="msil.name" value="msil.jar"/> + <property name="msil.jar" value="${lib.dir}/${msil.name}"/> <property name="scala.dll" value="${lib.dir}/scala.dll"/> <property name="ant.jar" value="${ant.home}/lib/ant.jar"/> <!-- Location of build products properties --> @@ -149,6 +151,8 @@ <!-- Defining version number --> <tstamp prefix="start"/> <property name="version.number" value="${start.DSTAMP}-${start.TSTAMP}"/> + <property name="dist.current.dir" + value="${dist.dir}/${dist.name}-${version.number}"/> <!-- Creating boot-level tasks --> <taskdef name="starr" classname="scala.tools.nsc.ant.NSC" @@ -187,8 +191,10 @@ --> <macrodef name="build.exec"> - <attribute name="lib.dir"/> - <attribute name="comp.dir"/> + <attribute name="lib.path"/> + <attribute name="comp.path"/> + <attribute name="fjbg.path"/> + <attribute name="msil.path"/> <attribute name="exec.dir"/> <sequential> <mkdir dir="@{exec.dir}"/> @@ -197,7 +203,7 @@ <filterset> <filter token="version" value="${version}"/> <filter token="copyright" value="${copyright}"/> - <filter token="lib.path" value="@{lib.dir}"/> + <filter token="lib.path" value="@{lib.path}"/> </filterset> </copy> <chmod file="@{exec.dir}/scala" perm="ugo+rx"/> @@ -206,10 +212,10 @@ <filterset> <filter token="version" value="${version}"/> <filter token="copyright" value="${copyright}"/> - <filter token="lib.path" value="@{lib.dir}"/> - <filter token="comp.path" value="@{comp.dir}"/> - <filter token="fjbg.jar" value="${fjbg.jar}"/> - <filter token="msil.jar" value="${msil.jar}"/> + <filter token="lib.path" value="@{lib.path}"/> + <filter token="comp.path" value="@{comp.path}"/> + <filter token="fjbg.jar" value="@{fjbg.path}"/> + <filter token="msil.jar" value="@{msil.path}"/> <filter token="tool.class" value="scala.tools.nsc.Main"/> </filterset> </copy> @@ -219,7 +225,7 @@ <filterset> <filter token="version" value="${version}"/> <filter token="copyright" value="${copyright}"/> - <filter token="lib.path" value="@{lib.dir}"/> + <filter token="lib.path" value="@{lib.path}"/> </filterset> </copy> <copy file="${src.dir}/${exec.dir.name}/scala-tool.win.tmpl" @@ -227,10 +233,10 @@ <filterset> <filter token="version" value="${version}"/> <filter token="copyright" value="${copyright}"/> - <filter token="lib.path" value="@{lib.dir}"/> - <filter token="comp.path" value="@{comp.dir}"/> - <filter token="fjbg.jar" value="${fjbg.jar}"/> - <filter token="msil.jar" value="${msil.jar}"/> + <filter token="lib.path" value="@{lib.path}"/> + <filter token="comp.path" value="@{comp.path}"/> + <filter token="fjbg.jar" value="@{fjbg.path}"/> + <filter token="msil.jar" value="@{msil.path}"/> <filter token="tool.class" value="scala.tools.nsc.Main"/> </filterset> </copy> @@ -299,8 +305,10 @@ <excludesfile name="${nsc.excludes}" if="excludes.avail"/> </starr> <!-- Build executable files --> - <build.exec lib.dir="${locker.lib.dir}" - comp.dir="${locker.comp.dir}" + <build.exec lib.path="${locker.lib.dir}" + comp.path="${locker.comp.dir}" + fjbg.path="${fjbg.jar}" + msil.path="${msil.jar}" exec.dir="${locker.dir}/${exec.dir.name}"/> </target> @@ -366,8 +374,10 @@ <excludesfile name="${nsc.excludes}" if="excludes.avail"/> </locker> <!-- Build executable files --> - <build.exec lib.dir="${quick.lib.dir}" - comp.dir="${quick.comp.dir}" + <build.exec lib.path="${quick.lib.dir}" + comp.path="${quick.comp.dir}" + fjbg.path="${fjbg.jar}" + msil.path="${msil.jar}" exec.dir="${quick.dir}/${exec.dir.name}"/> </target> @@ -434,8 +444,10 @@ <excludesfile name="${nsc.excludes}" if="excludes.avail"/> </quick> <!-- Build executable files --> - <build.exec lib.dir="${strap.lib.dir}" - comp.dir="${strap.comp.dir}" + <build.exec lib.path="${strap.lib.dir}" + comp.path="${strap.comp.dir}" + fjbg.path="${fjbg.jar}" + msil.path="${msil.jar}" exec.dir="${strap.dir}/${exec.dir.name}"/> <!-- Compares quick and test level --> <checksum totalproperty="quick.md5"> @@ -481,21 +493,28 @@ --> <target name="dist" depends="test"> - <mkdir dir="${dist.dir}"/> - <mkdir dir="${dist.dir}/lib"/> - <jar destfile="${dist.dir}/lib/${comp.jar.name}" + <mkdir dir="${dist.current.dir}"/> + <mkdir dir="${dist.current.dir}/lib"/> + <jar destfile="${dist.current.dir}/lib/${comp.jar.name}" basedir="${strap.comp.dir}"> <manifest> <attribute name="Main-Class" value="scala.tools.nsc.Main"/> </manifest> </jar> - <jar destfile="${dist.dir}/lib/${lib.jar.name}" + <jar destfile="${dist.current.dir}/lib/${lib.jar.name}" basedir="${strap.lib.dir}"> </jar> - <mkdir dir="${dist.dir}/bin"/> - <build.exec lib.dir="$$PREFIX/lib/${lib.jar.name}" - comp.dir="$$PREFIX/lib/${comp.jar.name}" - exec.dir="${dist.dir}/bin"/> + <copy file="${fjbg.jar}" todir="${dist.current.dir}/lib"/> + <copy file="${msil.jar}" todir="${dist.current.dir}/lib"/> + <mkdir dir="${dist.current.dir}/bin"/> + <build.exec lib.path="$$PREFIX/lib/${lib.jar.name}" + comp.path="$$PREFIX/lib/${comp.jar.name}" + fjbg.path="$$PREFIX/lib/${fjbg.name}" + msil.path="$$PREFIX/lib/${msil.name}" + exec.dir="${dist.current.dir}/bin"/> + <symlink link="${dist.latest.dir}" + resource="${dist.current.dir}" + overwrite="yes"/> </target> <!-- diff --git a/src/compiler/scala/tools/nsc/Settings.scala b/src/compiler/scala/tools/nsc/Settings.scala index a7a5dfe73c..63def3b60d 100644 --- a/src/compiler/scala/tools/nsc/Settings.scala +++ b/src/compiler/scala/tools/nsc/Settings.scala @@ -5,24 +5,42 @@ // $Id$ package scala.tools.nsc; +import java.io.File; + class Settings(error: String => unit) { private var allsettings: List[Setting] = List(); + private val classpathDefault = { + val scalaCp = System.getProperty("scala.class.path"); + if (scalaCp != null) scalaCp + File.pathSeparator + "." + else "." + } + private val bootclasspathDefault = { + val javaBcp = System.getProperty("sun.boot.class.path"); + val scalaBcp = System.getProperty("scala.boot.class.path"); + if (javaBcp != null && scalaBcp != null) javaBcp + File.pathSeparator + scalaBcp + else if (javaBcp != null) javaBcp + else if (scalaBcp != null) scalaBcp + else "" + } + private val extdirsDefault = { + val javaExt = System.getProperty("java.ext.dirs"); + val scalaExt = System.getProperty("scala.ext.dirs"); + if (javaExt != null && scalaExt != null) javaExt + File.pathSeparator + scalaExt + else if (javaExt != null) javaExt + else if (scalaExt != null) scalaExt + else "" + } + val debuginfo = BooleanSetting("-g", "Generate debugging info"); val nowarnings = BooleanSetting("-nowarn", "Generate no warnings"); val noassertions = BooleanSetting("-noassert", "Generate no assertions and assumptions"); val verbose = BooleanSetting("-verbose", "Output messages about what the compiler is doing"); - val classpath = StringSetting ("-classpath", "path", "Specify where to find user class files", - System.getProperty("scala.class.path", - System.getProperty("java.class.path", "."))); - val sourcepath = StringSetting ("-sourcepath", "path", "Specify where to find input source files", - System.getProperty("scala.source.path", - System.getProperty("java.source.path", "."))); - val bootclasspath = StringSetting ("-bootclasspath", "path", "Override location of bootstrap class files", - System.getProperty("sun.boot.class.path", "")); - val extdirs = StringSetting ("-extdirs", "dirs", "Override location of installed extensions", - System.getProperty("java.ext.dirs", "")); + val classpath = StringSetting ("-classpath", "path", "Specify where to find user class files", classpathDefault); + val sourcepath = StringSetting ("-sourcepath", "path", "Specify where to find input source files", ""); + val bootclasspath = StringSetting ("-bootclasspath", "path", "Override location of bootstrap class files", bootclasspathDefault); + val extdirs = StringSetting ("-extdirs", "dirs", "Override location of installed extensions", extdirsDefault); val outdir = StringSetting ("-d", "directory", "Specify where to place generated class files", ""); val encoding = StringSetting ("-encoding", "encoding", "Specify character encoding used by source files", "ISO-8859-1"); val separate = ChoiceSetting ("-separate", "Read symbol files for separate compilation", List("yes","no"), "default"); diff --git a/src/compiler/scala/tools/util/ClassPath.java b/src/compiler/scala/tools/util/ClassPath.java index 8df26355c8..182e8c2187 100644 --- a/src/compiler/scala/tools/util/ClassPath.java +++ b/src/compiler/scala/tools/util/ClassPath.java @@ -18,52 +18,6 @@ import java.util.Set; public class ClassPath { //######################################################################## - // Public Constants - - /** The system-dependent path-separator character */ - public static final String PATH_SEPARATOR = - System.getProperty("path.separator", ":"); - - /** The location of the scala library classes */ - public static final String SCALA_LIBRARY_CLASSPATH = - System.getProperty("scala.library.class.path", ""); - - /** The location of the scala library sources */ - public static final String SCALA_LIBRARY_SOURCEPATH = - System.getProperty("scala.library.source.path", ""); - - /** The current VM's boot class path */ - public static final String RUNTIME_BOOTCLASSPATH = - System.getProperty("sun.boot.class.path", ""); - - /** The current VM's extension directory path */ - public static final String RUNTIME_EXTDIRS = - System.getProperty("java.ext.dirs", ""); - - /** The implicit boot class path */ - public static final String IMPLICIT_BOOTCLASSPATH = - concat(new String[]{ - SCALA_LIBRARY_CLASSPATH, - SCALA_LIBRARY_SOURCEPATH, - RUNTIME_BOOTCLASSPATH}); - - /** The default class path */ - public static final String DEFAULT_CLASSPATH = - System.getProperty("scala.class.path", "."); - - /** The default source path */ - public static final String DEFAULT_SOURCEPATH = - System.getProperty("scala.source.path", ""); - - /** The default boot class path */ - public static final String DEFAULT_BOOTCLASSPATH = - System.getProperty("scala.boot.class.path", IMPLICIT_BOOTCLASSPATH); - - /** The default extension directory path */ - public static final String DEFAULT_EXTDIRS = - System.getProperty("scala.ext.dirs", RUNTIME_EXTDIRS); - - //######################################################################## // Public Functions /** @@ -100,9 +54,9 @@ public class ClassPath { * pass in an order preserving implementation of Set. */ public static void addFilesInPath(Set/*<File>*/ files, String path) { - path += PATH_SEPARATOR; + path += File.pathSeparator; for (int i = 0; i < path.length(); ) { - int j = path.indexOf(PATH_SEPARATOR, i); + int j = path.indexOf(File.pathSeparator, i); File file = new File(path.substring(i, j)); if (file.exists()) files.add(file); i = j + 1; @@ -110,23 +64,6 @@ public class ClassPath { } //######################################################################## - // Private Functions - - /** Returns the concatenation of the two paths. */ - private static String concat(String path1, String path2) { - if (path1.length() == 0) return path2; - if (path2.length() == 0) return path1; - return path1 + PATH_SEPARATOR + path2; - } - - /** Returns the concatenation of the array of paths. */ - private static String concat(String[] paths) { - String path = ""; - for (int i = 0; i < paths.length; i++) path = concat(path, paths[i]); - return path; - } - - //######################################################################## // Private Fields /** The abstract directory represented by this class path */ @@ -135,38 +72,17 @@ public class ClassPath { //######################################################################## // Public Constructors - /** Initializes this instance with default paths. */ - public ClassPath() { - this(DEFAULT_CLASSPATH); - } - - /** - * Initializes this instance with the specified class path and - * default source, boot class and extension directory paths. - */ - public ClassPath(String classpath) { - this(classpath, DEFAULT_SOURCEPATH, DEFAULT_BOOTCLASSPATH, - DEFAULT_EXTDIRS); - } - /** Initializes this instance with the specified paths. */ - public ClassPath(String classpath, String sourcepath, String bootclasspath, - String extdirs) + public ClassPath(String classpath, + String sourcepath, + String bootclasspath, + String extdirs) { - // replace first empty path in bootclasspath by IMPLICIT_BOOTCLASSPATH - if (!bootclasspath.equals(IMPLICIT_BOOTCLASSPATH)) { - String path = PATH_SEPARATOR + bootclasspath + PATH_SEPARATOR; - int index = path.indexOf(PATH_SEPARATOR + PATH_SEPARATOR); - if (index >= 0) - bootclasspath = - path.substring(1, index + 1) + IMPLICIT_BOOTCLASSPATH + - path.substring(index + 1, path.length() - 1); - } Set files = new LinkedHashSet(); addFilesInPath(files, bootclasspath); addArchivesInExtDirPath(files, extdirs); - addFilesInPath(files, classpath); addFilesInPath(files, sourcepath); + addFilesInPath(files, classpath); ArrayList dirs = new ArrayList(files.size()); for (Iterator i = files.iterator(); i.hasNext(); ) { AbstractFile dir = AbstractFile.getDirectory((File)i.next()); diff --git a/src/exec/scala-tool.unix.tmpl b/src/exec/scala-tool.unix.tmpl index 71f10fa261..5e5e2bb74d 100644 --- a/src/exec/scala-tool.unix.tmpl +++ b/src/exec/scala-tool.unix.tmpl @@ -15,7 +15,20 @@ case "`uname`" in Darwin*) darwin=true ;; esac -PREFIX=`dirname "$0"`/..; +SOURCE=$0; +SCRIPT=`basename "$SOURCE"`; +while [ -h "$SOURCE" ]; do + SCRIPT=`basename "$SOURCE"`; + LOOKUP=`ls -ld "$SOURCE"`; + TARGET=`expr "$LOOKUP" : '.*-> \(.*\)$'`; + if expr "${TARGET:-.}/" : '/.*/$' > /dev/null; then + SOURCE=${TARGET:-.}; + else + SOURCE=`dirname "$SOURCE"`/${TARGET:-.}; + fi; +done; +PREFIX=`dirname "$SOURCE"`/..; +prefix=$PREFIX; PREFIX=`cd "$PREFIX"; pwd`; JAVA=java @@ -38,5 +51,6 @@ $JAVA \ -Xms16M -Xmx256M \ -Dscala.version="20051219-1541" \ -Dscala.home="$PREFIX" \ + -Dscala.boot.class.path="$TOOL_CLASSPATH" \ -cp "$JAVA_CLASSPATH" \ - "$TOOL" -sourcepath "$TOOL_CLASSPATH" "$@"
\ No newline at end of file + "$TOOL" "$@"
\ No newline at end of file diff --git a/src/exec/scala-tool.win.tmpl b/src/exec/scala-tool.win.tmpl index 2f8cfd79ae..75db644099 100644 --- a/src/exec/scala-tool.win.tmpl +++ b/src/exec/scala-tool.win.tmpl @@ -22,13 +22,13 @@ goto loop :exec set _JAVACMD=java -set _PROPS=-Dscala.version=@version@ -Dscala.home=%SCALA_HOME% set _MAIN=@tool.class@ set _TOOLS_CPATH=@fjbg.jar@;@msil.jar@;@comp.path@;@lib.path@ set _LIB_CPATH=@lib.path@ +set _PROPS=-Dscala.version=@version@ -Dscala.home=%SCALA_HOME% -Dscala.boot.class.path="%_LIB_CPATH%" rem echo %_JAVACMD% %_PROPS% -cp %_CPATH% %_MAIN% %_ARGS% -%_JAVACMD% %_PROPS% -cp %_TOOLS_CPATH% %_MAIN% -bootclasspath %_LIB_CPATH% %_ARGS% +%_JAVACMD% %_PROPS% -cp %_TOOLS_CPATH% %_MAIN% %_ARGS% goto end rem ########################################################################## diff --git a/src/exec/scala.unix.tmpl b/src/exec/scala.unix.tmpl index bbc2f55e93..58f547f926 100644 --- a/src/exec/scala.unix.tmpl +++ b/src/exec/scala.unix.tmpl @@ -15,7 +15,20 @@ case "`uname`" in Darwin*) darwin=true ;; esac -PREFIX=`dirname "$0"`/..; +SOURCE=$0; +SCRIPT=`basename "$SOURCE"`; +while [ -h "$SOURCE" ]; do + SCRIPT=`basename "$SOURCE"`; + LOOKUP=`ls -ld "$SOURCE"`; + TARGET=`expr "$LOOKUP" : '.*-> \(.*\)$'`; + if expr "${TARGET:-.}/" : '/.*/$' > /dev/null; then + SOURCE=${TARGET:-.}; + else + SOURCE=`dirname "$SOURCE"`/${TARGET:-.}; + fi; +done; +PREFIX=`dirname "$SOURCE"`/..; +prefix=$PREFIX; PREFIX=`cd "$PREFIX"; pwd`; JAVA=java diff --git a/src/exec/scala.win.tmpl b/src/exec/scala.win.tmpl index feb4655e0f..630a52051a 100644 --- a/src/exec/scala.win.tmpl +++ b/src/exec/scala.win.tmpl @@ -1,7 +1,7 @@ @echo off rem ########################################################################## -rem # Copyright @COPYRIGHT@ +rem # Copyright @copyright@ 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 @@ -12,7 +12,6 @@ if "%OS%"=="Windows_NT" @setlocal if "%OS%"=="Windows_NT" @set SCALA_HOME=%~dp0 if "%SCALA_HOME%" == "" goto error1 -if not exist "%SCALA_HOME%\VERSION-@VERSION@" goto error2 set _ARGS= :loop @@ -24,25 +23,25 @@ goto loop :exec set _JAVACMD=java -set _JAVAOPT=-Xbootclasspath/a:@BOOTCPATH@ +set _JAVAOPT=-Xbootclasspath/a:@lib.path@ rem echo %_JAVACMD% %_JAVAOPT% %_ARGS% %_JAVACMD% %_JAVAOPT% %_ARGS% goto end :version -echo @PRODUCT@ @VERSION@ -- @COPYRIGHT@ +echo @product@ @version@ -- @copyright@ goto end rem ########################################################################## rem # errors :error1 -echo ERROR: environment variable SCALA_HOME is undefined. It should point to the directory containing the file "VERSION-@VERSION@". +echo ERROR: environment variable SCALA_HOME is undefined. It should point to the directory containing the file "VERSION-@version@". goto end :error2 -echo ERROR: environment variable SCALA_HOME points to the wrong directory "%SCALA_HOME%". It should point to the directory containing the file "VERSION-@VERSION@". +echo ERROR: environment variable SCALA_HOME points to the wrong directory "%SCALA_HOME%". It should point to the directory containing the file "VERSION-@version@". goto end :end diff --git a/test/scalanstest b/test/scalanstest index e553143362..075d9a9547 100755 --- a/test/scalanstest +++ b/test/scalanstest @@ -453,14 +453,10 @@ FILES_POS=""; FILES_NEG=""; FILES_MSIL=""; -case `uname` in - CYGWIN* ) LATEST="$PREFIX/distribs/windows/latest";; - * ) LATEST="$PREFIX/distribs/unix/latest";; -esac; - -SCALA="$LATEST/bin/ns"; -SOCOS="$LATEST/bin/nsc"; -SCALAP="$LATEST/bin/nsp"; +LATEST="$PREFIX/dists/latest"; +SCALA="$LATEST/bin/scala"; +SOCOS="$LATEST/bin/scalac"; +SCALAP="$LATEST/bin/scalap"; DIFF="diff"; case `uname` in |