Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

javabootclasspath supersedes jrt #10336

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
36 changes: 19 additions & 17 deletions src/compiler/scala/tools/util/PathResolver.scala
Expand Up @@ -16,12 +16,13 @@ package util

import java.net.URL

import scala.reflect.io.{Directory, File, Path}
import scala.tools.reflect.WrappedProperties.AccessControl
import scala.tools.nsc.{CloseableRegistry, Settings}
import scala.tools.nsc.classpath._
import scala.tools.nsc.util.ClassPath
import scala.reflect.io.{Directory, File, Path}
import scala.util.Properties.isJavaAtLeast
import PartialFunction.condOpt
import scala.tools.nsc.classpath._

// Loosely based on the draft specification at:
// https://wiki.scala-lang.org/display/SIW/Classpath
Expand Down Expand Up @@ -211,22 +212,21 @@ final class PathResolver(settings: Settings, closeableRegistry: CloseableRegistr

private val classPathFactory = new ClassPathFactory(settings, closeableRegistry)

import PathResolver.{ AsLines, Defaults, ppcp }
import PathResolver.{AsLines, Defaults, ppcp}

private def cmdLineOrElse(name: String, alt: String) = {
(commandLineFor(name) match {
case Some("") => None
case x => x
}) getOrElse alt
}
private def cmdLineOrElse(name: String, alt: String) =
commandLineFor(name) match {
case Some("") | None => alt
case Some(x) => x
}

private def commandLineFor(s: String): Option[String] = condOpt(s) {
case "javabootclasspath" => settings.javabootclasspath.value
case "javaextdirs" => settings.javaextdirs.value
case "bootclasspath" => settings.bootclasspath.value
case "extdirs" => settings.extdirs.value
case "classpath" | "cp" => settings.classpath.value
case "sourcepath" => settings.sourcepath.value
case "javabootclasspath" => settings.javabootclasspath.value
case "javaextdirs" => settings.javaextdirs.value
case "bootclasspath" => settings.bootclasspath.value
case "extdirs" => settings.extdirs.value
case "classpath" | "cp" => settings.classpath.value
case "sourcepath" => settings.sourcepath.value
}

/** Calculated values based on any given command line options, falling back on
Expand Down Expand Up @@ -258,8 +258,10 @@ final class PathResolver(settings: Settings, closeableRegistry: CloseableRegistr

// Assemble the elements!
def basis = List[Iterable[ClassPath]](
jrt, // 0. The Java 9+ classpath (backed by the ct.sym or jrt:/ virtual system, if available)
classesInPath(javaBootClassPath), // 1. The Java bootstrap class path.
if (!settings.javabootclasspath.isSetByUser && isJavaAtLeast(9))
jrt // 0. The Java 9+ classpath (backed by the ct.sym or jrt:/ virtual system, if available)
else
classesInPath(javaBootClassPath), // 1. The Java bootstrap class path.
contentsOfDirsInPath(javaExtDirs), // 2. The Java extension class path.
classesInExpandedPath(javaUserClassPath), // 3. The Java application class path.
classesInPath(scalaBootClassPath), // 4. The Scala boot class path.
Expand Down