Skip to content

Commit 94f889f

Browse files
authored
Merge pull request #7443 from dotty-staging/fix-test-run
Fix regression: Run the bootstrapped tests with the correct compiler
2 parents 2d9b3d1 + 04e71f9 commit 94f889f

File tree

1 file changed

+25
-46
lines changed

1 file changed

+25
-46
lines changed

project/Build.scala

Lines changed: 25 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,15 @@ object Build {
201201
).toList,
202202
PgpKeys.pgpPassphrase := sys.env.get("PGP_PW").map(_.toCharArray()),
203203
PgpKeys.useGpgPinentry := true,
204+
205+
javaOptions ++= {
206+
val ciOptions = // propagate if this is a CI build
207+
sys.props.get("dotty.drone.mem") match {
208+
case Some(prop) => List("-Xmx" + prop)
209+
case _ => List()
210+
}
211+
agentOptions ::: ciOptions
212+
}
204213
)
205214

206215
lazy val commonSettings = publishSettings ++ Seq(
@@ -432,29 +441,8 @@ object Build {
432441
def findArtifactPath(classpath: Def.Classpath, name: String): String =
433442
findArtifact(classpath, name).getAbsolutePath
434443

435-
// Settings shared between dotty-compiler, dotty-compiler-bootstrapped and dotty-staging
436-
lazy val commonDottyJarClasspathSettings = Seq(
437-
// http://grokbase.com/t/gg/simple-build-tool/135ke5y90p/sbt-setting-jvm-boot-paramaters-for-scala
438-
// packageAll should always be run before tests
439-
javaOptions ++= {
440-
val externalDeps = externalCompilerClasspathTask.value
441-
val jars = packageAll.in(LocalProject("dotty-compiler")).value
442-
443-
List(
444-
"-Ddotty.tests.classes.dottyInterfaces=" + jars("dotty-interfaces"),
445-
"-Ddotty.tests.classes.dottyLibrary=" + jars("dotty-library"),
446-
"-Ddotty.tests.classes.dottyCompiler=" + jars("dotty-compiler"),
447-
"-Ddotty.tests.classes.compilerInterface=" + findArtifactPath(externalDeps, "compiler-interface"),
448-
"-Ddotty.tests.classes.scalaLibrary=" + findArtifactPath(externalDeps, "scala-library"),
449-
"-Ddotty.tests.classes.scalaAsm=" + findArtifactPath(externalDeps, "scala-asm"),
450-
"-Ddotty.tests.classes.jlineTerminal=" + findArtifactPath(externalDeps, "jline-terminal"),
451-
"-Ddotty.tests.classes.jlineReader=" + findArtifactPath(externalDeps, "jline-reader")
452-
)
453-
}
454-
)
455-
456444
// Settings shared between dotty-compiler and dotty-compiler-bootstrapped
457-
lazy val commonDottyCompilerSettings = commonDottyJarClasspathSettings ++ Seq(
445+
lazy val commonDottyCompilerSettings = Seq(
458446
// set system in/out for repl
459447
connectInput in run := true,
460448
outputStrategy := Some(StdoutOutput),
@@ -509,32 +497,27 @@ object Build {
509497
// Add git-hash used to package the distribution to the manifest to know it in runtime and report it in REPL
510498
packageOptions += ManifestAttributes(("Git-Hash", VersionUtil.gitHash)),
511499

512-
// http://grokbase.com/t/gg/simple-build-tool/135ke5y90p/sbt-setting-jvm-boot-paramaters-for-scala
513-
// packageAll should always be run before tests
514500
javaOptions ++= {
515-
val ci_build = // propagate if this is a ci build
516-
sys.props.get("dotty.drone.mem") match {
517-
case Some(prop) => List("-Xmx" + prop)
518-
case _ => List()
519-
}
520-
521-
val tuning =
522-
if (sys.props.isDefinedAt("Oshort"))
523-
// Optimize for short-running applications, see https://github.com/lampepfl/dotty/issues/222
524-
List("-XX:+TieredCompilation", "-XX:TieredStopAtLevel=1")
525-
else List()
526-
527501
val managedSrcDir = {
528502
// Populate the directory
529503
(managedSources in Compile).value
530504

531505
(sourceManaged in Compile).value
532506
}
507+
val externalDeps = externalCompilerClasspathTask.value
508+
val jars = packageAll.value
533509

534-
val jarOpt =
535-
"-Ddotty.tests.dottyCompilerManagedSources=" + managedSrcDir
536-
537-
jarOpt :: tuning ::: agentOptions ::: ci_build
510+
Seq(
511+
"-Ddotty.tests.dottyCompilerManagedSources=" + managedSrcDir,
512+
"-Ddotty.tests.classes.dottyInterfaces=" + jars("dotty-interfaces"),
513+
"-Ddotty.tests.classes.dottyLibrary=" + jars("dotty-library"),
514+
"-Ddotty.tests.classes.dottyCompiler=" + jars("dotty-compiler"),
515+
"-Ddotty.tests.classes.compilerInterface=" + findArtifactPath(externalDeps, "compiler-interface"),
516+
"-Ddotty.tests.classes.scalaLibrary=" + findArtifactPath(externalDeps, "scala-library"),
517+
"-Ddotty.tests.classes.scalaAsm=" + findArtifactPath(externalDeps, "scala-asm"),
518+
"-Ddotty.tests.classes.jlineTerminal=" + findArtifactPath(externalDeps, "jline-terminal"),
519+
"-Ddotty.tests.classes.jlineReader=" + findArtifactPath(externalDeps, "jline-reader"),
520+
)
538521
},
539522

540523
testCompilation := Def.inputTaskDyn {
@@ -707,7 +690,7 @@ object Build {
707690

708691
lazy val bootstrapedDottyCompilerSettings = commonDottyCompilerSettings ++ Seq(
709692
javaOptions += {
710-
val jars = packageAll.in(LocalProject("dotty-compiler-bootstrapped")).value
693+
val jars = packageAll.value
711694
"-Ddotty.tests.classes.dottyStaging=" + jars("dotty-staging")
712695
},
713696
packageAll := {
@@ -769,12 +752,8 @@ object Build {
769752
dependsOn(dottyCompiler(Bootstrapped) % "compile->runtime").
770753
dependsOn(dottyCompiler(Bootstrapped) % "test->test").
771754
settings(commonBootstrappedSettings).
772-
settings(commonDottyJarClasspathSettings).
773755
settings(
774-
javaOptions ++= {
775-
val jars = packageAll.in(`dotty-compiler-bootstrapped`).value
776-
List("-Ddotty.tests.classes.dottyStaging=" + jars("dotty-staging"))
777-
}
756+
javaOptions := (javaOptions in `dotty-compiler-bootstrapped`).value
778757
)
779758

780759
lazy val `dotty-sbt-bridge` = project.in(file("sbt-bridge/src")).

0 commit comments

Comments
 (0)