@@ -610,17 +610,38 @@ trait ParallelTesting extends RunnerOrchestration { self =>
610
610
.run()
611
611
.mkString(JFile .pathSeparator)
612
612
613
- val stdlibClasspath = artifactClasspath(" org.scala-lang" , " scala3-library_3" )
614
- val scalacClasspath = artifactClasspath(" org.scala-lang" , " scala3-compiler_3" )
615
-
616
613
val pageWidth = TestConfiguration .pageWidth - 20
617
- val flags1 = flags.copy(defaultClassPath = stdlibClasspath)
618
- .withClasspath(targetDir.getPath)
619
- .and(" -d" , targetDir.getPath)
620
- .and(" -pagewidth" , pageWidth.toString)
621
614
622
- val scalacCommand = Array (" java" , " -cp" , scalacClasspath, " dotty.tools.dotc.Main" )
623
- val command = scalacCommand ++ flags1.all ++ files.map(_.getAbsolutePath)
615
+ val fileArgs = files.map(_.getAbsolutePath)
616
+
617
+ def scala2Command (): Array [String ] = {
618
+ assert(! flags.options.contains(" -scalajs" ),
619
+ " Compilation tests with Scala.js on Scala 2 are not supported.\n This test can be skipped using the `// scalajs: --skip` tag" )
620
+ val stdlibClasspath = artifactClasspath(" org.scala-lang" , " scala-library" )
621
+ val scalacClasspath = artifactClasspath(" org.scala-lang" , " scala-compiler" )
622
+ val flagsArgs = flags
623
+ .copy(options = Array .empty, defaultClassPath = stdlibClasspath)
624
+ .withClasspath(targetDir.getPath)
625
+ .and(" -d" , targetDir.getPath)
626
+ .all
627
+ val scalacCommand = Array (" java" , " -cp" , scalacClasspath, " scala.tools.nsc.Main" )
628
+ scalacCommand ++ flagsArgs ++ fileArgs
629
+ }
630
+
631
+ def scala3Command (): Array [String ] = {
632
+ val stdlibClasspath = artifactClasspath(" org.scala-lang" , " scala3-library_3" )
633
+ val scalacClasspath = artifactClasspath(" org.scala-lang" , " scala3-compiler_3" )
634
+ val flagsArgs = flags
635
+ .copy(defaultClassPath = stdlibClasspath)
636
+ .withClasspath(targetDir.getPath)
637
+ .and(" -d" , targetDir.getPath)
638
+ .and(" -pagewidth" , pageWidth.toString)
639
+ .all
640
+ val scalacCommand = Array (" java" , " -cp" , scalacClasspath, " dotty.tools.dotc.Main" )
641
+ scalacCommand ++ flagsArgs ++ fileArgs
642
+ }
643
+
644
+ val command = if compiler.startsWith(" 2" ) then scala2Command() else scala3Command()
624
645
val process = Runtime .getRuntime.exec(command)
625
646
626
647
val reporter = mkReporter
0 commit comments