Skip to content

Commit

Permalink
Fix scalacheck for Scala 3
Browse files Browse the repository at this point in the history
  • Loading branch information
cchantep committed Sep 6, 2022
1 parent 9dc1974 commit defd7f6
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 8 deletions.
25 changes: 21 additions & 4 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ def theScalacheckVersion(scalaVersion: String) =
def scalaTestPlay(scalaVersion: String) = CrossVersion.partialVersion(scalaVersion) match {
case Some((2, scalaMajor)) if scalaMajor >= 12 =>
"org.scalatestplus.play" %% "scalatestplus-play" % "5.0.0" % Test

case _ =>
throw new IllegalArgumentException(s"Unsupported Scala version $scalaVersion for play-test")
}
Expand Down Expand Up @@ -494,8 +495,20 @@ lazy val enumeratumScalacheck = crossProject(JSPlatform, JVMPlatform)
Seq(
"org.scalacheck" %%% "scalacheck" % theScalacheckVersion(scalaVersion.value),
"org.scalatestplus" %%% "scalacheck-1-14" % "3.1.1.1" % Test
).map(
_.exclude("org.scala-lang.modules", "*")
.exclude("org.scalatest", "*")
.cross(CrossVersion.for3Use2_13)
)
},
libraryDependencies += {
val ver: String = {
if (scalaBinaryVersion.value == "2.11") "1.3.0"
else "2.1.0"
}

"org.scala-lang.modules" %% "scala-xml" % ver % Test
},
libraryDependencies ++= {
if (useLocalVersion) {
Seq.empty
Expand Down Expand Up @@ -766,7 +779,13 @@ lazy val publishSettings = Seq(
val testSettings = {
Seq(
libraryDependencies += {
"org.scalatest" %%% "scalatest" % scalaTestVersion % Test
val dep = "org.scalatest" %%% "scalatest" % scalaTestVersion % Test

if (scalaBinaryVersion.value == "3") {
dep.exclude("org.scala-lang.modules", "*")
} else {
dep
}
},
doctestGenTests := {
val originalValue = doctestGenTests.value
Expand All @@ -779,9 +798,7 @@ val testSettings = {
val jsTestSettings = {
Seq(
coverageEnabled := false, // Disable until Scala.js 1.0 support is there https://github.com/scoverage/scalac-scoverage-plugin/pull/287
doctestGenTests := {
Seq.empty
}
doctestGenTests := Seq.empty
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import org.scalacheck.{Arbitrary, Gen}
trait ArbitraryInstances {

implicit def arbEnumEntry[EnumType <: EnumEntry](implicit
enum: Enum[EnumType]
): Arbitrary[EnumType] = Arbitrary(Gen.oneOf(enum.values))
myEnum: Enum[EnumType]
): Arbitrary[EnumType] = Arbitrary(Gen.oneOf(myEnum.values))

}
5 changes: 3 additions & 2 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ resolvers ++= Seq(
)

addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.6")
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.8.2")
addSbtPlugin("org.scoverage" % "sbt-coveralls" % "1.2.7")
addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "1.0.0")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.6.0")
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.1.0")
addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.4.3")
addSbtPlugin("com.github.tkawachi" % "sbt-doctest" % "0.9.9")
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.1.2")
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.9.0")

addSbtPlugin(("org.scoverage" % "sbt-scoverage" % "2.0.2").exclude("org.scala-lang.modules", "*"))
addSbtPlugin("org.scoverage" % "sbt-coveralls" % "1.3.2")

0 comments on commit defd7f6

Please sign in to comment.