@@ -520,23 +520,34 @@ trait ParallelTesting extends RunnerOrchestration { self =>
520
520
}
521
521
522
522
protected def compileWithOtherCompiler (compiler : String , files : Array [JFile ], flags : TestFlags , targetDir : JFile ): TestReporter =
523
- val compilerDir = getCompiler(compiler).toString
523
+ def artifactClasspath (organizationName : String , moduleName : String ) =
524
+ import coursier ._
525
+ val dep = Dependency (
526
+ Module (
527
+ Organization (organizationName),
528
+ ModuleName (moduleName),
529
+ attributes = Map .empty
530
+ ),
531
+ version = compiler
532
+ )
533
+ Fetch ()
534
+ .addDependencies(dep)
535
+ .run()
536
+ .mkString(JFile .pathSeparator)
524
537
525
- def substituteClasspath (old : String ): String =
526
- old.split(JFile .pathSeparator).map { o =>
527
- if JFile (o) == JFile (Properties .dottyLibrary) then s " $compilerDir/lib/scala3-library_3- $compiler.jar "
528
- else o
529
- }.mkString(JFile .pathSeparator)
538
+ val stdlibClasspath = artifactClasspath(" org.scala-lang" , " scala3-library_3" )
539
+ val scalacClasspath = artifactClasspath(" org.scala-lang" , " scala3-compiler_3" )
530
540
531
- val flags1 = flags.copy(defaultClassPath = substituteClasspath(flags.defaultClassPath) )
541
+ val flags1 = flags.copy(defaultClassPath = stdlibClasspath )
532
542
.withClasspath(targetDir.getPath)
533
543
.and(" -d" , targetDir.getPath)
534
544
545
+ val scalacCommand = Array (" java" , " -cp" , scalacClasspath, " dotty.tools.dotc.Main" )
546
+ val command = scalacCommand ++ flags1.all ++ files.map(_.getAbsolutePath)
547
+ val process = Runtime .getRuntime.exec(command)
548
+
535
549
val dummyStream = new PrintStream (new ByteArrayOutputStream ())
536
550
val reporter = TestReporter .reporter(dummyStream, ERROR )
537
-
538
- val command = Array (compilerDir + " /bin/scalac" ) ++ flags1.all ++ files.map(_.getPath)
539
- val process = Runtime .getRuntime.exec(command)
540
551
val errorsText = Source .fromInputStream(process.getErrorStream).mkString
541
552
if process.waitFor() != 0 then
542
553
val diagnostics = parseErrors(errorsText, compiler)
@@ -1418,23 +1429,5 @@ object ParallelTesting {
1418
1429
1419
1430
def isTastyFile (f : JFile ): Boolean =
1420
1431
f.getName.endsWith(" .tasty" )
1421
-
1422
- def getCompiler (version : String ): JFile =
1423
- val dir = cache.resolve(s " scala3- ${version}" ).toFile
1424
- synchronized {
1425
- if dir.exists then
1426
- dir
1427
- else
1428
- import scala .sys .process ._
1429
- val archivePath = cache.resolve(s " scala3- $version.tar.gz " )
1430
- val compilerDownloadUrl = s " https://github.com/lampepfl/dotty/releases/download/ $version/scala3- $version.tar.gz "
1431
- (URL (compilerDownloadUrl) #>> archivePath.toFile #&& s " tar -xf $archivePath -C $cache" ).!!
1432
- archivePath.toFile.delete()
1433
- dir
1434
- }
1435
-
1436
- private lazy val cache =
1437
- val dir = Properties .testCache.resolve(" compilers" )
1438
- dir.toFile.mkdirs()
1439
- dir
1432
+
1440
1433
}
0 commit comments