summaryrefslogtreecommitdiff
path: root/src/compiler
diff options
context:
space:
mode:
authorGilles Dubochet <gilles.dubochet@epfl.ch>2005-12-21 20:31:59 +0000
committerGilles Dubochet <gilles.dubochet@epfl.ch>2005-12-21 20:31:59 +0000
commit10322415aeea472260abd25324f707728fe55f4d (patch)
tree7772b8db4cc4a999e69ed01654363230770736d8 /src/compiler
parent713b176bd27f438b7870c3a69891eba0db49aaf4 (diff)
downloadscala-10322415aeea472260abd25324f707728fe55f4d.tar.gz
scala-10322415aeea472260abd25324f707728fe55f4d.tar.bz2
scala-10322415aeea472260abd25324f707728fe55f4d.zip
1.
2. Improved the generation of a distribution. 3. 'scalanstest' works again.
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/scala/tools/nsc/Settings.scala38
-rw-r--r--src/compiler/scala/tools/util/ClassPath.java98
2 files changed, 35 insertions, 101 deletions
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());