From c903c63d8617050e1afbd943ca26767c2dc63ffe Mon Sep 17 00:00:00 2001 From: Brice Jaglin Date: Sun, 16 Apr 2023 17:20:12 +0200 Subject: [PATCH] testkit: build against ScalaTest 3.2 This is a breaking change for testkit users that were relying on the ScalaTest 3.0 package hierarchy, deprecated 3 years ago in 3.1 and removed in 3.2 (despite no major bump). Scalafix rules were made available to ease that transition, see https://github.com/scalatest/autofix/tree/master. --- .scala-steward.conf | 3 --- build.sbt | 4 ++-- project/Dependencies.scala | 5 ++--- project/ScalafixBuild.scala | 6 +----- .../scala/scalafix/testkit/AbstractSemanticRuleSuite.scala | 4 ++-- .../scala/scalafix/testkit/AbstractSyntacticRuleSuite.scala | 5 ++--- 6 files changed, 9 insertions(+), 18 deletions(-) diff --git a/.scala-steward.conf b/.scala-steward.conf index f378d6a4a7..3fd7fb74da 100644 --- a/.scala-steward.conf +++ b/.scala-steward.conf @@ -1,8 +1,5 @@ pullRequests.frequency = "0 0 1,15 * ?" updates.pin = [ - # don't bump, to avoid forcing breaking changes on clients via eviction - { groupId = "org.scalatest", artifactId = "scalatest", version = "3.0.8" }, - # JGit 6.x requires Java 11, see https://www.eclipse.org/lists/cross-project-issues-dev/msg18654.html { groupId = "org.eclipse.jgit", artifactId = "org.eclipse.jgit", version = "5." }, diff --git a/build.sbt b/build.sbt index 7cc353e3d6..693e2f4f46 100644 --- a/build.sbt +++ b/build.sbt @@ -206,7 +206,7 @@ lazy val testkit = projectMatrix moduleName := "scalafix-testkit", isFullCrossVersion, libraryDependencies += googleDiff, - libraryDependencies += scalatestDep.value + libraryDependencies += scalatest ) .defaultAxes(VirtualAxis.jvm) .jvmPlatform(buildScalaVersions) @@ -224,7 +224,7 @@ lazy val unit = projectMatrix libraryDependencies ++= List( jgit, munit, - scalatest.withRevision(scalatestLatestV) + scalatest ), libraryDependencies ++= { if (!isScala3.value) { diff --git a/project/Dependencies.scala b/project/Dependencies.scala index 98b03f85de..c8de3ed01d 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -31,8 +31,7 @@ object Dependencies { val nailgunV = "0.9.1" val scalaXmlV = "2.1.0" val scalametaV = "4.7.6" - val scalatestMinV = "3.0.8" // don't bump, to avoid forcing breaking changes on clients via eviction - val scalatestLatestV = "3.2.13" + val scalatestV = "3.2.13" val munitV = "0.7.29" val bijectionCore = "com.twitter" %% "bijection-core" % bijectionCoreV @@ -55,7 +54,7 @@ object Dependencies { .cross(CrossVersion.for3Use2_13) val scalametaTeskit = ("org.scalameta" %% "testkit" % scalametaV) .cross(CrossVersion.for3Use2_13) - val scalatest = "org.scalatest" %% "scalatest" % scalatestMinV + val scalatest = "org.scalatest" %% "scalatest" % scalatestV val munit = "org.scalameta" %% "munit" % munitV val semanticdbScalacCore = "org.scalameta" % "semanticdb-scalac-core" % scalametaV cross CrossVersion.full diff --git a/project/ScalafixBuild.scala b/project/ScalafixBuild.scala index e1105ea9d2..d6ba5358c8 100644 --- a/project/ScalafixBuild.scala +++ b/project/ScalafixBuild.scala @@ -117,10 +117,6 @@ object ScalafixBuild extends AutoPlugin with GhpagesKeys { buildInfoObject := "RulesBuildInfo" ) - lazy val scalatestDep = Def.setting { - if (isScala3.value) scalatest.withRevision(scalatestLatestV) - else scalatest - } } import autoImport._ @@ -211,7 +207,7 @@ object ScalafixBuild extends AutoPlugin with GhpagesKeys { // don't publish scala 3 artifacts for now publish / skip := (if ((publish / skip).value) true else scalaBinaryVersion.value == "3"), - versionPolicyIntention := Compatibility.BinaryCompatible, + versionPolicyIntention := Compatibility.None, scalacOptions ++= compilerOptions.value, scalacOptions ++= semanticdbSyntheticsCompilerOption.value, Compile / console / scalacOptions := diff --git a/scalafix-testkit/src/main/scala/scalafix/testkit/AbstractSemanticRuleSuite.scala b/scalafix-testkit/src/main/scala/scalafix/testkit/AbstractSemanticRuleSuite.scala index dcf133ed9e..2a0d9e8c4c 100644 --- a/scalafix-testkit/src/main/scala/scalafix/testkit/AbstractSemanticRuleSuite.scala +++ b/scalafix-testkit/src/main/scala/scalafix/testkit/AbstractSemanticRuleSuite.scala @@ -19,8 +19,8 @@ import scalafix.internal.v1.Args /** * Construct a test suite for running semantic Scalafix rules.

Mix-in - * FunSuiteLike (ScalaTest 3.0), AnyFunSuiteLike (ScalaTest 3.1+) or the testing - * style of your choice if you add your own tests. + * AnyFunSuiteLike or the testing style of your choice if you add your own + * tests. */ abstract class AbstractSemanticRuleSuite( val props: TestkitProperties, diff --git a/scalafix-testkit/src/main/scala/scalafix/testkit/AbstractSyntacticRuleSuite.scala b/scalafix-testkit/src/main/scala/scalafix/testkit/AbstractSyntacticRuleSuite.scala index cc95c624fc..48c433863d 100644 --- a/scalafix-testkit/src/main/scala/scalafix/testkit/AbstractSyntacticRuleSuite.scala +++ b/scalafix-testkit/src/main/scala/scalafix/testkit/AbstractSyntacticRuleSuite.scala @@ -12,9 +12,8 @@ import scalafix.syntax._ import scalafix.v1._ /** - * Utility to unit test syntactic rules.

Mix-in FunSuiteLike (ScalaTest - * 3.0), AnyFunSuiteLike (ScalaTest 3.1+) or the testing style of your choice if - * you add your own tests. + * Utility to unit test syntactic rules.

Mix-in AnyFunSuiteLike or the + * testing style of your choice if you add your own tests. * * @param rule * the default rule to use from `check`/`checkDiff`.