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

Add sbt-explicit-dependencies and sbt-missinglink plugins #825

Merged
merged 6 commits into from
Apr 24, 2024
Merged
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
6 changes: 6 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ jobs:
run: sbt +publishLocal
- name: Mima check
run: sbt mimaChecks
- name: Undeclared dependencies check
run: sbt undeclaredCompileDependencies
- name: Unused dependencies check
run: sbt unusedCompileDependenciesTest
- name: MissingLink
run: sbt missinglinkCheck
- name: Check website build process
run: sbt docs/clean; sbt docs/buildWebsite
lint:
Expand Down
20 changes: 19 additions & 1 deletion build.sbt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import MimaSettings.mimaSettings
import ch.epfl.scala.sbtmissinglink.MissingLinkPlugin.missinglinkConflictsTag
import zio.sbt.githubactions.Step.SingleStep

enablePlugins(ZioSbtEcosystemPlugin, ZioSbtCiPlugin)
Expand Down Expand Up @@ -35,6 +36,18 @@ inThisBuild(
SingleStep(
name = "Mima check",
run = Some("sbt mimaChecks")
),
SingleStep(
name = "Undeclared dependencies check",
run = Some("sbt undeclaredCompileDependencies")
),
SingleStep(
name = "Unused dependencies check",
run = Some("sbt unusedCompileDependenciesTest")
),
SingleStep(
name = "MissingLink",
run = Some("sbt missinglinkCheck")
)
),
pgpPassphrase := sys.env.get("PGP_PASSWORD").map(_.toArray),
Expand All @@ -45,7 +58,8 @@ inThisBuild(
url("https://github.com/zio/zio-telemetry/"),
"scm:git:[email protected]:zio/zio-telemetry.git"
)
)
),
concurrentRestrictions += Tags.limit(missinglinkConflictsTag, 1)
)
)

Expand Down Expand Up @@ -103,6 +117,7 @@ lazy val opentracing =
)
.settings(libraryDependencies ++= Dependencies.opentracing)
.settings(mimaSettings(failOnProblem = true))
.settings(unusedCompileDependenciesFilter -= moduleFilter("org.scala-lang.modules", "scala-collection-compat"))

lazy val opentelemetry =
project
Expand All @@ -116,6 +131,7 @@ lazy val opentelemetry =
)
.settings(libraryDependencies ++= Dependencies.opentelemetry)
.settings(mimaSettings(failOnProblem = true))
.settings(unusedCompileDependenciesFilter -= moduleFilter("org.scala-lang.modules", "scala-collection-compat"))

lazy val opencensus = project
.in(file("opencensus"))
Expand All @@ -128,6 +144,7 @@ lazy val opencensus = project
)
.settings(libraryDependencies ++= Dependencies.opencensus)
.settings(mimaSettings(failOnProblem = true))
.settings(unusedCompileDependenciesFilter -= moduleFilter("io.opencensus", "opencensus-impl"))

lazy val opentracingExample =
project
Expand Down Expand Up @@ -180,5 +197,6 @@ lazy val docs =
ScalaUnidoc / unidoc / unidocProjectFilter := inProjects(opentracing, opentelemetry, opencensus),
scalacOptions --= Seq("-Yno-imports", "-Xfatal-warnings")
)
.settings(unusedCompileDependenciesFilter -= moduleFilter("org.scalameta", "mdoc"))
.dependsOn(opentracing, opentelemetry, opencensus)
.enablePlugins(WebsitePlugin)
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ object TracingTest extends ZIOSpecDefault {
} yield assert(root)(isSome(anything)) &&
assert(child)(
isSome(
hasField[SpanData, SpanId](
hasField[SpanData, Either[String, SpanId]](
"parentSpanId",
_.getParentSpanId,
equalTo(root.get.getContext.getSpanId)
spanData => Option(spanData.getParentSpanId).toRight("Span is root"),
equalTo(root.map(_.getContext.getSpanId).toRight("Not found spanId"))
)
)
)
Expand Down
14 changes: 8 additions & 6 deletions project/Dependencies.scala
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import sbt._
import sbt.*

object Dependencies {

Expand All @@ -8,6 +8,7 @@ object Dependencies {
val opencensus = "0.31.1"
val scalaCollectionCompat = "2.12.0"
val zio = "2.0.22"
val izumiReflect = "2.3.8"
}

object Orgs {
Expand Down Expand Up @@ -41,7 +42,9 @@ object Dependencies {
}

lazy val zio = Seq(
Orgs.zio %% "zio" % Versions.zio
Orgs.zio %% "zio" % Versions.zio,
Orgs.zio %% "izumi-reflect" % Versions.izumiReflect,
Orgs.zio %% "zio-stacktracer" % Versions.zio
)

lazy val opentracing = zio ++ Seq(
Expand All @@ -59,10 +62,9 @@ object Dependencies {
)

lazy val opencensus = zio ++ Seq(
Orgs.opencensus % "opencensus-api" % Versions.opencensus,
Orgs.opencensus % "opencensus-impl" % Versions.opencensus,
Orgs.opencensus % "opencensus-contrib-http-util" % Versions.opencensus,
Orgs.scalaLangModules %% "scala-collection-compat" % Versions.scalaCollectionCompat % Test
Orgs.opencensus % "opencensus-api" % Versions.opencensus,
Orgs.opencensus % "opencensus-impl" % Versions.opencensus,
Orgs.scalaLangModules %% "scala-collection-compat" % Versions.scalaCollectionCompat % Test
)

lazy val example = zio ++ Seq(
Expand Down
25 changes: 14 additions & 11 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
val zioSbtVersion = "0.4.0-alpha.25"

addSbtPlugin("com.thoughtworks.sbt-api-mappings" % "sbt-api-mappings" % "3.0.2")
addSbtPlugin("com.github.sbt" % "sbt-unidoc" % "0.5.0")
addSbtPlugin("ch.epfl.scala" % "sbt-bloop" % "1.5.17")
addSbtPlugin("org.typelevel" % "sbt-tpolecat" % "0.5.1")
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.2")
addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.5.2")
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "2.0.11")
addSbtPlugin("dev.zio" % "zio-sbt-ci" % zioSbtVersion)
addSbtPlugin("dev.zio" % "zio-sbt-ecosystem" % zioSbtVersion)
addSbtPlugin("dev.zio" % "zio-sbt-website" % zioSbtVersion)
addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "1.1.3")
addSbtPlugin("com.thoughtworks.sbt-api-mappings" % "sbt-api-mappings" % "3.0.2")
addSbtPlugin("com.github.sbt" % "sbt-unidoc" % "0.5.0")
addSbtPlugin("ch.epfl.scala" % "sbt-bloop" % "1.5.17")
addSbtPlugin("org.typelevel" % "sbt-tpolecat" % "0.5.1")
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.2")
addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.5.2")
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "2.0.11")
addSbtPlugin("dev.zio" % "zio-sbt-ci" % zioSbtVersion)
addSbtPlugin("dev.zio" % "zio-sbt-ecosystem" % zioSbtVersion)
addSbtPlugin("dev.zio" % "zio-sbt-website" % zioSbtVersion)
addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "1.1.3")
addSbtPlugin("com.github.cb372" % "sbt-explicit-dependencies" % "0.3.1")
addSbtPlugin("ch.epfl.scala" % "sbt-missinglink" % "0.3.6")

libraryDependencies += "org.snakeyaml" % "snakeyaml-engine" % "2.7"
libraryDependencies += "com.spotify" % "missinglink-core" % "0.2.11"

resolvers += Resolver.sonatypeRepo("public")