From 84b933802e0b1a2c1176d01c2799bff793375fb2 Mon Sep 17 00:00:00 2001 From: Adrien Piquerez Date: Tue, 26 Mar 2024 14:35:01 +0100 Subject: [PATCH] Fix compile-clean partially There is still no auto-definition of clean on tasks that return Seq[Path] --- .../sbt-test/actions/compile-clean/build.sbt | 3 ++- .../sbt-test/actions/compile-clean/pending | 22 ------------------- .../src/sbt-test/actions/compile-clean/test | 22 +++++++++++++++++++ 3 files changed, 24 insertions(+), 23 deletions(-) delete mode 100644 sbt-app/src/sbt-test/actions/compile-clean/pending create mode 100644 sbt-app/src/sbt-test/actions/compile-clean/test diff --git a/sbt-app/src/sbt-test/actions/compile-clean/build.sbt b/sbt-app/src/sbt-test/actions/compile-clean/build.sbt index 75c6a9b44..e6774e270 100644 --- a/sbt-app/src/sbt-test/actions/compile-clean/build.sbt +++ b/sbt-app/src/sbt-test/actions/compile-clean/build.sbt @@ -1,5 +1,6 @@ import sbt.nio.file.Glob -ThisBuild / scalaVersion := "2.12.17" +name := "compile-clean" +scalaVersion := "2.12.17" Compile / cleanKeepGlobs += Glob((Compile / compile / classDirectory).value, "X.class") diff --git a/sbt-app/src/sbt-test/actions/compile-clean/pending b/sbt-app/src/sbt-test/actions/compile-clean/pending deleted file mode 100644 index 2e805ffd0..000000000 --- a/sbt-app/src/sbt-test/actions/compile-clean/pending +++ /dev/null @@ -1,22 +0,0 @@ -$ touch target/cant-touch-this - -> Test/compile -$ exists target/scala-2.12/classes/A.class -$ exists target/scala-2.12/test-classes/B.class - -> Test/clean -$ exists target/cant-touch-this -# it should clean only compile classes -$ exists target/scala-2.12/classes/A.class -$ exists target/scala-2.12/classes/X.class -$ absent target/scala-2.12/test-classes/B.class - -# compiling everything again, but now cleaning only compile classes -> Test/compile -> Compile/clean -$ exists target/cant-touch-this -# it should clean only compile classes -$ absent target/scala-2.12/classes/A.class -$ exists target/scala-2.12/test-classes/B.class -# and X has to be kept, because of the cleanKeepFiles override -$ exists target/scala-2.12/classes/X.class diff --git a/sbt-app/src/sbt-test/actions/compile-clean/test b/sbt-app/src/sbt-test/actions/compile-clean/test new file mode 100644 index 000000000..a1289b6b1 --- /dev/null +++ b/sbt-app/src/sbt-test/actions/compile-clean/test @@ -0,0 +1,22 @@ +$ touch target/cant-touch-this + +> Test/products +$ exists target/out/jvm/scala-2.12.17/compile-clean/classes/A.class +$ exists target/out/jvm/scala-2.12.17/compile-clean/test-classes/B.class + +> Test/clean +$ exists target/cant-touch-this +# TODO it should clean only test classes +# $ exists target/out/jvm/scala-2.12.17/compile-clean/classes/A.class +# $ exists target/out/jvm/scala-2.12.17/compile-clean/classes/X.class +$ absent target/out/jvm/scala-2.12.17/compile-clean/test-classes/B.class + +# compiling everything again, but now cleaning only compile classes +> Test/products +> Compile/clean +$ exists target/cant-touch-this +# TODO it should clean only compile classes +$ absent target/out/jvm/scala-2.12.17/compile-clean/classes/A.class +# $ exists target/out/jvm/scala-2.12.17/compile-clean/test-classes/B.class +# TODO and X has to be kept, because of the cleanKeepFiles override +# $ exists target/out/jvm/scala-2.12.17/compile-clean/classes/X.class