Skip to content

Commit cb554eb

Browse files
authored
remove non-deterministic cancellation of async TASTy in sbt-test (#20319)
how-i-fixed-it: Originally these tests were written before we implemented async TASTy writing. This meant that we blocked the main thread at the end of `ExtractAPI` until TASTy was written. This meant that `-Ystop-after:firstTransform` would prevent the compiler reaching the backend, but stop after we knew that TASTy was written to `a-early.jar` Originally we did this to explicitly communicate that TASTy comes from `a-early.jar`, rather than `genBCode` output. In reality, it doesn't assert anything stronger than a comment would, because we manually fix the classpath to only be `a-early.jar`. After we added async TASTy writing, this test became non-deterministic, because we cancel async TASTy writing at the end of a run without synchronizing. So it's possible TASTy isn't written by the time we cancel after `firstTransform`. So instead, we remove `-Ystop-after`, guaranteeing that `a/compile` does not finish until we synchronize async TASTy in `genBCode`. fixes #20306 fixes #20278
2 parents e6bc130 + 8603146 commit cb554eb

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

sbt-test/pipelining/Yearly-tasty-output-inline/build.sbt

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
// defines a inline method
1+
// NOTE: in this test, we are explictly fixing the classpath of project `b` to be `a-early.jar`
2+
// to manually test pipelining without sbt/zinc managing the classpath.
3+
4+
// defines a inline method.
25
lazy val a = project.in(file("a"))
36
.settings(
47
scalacOptions ++= Seq("-Yearly-tasty-output", ((ThisBuild / baseDirectory).value / "a-early.jar").toString),
5-
scalacOptions += "-Ystop-after:firstTransform",
68
scalacOptions += "-Ycheck:all",
79
)
810

sbt-test/pipelining/Yearly-tasty-output/build.sbt

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
1+
// NOTE: in this test, we are explictly fixing the classpath of project `c` to be `a-early.jar:b-early-out`
2+
// to manually test pipelining without sbt/zinc managing the classpath.
3+
14
// early out is a jar
25
lazy val a = project.in(file("a"))
36
.settings(
47
scalacOptions ++= Seq("-Yearly-tasty-output", ((ThisBuild / baseDirectory).value / "a-early.jar").toString),
5-
scalacOptions += "-Ystop-after:firstTransform",
68
scalacOptions += "-Ycheck:all",
79
)
810

911
// early out is a directory
1012
lazy val b = project.in(file("b"))
1113
.settings(
1214
scalacOptions ++= Seq("-Yearly-tasty-output", ((ThisBuild / baseDirectory).value / "b-early-out").toString),
13-
scalacOptions += "-Ystop-after:firstTransform",
1415
scalacOptions += "-Ycheck:all",
1516
)
1617

0 commit comments

Comments
 (0)