summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/util/PathResolver.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2010-03-23 04:17:59 +0000
committerPaul Phillips <paulp@improving.org>2010-03-23 04:17:59 +0000
commitae8c065594aa605734b66c11693e5e584feaeddd (patch)
tree3c93cdc9a3d25ce9260bc7e7322b4f41c0c6e8d2 /src/compiler/scala/tools/util/PathResolver.scala
parent88aab1cf8e06f98ccd18437974c09162ee54149f (diff)
downloadscala-ae8c065594aa605734b66c11693e5e584feaeddd.tar.gz
scala-ae8c065594aa605734b66c11693e5e584feaeddd.tar.bz2
scala-ae8c065594aa605734b66c11693e5e584feaeddd.zip
Went ahead and implemented classpaths as descri...
Went ahead and implemented classpaths as described in email to scala-internals on the theory that at this point I must know what I'm doing. ** PUBLIC SERVICE ANNOUNCEMENT ** If your code of whatever kind stopped working with this commit (most likely the error is something like "object scala not found") you can get it working again with either of: passing -usejavacp on the command line set system property "scala.usejavacp" to "true" Either of these will alert scala that you want the java application classpath to be utilized by scala as well. Review by community.
Diffstat (limited to 'src/compiler/scala/tools/util/PathResolver.scala')
-rw-r--r--src/compiler/scala/tools/util/PathResolver.scala33
1 files changed, 12 insertions, 21 deletions
diff --git a/src/compiler/scala/tools/util/PathResolver.scala b/src/compiler/scala/tools/util/PathResolver.scala
index 58ac3bfa56..3f5b7c4d62 100644
--- a/src/compiler/scala/tools/util/PathResolver.scala
+++ b/src/compiler/scala/tools/util/PathResolver.scala
@@ -48,29 +48,20 @@ object PathResolver {
File(url.getFile).parent.path
} getOrElse ""
- def classPathEnv = envOrElse("CLASSPATH", "")
- def sourcePathEnv = envOrElse("SOURCEPATH", "") // not used
- def scalaHomeEnv = envOrElse("SCALA_HOME", "") // not used
+ // No environment variables are used. It's for the best.
+ //
+ // def classPathEnv = envOrElse("CLASSPATH", "")
+ // def sourcePathEnv = envOrElse("SOURCEPATH", "")
+ // def scalaHomeEnv = envOrElse("SCALA_HOME", "")
+
def javaBootClassPath = propOrElse("sun.boot.class.path", searchForBootClasspath)
def javaExtDirs = propOrEmpty("java.ext.dirs")
- def javaUserClassPath = propOrElse("java.class.path", classPathEnv)
- def scalaExtDirs = propOrEmpty("scala.ext.dirs")
-
def scalaHome = propOrEmpty("scala.home")
+ def scalaExtDirs = propOrEmpty("scala.ext.dirs")
- /** I have distilled everyone's classpath hopes and dreams into the
- * question of how to resolve this boolean. Right at this moment if I
- * do anything but default to true right here, partest chokes. I'm
- * steadily reworking all the places partest gets its hands on the
- * classpath so eventually I'll be able to remedy that, at which point
- * my current plan is to have this default to false unless some
- * property or command line option is supplied. This is negotiable,
- * but at this point I can say with confidence that less magic and
- * less autodetection is more better.
- */
- def useJavaClassPath = true
- // hypothetically:
- // def useJavaClassPath = propIsSet("scala.classpath.guess")
+ /** The java classpath and whether to use it. */
+ def javaUserClassPath = propOrElse("java.class.path", "")
+ def useJavaClassPath = propOrFalse("scala.usejavacp")
override def toString = """
|object Environment {
@@ -95,6 +86,7 @@ object PathResolver {
def javaBootClassPath = Environment.javaBootClassPath
def javaUserClassPath = Environment.javaUserClassPath
def javaExtDirs = Environment.javaExtDirs
+ def useJavaClassPath = Environment.useJavaClassPath
def scalaHome = Environment.scalaHome
def scalaHomeDir = Directory(scalaHome)
@@ -186,13 +178,12 @@ class PathResolver(settings: Settings, context: JavaContext) {
case "sourcepath" => settings.sourcepath.value
}
- private def useJavaClassPath = !settings.javaignorecp.value && Environment.useJavaClassPath
-
/** Calculated values based on any given command line options, falling back on
* those in Defaults.
*/
object Calculated {
def scalaHome = Defaults.scalaHome
+ def useJavaClassPath = settings.usejavacp.value || Defaults.useJavaClassPath
def javaBootClassPath = cmdLineOrElse("javabootclasspath", Defaults.javaBootClassPath)
def javaExtDirs = cmdLineOrElse("javaextdirs", Defaults.javaExtDirs)
def javaUserClassPath = if (useJavaClassPath) Defaults.javaUserClassPath else ""