Skip to content

Commit eb54a18

Browse files
committed
Move the Scala.js-specific compiler tests to a separate project.
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.
1 parent 400b6c2 commit eb54a18

File tree

4 files changed

+25
-9
lines changed

4 files changed

+25
-9
lines changed

.github/workflows/ci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ jobs:
9393

9494
- name: Test
9595
run: |
96-
./project/scripts/sbt ";dotty-bootstrapped/compile ;dotty-bootstrapped/test;sjsSandbox/run;sjsSandbox/test;sjsJUnitTests/test ;configureIDE"
96+
./project/scripts/sbt ";dotty-bootstrapped/compile ;dotty-bootstrapped/test;sjsSandbox/run;sjsSandbox/test;sjsJUnitTests/test;sjsCompilerTests/test ;configureIDE"
9797
./project/scripts/bootstrapCmdTests
9898
9999
community_build:

build.sbt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ val `community-build` = Build.`community-build`
3030

3131
val sjsSandbox = Build.sjsSandbox
3232
val sjsJUnitTests = Build.sjsJUnitTests
33+
val sjsCompilerTests = Build.sjsCompilerTests
3334

3435
val `sbt-dotty` = Build.`sbt-dotty`
3536
val `vscode-dotty` = Build.`vscode-dotty`

project/Build.scala

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,8 @@ object Build {
174174
fork in Test := true,
175175
parallelExecution in Test := false,
176176

177+
outputStrategy := Some(StdoutOutput),
178+
177179
// enable verbose exception messages for JUnit
178180
testOptions in Test += Tests.Argument(TestFrameworks.JUnit, "-a", "-v"),
179181
)
@@ -335,7 +337,6 @@ object Build {
335337
)
336338

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

405406
def dottyDocSettings(implicit mode: Mode) = Seq(
406407
connectInput in run := true,
407-
outputStrategy := Some(StdoutOutput),
408408

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

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

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

532530
Seq(
533531
"-Ddotty.tests.dottyCompilerManagedSources=" + managedSrcDir,
534532
"-Ddotty.tests.classes.dottyInterfaces=" + jars("dotty-interfaces"),
535533
"-Ddotty.tests.classes.dottyLibrary=" + jars("dotty-library"),
536-
"-Ddotty.tests.classes.dottyLibraryJS=" + jars("dotty-library-js"),
537534
"-Ddotty.tests.classes.dottyCompiler=" + jars("dotty-compiler"),
538535
"-Ddotty.tests.classes.tastyCore=" + jars("tasty-core"),
539536
"-Ddotty.tests.classes.compilerInterface=" + findArtifactPath(externalDeps, "compiler-interface"),
540537
"-Ddotty.tests.classes.scalaLibrary=" + findArtifactPath(externalDeps, "scala-library"),
541538
"-Ddotty.tests.classes.scalaAsm=" + findArtifactPath(externalDeps, "scala-asm"),
542539
"-Ddotty.tests.classes.jlineTerminal=" + findArtifactPath(externalDeps, "jline-terminal"),
543540
"-Ddotty.tests.classes.jlineReader=" + findArtifactPath(externalDeps, "jline-reader"),
544-
"-Ddotty.tests.classes.scalaJSLibrary=" + findArtifactPath(externalJSDeps, "scalajs-library_2.13"),
545541
)
546542
},
547543

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

1142+
lazy val sjsCompilerTests = project.in(file("sjs-compiler-tests")).
1143+
dependsOn(`dotty-compiler` % "test->test").
1144+
settings(
1145+
commonNonBootstrappedSettings,
1146+
1147+
// Change the baseDirectory when running the tests
1148+
baseDirectory in Test := baseDirectory.value.getParentFile,
1149+
1150+
javaOptions ++= (javaOptions in `dotty-compiler`).value,
1151+
javaOptions ++= {
1152+
val externalJSDeps = (externalDependencyClasspath in (`dotty-library-bootstrappedJS`, Compile)).value
1153+
val dottyLibraryJSJar = (packageBin in (`dotty-library-bootstrappedJS`, Compile)).value.getAbsolutePath
1154+
1155+
Seq(
1156+
"-Ddotty.tests.classes.dottyLibraryJS=" + dottyLibraryJSJar,
1157+
"-Ddotty.tests.classes.scalaJSLibrary=" + findArtifactPath(externalJSDeps, "scalajs-library_2.13"),
1158+
)
1159+
},
1160+
)
1161+
11471162
lazy val `dotty-bench` = project.in(file("bench")).asDottyBench(NonBootstrapped)
11481163
lazy val `dotty-bench-bootstrapped` = project.in(file("bench")).asDottyBench(Bootstrapped)
11491164
lazy val `dotty-bench-run` = project.in(file("bench-run")).asDottyBench(Bootstrapped)

0 commit comments

Comments
 (0)