diff --git a/bin/test-release.sh b/bin/test-release.sh index 71036ac69..235d8e9cf 100755 --- a/bin/test-release.sh +++ b/bin/test-release.sh @@ -10,11 +10,11 @@ cs resolve \ ch.epfl.scala:scalafix-core_2.13:$version \ ch.epfl.scala:scalafix-reflect_2.11.12:$version \ ch.epfl.scala:scalafix-reflect_2.12.17:$version \ - ch.epfl.scala:scalafix-reflect_2.13.8:$version \ + ch.epfl.scala:scalafix-reflect_2.13.9:$version \ ch.epfl.scala:scalafix-cli_2.11.12:$version \ ch.epfl.scala:scalafix-cli_2.12.17:$version \ - ch.epfl.scala:scalafix-cli_2.13.8:$version \ + ch.epfl.scala:scalafix-cli_2.13.9:$version \ ch.epfl.scala:scalafix-testkit_2.11.12:$version \ ch.epfl.scala:scalafix-testkit_2.12.17:$version \ - ch.epfl.scala:scalafix-testkit_2.13.8:$version \ + ch.epfl.scala:scalafix-testkit_2.13.9:$version \ -r sonatype:public diff --git a/project/Dependencies.scala b/project/Dependencies.scala index 6808868c1..bab1f92e0 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -9,7 +9,7 @@ import scala.util.Try object Dependencies { val scala211 = "2.11.12" val scala212 = "2.12.17" - val scala213 = "2.13.8" + val scala213 = "2.13.9" val scala3 = "3.1.3" val buildScalaVersions = Seq(scala211, scala212, scala213) diff --git a/project/ScalafixBuild.scala b/project/ScalafixBuild.scala index f06ccf988..676c6519e 100644 --- a/project/ScalafixBuild.scala +++ b/project/ScalafixBuild.scala @@ -7,6 +7,7 @@ import sbt.plugins.JvmPlugin import com.typesafe.tools.mima.plugin.MimaPlugin.autoImport._ import sbtbuildinfo.BuildInfoKey import sbtbuildinfo.BuildInfoPlugin.autoImport._ +import sbtversionpolicy.SbtVersionPolicyPlugin import sbtversionpolicy.SbtVersionPolicyPlugin.autoImport._ import scalafix.sbt.ScalafixPlugin.autoImport._ import com.typesafe.sbt.sbtghpages.GhpagesKeys @@ -15,7 +16,9 @@ import sbt.plugins.IvyPlugin object ScalafixBuild extends AutoPlugin with GhpagesKeys { override def trigger = allRequirements - override def requires = JvmPlugin && IvyPlugin + override def requires = + JvmPlugin && + SbtVersionPolicyPlugin // don't let it override our mimaPreviousArtifacts object autoImport { lazy val stableVersion = settingKey[String]("Version of latest release to Maven.") @@ -55,8 +58,9 @@ object ScalafixBuild extends AutoPlugin with GhpagesKeys { else Nil } lazy val targetJvm = Def.setting { - if (isScala3.value) "-Xtarget:8" - else "-target:jvm-1.8" + if (isScala3.value) Seq("-Xtarget:8") + else if (isScala213.value) Seq("-release", "8") + else Seq("-target:jvm-1.8") } val warnAdaptedArgs = Def.setting { if (isScala3.value) Nil @@ -80,8 +84,8 @@ object ScalafixBuild extends AutoPlugin with GhpagesKeys { } lazy val compilerOptions = Def.setting( warnUnusedImports.value ++ + targetJvm.value ++ Seq( - targetJvm.value, "-encoding", "UTF-8", "-feature", @@ -174,6 +178,7 @@ object ScalafixBuild extends AutoPlugin with GhpagesKeys { ) private val PreviousScalaVersion: Map[String, String] = Map( + "2.13.9" -> "2.13.8" ) override def buildSettings: Seq[Setting[_]] = List( @@ -191,6 +196,19 @@ object ScalafixBuild extends AutoPlugin with GhpagesKeys { ) override def projectSettings: Seq[Def.Setting[_]] = List( + // avoid "missing dependency" on artifacts with full scala version when bumping scala + versionPolicyIgnored ++= { + PreviousScalaVersion.get(scalaVersion.value) match { + case Some(previous) => + // all transitive dependencies with full scala version we know about + Seq( + "org.scalameta" % s"semanticdb-scalac-core_$previous", + "ch.epfl.scala" % s"scalafix-cli_$previous", + "ch.epfl.scala" % s"scalafix-reflect_$previous" + ) + case None => Seq() + } + }, // don't publish scala 3 artifacts for now publish / skip := (if ((publish / skip).value) true else scalaBinaryVersion.value == "3"), @@ -235,13 +253,6 @@ object ScalafixBuild extends AutoPlugin with GhpagesKeys { organizationName.value % previousScalaVCrossName % stableVersion.value ) }, - mimaDependencyResolution := { - // effectively reverts https://github.com/lightbend/mima/pull/508 since the - // Coursier resolution ignores/overrides the explicit scala full version set - // in mimaPreviousArtifacts - val ivy = sbt.Keys.ivySbt.value - IvyDependencyResolution(ivy.configuration) - }, mimaBinaryIssueFilters ++= Mima.ignoredABIProblems ) ++ Seq(Compile, Test).flatMap(conf => inConfig(conf)(configSettings)) diff --git a/scalafix-tests/unit/src/main/resources/expect/Pretty.expect b/scalafix-tests/unit/src/main/resources/expect/Pretty.expect index 500557a83..60f656ea9 100644 --- a/scalafix-tests/unit/src/main/resources/expect/Pretty.expect +++ b/scalafix-tests/unit/src/main/resources/expect/Pretty.expect @@ -111,7 +111,7 @@ [116:12..116:22]: test/Test.C#ByNameType. => final object ByNameType extends AnyRef { +1 decls } [117:11..117:13]: test/Test.C#ByNameType.m1(). => method m1(x: => Int): Int [117:14..117:15]: test/Test.C#ByNameType.m1().(x) => param x: => Int -[120:16..120:28]: test/Test.C#RepeatedType# => case class RepeatedType extends AnyRef with Product with Serializable { +12 decls } +[120:16..120:28]: test/Test.C#RepeatedType# => case class RepeatedType extends AnyRef with Product with Serializable { +11 decls } [120:28..120:28]: test/Test.C#RepeatedType#``(). => primary ctor (val s: String*) [120:29..120:30]: test/Test.C#RepeatedType#s. => val method s: String* [121:11..121:13]: test/Test.C#RepeatedType#m1(). => method m1(x: Int*): Int