Skip to content

Commit 130405d

Browse files
authored
Merge pull request #440 from tpolecat/royal-sampler
royal sampler of build updates
2 parents dd5b5ed + 4e63390 commit 130405d

File tree

12 files changed

+79
-55
lines changed

12 files changed

+79
-55
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
- name: Start up Postgres instances
1919
run: docker-compose up -d
2020
- name: Compile (All) and Test/Coverage (Scala 2 Only)
21-
run: csbt headerCheck +clean coverage test docs/makeSite coverageReport coverageOff +test
21+
run: sbt headerCheck +clean coverage test docs/makeSite coverageReport coverageOff +test
2222
- name: Shut down Postgres instances
2323
run: docker-compose down
2424
- name: Upload code coverage data

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
- uses: olafurpg/setup-scala@v10
1212
- uses: olafurpg/setup-gpg@v3
1313
- name: Publish
14-
run: csbt ci-release
14+
run: sbt ci-release
1515
env:
1616
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
1717
PGP_SECRET: ${{ secrets.PGP_SECRET }}

build.sbt

Lines changed: 47 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
// Our Scala versions.
44
lazy val `scala-2.12` = "2.12.13"
55
lazy val `scala-2.13` = "2.13.5"
6-
lazy val `scala-3.0-prev` = "3.0.0-RC1"
7-
lazy val `scala-3.0-curr` = "3.0.0-RC2"
6+
lazy val `scala-3.0-prev` = "3.0.0-RC2"
7+
lazy val `scala-3.0-curr` = "3.0.0-RC3"
88

99
// This is used in a couple places
10-
lazy val fs2Version = "2.5.4"
10+
lazy val fs2Version = "2.5.5"
1111

1212
// Global Settings
1313
lazy val commonSettings = Seq(
@@ -38,25 +38,25 @@ lazy val commonSettings = Seq(
3838
scalaVersion := `scala-2.13`,
3939
crossScalaVersions := Seq(`scala-2.12`, `scala-2.13`, `scala-3.0-prev`, `scala-3.0-curr`),
4040
scalacOptions -= "-language:experimental.macros", // doesn't work cross-version
41-
Compile / doc / scalacOptions --= Seq("-Xfatal-warnings"),
42-
Compile / doc / scalacOptions ++= Seq(
41+
Compile / doc / scalacOptions --= Seq("-Xfatal-warnings"),
42+
Compile / doc / scalacOptions ++= Seq(
4343
"-groups",
44-
"-sourcepath", (baseDirectory in LocalRootProject).value.getAbsolutePath,
44+
"-sourcepath", (LocalRootProject / baseDirectory).value.getAbsolutePath,
4545
"-doc-source-url", "https://github.com/tpolecat/skunk/blob/v" + version.value + "€{FILE_PATH}.scala",
4646
),
4747
libraryDependencies ++= Seq(
4848
compilerPlugin("org.typelevel" %% "kind-projector" % "0.11.3" cross CrossVersion.full),
49-
).filterNot(_ => isDotty.value),
49+
).filterNot(_ => scalaVersion.value.startsWith("3.")),
5050

5151
// Coverage Exclusions
5252
coverageExcludedPackages := "ffstest.*;tests.*;example.*;natchez.http4s.*",
5353

5454
// uncomment in case of emergency
55-
// scalacOptions ++= { if (isDotty.value) Seq("-source:3.0-migration") else Nil },
55+
// scalacOptions ++= { if (scalaVersion.value.startsWith("3.")) Seq("-source:3.0-migration") else Nil },
5656

5757
// Add some more source directories
58-
unmanagedSourceDirectories in Compile ++= {
59-
val sourceDir = (sourceDirectory in Compile).value
58+
Compile / unmanagedSourceDirectories ++= {
59+
val sourceDir = (Compile / sourceDirectory).value
6060
CrossVersion.partialVersion(scalaVersion.value) match {
6161
case Some((3, _)) => Seq(sourceDir / "scala-3", sourceDir / "scala-2.13+")
6262
case Some((2, 12)) => Seq(sourceDir / "scala-2")
@@ -66,8 +66,8 @@ lazy val commonSettings = Seq(
6666
},
6767

6868
// Also for test
69-
unmanagedSourceDirectories in Test ++= {
70-
val sourceDir = (sourceDirectory in Test).value
69+
Test / unmanagedSourceDirectories ++= {
70+
val sourceDir = (Test / sourceDirectory).value
7171
CrossVersion.partialVersion(scalaVersion.value) match {
7272
case Some((3, _)) => Seq(sourceDir / "scala-3")
7373
case Some((2, _)) => Seq(sourceDir / "scala-2")
@@ -78,7 +78,7 @@ lazy val commonSettings = Seq(
7878
// dottydoc really doesn't work at all right now
7979
Compile / doc / sources := {
8080
val old = (Compile / doc / sources).value
81-
if (isDotty.value)
81+
if (scalaVersion.value.startsWith("3."))
8282
Seq()
8383
else
8484
old
@@ -103,20 +103,19 @@ lazy val core = project
103103
description := "Tagless, non-blocking data access library for Postgres.",
104104
resolvers += "Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots",
105105
libraryDependencies ++= Seq(
106-
"org.typelevel" %% "cats-core" % "2.5.0",
107-
"org.typelevel" %% "cats-effect" % "2.4.1",
108-
"co.fs2" %% "fs2-core" % fs2Version,
109-
"co.fs2" %% "fs2-io" % fs2Version,
110-
"org.scodec" %% "scodec-core" % (if (isDotty.value) "2.0.0-RC2" else "1.11.7"),
111-
"org.scodec" %% "scodec-cats" % "1.1.0-RC2",
112-
"org.tpolecat" %% "natchez-core" % "0.0.22",
113-
"org.tpolecat" %% "sourcepos" % "0.1.2",
114-
"com.ongres.scram" % "client" % "2.1",
106+
"org.typelevel" %% "cats-core" % "2.6.0",
107+
"org.typelevel" %% "cats-effect" % "2.5.0",
108+
"co.fs2" %% "fs2-core" % fs2Version,
109+
"co.fs2" %% "fs2-io" % fs2Version,
110+
"org.scodec" %% "scodec-core" % (if (scalaVersion.value.startsWith("3.")) "2.0.0-RC3" else "1.11.7"),
111+
"org.scodec" %% "scodec-cats" % "1.1.0-RC3",
112+
"org.tpolecat" %% "natchez-core" % "0.0.24",
113+
"org.tpolecat" %% "sourcepos" % "0.1.3",
114+
"com.ongres.scram" % "client" % "2.1",
115+
"org.scala-lang.modules" %% "scala-collection-compat" % "2.4.3",
115116
) ++ Seq(
116117
"com.beachape" %% "enumeratum" % "1.6.1",
117-
).map(_.withDottyCompat(scalaVersion.value)) ++ Seq(
118-
"org.scala-lang.modules" %% "scala-collection-compat" % "2.4.3",
119-
)
118+
).filterNot(_ => scalaVersion.value.startsWith("3."))
120119
)
121120

122121
lazy val refined = project
@@ -127,7 +126,7 @@ lazy val refined = project
127126
.settings(
128127
libraryDependencies ++= Seq(
129128
"eu.timepit" %% "refined" % "0.9.24",
130-
).map(_.withDottyCompat(scalaVersion.value))
129+
)
131130
)
132131

133132
lazy val circe = project
@@ -137,10 +136,18 @@ lazy val circe = project
137136
.settings(commonSettings)
138137
.settings(
139138
name := "skunk-circe",
140-
libraryDependencies ++= Seq(
141-
"io.circe" %% "circe-core" % "0.13.0",
142-
"io.circe" %% "circe-parser" % "0.13.0"
143-
).filterNot(_ => isDotty.value)
139+
libraryDependencies ++= {
140+
lazy val circeVersion: String =
141+
scalaVersion.value match {
142+
case `scala-3.0-curr` => "0.14.0-M6"
143+
case `scala-3.0-prev` => "0.14.0-M5"
144+
case _ => "0.13.0"
145+
}
146+
Seq(
147+
"io.circe" %% "circe-core" % circeVersion,
148+
"io.circe" %% "circe-parser" % circeVersion
149+
)
150+
}
144151
)
145152

146153
lazy val tests = project
@@ -152,14 +159,14 @@ lazy val tests = project
152159
publish / skip := true,
153160
scalacOptions -= "-Xfatal-warnings",
154161
libraryDependencies ++= Seq(
155-
"org.typelevel" %% "scalacheck-effect-munit" % "1.0.0",
156-
"org.typelevel" %% "munit-cats-effect-2" % "1.0.1",
157-
"org.typelevel" %% "cats-free" % "2.5.0",
158-
"org.typelevel" %% "cats-laws" % "2.5.0",
159-
"org.typelevel" %% "discipline-munit" % "1.0.7",
162+
"org.typelevel" %% "scalacheck-effect-munit" % "1.0.1",
163+
"org.typelevel" %% "munit-cats-effect-2" % "1.0.2",
164+
"org.typelevel" %% "cats-free" % "2.6.0",
165+
"org.typelevel" %% "cats-laws" % "2.6.0",
166+
"org.typelevel" %% "discipline-munit" % "1.0.8",
160167
) ++ Seq(
161168
"io.chrisdavenport" %% "cats-time" % "0.3.4",
162-
).filterNot(_ => isDotty.value),
169+
).filterNot(_ => scalaVersion.value.startsWith("3.")),
163170
testFrameworks += new TestFramework("munit.Framework")
164171
)
165172

@@ -171,14 +178,14 @@ lazy val example = project
171178
.settings(
172179
publish / skip := true,
173180
libraryDependencies ++= Seq(
174-
"org.tpolecat" %% "natchez-honeycomb" % "0.0.22",
175-
"org.tpolecat" %% "natchez-jaeger" % "0.0.22",
181+
"org.tpolecat" %% "natchez-honeycomb" % "0.0.24",
182+
"org.tpolecat" %% "natchez-jaeger" % "0.0.24",
176183
) ++ Seq(
177184
"org.http4s" %% "http4s-dsl" % "0.21.22",
178185
"org.http4s" %% "http4s-blaze-server" % "0.21.22",
179186
"org.http4s" %% "http4s-circe" % "0.21.22",
180187
"io.circe" %% "circe-generic" % "0.13.0",
181-
).filterNot(_ => isDotty.value)
188+
).filterNot(_ => scalaVersion.value.startsWith("3."))
182189
)
183190

184191
lazy val docs = project
@@ -198,7 +205,7 @@ lazy val docs = project
198205
paradoxTheme := Some(builtinParadoxTheme("generic")),
199206
version := version.value.takeWhile(_ != '+'), // strip off the +3-f22dca22+20191110-1520-SNAPSHOT business
200207
paradoxProperties ++= Map(
201-
"scala-versions" -> (crossScalaVersions in core).value.map(CrossVersion.partialVersion).flatten.map(_._2).mkString("2.", "/", ""),
208+
"scala-versions" -> (core / crossScalaVersions).value.map(CrossVersion.partialVersion).flatten.map(_._2).mkString("2.", "/", ""),
202209
"org" -> organization.value,
203210
"scala.binary.version" -> s"2.${CrossVersion.partialVersion(scalaVersion.value).get._2}",
204211
"core-dep" -> s"${(core / name).value}_2.${CrossVersion.partialVersion(scalaVersion.value).get._2}",
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Copyright (c) 2018-2021 by Rob Norris
2+
// This software is licensed under the MIT License (MIT).
3+
// For more information see LICENSE or https://opensource.org/licenses/MIT
4+
5+
package skunk
6+
package codec
7+
8+
import enumeratum.{ Enum, EnumEntry }
9+
import skunk.data.Type
10+
11+
trait EnumCodecPlatform {
12+
13+
def `enum`[A <: EnumEntry](`enum`: Enum[A], tpe: Type): Codec[A] =
14+
Codec.simple[A](
15+
a => a.entryName,
16+
s => `enum`.withNameOption(s).toRight(s"${`enum`}: no such element '$s'"),
17+
tpe
18+
)
19+
20+
}

modules/core/src/main/scala-3/SqlState.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
package skunk
66

77
import scala.collection.immutable.IndexedSeq
8-
import enumeratum.{ EnumEntry, Enum }
98
import skunk.exception.PostgresErrorException
109

1110
/**
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// Copyright (c) 2018-2021 by Rob Norris
2+
// This software is licensed under the MIT License (MIT).
3+
// For more information see LICENSE or https://opensource.org/licenses/MIT
4+
5+
package skunk
6+
package codec
7+
8+
trait EnumCodecPlatform

modules/core/src/main/scala-3/syntax/StringContextOps.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ package syntax
88
import cats.data.State
99
import cats.syntax.all._
1010
import scala.language.implicitConversions
11-
import scala.reflect.macros.whitebox
1211
import scala.quoted._
1312
import skunk.data.Identifier
1413
import skunk.util.Origin

modules/core/src/main/scala/codec/EnumCodec.scala

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,13 @@
55
package skunk
66
package codec
77

8-
import enumeratum.{ Enum, EnumEntry }
98
import skunk.data.Type
109

11-
trait EnumCodec {
10+
trait EnumCodec extends EnumCodecPlatform {
1211

1312
def `enum`[A](encode: A => String, decode: String => Option[A], tpe: Type): Codec[A] =
1413
Codec.simple[A](encode, s => decode(s).toRight(s"${tpe.name}: no such element '$s'"), tpe)
1514

16-
def `enum`[A <: EnumEntry](`enum`: Enum[A], tpe: Type): Codec[A] =
17-
Codec.simple[A](
18-
a => a.entryName,
19-
s => `enum`.withNameOption(s).toRight(s"${`enum`}: no such element '$s'"),
20-
tpe
21-
)
22-
2315
}
2416

2517
object `enum` extends EnumCodec

0 commit comments

Comments
 (0)