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

fix: explicitly define transitive dependencies that were unresolvable #790

Merged
merged 10 commits into from
Nov 16, 2023
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
9 changes: 6 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ jobs:
GITHUB_ACTOR: ${{ secrets.ATALA_GITHUB_ACTOR }}
GITHUB_TOKEN: ${{ secrets.ATALA_GITHUB_TOKEN }}
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
# New JDK version makes 'localhost' lookup on linux return ipv6.
# Our test containers are on ipv4. We need to make 'localhost' resolve to ipv4.
JAVA_TOOL_OPTIONS: -Djava.net.preferIPv4Stack=true
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand All @@ -31,17 +34,17 @@ jobs:
ref: ${{ github.event.inputs.release-branch }}
fetch-depth: 0
- name: Setup Java and Scala
uses: olafurpg/setup-scala@v13
uses: olafurpg/setup-scala@v14
with:
java-version: openjdk@1.11
java-version: openjdk@1.17
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: "lts/*"
- name: Setup Helm
uses: azure/setup-helm@v3
with:
version: '3.12.2' # default is latest (stable)
version: "3.12.2" # default is latest (stable)
id: install
- name: Setup yq - portable yaml processor
uses: mikefarah/[email protected]
Expand Down
80 changes: 62 additions & 18 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ lazy val V = new {
val typesafeConfig = "1.4.2"
val protobuf = "3.1.9"
val testContainersScala = "0.41.0"
val testContainersJavaKeycloak = "3.0.0"
val testContainersJavaKeycloak = "3.0.0" // scala-steward:off

val doobie = "1.0.0-RC2"
val quill = "4.7.3"
Expand All @@ -85,7 +85,7 @@ lazy val V = new {
val micrometer = "1.11.2"

val nimbusJwt = "10.0.0"
val keycloak = "22.0.4"
val keycloak = "22.0.4" // scala-steward:off
}

/** Dependencies */
Expand Down Expand Up @@ -125,10 +125,12 @@ lazy val D = new {
val scalaPbRuntime: ModuleID =
"com.thesamet.scalapb" %% "scalapb-runtime" % scalapb.compiler.Version.scalapbVersion % "protobuf"
val scalaPbGrpc: ModuleID = "com.thesamet.scalapb" %% "scalapb-runtime-grpc" % scalapb.compiler.Version.scalapbVersion
// TODO we are adding test stuff to the main dependencies
val testcontainersPostgres: ModuleID = "com.dimafeng" %% "testcontainers-scala-postgresql" % V.testContainersScala
val testcontainersVault: ModuleID = "com.dimafeng" %% "testcontainers-scala-vault" % V.testContainersScala
val testcontainersKeycloak: ModuleID = "com.github.dasniko" % "testcontainers-keycloak" % V.testContainersJavaKeycloak

val testcontainersPostgres: ModuleID =
"com.dimafeng" %% "testcontainers-scala-postgresql" % V.testContainersScala % Test
val testcontainersVault: ModuleID = "com.dimafeng" %% "testcontainers-scala-vault" % V.testContainersScala % Test
val testcontainersKeycloak: ModuleID =
"com.github.dasniko" % "testcontainers-keycloak" % V.testContainersJavaKeycloak % Test exclude ("org.keycloak", "keycloak-admin-client")

val doobiePostgres: ModuleID = "org.tpolecat" %% "doobie-postgres" % V.doobie
val doobieHikari: ModuleID = "org.tpolecat" %% "doobie-hikari" % V.doobie
Expand All @@ -155,9 +157,6 @@ lazy val D_Shared = new {
Seq(
D.typesafeConfig,
D.scalaPbGrpc,
D.testcontainersPostgres,
D.testcontainersVault,
D.testcontainersKeycloak,
D.zio,
// FIXME: split shared DB stuff as subproject?
D.doobieHikari,
Expand All @@ -167,15 +166,60 @@ lazy val D_Shared = new {
}

lazy val D_SharedTest = new {
lazy val dependencies: Seq[ModuleID] =
// https://github.com/sbt/sbt-license-report/issues/87
// https://stackoverflow.com/questions/48771768/sbt-error-importing-resteasy-client
//
// 'sbt-license' plugin is using ivy to resolve dependencies where other tasks are using coursier.
// 'org.jboss.resteasy:resteasy-*' which is the transitive dependencies of 'keycloak-admin-client'
// has this issue where 'relativePath' is used in the 'parent' section.
// - https://github.com/resteasy/resteasy/blob/6.2.4.Final/resteasy-client-api/pom.xml#L9
// - https://www.scala-sbt.org/1.x/docs/Library-Management.html#Known+limitations
//
// This workaround provides those dependencies explicitly, but it will be a nightmare to maintain.
// for version reference: https://github.com/resteasy/resteasy/blob/6.2.4.Final/resteasy-dependencies-bom/pom.xml
// FIXME: solve this with a long-term solution
lazy val keycloakAdminExplicitDependencies: Seq[ModuleID] =
patlo-iog marked this conversation as resolved.
Show resolved Hide resolved
Seq(
D.typesafeConfig,
"org.keycloak" % "keycloak-admin-client" % V.keycloak excludeAll (
ExclusionRule("org.jboss.resteasy", "resteasy-core"),
ExclusionRule("org.jboss.resteasy", "resteasy-multipart-provider"),
ExclusionRule("org.jboss.resteasy", "resteasy-jackson2-provider"),
ExclusionRule("org.jboss.resteasy", "resteasy-jaxb-provider"),
),
// scala-steward:off
"org.jboss.resteasy" % "resteasy-core" % "6.2.4.Final" excludeAll (
ExclusionRule("jakarta.servlet", "jakarta.servlet-api"),
),
"org.jboss.resteasy" % "resteasy-jackson2-provider" % "6.2.4.Final" excludeAll (
ExclusionRule("jakarta.servlet", "jakarta.servlet-api"),
),
"org.jboss.logging" % "jboss-logging" % "3.5.0.Final",
"commons-codec" % "commons-codec" % "1.15",
"jakarta.ws.rs" % "jakarta.ws.rs-api" % "3.1.0",
"jakarta.annotation" % "jakarta.annotation-api" % "2.1.1",
"jakarta.xml.bind" % "jakarta.xml.bind-api" % "3.0.1",
"org.reactivestreams" % "reactive-streams" % "1.0.4",
"jakarta.validation" % "jakarta.validation-api" % "3.0.2",
"org.jboss" % "jandex" % "2.4.3.Final",
"jakarta.activation" % "jakarta.activation-api" % "2.1.2",
"org.eclipse.angus" % "angus-activation" % "1.0.0",
"com.ibm.async" % "asyncutil" % "0.1.0",
"org.apache.httpcomponents" % "httpclient" % "4.5.14",
"com.github.java-json-tools" % "json-patch" % "1.13",
"com.fasterxml.jackson.core" % "jackson-core" % "2.14.3",
"com.fasterxml.jackson.core" % "jackson-databind" % "2.14.3",
"com.fasterxml.jackson.core" % "jackson-annotations" % "2.14.3",
"com.fasterxml.jackson.jakarta.rs" % "jackson-jakarta-rs-base" % "2.14.3",
"com.fasterxml.jackson.jakarta.rs" % "jackson-jakarta-rs-json-provider" % "2.14.3",
"com.fasterxml.jackson.module" % "jackson-module-jakarta-xmlbind-annotations" % "2.14.3",
// scala-steward:on
).map(_ % Test)

lazy val dependencies: Seq[ModuleID] =
D_Shared.dependencies ++ keycloakAdminExplicitDependencies ++ Seq(
D.testcontainersPostgres,
D.testcontainersVault,
D.testcontainersKeycloak,
D.zio,
D.doobieHikari,
D.doobiePostgres,
D.zioCatsInterop,
D.zioJson,
D.zioHttp,
Expand Down Expand Up @@ -711,7 +755,7 @@ lazy val polluxDoobie = project
)
.dependsOn(polluxCore % "compile->compile;test->test")
.dependsOn(shared)
.dependsOn(sharedTest % Test)
.dependsOn(sharedTest % "test->test")

// ########################
// ### Pollux Anoncreds ###
Expand Down Expand Up @@ -761,7 +805,7 @@ lazy val connectDoobie = project
libraryDependencies ++= D_Connect.sqlDoobieDependencies
)
.dependsOn(shared)
.dependsOn(sharedTest % Test)
.dependsOn(sharedTest % "test->test")
.dependsOn(connectCore % "compile->compile;test->test")

// ############################
Expand Down Expand Up @@ -797,7 +841,7 @@ lazy val prismAgentWalletAPI = project
castorCore,
eventNotification
)
.dependsOn(sharedTest % Test)
.dependsOn(sharedTest % "test->test")

lazy val prismAgentServer = project
.in(file("prism-agent/service/server"))
Expand Down Expand Up @@ -830,7 +874,7 @@ lazy val prismAgentServer = project
castorCore,
eventNotification
)
.dependsOn(sharedTest % Test)
.dependsOn(sharedTest % "test->test")

// ############################
// #### Release process #####
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ class KeycloakClientImpl(client: AuthzClient, httpClient: Client, keycloakConfig
)
)
)
.logError("Fail to get the accessToken on keyclaok.")
.mapError(e => KeycloakClientError.UnexpectedError("Fail to get the accessToken on keyclaok."))
.logError("Fail to get the accessToken on keycloak.")
.mapError(e => KeycloakClientError.UnexpectedError("Fail to get the accessToken on keycloak."))
.provide(ZLayer.succeed(httpClient))
body <- response.body.asString
.logError("Fail parse keycloak token response.")
Expand Down
2 changes: 1 addition & 1 deletion project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ addSbtPlugin("com.github.sbt" % "sbt-native-packager" % "1.9.11")
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "2.0.6")
addSbtPlugin("com.github.sbt" % "sbt-native-packager" % "1.9.11")
addSbtPlugin("org.scoverage" % "sbt-coveralls" % "1.3.9")
addSbtPlugin("com.github.sbt" % "sbt-license-report" % "1.5.0")
addSbtPlugin("com.github.sbt" % "sbt-license-report" % "1.6.1")
addSbtPlugin("com.thesamet" % "sbt-protoc" % "1.0.6")

// In order to import proper version of com.google.protobuf.ByteString we need to add this dependency
Expand Down
Loading