Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
luksow committed Sep 26, 2024
2 parents 41e2b9d + d0a5dcf commit 8496f57
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 59 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
scala: [2.13.14, 3.3.3]
scala: [2.13.15, 3.3.3]
java: [temurin@17]
runs-on: ${{ matrix.os }}
steps:
Expand Down
87 changes: 49 additions & 38 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import sbt.librarymanagement.ConflictWarning

val scala_2_13 = "2.13.14"
val scala_2_13 = "2.13.15"
val scala_3 = "3.3.3"
val mainScalaVersion = scala_3
val supportedScalaVersions = Seq(scala_2_13, scala_3)
Expand Down Expand Up @@ -94,27 +94,28 @@ def paradiseFlag(scalaVersion: String): Seq[String] =
else
Seq("-Ymacro-annotations")

val scalaTest = Def.setting("org.scalatest" %%% "scalatest" % "3.2.19")
val scalaCheck = Def.setting("org.scalacheck" %%% "scalacheck" % "1.18.0")
val slick = "com.typesafe.slick" %% "slick" % "3.5.1"
val scalaTest = Def.setting("org.scalatest" %%% "scalatest" % "3.2.19")
val scalaCheck = Def.setting("org.scalacheck" %%% "scalacheck" % "1.18.1")

val slick = "com.typesafe.slick" %% "slick" % "3.5.1"
val optionalSlick = optional(slick)
val playJson = Def.setting("org.playframework" %%% "play-json" % "3.0.4")
val slickPg = "com.github.tminglei" %% "slick-pg" % "0.22.2"
val doobie = "org.tpolecat" %% "doobie-core" % "1.0.0-RC5"
val doobiePg = "org.tpolecat" %% "doobie-postgres" % "1.0.0-RC5"
val sprayJson = "io.spray" %% "spray-json" % "1.3.6"
val playJson = Def.setting("org.playframework" %%% "play-json" % "3.0.4")
val slickPg = "com.github.tminglei" %% "slick-pg" % "0.22.2"
val doobie = "org.tpolecat" %% "doobie-core" % "1.0.0-RC6"
val doobiePg = "org.tpolecat" %% "doobie-postgres" % "1.0.0-RC6"
val sprayJson = "io.spray" %% "spray-json" % "1.3.6"
val circeV = "0.14.10"
val circe = Def.setting("io.circe" %%% "circe-core" % circeV)
val circeAuto = Def.setting("io.circe" %%% "circe-generic" % circeV)
val circeAutoExtras = Def.setting("io.circe" %%% "circe-generic-extras" % "0.14.4")
val circeParser = Def.setting("io.circe" %%% "circe-parser" % circeV)
val circe = Def.setting("io.circe" %%% "circe-core" % circeV)
val circeAuto = Def.setting("io.circe" %%% "circe-generic" % circeV)
val circeAutoExtras = Def.setting("io.circe" %%% "circe-generic-extras" % "0.14.4")
val circeParser = Def.setting("io.circe" %%% "circe-parser" % circeV)

val jsonschema = "com.github.andyglow" %% "scala-jsonschema" % "0.7.11"

val scalacheck = "org.scalacheck" %% "scalacheck" % "1.18.0"
val scalacheck = "org.scalacheck" %% "scalacheck" % "1.18.1"

val scalacheckMagnolify = "com.spotify" % "magnolify-scalacheck" % "0.7.4"
val scalacheckDerived = "io.github.martinhh" %% "scalacheck-derived" % "0.4.2"
val scalacheckMagnolify = "com.spotify" % "magnolify-scalacheck" % "0.7.4"
val scalacheckDerived = "io.github.martinhh" %% "scalacheck-derived" % "0.4.2"

val enumeratumVersion = "1.7.4"
val enumeratumPlayJsonVersion = "1.8.1"
Expand All @@ -124,7 +125,7 @@ def enumeratumInExamples = {
Seq("com.beachape" %% "enumeratum" % enumeratumVersion, playJsonSupport)
}
val optionalEnumeratum = Def.setting("com.beachape" %%% "enumeratum" % enumeratumVersion % "provided")
val enumeratumInTest = Def.setting("com.beachape" %%% "enumeratum" % enumeratumVersion % "test")
val enumeratumInTest = Def.setting("com.beachape" %%% "enumeratum" % enumeratumVersion % "test")

val akkaVersion = "2.6.20"
val akkaHttpVersion = "10.2.10"
Expand All @@ -141,7 +142,7 @@ def akkaHttpInExamples = {
)
}

val pekkoVersion = "1.1.0"
val pekkoVersion = "1.1.1"
val pekkoHttpVersion = "1.0.1"
val pekkoHttpJsonV = "2.0.0"
val pekkoStream = "org.apache.pekko" %% "pekko-stream" % pekkoVersion
Expand All @@ -158,12 +159,12 @@ val http4sVersion = "0.23.28"
val http4s = Def.setting("org.http4s" %%% "http4s-dsl" % http4sVersion)

val http4sStirVersion = "0.3"
val http4sStir = Def.setting("pl.iterators" %%% "http4s-stir" % http4sStirVersion)
val http4sStir = Def.setting("pl.iterators" %%% "http4s-stir" % http4sStirVersion)
val http4sStirTestkit = Def.setting("pl.iterators" %%% "http4s-stir-testkit" % http4sStirVersion)

val pureConfigVersion = "0.17.7"
val pureConfig = "com.github.pureconfig" %% "pureconfig-core" % pureConfigVersion
val pureConfigGeneric = "com.github.pureconfig" %% "pureconfig-generic" % pureConfigVersion
val pureConfigVersion = "0.17.7"
val pureConfig = "com.github.pureconfig" %% "pureconfig-core" % pureConfigVersion
val pureConfigGeneric = "com.github.pureconfig" %% "pureconfig-generic" % pureConfigVersion
val pureConfigGenericScala3 = "com.github.pureconfig" %% "pureconfig-generic-scala3" % pureConfigVersion

val scalaJavaTime = Def.setting("io.github.cquiroz" %%% "scala-java-time" % "2.6.0")
Expand All @@ -179,13 +180,13 @@ lazy val commonSettings = baseSettings ++ Seq(

lazy val slickSettings = commonSettings ++ Seq(
libraryDependencies += slick,
libraryDependencies += (slickPg % "test"),
libraryDependencies += (slickPg % "test"),
libraryDependencies += (enumeratumInTest.value)
)

lazy val doobieSettings = commonSettings ++ Seq(
libraryDependencies += doobie,
libraryDependencies += (doobiePg % "test"),
libraryDependencies += (doobiePg % "test"),
libraryDependencies += (enumeratumInTest.value)
)

Expand All @@ -195,13 +196,13 @@ lazy val coreSettings = commonMacroSettings ++ Seq(

lazy val enumSettings = commonMacroSettings ++ Seq(
libraryDependencies += scalaCheck.value % "test",
libraryDependencies += scalaTest.value % "test",
libraryDependencies += scalaTest.value % "test",
scalacOptions ++= paradiseFlag(scalaVersion.value)
)

lazy val enumeratumSettings = commonMacroSettings ++ Seq(
libraryDependencies += scalaCheck.value % "test",
libraryDependencies += scalaTest.value % "test",
libraryDependencies += scalaTest.value % "test",
libraryDependencies += optionalEnumeratum.value,
scalacOptions ++= paradiseFlag(scalaVersion.value)
)
Expand Down Expand Up @@ -262,7 +263,7 @@ lazy val jsonschemaSettings = commonSettings ++ Seq(

lazy val scalacheckSettings = commonSettings ++ Seq(
libraryDependencies += scalacheck,
libraryDependencies += (enumeratumInTest.value),
libraryDependencies += (enumeratumInTest.value)
) ++ Seq(
libraryDependencies ++= (if (scalaVersion.value.startsWith("3")) Seq(scalacheckDerived)
else Seq(scalacheckMagnolify.cross(CrossVersion.for3Use2_13)))
Expand Down Expand Up @@ -292,7 +293,7 @@ lazy val instancesSettings = commonSettings

lazy val pureConfigSettings = commonSettings ++ Seq(
libraryDependencies += pureConfig,
libraryDependencies += (if (scalaVersion.value.startsWith("3")) pureConfigGenericScala3 else pureConfigGeneric) % "test",
libraryDependencies += (if (scalaVersion.value.startsWith("3")) pureConfigGenericScala3 else pureConfigGeneric) % "test"
)

lazy val core = crossProject(JSPlatform, NativePlatform, JVMPlatform)
Expand Down Expand Up @@ -392,7 +393,7 @@ lazy val pekkoHttpSupport = project
enumeratumSupport.jvm,
enumSupport.jvm,
instances.jvm % "test -> test",
tagged.jvm % "test -> test",
tagged.jvm % "test -> test",
taggedMeta.jvm % "test -> test"
)
.settings(pekkoHttpSettings *)
Expand Down Expand Up @@ -422,7 +423,15 @@ lazy val http4sStirSupport = crossProject(JSPlatform, JVMPlatform)
.withoutSuffixFor(JVMPlatform)
.crossType(CrossType.Full)
.in(file("http4s-stir"))
.dependsOn(core, instances, enumSupport % "test -> test", circeSupport % "test -> test", opaque % "test -> test", tagged % "test -> test", taggedMeta % "test -> test")
.dependsOn(
core,
instances,
enumSupport % "test -> test",
circeSupport % "test -> test",
opaque % "test -> test",
tagged % "test -> test",
taggedMeta % "test -> test"
)
.settings(http4sStirSettings *)
.settings(publishSettings *)
.settings(
Expand Down Expand Up @@ -494,12 +503,14 @@ lazy val taggedMeta = crossProject(JSPlatform, NativePlatform, JVMPlatform)
core,
tagged
)
.jvmConfigure(_.dependsOn(
sprayJsonSupport % "test -> test",
circeSupport.jvm % "test -> test",
jsonschemaSupport % "test -> test",
scalacheckSupport % "test -> test"
))
.jvmConfigure(
_.dependsOn(
sprayJsonSupport % "test -> test",
circeSupport.jvm % "test -> test",
jsonschemaSupport % "test -> test",
scalacheckSupport % "test -> test"
)
)
.settings(taggedMetaSettings *)
.settings(publishSettings *)
.settings(disableScala(List("3")))
Expand Down Expand Up @@ -570,9 +581,9 @@ lazy val pureConfigSupport = project
.settings(pureConfigSettings *)
.settings(publishSettings *)
.settings(
name := "pureconfig",
name := "pureconfig",
moduleName := "kebs-pureconfig"
)
)

lazy val kebs = project
.in(file("."))
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.10.1
sbt.version = 1.10.2
2 changes: 1 addition & 1 deletion project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.6.1")
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.3.2")
addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.3.2")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.16.0")
addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.5.4")
addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.5.5")
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package pl.iterators.kebs.scalacheck

import org.scalacheck.Arbitrary
import org.scalacheck.rng.Seed
import org.scalacheck.{Arbitrary, Gen}

trait Generator[T] {
def ArbT: Arbitrary[T]

def generate: T = ArbT.arbitrary.sample.get
def generate: T = ArbT.arbitrary.pureApply(Gen.Parameters.default, Seed.random())
}

trait AllGenerators[T] {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package pl.iterators.kebs.scalacheck

import org.scalacheck.Arbitrary
import org.scalatest.funsuite.AnyFunSuite
import org.scalatest.matchers.should.Matchers

Expand Down Expand Up @@ -52,24 +51,9 @@ class GeneratorsTests extends AnyFunSuite with Matchers {
maximal.optionOfNumber shouldNot be(empty)
maximal.mapOfNumberString shouldNot be(empty)
}

test("Non standard types sample test") {
import KebsProtocolWithFancyPredefs._

noException should be thrownBy allGenerators[NonStandardTypesSample].normal.generate
}

test("Issue 309") {
import KebsProtocol._
import model._

given Arbitrary[WrappedInt] = Arbitrary {
WrappedInt(42)
}

val generator = allGenerators[BasicSample]
val basicSample = generator.normal.generate

basicSample.wrappedNumber shouldBe WrappedInt(42)
}
}

0 comments on commit 8496f57

Please sign in to comment.