Skip to content

Commit

Permalink
build: add predef to remove ??? (#1251)
Browse files Browse the repository at this point in the history
Signed-off-by: FabioPinheiro <fabiomgpinheiro@gmail.com>
  • Loading branch information
FabioPinheiro authored Aug 29, 2024
1 parent 238492b commit 0fec91a
Show file tree
Hide file tree
Showing 17 changed files with 155 additions and 94 deletions.
71 changes: 55 additions & 16 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,18 @@ coberturaFile := target.value / "coverage" / "coverage-report" / "cobertura.xml"

inThisBuild(
Seq(
scalacOptions ++= Seq("-encoding", "UTF-8"),
scalacOptions ++= Seq(
"-encoding",
"UTF-8",
"-feature",
"-deprecation",
"-unchecked",
"-Wunused:all",
"-Wconf:any:warning", // TODO: change unused imports to errors, Wconf configuration string is different from scala 2, figure out how!
// TODO "-feature",
// TODO "-Xfatal-warnings",
// TODO "-Yexplicit-nulls",
// "-Ysafe-init",
)
),
scalacOptions += "-Wunused:all",
scalacOptions += "-Wconf:cat=deprecation:warning,any:error", // "-Wconf:help",
// scalacOptions += "-Yexplicit-nulls",
// scalacOptions += "-Ysafe-init",
// scalacOptions += "-Werror", // <=> "-Xfatal-warnings"
scalacOptions += "-Dquill.macro.log=false", // disable quill macro logs // TODO https://github.com/zio/zio-protoquill/issues/470
)
)

Expand Down Expand Up @@ -455,11 +454,19 @@ val commonSetttings = Seq(
}
)

lazy val commonConfigure: Project => Project = _.settings(
Compile / scalacOptions += "-Yimports:java.lang,scala,scala.Predef,org.hyperledger.identus.Predef",
Test / scalacOptions -= "-Yimports:java.lang,scala,scala.Predef,org.hyperledger.identus.Predef",
).dependsOn(predef)

// #####################
// ##### shared ######
// #####################

lazy val predef = (project in file("shared/predef"))

lazy val shared = (project in file("shared/core"))
.configure(commonConfigure)
.settings(commonSetttings)
.settings(
name := "shared",
Expand All @@ -477,6 +484,7 @@ lazy val sharedJson = (project in file("shared/json"))
.dependsOn(shared)

lazy val sharedCrypto = (project in file("shared/crypto"))
.configure(commonConfigure)
.settings(commonSetttings)
.settings(
name := "shared-crypto",
Expand All @@ -486,6 +494,7 @@ lazy val sharedCrypto = (project in file("shared/crypto"))
.dependsOn(shared)

lazy val sharedTest = (project in file("shared/test"))
.configure(commonConfigure)
.settings(commonSetttings)
.settings(
name := "shared-test",
Expand All @@ -504,6 +513,7 @@ lazy val sharedTest = (project in file("shared/test"))
*/
lazy val models = project
.in(file("mercury/models"))
.configure(commonConfigure)
.settings(name := "mercury-data-models")
.settings(
libraryDependencies ++= Seq(D.zio),
Expand Down Expand Up @@ -531,6 +541,7 @@ models implementation for didcommx () */

lazy val protocolConnection = project
.in(file("mercury/protocol-connection"))
.configure(commonConfigure)
.settings(name := "mercury-protocol-connection")
.settings(libraryDependencies += D.zio)
.settings(libraryDependencies ++= Seq(D.circeCore, D.circeGeneric, D.circeParser))
Expand All @@ -539,6 +550,7 @@ lazy val protocolConnection = project

lazy val protocolCoordinateMediation = project
.in(file("mercury/protocol-coordinate-mediation"))
.configure(commonConfigure)
.settings(name := "mercury-protocol-coordinate-mediation")
.settings(libraryDependencies += D.zio)
.settings(libraryDependencies ++= Seq(D.circeCore, D.circeGeneric, D.circeParser))
Expand All @@ -547,13 +559,15 @@ lazy val protocolCoordinateMediation = project

lazy val protocolDidExchange = project
.in(file("mercury/protocol-did-exchange"))
.configure(commonConfigure)
.settings(name := "mercury-protocol-did-exchange")
.settings(libraryDependencies += D.zio)
.settings(libraryDependencies ++= Seq(D.circeCore, D.circeGeneric, D.circeParser))
.dependsOn(models, protocolInvitation)

lazy val protocolInvitation = project
.in(file("mercury/protocol-invitation"))
.configure(commonConfigure)
.settings(name := "mercury-protocol-invitation")
.settings(libraryDependencies += D.zio)
.settings(
Expand All @@ -567,14 +581,16 @@ lazy val protocolInvitation = project
)
.dependsOn(models)

lazy val protocolMercuryMailbox = project
.in(file("mercury/protocol-mercury-mailbox"))
.settings(name := "mercury-protocol-mailbox")
.settings(libraryDependencies += D.zio)
.dependsOn(models, protocolInvitation, protocolRouting)
// lazy val protocolMercuryMailbox = project
// .in(file("mercury/protocol-mercury-mailbox"))
// .settings(predefSetttings)
// .settings(name := "mercury-protocol-mailbox")
// .settings(libraryDependencies += D.zio)
// .dependsOn(models, protocolInvitation, protocolRouting)

lazy val protocolLogin = project
.in(file("mercury/protocol-outofband-login"))
.configure(commonConfigure)
.settings(name := "mercury-protocol-outofband-login")
.settings(libraryDependencies += D.zio)
.settings(libraryDependencies += D.zio)
Expand All @@ -584,18 +600,21 @@ lazy val protocolLogin = project

lazy val protocolReportProblem = project
.in(file("mercury/protocol-report-problem"))
.configure(commonConfigure)
.settings(name := "mercury-protocol-report-problem")
.settings(libraryDependencies += D.munitZio)
.dependsOn(models)

lazy val protocolRouting = project
.in(file("mercury/protocol-routing"))
.configure(commonConfigure)
.settings(name := "mercury-protocol-routing-2-0")
.settings(libraryDependencies += D.zio)
.dependsOn(models)

lazy val protocolIssueCredential = project
.in(file("mercury/protocol-issue-credential"))
.configure(commonConfigure)
.settings(name := "mercury-protocol-issue-credential")
.settings(libraryDependencies += D.zio)
.settings(libraryDependencies ++= Seq(D.circeCore, D.circeGeneric, D.circeParser))
Expand All @@ -604,6 +623,7 @@ lazy val protocolIssueCredential = project

lazy val protocolRevocationNotification = project
.in(file("mercury/protocol-revocation-notification"))
.configure(commonConfigure)
.settings(name := "mercury-protocol-revocation-notification")
.settings(libraryDependencies += D.zio)
.settings(libraryDependencies ++= Seq(D.circeCore, D.circeGeneric, D.circeParser))
Expand All @@ -612,6 +632,7 @@ lazy val protocolRevocationNotification = project

lazy val protocolPresentProof = project
.in(file("mercury/protocol-present-proof"))
.configure(commonConfigure)
.settings(name := "mercury-protocol-present-proof")
.settings(libraryDependencies += D.zio)
.settings(libraryDependencies ++= Seq(D.circeCore, D.circeGeneric, D.circeParser))
Expand All @@ -620,11 +641,13 @@ lazy val protocolPresentProof = project

lazy val vc = project
.in(file("mercury/vc"))
.configure(commonConfigure)
.settings(name := "mercury-verifiable-credentials")
.dependsOn(protocolIssueCredential, protocolPresentProof) //TODO merge those two modules into this one

lazy val protocolTrustPing = project
.in(file("mercury/protocol-trust-ping"))
.configure(commonConfigure)
.settings(name := "mercury-protocol-trust-ping")
.settings(libraryDependencies += D.zio)
.settings(libraryDependencies ++= Seq(D.circeCore, D.circeGeneric, D.circeParser))
Expand All @@ -638,6 +661,7 @@ lazy val protocolTrustPing = project
// TODO move stuff to the models module
lazy val resolver = project // maybe merge into models
.in(file("mercury/resolver"))
.configure(commonConfigure)
.settings(name := "mercury-resolver")
.settings(
libraryDependencies ++= Seq(
Expand All @@ -657,6 +681,7 @@ lazy val resolver = project // maybe merge into models

lazy val agent = project // maybe merge into models
.in(file("mercury/agent"))
.configure(commonConfigure)
.settings(name := "mercury-agent-core")
.settings(libraryDependencies ++= Seq(D.zioLog, D.zioSLF4J))
.dependsOn(
Expand All @@ -665,7 +690,7 @@ lazy val agent = project // maybe merge into models
protocolCoordinateMediation,
protocolInvitation,
protocolRouting,
protocolMercuryMailbox,
// protocolMercuryMailbox,
protocolLogin,
protocolIssueCredential,
protocolRevocationNotification,
Expand All @@ -679,6 +704,7 @@ lazy val agent = project // maybe merge into models
/** agents implementation with didcommx */
lazy val agentDidcommx = project
.in(file("mercury/agent-didcommx"))
.configure(commonConfigure)
.settings(name := "mercury-agent-didcommx")
.settings(libraryDependencies += D.didcommx)
.settings(libraryDependencies += D.munitZio)
Expand All @@ -697,6 +723,7 @@ lazy val agentDidcommx = project
// ####################
val prismNodeClient = project
.in(file("prism-node/client/scala-client"))
.configure(commonConfigure)
.settings(
name := "prism-node-client",
libraryDependencies ++= Seq(D.scalaPbGrpc, D.scalaPbRuntime, D.grpcOkHttp),
Expand All @@ -715,6 +742,7 @@ val prismNodeClient = project

lazy val castorCore = project
.in(file("castor"))
.configure(commonConfigure)
.settings(commonSetttings)
.settings(
name := "castor-core",
Expand All @@ -729,6 +757,7 @@ lazy val castorCore = project

lazy val polluxVcJWT = project
.in(file("pollux/vc-jwt"))
.configure(commonConfigure)
.settings(commonSetttings)
.settings(
name := "pollux-vc-jwt",
Expand All @@ -738,6 +767,7 @@ lazy val polluxVcJWT = project

lazy val polluxCore = project
.in(file("pollux/core"))
.configure(commonConfigure)
.settings(commonSetttings)
.settings(
name := "pollux-core",
Expand All @@ -759,6 +789,7 @@ lazy val polluxCore = project

lazy val polluxDoobie = project
.in(file("pollux/sql-doobie"))
.configure(commonConfigure)
.settings(commonSetttings)
.settings(
name := "pollux-sql-doobie",
Expand All @@ -780,6 +811,7 @@ lazy val polluxPreX = project

lazy val polluxAnoncreds = project
.in(file("pollux/anoncreds"))
.configure(commonConfigure)
.settings(
name := "pollux-anoncreds",
Compile / unmanagedJars += baseDirectory.value / "anoncreds-jvm-1.0-SNAPSHOT.jar",
Expand All @@ -791,11 +823,13 @@ lazy val polluxAnoncreds = project

lazy val polluxAnoncredsTest = project
.in(file("pollux/anoncredsTest"))
.configure(commonConfigure)
.settings(libraryDependencies += D.scalaTest)
.dependsOn(polluxAnoncreds % "compile->test")

lazy val polluxSDJWT = project
.in(file("pollux/sd-jwt"))
.configure(commonConfigure)
.settings(commonSetttings)
.settings(
name := "pollux-sd-jwt",
Expand All @@ -809,6 +843,7 @@ lazy val polluxSDJWT = project

lazy val connectCore = project
.in(file("connect/core"))
.configure(commonConfigure)
.settings(commonSetttings)
.settings(
name := "connect-core",
Expand All @@ -820,6 +855,7 @@ lazy val connectCore = project

lazy val connectDoobie = project
.in(file("connect/sql-doobie"))
.configure(commonConfigure)
.settings(commonSetttings)
.settings(
name := "connect-sql-doobie",
Expand All @@ -835,6 +871,7 @@ lazy val connectDoobie = project

lazy val eventNotification = project
.in(file("event-notification"))
.configure(commonConfigure)
.settings(
name := "event-notification",
libraryDependencies ++= D_EventNotification.baseDependencies
Expand All @@ -847,6 +884,7 @@ lazy val eventNotification = project

lazy val agentWalletAPI = project
.in(file("cloud-agent/service/wallet-api"))
.configure(commonConfigure)
.settings(commonSetttings)
.settings(
name := "cloud-agent-wallet-api",
Expand All @@ -866,6 +904,7 @@ lazy val agentWalletAPI = project

lazy val cloudAgentServer = project
.in(file("cloud-agent/service/server"))
.configure(commonConfigure)
.settings(commonSetttings)
.settings(
name := "identus-cloud-agent",
Expand Down Expand Up @@ -926,7 +965,7 @@ lazy val aggregatedProjects: Seq[ProjectReference] = Seq(
protocolCoordinateMediation,
protocolDidExchange,
protocolInvitation,
protocolMercuryMailbox,
// protocolMercuryMailbox,
protocolLogin,
protocolReportProblem,
protocolRouting,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,7 @@ object IssueBackgroundJobs extends BackgroundJobsHelper {
case walletNotFound: WalletNotFoundError => ZIO.unit
case CredentialServiceError.RecordNotFound(_, _) => ZIO.unit
case CredentialServiceError.UnsupportedDidFormat(_) => ZIO.unit
case failure: Failure => ??? // FIXME
case failure: Failure => ZIO.unit
case ((walletAccessContext, failure)) =>
for {
credentialService <- ZIO.service[CredentialService]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,9 +203,9 @@ case class CredentialIssuerControllerImpl(
)
.mapError(ue => serverError(Some(s"Unexpected error while issuing credential: ${ue.userFacingMessage}")))
} yield ImmediateCredentialResponse(credential.value)
case None => ZIO.fail(badRequestInvalidProof(jwt = "empty", details = "No proof provided"))
// case Some(CwtProof(_, _)) => ??? // TODO
// case Some(LdpProof(_, _)) => ??? // TODO
case None => ZIO.fail(badRequestInvalidProof(jwt = "empty", details = "No proof provided"))
case Some(CwtProof(_, _)) => FeatureNotImplemented
case Some(LdpProof(_, _)) => FeatureNotImplemented
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ object PresentationStatus {
case Base64(data) =>
val base64Decoded = new String(java.util.Base64.getUrlDecoder.decode(data))
Seq(base64Decoded)
case any => ???
case any => FeatureNotImplemented
}
case None => Seq.empty
PresentationStatus(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,15 @@ class JdbcConnectionRepository(xa: Transactor[ContextAwareTask], xb: Transactor[
given roleGet: Get[Role] = Get[String].map(Role.valueOf)
given rolePut: Put[Role] = Put[String].contramap(_.toString)

given invitationGet: Get[Invitation] = Get[String].map(decode[Invitation](_).getOrElse(???))
given invitationGet: Get[Invitation] = Get[String].map(decode[Invitation](_).getOrElse(UnexpectedCodeExecutionPath))
given invitationPut: Put[Invitation] = Put[String].contramap(_.asJson.toString)

given connectionRequestGet: Get[ConnectionRequest] = Get[String].map(decode[ConnectionRequest](_).getOrElse(???))
given connectionRequestGet: Get[ConnectionRequest] =
Get[String].map(decode[ConnectionRequest](_).getOrElse(UnexpectedCodeExecutionPath))
given connectionRequestPut: Put[ConnectionRequest] = Put[String].contramap(_.asJson.toString)

given connectionResponseGet: Get[ConnectionResponse] = Get[String].map(decode[ConnectionResponse](_).getOrElse(???))
given connectionResponseGet: Get[ConnectionResponse] =
Get[String].map(decode[ConnectionResponse](_).getOrElse(UnexpectedCodeExecutionPath))
given connectionResponsePut: Put[ConnectionResponse] = Put[String].contramap(_.asJson.toString)

given failureGet: Get[Failure] = Get[String].temap(_.fromJson[FailureInfo])
Expand Down
Loading

0 comments on commit 0fec91a

Please sign in to comment.