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 scalacheck-1-14 to 3.2.11.0 #649

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
42 changes: 22 additions & 20 deletions project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,13 @@ import org.scalajs.sbtplugin.ScalaJSPlugin.autoImport._
import scalajsbundler.sbtplugin.ScalaJSBundlerPlugin
import scalajsbundler.sbtplugin.ScalaJSBundlerPlugin.autoImport._


object dependencies {

lazy val copyFastOptJS =
TaskKey[Unit]("copyFastOptJS", "Copy javascript files to target directory")

lazy val copyFastOptJS = TaskKey[Unit]("copyFastOptJS", "Copy javascript files to target directory")

val withTests : String = "compile->compile;test->test"
val inTestOnly : String = "test->test"
val withTests: String = "compile->compile;test->test"
val inTestOnly: String = "test->test"

val scala212 = "2.12.12"
val scala213 = "2.13.3"
Expand All @@ -23,7 +22,7 @@ object dependencies {
lazy val JvmTest = config("jvm").extend(Test)

val addResolvers = Seq(
Resolver.sonatypeRepo("public")
Resolver.sonatypeRepo("public"),
)

object versions {
Expand All @@ -50,25 +49,28 @@ object dependencies {
val scalajs = "1.0.0"
val scalaJavaTime = "2.0.0"
val scalaTest = "3.2.3"
val scalaTestPlusScalacheck = "3.2.2.0"
val scalaTestPlusScalacheck = "3.2.11.0"
val simulacrum = "1.0.0"
val tsec = "0.2.1-ct-2"
}

def compilerPlugins = Seq(
compilerPlugin("com.olegpy" %% "better-monadic-for" % versions.betterMonadicFor)
compilerPlugin("com.olegpy" %% "better-monadic-for" % versions.betterMonadicFor),
)

def compilerPluginsForVersion(version: String) =
CrossVersion.partialVersion(version) match {
case Some((2, major)) if major < 13 =>
compilerPlugins ++ Seq(
compilerPlugin("org.scalamacros" % "paradise" % versions.macroParadise cross CrossVersion.full),
compilerPlugin("org.typelevel" %% "kind-projector" % versions.kindProjector212)
compilerPlugin(
("org.scalamacros" % "paradise" % versions.macroParadise).cross(CrossVersion.full),
),
compilerPlugin("org.typelevel" %% "kind-projector" % versions.kindProjector212),
)
case Some((2, major)) if major == 13 =>
compilerPlugins ++ Seq(
compilerPlugin("org.typelevel" % s"kind-projector_$version" % versions.kindProjector213),
)
case Some((2, major)) if major == 13 => compilerPlugins ++ Seq(
compilerPlugin("org.typelevel" % s"kind-projector_$version" % versions.kindProjector213)
)
case _ => compilerPlugins
}

Expand All @@ -77,12 +79,12 @@ object dependencies {
"http4s-blaze-server",
"http4s-blaze-client",
"http4s-circe",
"http4s-dsl"
"http4s-dsl",
).map("org.http4s" %% _ % versions.http4s)

val testDeps = Seq(
"org.scalatest" %% "scalatest" % versions.scalaTest,
"org.scalatestplus" %% "scalacheck-1-14" % versions.scalaTestPlusScalacheck,
"org.scalatestplus" %% "scalacheck-1-15" % versions.scalaTestPlusScalacheck,
"org.tpolecat" %% "doobie-scalatest" % versions.doobie,
"org.scalacheck" %% "scalacheck" % versions.scalaCheck,
"com.clovellytech" %% "cats-scalacheck" % versions.catsScalacheck,
Expand All @@ -92,11 +94,11 @@ object dependencies {

val dbDeps = Seq(
"org.flywaydb" % "flyway-core" % versions.flyway,
"org.postgresql" % "postgresql" % versions.postgres
"org.postgresql" % "postgresql" % versions.postgres,
) ++ Seq(
"doobie-core",
"doobie-postgres",
"doobie-hikari"
"doobie-hikari",
).map("org.tpolecat" %% _ % versions.doobie)

val commonDeps = Seq(
Expand All @@ -105,7 +107,7 @@ object dependencies {
"cats-mtl-core" -> versions.catsMtl,
).map(("org.typelevel" %% (_: String) % (_: String)).tupled) ++ Seq(
"org.apache.commons" % "commons-lang3" % versions.apacheLang3,
"ch.qos.logback" % "logback-classic" % versions.logback,
"ch.qos.logback" % "logback-classic" % versions.logback,
"org.codehaus.janino" % "janino" % versions.janino,
"org.typelevel" %% "simulacrum" % versions.simulacrum,
) ++ Seq(
Expand All @@ -114,7 +116,7 @@ object dependencies {
"circe-parser",
// "circe-java8"
).map("io.circe" %% _ % versions.circe) ++ Seq(
"io.circe" %% "circe-config" % versions.circeConfig
"io.circe" %% "circe-config" % versions.circeConfig,
)

val authDeps = Seq(
Expand All @@ -126,6 +128,6 @@ object dependencies {
"tsec-hash-jca",
"tsec-jwt-mac",
"tsec-jwt-sig",
"tsec-http4s"
"tsec-http4s",
).map("com.clovellytech" %% _ % versions.tsec)
}
140 changes: 73 additions & 67 deletions project/ProjectImplicits.scala
Original file line number Diff line number Diff line change
Expand Up @@ -16,87 +16,93 @@ import sbtcrossproject.CrossPlugin.autoImport._
object ProjectImplicits {

implicit class CommonSettings(val p: CrossProject) extends AnyVal {
def commonSettingsNoResource(): CrossProject = {
def commonSettingsNoResource(): CrossProject =
p.settings(
crossScalaVersions := Seq(scala212, scala213),
organization := "com.clovellytech",
resolvers ++= addResolvers,
// Make sure every subproject is using a logging configuration and conf file
scalacOptions ++= options.scalacExtraOptionsForVersion(scalaVersion.value),
libraryDependencies ++= compilerPluginsForVersion(scalaVersion.value),
crossScalaVersions := Seq(scala212, scala213),
organization := "com.clovellytech",
resolvers ++= addResolvers,
// Make sure every subproject is using a logging configuration and conf file
scalacOptions ++= options.scalacExtraOptionsForVersion(scalaVersion.value),
libraryDependencies ++= compilerPluginsForVersion(scalaVersion.value),
)
}

def commonSettings(): CrossProject = {
def commonSettings(): CrossProject =
commonSettingsNoResource()
.settings(
Seq(
Compile / unmanagedResourceDirectories ++= Seq((ThisBuild / baseDirectory).value / "shared/src/main/resources"),
Test / unmanagedResourceDirectories ++= Seq((ThisBuild / baseDirectory).value / "shared/src/test/resources"),
.settings(
Seq(
Compile / unmanagedResourceDirectories ++= Seq(
(ThisBuild / baseDirectory).value / "shared/src/main/resources",
),
Test / unmanagedResourceDirectories ++= Seq(
(ThisBuild / baseDirectory).value / "shared/src/test/resources",
),
),
)
)
}
}


implicit class AddDependenciesOps(val p: CrossProject.Builder) extends AnyVal {
def addScalaTest(): CrossProject = {
def addScalaTest(): CrossProject =
p
.jsConfigure(
_.settings(
libraryDependencies ++= Seq(
"org.scalatest" %%% "scalatest" % versions.scalaTest % "test",
"org.scalatestplus" %%% "scalacheck-1-14" % versions.scalaTestPlusScalacheck % "test",
"com.clovellytech" %%% "cats-scalacheck" % versions.catsScalacheck,
)
.jsConfigure(
_.settings(
libraryDependencies ++= Seq(
"org.scalatest" %%% "scalatest" % versions.scalaTest % "test",
"org.scalatestplus" %%% "scalacheck-1-15" % versions.scalaTestPlusScalacheck % "test",
"com.clovellytech" %%% "cats-scalacheck" % versions.catsScalacheck,
),
),
)
)
.jvmConfigure(
_.settings(
libraryDependencies ++= testDepsInTestOnly
.jvmConfigure(
_.settings(
libraryDependencies ++= testDepsInTestOnly,
),
)
)
}
}


implicit class ConfigureJSProjectOps(val p: CrossProject.Builder) extends AnyVal {
def configureJsProject(id: String): CrossProject = {
def configureJsProject(id: String): CrossProject =
p
.configs(JsTest)
.enablePlugins(ScalaJSPlugin)
.enablePlugins(ScalaJSBundlerPlugin)
.settings(
libraryDependencies ++= Seq(
"org.scalatest" %%% "scalatest" % versions.scalaTest % "test",
"org.scalatestplus" %%% "scalacheck-1-14" % versions.scalaTestPlusScalacheck % "test",
"com.clovellytech" %%% "cats-scalacheck" % versions.catsScalacheck,
),
useYarn := true, // makes scalajs-bundler use yarn instead of npm
requireJsDomEnv in Test := true,
scalaJSUseMainModuleInitializer := true,
// configure Scala.js to emit a JavaScript module instead of a top-level script
scalaJSLinkerConfig ~= (_.withModuleKind(ModuleKind.CommonJSModule)),
// https://scalacenter.github.io/scalajs-bundler/cookbook.html#performance
webpackBundlingMode in fastOptJS := BundlingMode.LibraryOnly(),
copyFastOptJS := {
val inDir = (crossTarget in (Compile, fastOptJS)).value
val outDir = (baseDirectory in (Compile, fastOptJS)).value / ".." / "static/public" / id
val fileNames = Seq(
s"${name.value}-fastopt-loader.js",
s"${name.value}-fastopt-library.js",
s"${name.value}-fastopt-library.js.map",
s"${name.value}-fastopt.js",
s"${name.value}-fastopt.js.map",
)
val copies = fileNames.map(p => (inDir / p, outDir / p))
IO.copy(copies, overwrite = true, preserveLastModified = true, preserveExecutable = true)
},
// hot reloading configuration:
// https://github.com/scalacenter/scalajs-bundler/issues/180
addCommandAlias("dev", "; compile; fastOptJS::startWebpackDevServer; devwatch; fastOptJS::stopWebpackDevServer"),
addCommandAlias("devwatch", "~; compile; fastOptJS; copyFastOptJS"),
)
}
.configs(JsTest)
.enablePlugins(ScalaJSPlugin)
.enablePlugins(ScalaJSBundlerPlugin)
.settings(
libraryDependencies ++= Seq(
"org.scalatest" %%% "scalatest" % versions.scalaTest % "test",
"org.scalatestplus" %%% "scalacheck-1-15" % versions.scalaTestPlusScalacheck % "test",
"com.clovellytech" %%% "cats-scalacheck" % versions.catsScalacheck,
),
useYarn := true, // makes scalajs-bundler use yarn instead of npm
requireJsDomEnv in Test := true,
scalaJSUseMainModuleInitializer := true,
// configure Scala.js to emit a JavaScript module instead of a top-level script
scalaJSLinkerConfig ~= (_.withModuleKind(ModuleKind.CommonJSModule)),
// https://scalacenter.github.io/scalajs-bundler/cookbook.html#performance
webpackBundlingMode in fastOptJS := BundlingMode.LibraryOnly(),
copyFastOptJS := {
val inDir = (crossTarget in (Compile, fastOptJS)).value
val outDir = (baseDirectory in (Compile, fastOptJS)).value / ".." / "static/public" / id
val fileNames = Seq(
s"${name.value}-fastopt-loader.js",
s"${name.value}-fastopt-library.js",
s"${name.value}-fastopt-library.js.map",
s"${name.value}-fastopt.js",
s"${name.value}-fastopt.js.map",
)
val copies = fileNames.map(p => (inDir / p, outDir / p))
IO.copy(
copies,
overwrite = true,
preserveLastModified = true,
preserveExecutable = true,
)
},
// hot reloading configuration:
// https://github.com/scalacenter/scalajs-bundler/issues/180
addCommandAlias(
"dev",
"; compile; fastOptJS::startWebpackDevServer; devwatch; fastOptJS::stopWebpackDevServer",
),
addCommandAlias("devwatch", "~; compile; fastOptJS; copyFastOptJS"),
)
}
}