From 6278bc77887df73ef0fbb9fb79a1cc9c4ca574d1 Mon Sep 17 00:00:00 2001 From: Thijs Broersen Date: Sun, 3 Nov 2024 20:14:35 +0100 Subject: [PATCH] unusedCompileDependenciesFilter scala-js and scala-native --- project/build.properties | 2 +- project/plugins.sbt | 2 +- zio-sbt-ecosystem/build.sbt | 4 +- .../scala/zio/sbt/ScalaCompilerSettings.scala | 12 +++--- .../zio/sbt/githubactionsnative/model.scala | 40 +++++++++---------- 5 files changed, 29 insertions(+), 31 deletions(-) diff --git a/project/build.properties b/project/build.properties index 23f7d979..1767a6f8 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version = 1.10.2 +sbt.version = 1.10.5 diff --git a/project/plugins.sbt b/project/plugins.sbt index 0a36f4da..d417a058 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -8,7 +8,7 @@ addSbtPlugin("com.github.cb372" % "sbt-explicit-dependencies" % "0.3.1") // Versioning and Release Plugins addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.12.0") -addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.5.12") +addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.9.0") // Docs Plugins addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.6.1") diff --git a/zio-sbt-ecosystem/build.sbt b/zio-sbt-ecosystem/build.sbt index e02830c9..969d1f84 100644 --- a/zio-sbt-ecosystem/build.sbt +++ b/zio-sbt-ecosystem/build.sbt @@ -8,7 +8,7 @@ addSbtPlugin("com.github.cb372" % "sbt-explicit-dependencies" % "0.3.1") // Versioning and Release Plugins addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.12.0") -addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.5.12") +addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.9.0") // Docs Plugins addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.6.1") @@ -16,6 +16,6 @@ addSbtPlugin("com.github.sbt" % "sbt-unidoc" % "0.5.0") addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.10.0") // Binary Compatibility Plugin -addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "1.1.3") +addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "1.1.4") libraryDependencies += "dev.zio" %% "zio" % "2.1.11" diff --git a/zio-sbt-ecosystem/src/main/scala/zio/sbt/ScalaCompilerSettings.scala b/zio-sbt-ecosystem/src/main/scala/zio/sbt/ScalaCompilerSettings.scala index 90f8a335..9cecb95a 100644 --- a/zio-sbt-ecosystem/src/main/scala/zio/sbt/ScalaCompilerSettings.scala +++ b/zio-sbt-ecosystem/src/main/scala/zio/sbt/ScalaCompilerSettings.scala @@ -211,11 +211,7 @@ trait ScalaCompilerSettings { }, Test / parallelExecution := scalaBinaryVersion.value != "3", // why not parallel execution for Scala 3? incOptions ~= (_.withLogRecompileOnMacro(false)), - autoAPIMappings := true, - unusedCompileDependenciesFilter -= moduleFilter( - "org.scala-js", - "scalajs-library" - ) // why does it need to be filtered out? + autoAPIMappings := true ) ++ (if (enableCrossProject) crossProjectSettings else Seq.empty) ++ { packageName match { case Some(name) => buildInfoSettings(name) @@ -294,7 +290,8 @@ trait ScalaCompilerSettings { .requireJS( false ) - .value + .value, + unusedCompileDependenciesFilter -= moduleFilter("org.scala-js") ) def jvmSettings: Seq[Setting[_]] = Seq( @@ -312,7 +309,8 @@ trait ScalaCompilerSettings { ) .value, doc / skip := BuildAssertions.requireNative(true).value, - Compile / doc / sources := BuildAssertions.requireNative(Seq.empty).value + Compile / doc / sources := BuildAssertions.requireNative(Seq.empty).value, + unusedCompileDependenciesFilter -= moduleFilter("org.scala-native") // Test / test := { val _ = (Test / compile).value; () } // ?? ) diff --git a/zio-sbt-githubactions/src/main/scala/zio/sbt/githubactionsnative/model.scala b/zio-sbt-githubactions/src/main/scala/zio/sbt/githubactionsnative/model.scala index ff84a810..48ebba09 100644 --- a/zio-sbt-githubactions/src/main/scala/zio/sbt/githubactionsnative/model.scala +++ b/zio-sbt-githubactions/src/main/scala/zio/sbt/githubactionsnative/model.scala @@ -41,7 +41,7 @@ object Branch { case object All extends Branch case class Named(name: String) extends Branch - implicit val codec: JsonCodec[Branch] = JsonCodec.string.transform( + implicit lazy val codec: JsonCodec[Branch] = JsonCodec.string.transform( { case "*" => All case name => Named(name) @@ -64,7 +64,7 @@ case class Triggers( object Triggers { - implicit val codec: JsonCodec[Triggers] = DeriveJsonCodec.gen[Triggers] + implicit lazy val codec: JsonCodec[Triggers] = DeriveJsonCodec.gen[Triggers] } sealed trait Trigger @@ -72,7 +72,7 @@ sealed trait Trigger object Trigger { case class InputValue(description: String, required: Boolean, default: String) object InputValue { - implicit val jsonCodec: JsonCodec[InputValue] = DeriveJsonCodec.gen[InputValue] + implicit lazy val jsonCodec: JsonCodec[InputValue] = DeriveJsonCodec.gen[InputValue] } case class WorkflowDispatch( @@ -86,7 +86,7 @@ object Trigger { JsonDecoder.keyValueChunk[K, V].map(c => ListMap(c: _*)) ) - implicit val jsonCodec: JsonCodec[WorkflowDispatch] = DeriveJsonCodec.gen[WorkflowDispatch] + implicit lazy val jsonCodec: JsonCodec[WorkflowDispatch] = DeriveJsonCodec.gen[WorkflowDispatch] } case class Release( @@ -94,7 +94,7 @@ object Trigger { ) extends Trigger object Release { - implicit val jsonCodec: JsonCodec[Release] = DeriveJsonCodec.gen[Release] + implicit lazy val jsonCodec: JsonCodec[Release] = DeriveJsonCodec.gen[Release] } sealed trait ReleaseType @@ -103,7 +103,7 @@ object Trigger { case object Published extends ReleaseType case object Prereleased extends ReleaseType - implicit val codec: JsonCodec[ReleaseType] = JsonCodec.string.transformOrFail( + implicit lazy val codec: JsonCodec[ReleaseType] = JsonCodec.string.transformOrFail( { case "created" => Right(Created) case "published" => Right(Published) @@ -127,7 +127,7 @@ object Trigger { ) extends Trigger object PullRequest { - implicit val jsonCodec: JsonCodec[PullRequest] = DeriveJsonCodec.gen[PullRequest] + implicit lazy val jsonCodec: JsonCodec[PullRequest] = DeriveJsonCodec.gen[PullRequest] } case class Push( @@ -136,7 +136,7 @@ object Trigger { ) extends Trigger object Push { - implicit val jsonCodec: JsonCodec[Push] = DeriveJsonCodec.gen[Push] + implicit lazy val jsonCodec: JsonCodec[Push] = DeriveJsonCodec.gen[Push] } case class Create( @@ -145,7 +145,7 @@ object Trigger { ) extends Trigger object Create { - implicit val jsonCodec: JsonCodec[Create] = DeriveJsonCodec.gen[Create] + implicit lazy val jsonCodec: JsonCodec[Create] = DeriveJsonCodec.gen[Create] } } @@ -155,12 +155,12 @@ case class Strategy(matrix: ListMap[String, List[String]], maxParallel: Option[I object Strategy { import Workflow.listMapCodec - implicit val codec: JsonCodec[Strategy] = DeriveJsonCodec.gen[Strategy] + implicit lazy val codec: JsonCodec[Strategy] = DeriveJsonCodec.gen[Strategy] } case class ActionRef(ref: String) object ActionRef { - implicit val codec: JsonCodec[ActionRef] = JsonCodec.string.transform(ActionRef(_), _.ref) + implicit lazy val codec: JsonCodec[ActionRef] = JsonCodec.string.transform(ActionRef(_), _.ref) } sealed trait Condition { @@ -191,7 +191,7 @@ object Condition { } object Expression { - implicit val codec: JsonCodec[Expression] = JsonCodec.string.transform(Expression(_), _.asString) + implicit lazy val codec: JsonCodec[Expression] = JsonCodec.string.transform(Expression(_), _.asString) } case class Function(expression: String) extends Condition { @@ -205,10 +205,10 @@ object Condition { } object Function { - implicit val codec: JsonCodec[Function] = JsonCodec.string.transform(Function(_), _.expression) + implicit lazy val codec: JsonCodec[Function] = JsonCodec.string.transform(Function(_), _.expression) } - implicit val codec: JsonCodec[Condition] = JsonCodec.string.transform( + implicit lazy val codec: JsonCodec[Condition] = JsonCodec.string.transform( { case expression if expression.startsWith("${{") => Expression(expression) case expression => Function(expression) @@ -251,17 +251,17 @@ object Step { steps.flatMap(_.flatten) } - implicit val codec: JsonCodec[Step] = DeriveJsonCodec.gen[Step] + implicit lazy val codec: JsonCodec[Step] = DeriveJsonCodec.gen[Step] } case class ImageRef(ref: String) object ImageRef { - implicit val codec: JsonCodec[ImageRef] = JsonCodec.string.transform(ImageRef(_), _.ref) + implicit lazy val codec: JsonCodec[ImageRef] = JsonCodec.string.transform(ImageRef(_), _.ref) } case class ServicePort(inner: Int, outer: Int) object ServicePort { - implicit val codec: JsonCodec[ServicePort] = JsonCodec.string.transformOrFail( + implicit lazy val codec: JsonCodec[ServicePort] = JsonCodec.string.transformOrFail( v => Try(v.split(":", 2).map(_.toInt).toList) match { case Success(inner :: outer :: Nil) => Right(ServicePort(inner.toInt, outer.toInt)) @@ -279,7 +279,7 @@ case class Service( ports: Option[Seq[ServicePort]] = None ) object Service { - implicit val codec: JsonCodec[Service] = DeriveJsonCodec.gen[Service] + implicit lazy val codec: JsonCodec[Service] = DeriveJsonCodec.gen[Service] } @jsonMemberNames(KebabCase) @@ -340,7 +340,7 @@ case class Concurrency( ) object Concurrency { - implicit val codec: JsonCodec[Concurrency] = DeriveJsonCodec.gen[Concurrency] + implicit lazy val codec: JsonCodec[Concurrency] = DeriveJsonCodec.gen[Concurrency] } case class Workflow( @@ -372,5 +372,5 @@ object Workflow { JsonEncoder.keyValueIterable[K, V, ListMap], JsonDecoder.keyValueChunk[K, V].map(c => ListMap(c: _*)) ) - implicit val codec: JsonCodec[Workflow] = DeriveJsonCodec.gen[Workflow] + implicit lazy val codec: JsonCodec[Workflow] = DeriveJsonCodec.gen[Workflow] }