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

Cross-publish fix. kebs-opaque only as test-dependency for kebs-doobie #281

Merged
merged 2 commits into from
May 26, 2023
Merged
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
41 changes: 20 additions & 21 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -56,32 +56,33 @@ lazy val noPublishSettings =
publishArtifact := false,
)

def disableScala(v: String) = Def.settings(
def disableScala(v: List[String]) =
Def.settings(
libraryDependencies := {
if (scalaBinaryVersion.value == v) {
if (v.contains(scalaBinaryVersion.value)) {
Nil
} else {
libraryDependencies.value
}
},
Seq(Compile, Test).map { x =>
(x / sources) := {
if (scalaBinaryVersion.value == v) {
if (v.contains(scalaBinaryVersion.value)) {
Nil
} else {
(x / sources).value
}
}
},
Test / test := {
if (scalaBinaryVersion.value == v) {
if (v.contains(scalaBinaryVersion.value)) {
()
} else {
(Test / test).value
}
},
publish / skip := (scalaBinaryVersion.value == v)
)
publish / skip := (v.contains(scalaBinaryVersion.value)))


def optional(dependency: ModuleID) = dependency % "provided"
def sv[A](scalaVersion: String, scala2_12Version: => A, scala2_13Version: => A) =
Expand Down Expand Up @@ -288,7 +289,7 @@ lazy val slickSupport = project
.dependsOn(core.jvm, instances % "test -> test")
.settings(slickSettings: _*)
.settings(publishSettings: _*)
.settings(disableScala("3"))
.settings(disableScala(List("3")))
.settings(
name := "slick",
description := "Library to eliminate the boilerplate code that comes with the use of Slick",
Expand All @@ -298,7 +299,7 @@ lazy val slickSupport = project

lazy val doobieSupport = project
.in(file("doobie"))
.dependsOn(instances, opaque.jvm)
.dependsOn(instances, opaque.jvm % "test -> test")
.settings(doobieSettings: _*)
.settings(publishSettings: _*)
.settings(
Expand All @@ -313,7 +314,7 @@ lazy val sprayJsonMacros = project
.dependsOn(core.jvm)
.settings(sprayJsonMacroSettings: _*)
.settings(publishSettings: _*)
.settings(disableScala("3"))
.settings(disableScala(List("3")))
.settings(
name := "spray-json-macros",
description := "Automatic generation of Spray json formats for case-classes - macros",
Expand All @@ -326,7 +327,7 @@ lazy val sprayJsonSupport = project
.dependsOn(sprayJsonMacros, instances % "test -> test")
.settings(sprayJsonSettings: _*)
.settings(publishSettings: _*)
.settings(disableScala("3"))
.settings(disableScala(List("3")))
.settings(
name := "spray-json",
description := "Automatic generation of Spray json formats for case-classes",
Expand All @@ -339,7 +340,7 @@ lazy val playJsonSupport = project
.dependsOn(core.jvm, instances % "test -> test")
.settings(playJsonSettings: _*)
.settings(publishSettings: _*)
.settings(disableScala("3"))
.settings(disableScala(List("3")))
.settings(
name := "play-json",
description := "Automatic generation of Play json formats for case-classes",
Expand All @@ -364,7 +365,7 @@ lazy val akkaHttpSupport = project
.dependsOn(core.jvm, instances % "test -> test", tagged.jvm % "test -> test", taggedMeta % "test -> test")
.settings(akkaHttpSettings: _*)
.settings(publishSettings: _*)
.settings(disableScala("3"))
.settings(disableScala(List("3")))
.settings(
name := "akka-http",
description := "Automatic generation of akka-http deserializers for 1-element case classes",
Expand All @@ -389,7 +390,7 @@ lazy val jsonschemaSupport = project
.dependsOn(core.jvm)
.settings(jsonschemaSettings: _*)
.settings(publishSettings: _*)
.settings(disableScala("3"))
.settings(disableScala(List("3")))
.settings(
name := "jsonschema",
description := "Automatic generation of JSON Schemas for case classes",
Expand All @@ -402,7 +403,7 @@ lazy val scalacheckSupport = project
.dependsOn(core.jvm)
.settings(scalacheckSettings: _*)
.settings(publishSettings: _*)
.settings(disableScala("3"))
.settings(disableScala(List("3")))
.settings(
name := "scalacheck",
description := "Automatic generation of scalacheck generators for case classes",
Expand All @@ -417,7 +418,7 @@ lazy val tagged = crossProject(JSPlatform, JVMPlatform)
.dependsOn(core)
.settings(taggedSettings: _*)
.settings(publishSettings: _*)
.settings(disableScala("3"))
.settings(disableScala(List("3")))
.settings(
name := "tagged",
description := "Representation of tagged types",
Expand All @@ -431,16 +432,14 @@ lazy val opaque = crossProject(JSPlatform, JVMPlatform)
.in(file("opaque"))
.dependsOn(core)
.settings(opaqueSettings: _*)
.settings(disableScala("2.13"))
.settings(disableScala("2.12"))
.settings(publishSettings: _*)
.settings(
name := "opaque",
description := "Representation of opaque types",
moduleName := "kebs-opaque",
crossScalaVersions := supportedScalaVersions,
publish / skip := (scalaBinaryVersion.value == "2.13")
crossScalaVersions := supportedScalaVersions
)
.settings(disableScala(List("2.12", "2.13")))

lazy val taggedMeta = project
.in(file("tagged-meta"))
Expand All @@ -454,7 +453,7 @@ lazy val taggedMeta = project
)
.settings(taggedMetaSettings: _*)
.settings(publishSettings: _*)
.settings(disableScala("3"))
.settings(disableScala(List("3")))
.settings(
name := "tagged-meta",
description := "Representation of tagged types - code generation based on scala-meta",
Expand All @@ -467,7 +466,7 @@ lazy val examples = project
.dependsOn(slickSupport, sprayJsonSupport, playJsonSupport, akkaHttpSupport, taggedMeta, circeSupport, instances)
.settings(examplesSettings: _*)
.settings(noPublishSettings: _*)
.settings(disableScala("3"))
.settings(disableScala(List("3")))
.settings(
name := "examples",
moduleName := "kebs-examples"
Expand Down