Skip to content

Fix windows CI; conditionally enable forward compat community build in PRs #14301

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
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
6 changes: 6 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,12 @@ jobs:
- ${{ github.workspace }}/../../cache/ivy:/root/.ivy2/cache
- ${{ github.workspace }}/../../cache/general:/root/.cache
if: "github.event_name == 'schedule' && github.repository == 'lampepfl/dotty'
|| (
github.event_name == 'pull_request'
&& !contains(github.event.pull_request.body, '[skip ci]')
&& !contains(github.event.pull_request.body, '[skip community_build]')
&& contains(github.event.pull_request.body, '[test_forward_compat]')
)
|| (
github.event_name == 'workflow_dispatch'
&& github.repository == 'lampepfl/dotty'
Expand Down
51 changes: 22 additions & 29 deletions compiler/test/dotty/tools/vulpix/ParallelTesting.scala
Original file line number Diff line number Diff line change
Expand Up @@ -545,25 +545,36 @@ trait ParallelTesting extends RunnerOrchestration { self =>
diagnostics.reverse

protected def compileWithOtherCompiler(compiler: String, files: Array[JFile], flags: TestFlags, targetDir: JFile): TestReporter =
val compilerDir = getCompiler(compiler).toString
def artifactClasspath(organizationName: String, moduleName: String) =
import coursier._
val dep = Dependency(
Module(
Organization(organizationName),
ModuleName(moduleName),
attributes = Map.empty
),
version = compiler
)
Fetch()
.addDependencies(dep)
.run()
.mkString(JFile.pathSeparator)

def substituteClasspath(old: String): String =
old.split(JFile.pathSeparator).map { o =>
if JFile(o) == JFile(Properties.dottyLibrary) then s"$compilerDir/lib/scala3-library_3-$compiler.jar"
else o
}.mkString(JFile.pathSeparator)
val stdlibClasspath = artifactClasspath("org.scala-lang", "scala3-library_3")
val scalacClasspath = artifactClasspath("org.scala-lang", "scala3-compiler_3")

val pageWidth = TestConfiguration.pageWidth - 20
val flags1 = flags.copy(defaultClassPath = substituteClasspath(flags.defaultClassPath))
val flags1 = flags.copy(defaultClassPath = stdlibClasspath)
.withClasspath(targetDir.getPath)
.and("-d", targetDir.getPath)
.and("-pagewidth", pageWidth.toString)

val reporter = TestReporter.reporter(realStdout, logLevel =
if (suppressErrors || suppressAllOutput) ERROR + 1 else ERROR)

val command = Array(compilerDir + "/bin/scalac") ++ flags1.all ++ files.map(_.getPath)
val scalacCommand = Array("java", "-cp", scalacClasspath, "dotty.tools.dotc.Main")
val command = scalacCommand ++ flags1.all ++ files.map(_.getAbsolutePath)
val process = Runtime.getRuntime.exec(command)

val reporter = TestReporter.reporter(realStdout, logLevel =
if (suppressErrors || suppressAllOutput) ERROR + 1 else ERROR)
val errorsText = Source.fromInputStream(process.getErrorStream).mkString
if process.waitFor() != 0 then
val diagnostics = parseErrors(errorsText, compiler, pageWidth)
Expand Down Expand Up @@ -1445,22 +1456,4 @@ object ParallelTesting {
def isTastyFile(f: JFile): Boolean =
f.getName.endsWith(".tasty")

def getCompiler(version: String): JFile =
val dir = cache.resolve(s"scala3-${version}").toFile
synchronized {
if dir.exists then
dir
else
import scala.sys.process._
val archivePath = cache.resolve(s"scala3-$version.tar.gz")
val compilerDownloadUrl = s"https://github.com/lampepfl/dotty/releases/download/$version/scala3-$version.tar.gz"
(URL(compilerDownloadUrl) #>> archivePath.toFile #&& s"tar -xf $archivePath -C $cache").!!
archivePath.toFile.delete()
dir
}

private lazy val cache =
val dir = Properties.testCache.resolve("compilers")
dir.toFile.mkdirs()
dir
}
3 changes: 2 additions & 1 deletion project/Build.scala
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,8 @@ object Build {
Dependencies.oldCompilerInterface, // we stick to the old version to avoid deprecation warnings
"org.jline" % "jline-reader" % "3.19.0", // used by the REPL
"org.jline" % "jline-terminal" % "3.19.0",
"org.jline" % "jline-terminal-jna" % "3.19.0" // needed for Windows
"org.jline" % "jline-terminal-jna" % "3.19.0", // needed for Windows
("io.get-coursier" %% "coursier" % "2.0.16" % Test).cross(CrossVersion.for3Use2_13),
),

// For convenience, change the baseDirectory when running the compiler
Expand Down