Skip to content

Commit 00e56cb

Browse files
cb372ccantarero91Cristian CantareroAlejandroBudy
authored
V4 🚀 (#549)
This PR contains all the changes planned for the v4 release. It's basically a full rewrite, but see `modules/docs/src/main/mdoc/docs/migration.md` for a summary of the user-facing changes. Other changes not mentioned on that page include: * rewriting the codebase using Scala 3 syntax, getting rid of package objects, updating the syntactic sugar to use Scala 3 extension methods, switching to Scala 3 enums, etc * rewriting all the ScalaTest suites in MUnit Once this is merged, I will tag a `v4.0.0-RC1`. If we don't get any show-stopping feedback, I plan to release `v4.0.0` on Wednesday ~8th~ 15th Jan. --------- Co-authored-by: Cristian Cantarero Dávila <[email protected]> Co-authored-by: Cristian Cantarero <[email protected]> Co-authored-by: Alejandro <[email protected]> Co-authored-by: alejandrobudy <[email protected]>
1 parent 90d7f5c commit 00e56cb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+3253
-2872
lines changed

‎.github/workflows/ci.yml

+4
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ jobs:
1414
distribution: 'temurin'
1515
java-version: '17'
1616
cache: 'sbt'
17+
- uses: sbt/setup-sbt@v1
1718
- name: Test
1819
run: sbt -J-Xms4G -J-Xmx4G +test
1920
bincompat:
@@ -25,6 +26,7 @@ jobs:
2526
distribution: 'temurin'
2627
java-version: '17'
2728
cache: 'sbt'
29+
- uses: sbt/setup-sbt@v1
2830
- name: Check binary compatibility
2931
run: sbt -J-Xms4G -J-Xmx4G +mimaReportBinaryIssues
3032
docs:
@@ -36,6 +38,7 @@ jobs:
3638
distribution: 'temurin'
3739
java-version: '17'
3840
cache: 'sbt'
41+
- uses: sbt/setup-sbt@v1
3942
- name: Compile documentation
4043
run: sbt -J-Xms4G -J-Xmx4G docs/mdoc
4144
format:
@@ -47,5 +50,6 @@ jobs:
4750
distribution: 'temurin'
4851
java-version: '17'
4952
cache: 'sbt'
53+
- uses: sbt/setup-sbt@v1
5054
- name: Check formatting
5155
run: sbt -J-Xms4G -J-Xmx4G scalafmtCheckAll scalafmtSbtCheck

‎.github/workflows/release.yml

+2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ jobs:
1515
distribution: 'temurin'
1616
java-version: '17'
1717
cache: 'sbt'
18+
- uses: sbt/setup-sbt@v1
1819
- name: Publish
1920
run: sbt +test ci-release
2021
env:
@@ -33,6 +34,7 @@ jobs:
3334
distribution: 'temurin'
3435
java-version: '17'
3536
cache: 'sbt'
37+
- uses: sbt/setup-sbt@v1
3638
- uses: ruby/setup-ruby@v1
3739
with:
3840
ruby-version: 2.6

‎.gitignore

+4-1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,7 @@ target
55
.idea
66
*.ipr
77
*.iws
8-
.bsp
8+
.bsp
9+
.metals
10+
project/metals.sbt
11+
project/project/

‎.scalafmt.conf

+11-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
version = 3.6.1
2-
runner.dialect = scala213
2+
runner.dialect = scala3
33

44
align.preset = more
5-
maxColumn = 80
5+
maxColumn = 110
6+
7+
rewrite {
8+
scala3 {
9+
convertToNewSyntax = true
10+
removeOptionalBraces = true
11+
insertEndMarkerMinLines = 30
12+
removeEndMarkerMaxLines = 29
13+
}
14+
}

‎build.sbt

+38-72
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
11
import sbtcrossproject.CrossPlugin.autoImport.crossProject
2-
import _root_.org.typelevel.sbt.tpolecat.TpolecatPlugin.autoImport._
32
import _root_.org.typelevel.scalacoptions.ScalacOptions
43

5-
lazy val scalaVersion212 = "2.12.19"
6-
lazy val scalaVersion213 = "2.13.13"
7-
lazy val scalaVersion3 = "3.3.3"
8-
lazy val scalaVersions = List(scalaVersion212, scalaVersion213, scalaVersion3)
4+
lazy val scalaVersion3 = "3.3.4"
5+
lazy val scalaVersions = List(scalaVersion3)
96

107
inThisBuild(
118
Seq(
12-
scalaVersion := scalaVersion213,
9+
scalaVersion := scalaVersion3,
1310
organization := "com.github.cb372",
1411
licenses := Seq(
1512
"Apache License, Version 2.0" -> url(
@@ -29,75 +26,53 @@ inThisBuild(
2926
name = "Luka Jacobowitz",
3027
email = "[email protected]",
3128
url = url("https://github.com/LukaJCB")
29+
),
30+
Developer(
31+
id = "AlejandroBudy",
32+
name = "Alejandro Torres",
33+
email = "[email protected]",
34+
url = url("https://github.com/AlejandroBudy")
35+
),
36+
Developer(
37+
id = "ccantarero91",
38+
name = "Cristian Cantarero Dávila",
39+
email = "[email protected]",
40+
url = url("https://github.com/ccantarero91")
3241
)
3342
),
3443
mimaPreviousArtifacts := Set.empty,
35-
scalafmtOnCompile := true
44+
scalafmtOnCompile := false
3645
)
3746
)
3847

39-
val catsVersion = "2.10.0"
40-
val catsEffectVersion = "3.5.4"
41-
val catsMtlVersion = "1.4.0"
42-
val scalatestVersion = "3.2.18"
43-
val scalaTestPlusVersion = "3.2.18.0"
44-
val scalacheckVersion = "1.17.0"
45-
val disciplineVersion = "2.2.0"
48+
val catsVersion = "2.12.0"
49+
val catsEffectVersion = "3.5.7"
50+
val catsMtlVersion = "1.5.0"
51+
val munitVersion = "1.0.0"
52+
val munitCatsEffectVersion = "2.0.0"
53+
val disciplineVersion = "2.0.0"
54+
val scalacheckEffectVersion = "1.0.4"
4655

4756
val core = crossProject(JVMPlatform, JSPlatform)
4857
.in(file("modules/core"))
4958
.settings(
5059
name := "cats-retry",
5160
crossScalaVersions := scalaVersions,
5261
libraryDependencies ++= Seq(
53-
"org.typelevel" %%% "cats-core" % catsVersion,
54-
"org.typelevel" %%% "cats-effect" % catsEffectVersion,
55-
"org.scalatest" %%% "scalatest" % scalatestVersion % Test,
56-
"org.scalacheck" %%% "scalacheck" % scalacheckVersion % Test,
57-
"org.typelevel" %%% "cats-laws" % catsVersion % Test,
58-
"org.scalatestplus" %%% "scalacheck-1-17" % scalaTestPlusVersion % Test,
59-
"org.typelevel" %%% "discipline-scalatest" % disciplineVersion % Test
60-
),
61-
mimaPreviousArtifacts := Set(
62-
"com.github.cb372" %%% "cats-retry" % "3.1.0"
62+
"org.typelevel" %%% "cats-core" % catsVersion,
63+
"org.typelevel" %%% "cats-effect" % catsEffectVersion,
64+
"org.scalameta" %%% "munit-scalacheck" % munitVersion % Test,
65+
"org.typelevel" %%% "munit-cats-effect" % munitCatsEffectVersion % Test,
66+
"org.typelevel" %%% "scalacheck-effect" % scalacheckEffectVersion % Test,
67+
"org.typelevel" %%% "cats-laws" % catsVersion % Test,
68+
"org.typelevel" %%% "discipline-munit" % disciplineVersion % Test
6369
),
64-
tpolecatExcludeOptions += ScalacOptions.lintPackageObjectClasses,
70+
mimaPreviousArtifacts := Set.empty,
6571
Test / tpolecatExcludeOptions += ScalacOptions.warnNonUnitStatement
6672
)
67-
.jsSettings(
68-
// work around https://github.com/typelevel/sbt-tpolecat/issues/102
69-
tpolecatScalacOptions +=
70-
ScalacOptions.other("-scalajs", sv => sv.major == 3L)
71-
)
7273
val coreJVM = core.jvm
7374
val coreJS = core.js
7475

75-
val alleycatsRetry = crossProject(JVMPlatform, JSPlatform)
76-
.in(file("modules/alleycats"))
77-
.jvmConfigure(_.dependsOn(coreJVM))
78-
.jsConfigure(_.dependsOn(coreJS))
79-
.settings(
80-
name := "alleycats-retry",
81-
crossScalaVersions := scalaVersions,
82-
libraryDependencies ++= Seq(
83-
"org.scalatest" %%% "scalatest" % scalatestVersion % Test,
84-
"org.scalacheck" %%% "scalacheck" % scalacheckVersion % Test,
85-
"org.typelevel" %%% "cats-laws" % catsVersion % Test,
86-
"org.scalatestplus" %%% "scalacheck-1-17" % scalaTestPlusVersion % Test,
87-
"org.typelevel" %%% "discipline-scalatest" % disciplineVersion % Test
88-
),
89-
mimaPreviousArtifacts := Set(
90-
"com.github.cb372" %%% "alleycats-retry" % "3.1.0"
91-
),
92-
Test / tpolecatExcludeOptions += ScalacOptions.warnNonUnitStatement
93-
)
94-
.jsSettings(
95-
tpolecatScalacOptions += ScalacOptions
96-
.other("-scalajs", sv => sv.major == 3L)
97-
)
98-
val alleycatsJVM = alleycatsRetry.jvm
99-
val alleycatsJS = alleycatsRetry.js
100-
10176
val mtlRetry = crossProject(JVMPlatform, JSPlatform)
10277
.in(file("modules/mtl"))
10378
.jvmConfigure(_.dependsOn(coreJVM))
@@ -106,30 +81,23 @@ val mtlRetry = crossProject(JVMPlatform, JSPlatform)
10681
name := "cats-retry-mtl",
10782
crossScalaVersions := scalaVersions,
10883
libraryDependencies ++= Seq(
109-
"org.typelevel" %%% "cats-mtl" % catsMtlVersion,
110-
"org.scalatest" %%% "scalatest" % scalatestVersion % Test
111-
),
112-
mimaPreviousArtifacts := Set(
113-
"com.github.cb372" %%% "cats-retry-mtl" % "3.1.0"
84+
"org.typelevel" %%% "cats-mtl" % catsMtlVersion,
85+
"org.typelevel" %%% "munit-cats-effect" % munitCatsEffectVersion % Test,
86+
"org.scalameta" %%% "munit-scalacheck" % munitVersion % Test
11487
),
115-
tpolecatExcludeOptions += ScalacOptions.lintPackageObjectClasses,
88+
mimaPreviousArtifacts := Set.empty,
11689
Test / tpolecatExcludeOptions += ScalacOptions.warnNonUnitStatement
11790
)
118-
.jsSettings(
119-
// work around https://github.com/typelevel/sbt-tpolecat/issues/102
120-
tpolecatScalacOptions +=
121-
ScalacOptions.other("-scalajs", sv => sv.major == 3L)
122-
)
12391
val mtlJVM = mtlRetry.jvm
12492
val mtlJS = mtlRetry.js
12593

12694
val docs = project
12795
.in(file("modules/docs"))
128-
.dependsOn(coreJVM, alleycatsJVM, mtlJVM)
96+
.dependsOn(coreJVM, mtlJVM)
12997
.enablePlugins(MicrositesPlugin, BuildInfoPlugin)
13098
.settings(
131-
addCompilerPlugin(
132-
"org.typelevel" %% "kind-projector" % "0.13.3" cross CrossVersion.full
99+
libraryDependencies ++= Seq(
100+
"software.amazon.awssdk" % "dynamodb" % "2.29.43"
133101
),
134102
tpolecatExcludeOptions ++= ScalacOptions.warnUnusedOptions,
135103
tpolecatExcludeOptions += ScalacOptions.warnNonUnitStatement,
@@ -158,8 +126,6 @@ val root = project
158126
.aggregate(
159127
coreJVM,
160128
coreJS,
161-
alleycatsJVM,
162-
alleycatsJS,
163129
mtlJVM,
164130
mtlJS,
165131
docs

‎modules/alleycats/jvm/src/main/scala/retry/alleycats/instances.scala

-39
This file was deleted.

‎modules/alleycats/jvm/src/test/scala/retry/alleycats/PackageObjectLazinessSpec.scala

-59
This file was deleted.

‎modules/alleycats/shared/src/main/scala/retry/alleycats/syntax.scala

-18
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,17 @@
11
package retry
22

3-
object Fibonacci {
4-
def fibonacci(n: Int): Long = {
5-
if (n > 0)
6-
fib(n)._1
7-
else
8-
0
9-
}
3+
object Fibonacci:
4+
def fibonacci(n: Int): Long =
5+
if n > 0 then fib(n)._1
6+
else 0
107

118
// "Fast doubling" Fibonacci algorithm.
129
// See e.g. http://funloop.org/post/2017-04-14-computing-fibonacci-numbers.html for explanation.
13-
private def fib(n: Int): (Long, Long) = n match {
10+
private def fib(n: Int): (Long, Long) = n match
1411
case 0 => (0, 1)
1512
case m =>
1613
val (a, b) = fib(m / 2)
1714
val c = a * (b * 2 - a)
1815
val d = a * a + b * b
19-
if (n % 2 == 0)
20-
(c, d)
21-
else
22-
(d, c + d)
23-
}
24-
}
16+
if n % 2 == 0 then (c, d)
17+
else (d, c + d)

0 commit comments

Comments
 (0)