Skip to content

Commit 2be4d79

Browse files
Kordyjanprolativ
authored andcommitted
Handle classpath substitution in classpath
1 parent 0a0d7ac commit 2be4d79

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

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

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -505,9 +505,21 @@ trait ParallelTesting extends RunnerOrchestration { self =>
505505
}
506506

507507
protected def compileWithOtherCompiler(compiler: String, files: Array[JFile], flags: TestFlags, targetDir: JFile): TestReporter =
508+
val compilerDir = getCompiler(compiler).toString
509+
510+
def substituteClasspath(old: String): String =
511+
old.split(JFile.pathSeparator).map { o =>
512+
if JFile(o) == JFile(Properties.dottyLibrary) then s"$compilerDir/lib/scala3-library_3-${trueVersions(compiler)}.jar"
513+
else o
514+
}.mkString(JFile.pathSeparator)
515+
516+
val flags1 = flags.copy(defaultClassPath = substituteClasspath(flags.defaultClassPath))
517+
.withClasspath(targetDir.getPath)
518+
.and("-d", targetDir.getPath)
519+
508520
val reporter = TestReporter.reporter(realStdout, ERROR) // TODO: do some reporting
509521

510-
val command = Array(getCompiler(compiler).toString + "/bin/scalac") ++ flags.and("-d", targetDir.getPath).all ++ files.map(_.getPath)
522+
val command = Array(compilerDir + "/bin/scalac") ++ flags1.all ++ files.map(_.getPath)
511523
val process = Runtime.getRuntime.exec(command)
512524
val output = Source.fromInputStream(process.getErrorStream).mkString
513525
if process.waitFor() != 0 then
@@ -1400,7 +1412,7 @@ object ParallelTesting {
14001412
dir
14011413

14021414

1403-
private val trueVersions = Map(
1415+
val trueVersions = Map(
14041416
"3.0" -> "3.0.2",
14051417
"3.1" -> "3.1.0"
14061418
)

0 commit comments

Comments
 (0)