From 7480df5bb4d4911c8a45ab98b0c98147ae3c8c48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Zu=CC=88hlke?= Date: Sat, 4 Jan 2025 19:26:17 +0100 Subject: [PATCH] Simplify scripted tests using globs After support for globs in scripted tests: * https://github.com/sbt/sbt/pull/7933 * https://github.com/sbt/sbt/pull/7932 The changes introduced in #184 can be simplified again. --- build.sbt | 6 ++++++ .../sbt-test/sbt-contraband/roundtrip-test-java/build.sbt | 5 ----- plugin/src/sbt-test/sbt-contraband/roundtrip-test-java/test | 2 +- .../sbt-test/sbt-contraband/roundtrip-test-mixed/build.sbt | 5 ----- .../src/sbt-test/sbt-contraband/roundtrip-test-mixed/test | 2 +- .../sbt-test/sbt-contraband/roundtrip-test-scala/build.sbt | 5 ----- .../src/sbt-test/sbt-contraband/roundtrip-test-scala/test | 2 +- project/build.properties | 2 +- 8 files changed, 10 insertions(+), 19 deletions(-) diff --git a/build.sbt b/build.sbt index 94c05e2..63e700f 100644 --- a/build.sbt +++ b/build.sbt @@ -74,5 +74,11 @@ lazy val plugin = (project in file("plugin")) case _ => "2.0.0-M3" } }, + scriptedSbt := { + scalaBinaryVersion.value match { + case "2.12" => "1.10.7" + case _ => "2.0.0-M3" + } + }, publishLocal := (publishLocal dependsOn (library / publishLocal)).value, ) diff --git a/plugin/src/sbt-test/sbt-contraband/roundtrip-test-java/build.sbt b/plugin/src/sbt-test/sbt-contraband/roundtrip-test-java/build.sbt index 90f0670..61f3d29 100644 --- a/plugin/src/sbt-test/sbt-contraband/roundtrip-test-java/build.sbt +++ b/plugin/src/sbt-test/sbt-contraband/roundtrip-test-java/build.sbt @@ -11,11 +11,6 @@ lazy val root = (project in file(".")). if (substitutions contains name) substitutions(name) :: Nil else ((Compile / generateContrabands / contrabandFormatsForType).value)(tpe) }, - TaskKey[Unit]("check") := { - val dir = (Compile / generateContrabands / sourceManaged).value - val src = dir / "generated" / "CustomProtocol.scala" - assert(src.isFile) - }, libraryDependencies += "com.eed3si9n" %% "sjson-new-scalajson" % contrabandSjsonNewVersion.value // scalacOptions += "-Xlog-implicits" ) diff --git a/plugin/src/sbt-test/sbt-contraband/roundtrip-test-java/test b/plugin/src/sbt-test/sbt-contraband/roundtrip-test-java/test index 1c19b19..09f929d 100644 --- a/plugin/src/sbt-test/sbt-contraband/roundtrip-test-java/test +++ b/plugin/src/sbt-test/sbt-contraband/roundtrip-test-java/test @@ -2,6 +2,6 @@ > compile -> check +$ exists target/**/src_managed/main/generated/CustomProtocol.scala > run diff --git a/plugin/src/sbt-test/sbt-contraband/roundtrip-test-mixed/build.sbt b/plugin/src/sbt-test/sbt-contraband/roundtrip-test-mixed/build.sbt index 90f0670..61f3d29 100644 --- a/plugin/src/sbt-test/sbt-contraband/roundtrip-test-mixed/build.sbt +++ b/plugin/src/sbt-test/sbt-contraband/roundtrip-test-mixed/build.sbt @@ -11,11 +11,6 @@ lazy val root = (project in file(".")). if (substitutions contains name) substitutions(name) :: Nil else ((Compile / generateContrabands / contrabandFormatsForType).value)(tpe) }, - TaskKey[Unit]("check") := { - val dir = (Compile / generateContrabands / sourceManaged).value - val src = dir / "generated" / "CustomProtocol.scala" - assert(src.isFile) - }, libraryDependencies += "com.eed3si9n" %% "sjson-new-scalajson" % contrabandSjsonNewVersion.value // scalacOptions += "-Xlog-implicits" ) diff --git a/plugin/src/sbt-test/sbt-contraband/roundtrip-test-mixed/test b/plugin/src/sbt-test/sbt-contraband/roundtrip-test-mixed/test index 1c19b19..09f929d 100644 --- a/plugin/src/sbt-test/sbt-contraband/roundtrip-test-mixed/test +++ b/plugin/src/sbt-test/sbt-contraband/roundtrip-test-mixed/test @@ -2,6 +2,6 @@ > compile -> check +$ exists target/**/src_managed/main/generated/CustomProtocol.scala > run diff --git a/plugin/src/sbt-test/sbt-contraband/roundtrip-test-scala/build.sbt b/plugin/src/sbt-test/sbt-contraband/roundtrip-test-scala/build.sbt index 68009c9..bad9cfb 100644 --- a/plugin/src/sbt-test/sbt-contraband/roundtrip-test-scala/build.sbt +++ b/plugin/src/sbt-test/sbt-contraband/roundtrip-test-scala/build.sbt @@ -5,11 +5,6 @@ lazy val root = (project in file(".")). settings( name := "example", scalaVersion := "2.13.15", - TaskKey[Unit]("check") := { - val dir = (Compile / generateContrabands / sourceManaged).value - val src = dir / "com" / "example" / "codec" / "CustomJsonProtocol.scala" - assert(src.isFile) - }, libraryDependencies += "com.eed3si9n" %% "sjson-new-scalajson" % contrabandSjsonNewVersion.value // scalacOptions += "-Xlog-implicits" ) diff --git a/plugin/src/sbt-test/sbt-contraband/roundtrip-test-scala/test b/plugin/src/sbt-test/sbt-contraband/roundtrip-test-scala/test index 1c19b19..198ca6a 100644 --- a/plugin/src/sbt-test/sbt-contraband/roundtrip-test-scala/test +++ b/plugin/src/sbt-test/sbt-contraband/roundtrip-test-scala/test @@ -2,6 +2,6 @@ > compile -> check +$ exists target/**/src_managed/main/com/example/codec/CustomJsonProtocol.scala > run diff --git a/project/build.properties b/project/build.properties index bc73906..73df629 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.10.3 +sbt.version=1.10.7