Skip to content

Commit 0a365ed

Browse files
authored
Merge pull request #2320 from dotty-staging/fix/jars
Add a DOTTY_SCALA_LIBRARY env variable to run the tests with Eclipse
2 parents b4a51fc + e2651d8 commit 0a365ed

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

compiler/test/dotty/Jars.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,14 @@ object Jars {
2525
val dottyTestDeps: List[String] =
2626
dottyLib :: dottyCompiler :: dottyInterfaces :: dottyExtras
2727

28+
def scalaLibrary: String = sys.env.get("DOTTY_SCALA_LIBRARY")
29+
.getOrElse(findJarFromRuntime("scala-library-2."))
30+
2831
/** Gets the scala 2.* library at runtime, note that doing this is unsafe
2932
* unless you know that the library will be on the classpath of the running
3033
* application. It is currently safe to call this function if the tests are
3134
* run by sbt.
3235
*/
33-
def scalaLibraryFromRuntime: String = findJarFromRuntime("scala-library-2.")
34-
3536
private def findJarFromRuntime(partialName: String) = {
3637
val urls = ClassLoader.getSystemClassLoader.asInstanceOf[java.net.URLClassLoader].getURLs.map(_.getFile.toString)
3738
urls.find(_.contains(partialName)).getOrElse {

compiler/test/dotty/tools/vulpix/ParallelTesting.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ trait ParallelTesting extends RunnerOrchestration { self =>
343343
val fullArgs = Array(
344344
"javac",
345345
"-classpath",
346-
s".:${Jars.scalaLibraryFromRuntime}:${targetDir.getAbsolutePath}"
346+
s".:${Jars.scalaLibrary}:${targetDir.getAbsolutePath}"
347347
) ++ flags.takeRight(2) ++ fs
348348

349349
Runtime.getRuntime.exec(fullArgs).waitFor() == 0

compiler/test/dotty/tools/vulpix/RunnerOrchestration.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ trait RunnerOrchestration {
153153
val sep = sys.props("file.separator")
154154
val cp =
155155
classOf[ChildJVMMain].getProtectionDomain.getCodeSource.getLocation.getFile + ":" +
156-
Jars.scalaLibraryFromRuntime
156+
Jars.scalaLibrary
157157
val javaBin = sys.props("java.home") + sep + "bin" + sep + "java"
158158
new ProcessBuilder(javaBin, "-cp", cp, "dotty.tools.vulpix.ChildJVMMain")
159159
.redirectErrorStream(true)

0 commit comments

Comments
 (0)