Skip to content

Commit

Permalink
Merge pull request #1729 from bjaglin/scala211
Browse files Browse the repository at this point in the history
drop support for Scala 2.11
  • Loading branch information
bjaglin authored Jan 29, 2023
2 parents a8789ee + 366db89 commit ca66e1d
Show file tree
Hide file tree
Showing 39 changed files with 40 additions and 366 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ jobs:
fail-fast: false
matrix:
command:
- "ci-211"
- "ci-212"
- "ci-213"
- "ci-3"
Expand Down Expand Up @@ -40,7 +39,7 @@ jobs:
- run: sbt ci-213

jdk17_213:
name: JDK117/scala_2.13 tests
name: JDK17/scala_2.13 tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand Down
4 changes: 0 additions & 4 deletions bin/test-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,12 @@ version=$1

cs resolve \
ch.epfl.scala:scalafix-interfaces:$version \
ch.epfl.scala:scalafix-core_2.11:$version \
ch.epfl.scala:scalafix-core_2.12:$version \
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.10:$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.10:$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.10:$version \
-r sonatype:public
16 changes: 3 additions & 13 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ lazy val interfaces = projectMatrix
props.put("scalametaVersion", scalametaV)
props.put("scala213", scala213)
props.put("scala212", scala212)
props.put("scala211", scala211)
val out =
(Compile / managedResourceDirectories).value.head /
"scalafix-interfaces.properties"
Expand Down Expand Up @@ -78,10 +77,7 @@ lazy val core = projectMatrix
)
}
},
libraryDependencies += {
if (isScala211.value) metaconfigFor211
else metaconfig
}
libraryDependencies += metaconfig
)
.defaultAxes(VirtualAxis.jvm)
.jvmPlatform(buildScalaVersions)
Expand Down Expand Up @@ -148,7 +144,7 @@ lazy val cli = projectMatrix
Seq()
},
libraryDependencies ++= {
if (isScala211.value || isScala3.value) Seq()
if (isScala3.value) Seq()
else
Seq(
// metaconfig 0.10.0 shaded pprint but rules built with an old
Expand Down Expand Up @@ -361,11 +357,6 @@ lazy val unit = projectMatrix
axisValues = Seq(TargetAxis(scala212)),
settings = Seq()
)
.jvmPlatform(
scalaVersions = Seq(scala211),
axisValues = Seq(TargetAxis(scala211)),
settings = Seq()
)
.enablePlugins(BuildInfoPlugin)
.dependsOn(testkit)

Expand All @@ -378,8 +369,7 @@ lazy val docs = projectMatrix
scalacOptions += "-Wconf:msg='match may not be exhaustive':s", // silence exhaustive pattern matching warning for documentation
scalacOptions += "-Xfatal-warnings",
mdoc := (Compile / run).evaluated,
libraryDependencies += (if (isScala211.value) metaconfigDocFor211
else metaconfigDoc)
libraryDependencies += metaconfigDoc
)
.defaultAxes(VirtualAxis.jvm)
.jvmPlatform(scalaVersions = Seq(scala213))
Expand Down
2 changes: 1 addition & 1 deletion docs/developers/cross-publish-custom-rules.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ For most rules, this change requires only modifying the build settings as follow
```diff
// build.sbt
scalaVersion := V.scala212,
+crossScalaVersions := List(V.scala213, V.scala212, V.scala211),
+crossScalaVersions := List(V.scala213, V.scala212),
```
The second step is to update your CI to run tests on the different
scala versions your rule is being cross-published to. For that, you only
Expand Down
1 change: 0 additions & 1 deletion docs/developers/setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ that is either supported by
[SemanticDB](https://scalameta.org/docs/semanticdb/specification.html) compiler
plugin or built-in in the compiler. Supported Scala compiler versions include:

- Scala @SCALA211@
- Scala @SCALA212@
- Scala @SCALA213@
- Scala 3.x
Expand Down
2 changes: 1 addition & 1 deletion docs/rules/ExplicitResultTypes.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ title: ExplicitResultTypes
---

This rewrite inserts type annotations for inferred public members. Only compatible with
scala 2.11, 2.12 & 2.13.
scala 2.12 & 2.13.

Example:

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/NoAutoTupling.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Adds explicit tuples around argument lists where auto-tupling is occurring.

To use this rule:

- enable `-Ywarn-adapted-args` for Scala 2.11 and 2.12 (note, `-Yno-adapted-args` will fail compilation,
- enable `-Ywarn-adapted-args` for Scala 2.12 (note, `-Yno-adapted-args` will fail compilation,
which prevents scalafix from running). For Scala 2.13, use instead `-Xlint:adapted-args`.
- enable also `-deprecation` to get warnings on insertions of `Unit`.

Expand Down
16 changes: 3 additions & 13 deletions docs/rules/RemoveUnused.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ object Main {
}
```

Remove unused pattern match variables (Scala 2.12 & 2.13 only):
Remove unused pattern match variables:

```scala
case class AB(a: Int, b: String)
Expand All @@ -87,7 +87,7 @@ object Main {
}
```

Remove unused function parameters (Scala 2.12 & 2.13 only):
Remove unused function parameters:

```scala
// before
Expand Down Expand Up @@ -134,8 +134,6 @@ println(scalafix.website.rule("RemoveUnused", RemoveUnusedConfig.default))
Consult `scala -Y` in the command-line for more information about using
`-Ywarn-unused`.

For Scala @SCALA212@ & @SCALA213@

```
$ scala -Ywarn-unused:help
Enable or disable specific `unused' warnings
Expand All @@ -148,12 +146,4 @@ Enable or disable specific `unused' warnings
params Enable -Ywarn-unused:explicits,implicits.
linted -Xlint:unused.
Default: All choices are enabled by default.
```

For Scala @SCALA211@

```
$ scala -Y | grep warn-unused
-Ywarn-unused Warn when local and private vals, vars, defs, and types are unused.
-Ywarn-unused-import Warn when imports are unused.
```
```
6 changes: 3 additions & 3 deletions docs/users/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pull request is tested on both Linux and Windows.

**Java 8 or Java 11.**

**Scala 2.11, 2.12 or 2.13**
**Scala 2.12 and 2.13**

**Scala 3.x**: Scala 3 support is experimental and many built-in rules are not
supported.
Expand Down Expand Up @@ -79,7 +79,7 @@ the Scala compiler option `-Ywarn-unused-import` (or `-Wunused:imports` in
*/
inThisBuild(
List(
scalaVersion := "@SCALA212@", // @SCALA211@, @SCALA213@, or 3.x
scalaVersion := "@SCALA212@", // @SCALA213@, or 3.x
+ semanticdbEnabled := true, // enable SemanticDB
+ semanticdbVersion := scalafixSemanticdb.revision // only required for Scala 2.x
)
Expand All @@ -97,7 +97,7 @@ the Scala compiler option `-Ywarn-unused-import` (or `-Wunused:imports` in
* https://www.scala-sbt.org/1.x/docs/sbt-1.3-Release-Notes.html#SemanticDB+support
*/
lazy val myproject = project.settings(
scalaVersion := "@SCALA212@", // @SCALA211@, @SCALA213@, or 3.x
scalaVersion := "@SCALA212@", // @SCALA213@, or 3.x
+ semanticdbEnabled := true, // enable SemanticDB
+ semanticdbVersion := scalafixSemanticdb.revision, // only required for Scala 2.x
+ scalacOptions += "-Ywarn-unused-import" // Scala 2.x only, required by `RemoveUnused`
Expand Down
10 changes: 2 additions & 8 deletions project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,12 @@ import scala.util.Try
/* scalafmt: { maxColumn = 120 }*/

object Dependencies {
val scala211 = "2.11.12"
val scala212 = "2.12.17"
val scala213 = "2.13.10"
val scala3 = "3.2.1"

val buildScalaVersions = Seq(scala211, scala212, scala213, scala3)
val testTargetScalaVersions = Seq(scala211, scala212, scala213, scala3)
val buildScalaVersions = Seq(scala212, scala213, scala3)
val testTargetScalaVersions = Seq(scala212, scala213, scala3)

// we support 3 last binary versions of scala212 and scala213
val testedPreviousScalaVersions: Map[String, List[String]] =
Expand All @@ -27,12 +26,10 @@ object Dependencies {
val googleDiffV = "1.3.0"
val java8CompatV = "0.9.1"
val jgitV = "5.13.1.202206130422-r"
val metaconfigFor211V = "0.9.10" // metaconfig stops publishing for scala 2.11
val metaconfigV = "0.11.1"
val pprintV = "0.6.6" // don't bump, rules built against metaconfig 0.9.15 or earlier would not link
val nailgunV = "0.9.1"
val scalaXmlV = "2.1.0"
val scalaXml211V = "1.3.0" // scala-xml stops publishing for scala 2.11
val scalametaV = "4.6.0"
val scalatestMinV = "3.0.8" // don't bump, to avoid forcing breaking changes on clients via eviction
val scalatestLatestV = "3.2.13"
Expand All @@ -47,15 +44,12 @@ object Dependencies {
val googleDiff = "com.googlecode.java-diff-utils" % "diffutils" % googleDiffV
val java8Compat = "org.scala-lang.modules" %% "scala-java8-compat" % java8CompatV
val jgit = "org.eclipse.jgit" % "org.eclipse.jgit" % jgitV
val metaconfigFor211 = "com.geirsson" %% "metaconfig-typesafe-config" % metaconfigFor211V
val metaconfig = "com.geirsson" %% "metaconfig-typesafe-config" % metaconfigV
val pprint = "com.lihaoyi" %% "pprint" % pprintV
val metaconfigDocFor211 = "com.geirsson" %% "metaconfig-docs" % metaconfigFor211V
val metaconfigDoc = "com.geirsson" %% "metaconfig-docs" % metaconfigV
val metacp = "org.scalameta" %% "metacp" % scalametaV
val nailgunServer = "com.martiansoftware" % "nailgun-server" % nailgunV
val scalaXml = "org.scala-lang.modules" %% "scala-xml" % scalaXmlV
val scalaXml211 = "org.scala-lang.modules" %% "scala-xml" % scalaXml211V
// https://github.com/scalameta/scalameta/issues/2485
val scalameta = ("org.scalameta" %% "scalameta" % scalametaV)
.cross(CrossVersion.for3Use2_13)
Expand Down
33 changes: 2 additions & 31 deletions project/Mima.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,39 +6,10 @@ object Mima {
// To learn more about mima, see:
// See https://github.com/lightbend/mima
Seq(
ProblemFilters.exclude[MissingTypesProblem]("scalafix.testkit.DiffAssertions"),
ProblemFilters.exclude[MissingTypesProblem]("scalafix.testkit.SemanticRuleSuite"),
ProblemFilters.exclude[Problem]("scalafix.internal.*"),
ProblemFilters.exclude[ReversedMissingMethodProblem]("scalafix.interfaces.ScalafixArguments.evaluate"),
// https://github.com/sbt/sbt-buildinfo/pull/150
ProblemFilters.exclude[IncompatibleResultTypeProblem]("scalafix.Versions.supportedScalaVersions"),
ProblemFilters.exclude[IncompatibleResultTypeProblem]("buildinfo.RulesBuildInfo.allSupportedScalaVersions"),
ProblemFilters.exclude[IncompatibleResultTypeProblem]("buildinfo.RulesBuildInfo.supportedScalaVersions"),
ProblemFilters.exclude[ReversedMissingMethodProblem]("scalafix.interfaces.ScalafixFileEvaluation.getErrorMessage"),
ProblemFilters.exclude[ReversedMissingMethodProblem]("scalafix.interfaces.ScalafixEvaluation.getError"),
ProblemFilters.exclude[ReversedMissingMethodProblem]("scalafix.interfaces.ScalafixEvaluation.getErrorMessage"),
ProblemFilters.exclude[ReversedMissingMethodProblem]("scalafix.interfaces.ScalafixFileEvaluation.getError"),
ProblemFilters.exclude[DirectMissingMethodProblem]("scalafix.v1.SemanticDocument.fromPath"),
ProblemFilters.exclude[Problem]("scala.meta.internal.*"),
ProblemFilters.exclude[Problem]("scala.tools.nsc.interactive.*"),
ProblemFilters.exclude[Problem]("scalafix.syntax.package.XtensionDocument"),
ProblemFilters.exclude[MissingClassProblem]("scalafix.syntax.package$XtensionDocument"),
ProblemFilters.exclude[DirectMissingMethodProblem]("scalafix.interfaces.ScalafixEvaluation.getErrors"),
ProblemFilters.exclude[DirectMissingMethodProblem]("scalafix.interfaces.ScalafixEvaluation.getMessageError"),
ProblemFilters.exclude[DirectMissingMethodProblem]("scalafix.interfaces.ScalafixFileEvaluation.getErrors"),
ProblemFilters.exclude[MissingClassProblem]("scalafix.testkit.AbstractSyntacticRuleSuite$"),
ProblemFilters.exclude[Problem]("scalafix.testkit.AbstractSyntacticRuleSuite"),
ProblemFilters.exclude[Problem]("scalafix.testkit.AbstractSyntacticRuleSuite.*"),
ProblemFilters.exclude[MissingTypesProblem]("scalafix.testkit.SemanticRuleSuite$"),
ProblemFilters.exclude[Problem]("scalafix.testkit.SemanticRuleSuite"),
ProblemFilters.exclude[Problem]("scalafix.testkit.SemanticRuleSuite.*"),
ProblemFilters.exclude[MissingClassProblem]("scalafix.testkit.SyntacticRuleSuite$"),
ProblemFilters.exclude[Problem]("scalafix.testkit.SyntacticRuleSuite"),
ProblemFilters.exclude[ReversedMissingMethodProblem]("scalafix.interfaces.ScalafixArguments.withSemanticdbTargetroots"),
ProblemFilters.exclude[IncompatibleMethTypeProblem]("scalafix.testkit.RuleTest.fromPath"), // private[scalafix]
ProblemFilters.exclude[MissingClassProblem]("metaconfig.generic.package"),
ProblemFilters.exclude[MissingClassProblem]("metaconfig.generic.package$"),
ProblemFilters.exclude[MissingClassProblem]("scalafix.interfaces.ScalafixDialect")
// Exceptions
ProblemFilters.exclude[DirectMissingMethodProblem]("scalafix.Versions.scala211")
)
}
}
22 changes: 2 additions & 20 deletions project/ScalafixBuild.scala
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ object ScalafixBuild extends AutoPlugin with GhpagesKeys {
mimaPreviousArtifacts := Set.empty,
publish / skip := true
)
lazy val supportedScalaVersions = List(scala213, scala211, scala212)
lazy val supportedScalaVersions = List(scala213, scala212)
lazy val publishLocalTransitive =
taskKey[Unit]("Run publishLocal on this project and its dependencies")
lazy val isFullCrossVersion = Seq(
Expand All @@ -45,9 +45,6 @@ object ScalafixBuild extends AutoPlugin with GhpagesKeys {
lazy val isScala212 = Def.setting {
scalaVersion.value.startsWith("2.12")
}
lazy val isScala211 = Def.setting {
scalaVersion.value.startsWith("2.11")
}
lazy val warnUnusedImports = Def.setting {
if (isScala3.value) Nil
else if (isScala213.value) Seq("-Wunused:imports")
Expand All @@ -72,15 +69,14 @@ object ScalafixBuild extends AutoPlugin with GhpagesKeys {
"-implicits"
)
lazy val testsDependencies = Def.setting {
val xmlLib = if (isScala211.value) scalaXml211 else scalaXml
val otherLibs =
if (isScala2.value)
Seq(
bijectionCore,
"org.scala-lang" % "scala-reflect" % scalaVersion.value
)
else Nil
xmlLib +: otherLibs
scalaXml +: otherLibs
}
lazy val compilerOptions = Def.setting(
warnUnusedImports.value ++
Expand Down Expand Up @@ -109,7 +105,6 @@ object ScalafixBuild extends AutoPlugin with GhpagesKeys {
"scalameta" -> scalametaV,
scalaVersion,
"supportedScalaVersions" -> supportedScalaVersions,
"scala211" -> scala211,
"scala212" -> scala212,
"scala213" -> scala213,
sbtVersion
Expand Down Expand Up @@ -158,10 +153,6 @@ object ScalafixBuild extends AutoPlugin with GhpagesKeys {
"unit2_12Target2_12/test" ::
testRulesAgainstPreviousScalaVersions(scala212, s)
},
commands += Command.command("ci-211") { s =>
"unit2_11Target2_11/test" ::
testRulesAgainstPreviousScalaVersions(scala211, s)
},
commands += Command.command("ci-213-windows") { s =>
"publishLocalTransitive" :: // scalafix.tests.interfaces.ScalafixSuite
s"unit2_13Target2_13/testOnly -- -l scalafix.internal.tests.utils.SkipWindows" ::
Expand Down Expand Up @@ -223,15 +214,6 @@ object ScalafixBuild extends AutoPlugin with GhpagesKeys {
Compile / console / scalacOptions :=
compilerOptions.value :+ "-Yrepl-class-based",
Compile / doc / scalacOptions ++= scaladocOptions,
Compile / unmanagedSourceDirectories ++= {
val sourceDir = (Compile / sourceDirectory).value
val scala212PlusSourceDir = "scala-2.12+"
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, n)) if n >= 12 => Seq(sourceDir / scala212PlusSourceDir)
case Some((3, _)) => Seq(sourceDir / scala212PlusSourceDir)
case _ => Seq()
}
},
Compile / unmanagedResourceDirectories ++= {
val resourceParentDir = (Compile / resourceDirectory).value.getParentFile
CrossVersion.partialVersion(scalaVersion.value) match {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ final class ScalafixImpl extends Scalafix {
override def supportedScalaVersions(): Array[String] =
Versions.supportedScalaVersions.toArray
override def scala211(): String =
Versions.scala211
throw new java.lang.UnsupportedOperationException()
override def scala212(): String =
Versions.scala212
override def scala213(): String =
Expand Down
9 changes: 0 additions & 9 deletions scalafix-core/src/main/scala-2.11/scalafix/util/Compat.scala

This file was deleted.

Loading

0 comments on commit ca66e1d

Please sign in to comment.