Skip to content

Commit

Permalink
Move the Scala.js-specific compiler tests to a separate project.
Browse files Browse the repository at this point in the history
This way, it is not necessary to compile
`dotty-library-bootstrappedJS` unless we want to run the
Scala.js-specific tests.

This reduces test coverage, since those tests won't be run with the
bootstrapped compiler anymore.
sjrd committed Aug 21, 2020

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 400b6c2 commit eb54a18
Showing 4 changed files with 25 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -93,7 +93,7 @@ jobs:

- name: Test
run: |
./project/scripts/sbt ";dotty-bootstrapped/compile ;dotty-bootstrapped/test;sjsSandbox/run;sjsSandbox/test;sjsJUnitTests/test ;configureIDE"
./project/scripts/sbt ";dotty-bootstrapped/compile ;dotty-bootstrapped/test;sjsSandbox/run;sjsSandbox/test;sjsJUnitTests/test;sjsCompilerTests/test ;configureIDE"
./project/scripts/bootstrapCmdTests
community_build:
1 change: 1 addition & 0 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -30,6 +30,7 @@ val `community-build` = Build.`community-build`

val sjsSandbox = Build.sjsSandbox
val sjsJUnitTests = Build.sjsJUnitTests
val sjsCompilerTests = Build.sjsCompilerTests

val `sbt-dotty` = Build.`sbt-dotty`
val `vscode-dotty` = Build.`vscode-dotty`
31 changes: 23 additions & 8 deletions project/Build.scala
Original file line number Diff line number Diff line change
@@ -174,6 +174,8 @@ object Build {
fork in Test := true,
parallelExecution in Test := false,

outputStrategy := Some(StdoutOutput),

// enable verbose exception messages for JUnit
testOptions in Test += Tests.Argument(TestFrameworks.JUnit, "-a", "-v"),
)
@@ -335,7 +337,6 @@ object Build {
)

lazy val commonBenchmarkSettings = Seq(
outputStrategy := Some(StdoutOutput),
mainClass in (Jmh, run) := Some("dotty.tools.benchmarks.Bench"), // custom main for jmh:run
javaOptions += "-DBENCH_COMPILER_CLASS_PATH=" + Attributed.data((fullClasspath in (`dotty-bootstrapped`, Compile)).value).mkString("", File.pathSeparator, ""),
javaOptions += "-DBENCH_CLASS_PATH=" + Attributed.data((fullClasspath in (`dotty-library-bootstrapped`, Compile)).value).mkString("", File.pathSeparator, "")
@@ -404,7 +405,6 @@ object Build {

def dottyDocSettings(implicit mode: Mode) = Seq(
connectInput in run := true,
outputStrategy := Some(StdoutOutput),

javaOptions ++= (javaOptions in `dotty-compiler`).value,

@@ -466,7 +466,6 @@ object Build {
lazy val commonDottyCompilerSettings = Seq(
// set system in/out for repl
connectInput in run := true,
outputStrategy := Some(StdoutOutput),

// Generate compiler.properties, used by sbt
resourceGenerators in Compile += Def.task {
@@ -526,22 +525,19 @@ object Build {
(sourceManaged in Compile).value
}
val externalDeps = externalCompilerClasspathTask.value
val externalJSDeps = (externalDependencyClasspath in (LocalProject("dotty-library-bootstrappedJS"), Compile)).value
val jars = packageAll.value

Seq(
"-Ddotty.tests.dottyCompilerManagedSources=" + managedSrcDir,
"-Ddotty.tests.classes.dottyInterfaces=" + jars("dotty-interfaces"),
"-Ddotty.tests.classes.dottyLibrary=" + jars("dotty-library"),
"-Ddotty.tests.classes.dottyLibraryJS=" + jars("dotty-library-js"),
"-Ddotty.tests.classes.dottyCompiler=" + jars("dotty-compiler"),
"-Ddotty.tests.classes.tastyCore=" + jars("tasty-core"),
"-Ddotty.tests.classes.compilerInterface=" + findArtifactPath(externalDeps, "compiler-interface"),
"-Ddotty.tests.classes.scalaLibrary=" + findArtifactPath(externalDeps, "scala-library"),
"-Ddotty.tests.classes.scalaAsm=" + findArtifactPath(externalDeps, "scala-asm"),
"-Ddotty.tests.classes.jlineTerminal=" + findArtifactPath(externalDeps, "jline-terminal"),
"-Ddotty.tests.classes.jlineReader=" + findArtifactPath(externalDeps, "jline-reader"),
"-Ddotty.tests.classes.scalaJSLibrary=" + findArtifactPath(externalJSDeps, "scalajs-library_2.13"),
)
},

@@ -708,8 +704,7 @@ object Build {
// running the compiler, we should always have the bootstrapped
// library on the compiler classpath since the non-bootstrapped one
// may not be binary-compatible.
"dotty-library" -> packageBin.in(`dotty-library-bootstrapped`, Compile).value,
"dotty-library-js" -> packageBin.in(`dotty-library-bootstrappedJS`, Compile).value,
"dotty-library" -> packageBin.in(`dotty-library-bootstrapped`, Compile).value
).mapValues(_.getAbsolutePath)
}
}.value,
@@ -1144,6 +1139,26 @@ object Build {
}
)

lazy val sjsCompilerTests = project.in(file("sjs-compiler-tests")).
dependsOn(`dotty-compiler` % "test->test").
settings(
commonNonBootstrappedSettings,

// Change the baseDirectory when running the tests
baseDirectory in Test := baseDirectory.value.getParentFile,

javaOptions ++= (javaOptions in `dotty-compiler`).value,
javaOptions ++= {
val externalJSDeps = (externalDependencyClasspath in (`dotty-library-bootstrappedJS`, Compile)).value
val dottyLibraryJSJar = (packageBin in (`dotty-library-bootstrappedJS`, Compile)).value.getAbsolutePath

Seq(
"-Ddotty.tests.classes.dottyLibraryJS=" + dottyLibraryJSJar,
"-Ddotty.tests.classes.scalaJSLibrary=" + findArtifactPath(externalJSDeps, "scalajs-library_2.13"),
)
},
)

lazy val `dotty-bench` = project.in(file("bench")).asDottyBench(NonBootstrapped)
lazy val `dotty-bench-bootstrapped` = project.in(file("bench")).asDottyBench(Bootstrapped)
lazy val `dotty-bench-run` = project.in(file("bench-run")).asDottyBench(Bootstrapped)

0 comments on commit eb54a18

Please sign in to comment.