From 86031461d1936679cbbafc956250dcfbc2c11615 Mon Sep 17 00:00:00 2001 From: Jamie Thompson Date: Thu, 2 May 2024 11:08:26 +0200 Subject: [PATCH] remove non-deterministic cancellation of async TASTy in sbt-test 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 its 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. --- sbt-test/pipelining/Yearly-tasty-output-inline/build.sbt | 6 ++++-- sbt-test/pipelining/Yearly-tasty-output/build.sbt | 5 +++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/sbt-test/pipelining/Yearly-tasty-output-inline/build.sbt b/sbt-test/pipelining/Yearly-tasty-output-inline/build.sbt index c0c726ce6a02..e350fa7e7def 100644 --- a/sbt-test/pipelining/Yearly-tasty-output-inline/build.sbt +++ b/sbt-test/pipelining/Yearly-tasty-output-inline/build.sbt @@ -1,8 +1,10 @@ -// defines a inline method +// NOTE: in this test, we are explictly fixing the classpath of project `b` to be `a-early.jar` +// to manually test pipelining without sbt/zinc managing the classpath. + +// defines a inline method. lazy val a = project.in(file("a")) .settings( scalacOptions ++= Seq("-Yearly-tasty-output", ((ThisBuild / baseDirectory).value / "a-early.jar").toString), - scalacOptions += "-Ystop-after:firstTransform", scalacOptions += "-Ycheck:all", ) diff --git a/sbt-test/pipelining/Yearly-tasty-output/build.sbt b/sbt-test/pipelining/Yearly-tasty-output/build.sbt index 62990c616071..5cfe30936ea9 100644 --- a/sbt-test/pipelining/Yearly-tasty-output/build.sbt +++ b/sbt-test/pipelining/Yearly-tasty-output/build.sbt @@ -1,8 +1,10 @@ +// NOTE: in this test, we are explictly fixing the classpath of project `c` to be `a-early.jar:b-early-out` +// to manually test pipelining without sbt/zinc managing the classpath. + // early out is a jar lazy val a = project.in(file("a")) .settings( scalacOptions ++= Seq("-Yearly-tasty-output", ((ThisBuild / baseDirectory).value / "a-early.jar").toString), - scalacOptions += "-Ystop-after:firstTransform", scalacOptions += "-Ycheck:all", ) @@ -10,7 +12,6 @@ lazy val a = project.in(file("a")) lazy val b = project.in(file("b")) .settings( scalacOptions ++= Seq("-Yearly-tasty-output", ((ThisBuild / baseDirectory).value / "b-early-out").toString), - scalacOptions += "-Ystop-after:firstTransform", scalacOptions += "-Ycheck:all", )