Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update sbt to 1.10.1 #195

Merged
merged 2 commits into from
Jul 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 9 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ Add Scalafix to your project's build by [following the instructions](https://sca
1. Add the Scalafix plugin to the project by adding this to `project/plugins.sbt`:

```scala
addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.11.0")
addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.12.1")
```

2. Enable SemanticDB by adding this to `build.sbt`:
Expand All @@ -187,21 +187,14 @@ Add Scalafix to your project's build by [following the instructions](https://sca
ThisBuild / semanticdbEnabled := true
ThisBuild / semanticdbVersion := scalafixSemanticdb.revision
ThisBuild / scalafixScalaBinaryVersion := CrossVersion.binaryScalaVersion(scalaVersion.value)
ThisBuild / scalafixDependencies += "com.dwolla" %% "finagle-tagless-scalafix" % "0.2.0"
ThisBuild / scalafixDependencies += "com.dwolla" %% "finagle-tagless-scalafix" % "1.1.1"
```

3. Run the Scalafix rule automatically after generating the Thrift sources by adding this to `build.sbt`:

```scala
Compile / scalafix / unmanagedSources := (Compile / sources).value
Compile / compile := Def.taskDyn {
val compileOutput = (Compile / compile).value

Def.task {
(Compile / scalafix).toTask(" AddCatsTaglessInstances").value
compileOutput
}
}.value
scalafixOnCompile := true
libraryDependencies ++= {
val catsTaglessV = "0.14.0"
Seq(
Expand All @@ -211,6 +204,12 @@ Add Scalafix to your project's build by [following the instructions](https://sca
}
```

and adding this to `.scalafix.conf`:

```hocon
triggered.rules = [ AddCatsTaglessInstances ]
```

### `AddCatsTaglessInstances`

The `AddCatsTaglessInstances` rule finds generated Thrift service traits and adds implicit instances of
Expand Down
2 changes: 1 addition & 1 deletion project/AsyncUtilsBuildPlugin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ object AsyncUtilsBuildPlugin extends AutoPlugin {

private val supportedVersions = (currentTwitterVersion :: oldVersions).sorted.reverse

private val SCALA_2_13: String = "2.13.13"
private val SCALA_2_13: String = "2.13.14"
private val SCALA_2_12 = "2.12.19"
private val Scala2Versions: Seq[String] = Seq(SCALA_2_13, SCALA_2_12)

Expand Down
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=1.9.9
sbt.version=1.10.1
2 changes: 1 addition & 1 deletion project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ addSbtPlugin("org.typelevel" % "sbt-typelevel-ci-release" % "0.7.2")
addSbtPlugin("org.typelevel" % "sbt-typelevel-mergify" % "0.7.2")
addSbtPlugin("org.typelevel" % "sbt-typelevel-settings" % "0.7.2")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.16.0")
addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.12.0")
addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.12.1")
addSbtPlugin("com.eed3si9n" % "sbt-projectmatrix" % "0.10.0")
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import com.eed3si9n.expecty.Expecty.expect
import munit.FunSuite
import scalafix.Patch

import scala.meta._
import scala.meta.*

class AddCatsTaglessInstancesTest extends FunSuite {

Expand Down Expand Up @@ -69,7 +69,7 @@ class AddCatsTaglessInstancesTest extends FunSuite {

test("add SimpleService companion object with implicits") {
val expectedPatchContent =
"""Add(}, RightBrace(}) [467..468), }
"""Add(}, RightBrace [467..468), }
|
| object SimpleService {
| implicit def SimpleServiceInReaderT[F[_]]: SimpleService[({type Ξ›[Ξ²0] = _root_.cats.data.ReaderT[F, SimpleService[F], Ξ²0]})#Ξ›] =
Expand All @@ -92,12 +92,12 @@ class AddCatsTaglessInstancesTest extends FunSuite {

test("add replacement MethodPerEndpoint that extends SimpleService[Future]") {
val expectedPatchContent =
"""Add(}, RightBrace(}) [467..468), }
"""Add(}, RightBrace [467..468), }
| trait MethodPerEndpoint extends SimpleService[Future])""".stripMargin

expect(patch.toString.contains(expectedPatchContent))
}

test("the patches don't touch SimpleService2, which has already been fixed") {
expect(!patch.toString.contains("SimpleService2"))
expect(!patch.toString.contains(s"Add(Future, Future [${range("Future")(input.lastIndexOf)}), F)"))
Expand Down