Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions compiler/test/dotty/Jars.scala
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,14 @@ object Jars {
val dottyTestDeps: List[String] =
dottyLib :: dottyCompiler :: dottyInterfaces :: dottyExtras

def scalaLibrary: String = sys.env.get("DOTTY_SCALA_LIBRARY")
.getOrElse(findJarFromRuntime("scala-library-2."))

/** Gets the scala 2.* library at runtime, note that doing this is unsafe
* unless you know that the library will be on the classpath of the running
* application. It is currently safe to call this function if the tests are
* run by sbt.
*/
def scalaLibraryFromRuntime: String = findJarFromRuntime("scala-library-2.")

private def findJarFromRuntime(partialName: String) = {
val urls = ClassLoader.getSystemClassLoader.asInstanceOf[java.net.URLClassLoader].getURLs.map(_.getFile.toString)
urls.find(_.contains(partialName)).getOrElse {
Expand Down
2 changes: 1 addition & 1 deletion compiler/test/dotty/tools/vulpix/ParallelTesting.scala
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ trait ParallelTesting extends RunnerOrchestration { self =>
val fullArgs = Array(
"javac",
"-classpath",
s".:${Jars.scalaLibraryFromRuntime}:${targetDir.getAbsolutePath}"
s".:${Jars.scalaLibrary}:${targetDir.getAbsolutePath}"
) ++ flags.takeRight(2) ++ fs

Runtime.getRuntime.exec(fullArgs).waitFor() == 0
Expand Down
2 changes: 1 addition & 1 deletion compiler/test/dotty/tools/vulpix/RunnerOrchestration.scala
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ trait RunnerOrchestration {
val sep = sys.props("file.separator")
val cp =
classOf[ChildJVMMain].getProtectionDomain.getCodeSource.getLocation.getFile + ":" +
Jars.scalaLibraryFromRuntime
Jars.scalaLibrary
val javaBin = sys.props("java.home") + sep + "bin" + sep + "java"
new ProcessBuilder(javaBin, "-cp", cp, "dotty.tools.vulpix.ChildJVMMain")
.redirectErrorStream(true)
Expand Down