Skip to content

Commit 9279bfe

Browse files
author
shotexa
authored
refactor(node): build files and add default port for gRPC server (#844)
* Change some build files Signed-off-by: Shota Jolbordi <[email protected]> * Rmove unused files Signed-off-by: Shota Jolbordi <[email protected]> * Remove unused files Signed-off-by: Shota Jolbordi <[email protected]> * Remove outer node folder Signed-off-by: Shota Jolbordi <[email protected]> * Revert version name Signed-off-by: Shota Jolbordi <[email protected]> * Remove unneeded resolver from the build Signed-off-by: Shota Jolbordi <[email protected]> * Update fs2 Signed-off-by: Shota Jolbordi <[email protected]> * Start adding tests Signed-off-by: Shota Jolbordi <[email protected]> * Add more tests Signed-off-by: Shota Jolbordi <[email protected]> * Fix 1 failing test Signed-off-by: Shota Jolbordi <[email protected]> * Minor adjustment in docs Signed-off-by: Shota Jolbordi <[email protected]> * Remove test report aggregation step Signed-off-by: Shota Jolbordi <[email protected]> --------- Signed-off-by: Shota Jolbordi <[email protected]>
1 parent 3abf2f8 commit 9279bfe

File tree

226 files changed

+407
-419
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

226 files changed

+407
-419
lines changed

.github/workflows/unit-tests.yml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,6 @@ jobs:
3636
if: always()
3737
run: sbt coverageReport coverageAggregate
3838

39-
- name: Aggregate test reports
40-
if: always()
41-
run: |
42-
for reports in `find -name test-reports`; do
43-
project=${reports%/target/*}
44-
dest=target/test-reports/$project
45-
mkdir -p $dest
46-
cp $reports/* $dest
47-
done
48-
4939
- name: Publish Backend Unit Test Results
5040
if: always()
5141
uses: EnricoMi/publish-unit-test-result-action@v1

CHANGELOG.md

Lines changed: 0 additions & 13 deletions
This file was deleted.

CONTRIBUTING.md

Lines changed: 0 additions & 138 deletions
This file was deleted.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ $ sbt node/run
8181

8282
This will start the node server. You can interact with it using gRPC calls at port 50053.
8383
By default, the node is running on "in memory" mode, which means that any operation submitted to it will be instantly confirmed and processed.
84-
Alternatively, you can configure to run it against a Cardano network by setting values for the db-sync and Cardano wallet services. See [this documentation](https://github.com/hyperledger/identus-cloud-agent/blob/main/docs/guides/deploying-node.md) for more details
84+
Alternatively, you can configure to run it against a Cardano network by setting values for the db-sync and Cardano wallet services. See [this documentation](docs/node/deployment.md) for more details
8585

8686
For development purposes, you may want to reduce the number of blocks to wait for confirmations. Note that this parameter is fixed for mainnet. Hence, only modify then for tests if needed.
8787

build.sbt

Lines changed: 59 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,8 @@ lazy val versions = new {
4848
val tofuDerevo = "0.13.0"
4949
val twirl = "1.5.1"
5050
val typesafeConfig = "1.4.2"
51-
val fs2 = "3.2.5"
51+
val fs2 = "3.8.0"
5252
val scalaUri = "4.0.0"
53-
val prismSdk =
54-
"v1.4.1-snapshot-1688975371-7541fd2" // deployed to github packages from sdk branch "node-1.4-extension-sdk"
55-
val vaultSdk = "0.1.0-build-2-96cc137d"
5653
}
5754

5855
lazy val Dependencies = new {
@@ -103,9 +100,6 @@ lazy val Dependencies = new {
103100
val typesafeConfig = "com.typesafe" % "config" % versions.typesafeConfig
104101
val fs2 = "co.fs2" %% "fs2-io" % versions.fs2
105102
val scalaUri = "io.lemonlabs" %% "scala-uri" % versions.scalaUri
106-
107-
// SDK dependencies
108-
109103
// Test dependencies
110104
val catsScalatest =
111105
"com.ironcorelabs" %% "cats-scalatest" % versions.catsScalatest % Test
@@ -150,89 +144,70 @@ lazy val Dependencies = new {
150144
"com.thesamet.scalapb" %% "scalapb-runtime" % scalapb.compiler.Version.scalapbVersion % "protobuf",
151145
"com.thesamet.scalapb" %% "scalapb-runtime-grpc" % scalapb.compiler.Version.scalapbVersion
152146
)
153-
154-
// cardano-address library binary
155-
val cardanoAddressBinaryUrl =
156-
"https://github.com/input-output-hk/cardano-addresses/releases/download/3.2.0/cardano-addresses-3.2.0-linux64.tar.gz"
157-
158-
// sha512 checksum of untarred binary file,
159-
val cardanoAddressBinaryChecksum =
160-
"fc45eeb026ef3e6fda8fdb792c83bb5bd25946b011b75e6364931206b4b6037e5d8e6f1a78b92b17062b28ae2b6bbd617a8fe50831a00f6fc8758234d36e2db9"
161147
}
162148

163149
publish / skip := true
164150

165-
lazy val commonSettings = Seq(
166-
publish / skip := true,
167-
buildInfoPackage := "io.iohk.atala.prism",
168-
scalacOptions ~= (options =>
169-
options.filterNot(
170-
Set(
171-
"-Xlint:package-object-classes",
172-
"-Wdead-code",
173-
"-Ywarn-dead-code"
174-
)
175-
)
176-
),
177-
scalacOptions += "-Ymacro-annotations",
178-
javacOptions ++= Seq("-source", "1.11", "-target", "1.11"),
179-
githubTokenSource := TokenSource.Environment("GITHUB_TOKEN"),
180-
resolvers += Resolver
181-
.githubPackages("input-output-hk", "atala-prism-sdk"),
182-
// Needed for Kotlin coroutines that support new memory management mode
183-
resolvers +=
184-
"JetBrains Space Maven Repository" at "https://maven.pkg.jetbrains.space/public/p/kotlinx-coroutines/maven",
185-
libraryDependencies ++= Dependencies.scalatestDependencies,
186-
addCompilerPlugin(
187-
"org.typelevel" % "kind-projector" % "0.13.2" cross CrossVersion.full
188-
),
189-
Test / fork := true,
190-
Test / parallelExecution := false,
191-
Test / testForkedParallel := false,
192-
assembly / test := {},
193-
commands += Command.args("testOnlyUntilFailed", "<testOnly params>") { (state, args) =>
194-
val argsString = args.mkString(" ")
195-
("testOnly " + argsString) :: ("testOnlyUntilFailed " + argsString) :: state
196-
},
197-
assembly / assemblyExcludedJars := {
198-
val cp = (assembly / fullClasspath).value
199-
200-
val excludeLibs =
201-
Set(
202-
"protobuf-javalite",
203-
"kotlinx-coroutines-core",
204-
"pbandk-protos",
205-
"jakarta"
206-
)
207-
208-
cp.filter { path =>
209-
excludeLibs.exists(lib => path.data.getName.startsWith(lib))
210-
}
211-
},
212-
assembly / assemblyMergeStrategy := {
213-
// Merge service files, otherwise GRPC client doesn't work: https://github.com/grpc/grpc-java/issues/5493
214-
case PathList("META-INF", "services", _*) => MergeStrategy.concat
215-
case PathList("META-INF", "io.netty.versions.properties") =>
216-
MergeStrategy.concat
217-
// It is safe to discard when building an uber-jar according to https://stackoverflow.com/a/55557287
218-
case x if x.endsWith("module-info.class") => MergeStrategy.discard
219-
case "logback.xml" => MergeStrategy.first
220-
case "scala-collection-compat.properties" => MergeStrategy.last
221-
// org.bitcoin classes are coming from both bitcoinj and fr.acinq.secp256k1-jni
222-
case PathList("org", "bitcoin", _*) => MergeStrategy.last
223-
case x =>
224-
val oldStrategy = (assembly / assemblyMergeStrategy).value
225-
oldStrategy(x)
226-
}
227-
)
228-
229-
lazy val node =
151+
lazy val root =
230152
project
231-
.in(file("node"))
153+
.in(file("."))
232154
.settings(
233-
commonSettings,
234155
name := "node",
235156
Compile / mainClass := Some("io.iohk.atala.prism.node.NodeApp"),
157+
buildInfoPackage := "io.iohk.atala.prism",
158+
scalacOptions ~= (options =>
159+
options.filterNot(
160+
Set(
161+
"-Xlint:package-object-classes",
162+
"-Wdead-code",
163+
"-Ywarn-dead-code"
164+
)
165+
)
166+
),
167+
scalacOptions += "-Ymacro-annotations",
168+
javacOptions ++= Seq("-source", "1.11", "-target", "1.11"),
169+
githubTokenSource := TokenSource.Environment("GITHUB_TOKEN"),
170+
addCompilerPlugin(
171+
"org.typelevel" % "kind-projector" % "0.13.2" cross CrossVersion.full
172+
),
173+
Test / fork := true,
174+
Test / parallelExecution := false,
175+
Test / testForkedParallel := false,
176+
assembly / test := {},
177+
commands += Command.args("testOnlyUntilFailed", "<testOnly params>") { (state, args) =>
178+
val argsString = args.mkString(" ")
179+
("testOnly " + argsString) :: ("testOnlyUntilFailed " + argsString) :: state
180+
},
181+
assembly / assemblyExcludedJars := {
182+
val cp = (assembly / fullClasspath).value
183+
184+
val excludeLibs =
185+
Set(
186+
"protobuf-javalite",
187+
"kotlinx-coroutines-core",
188+
"pbandk-protos",
189+
"jakarta"
190+
)
191+
192+
cp.filter { path =>
193+
excludeLibs.exists(lib => path.data.getName.startsWith(lib))
194+
}
195+
},
196+
assembly / assemblyMergeStrategy := {
197+
// Merge service files, otherwise GRPC client doesn't work: https://github.com/grpc/grpc-java/issues/5493
198+
case PathList("META-INF", "services", _*) => MergeStrategy.concat
199+
case PathList("META-INF", "io.netty.versions.properties") =>
200+
MergeStrategy.concat
201+
// It is safe to discard when building an uber-jar according to https://stackoverflow.com/a/55557287
202+
case x if x.endsWith("module-info.class") => MergeStrategy.discard
203+
case "logback.xml" => MergeStrategy.first
204+
case "scala-collection-compat.properties" => MergeStrategy.last
205+
// org.bitcoin classes are coming from both bitcoinj and fr.acinq.secp256k1-jni
206+
case PathList("org", "bitcoin", _*) => MergeStrategy.last
207+
case x =>
208+
val oldStrategy = (assembly / assemblyMergeStrategy).value
209+
oldStrategy(x)
210+
},
236211
// Make ScalaPB compile protos relative to `protobuf_external_src/protos` directory.
237212
// Otherwise, it will assume that `protobuf_external_src` is the root directory for proto files.
238213
Compile / PB.protoSources := (Compile / PB.protoSources).value.map {
@@ -265,6 +240,7 @@ lazy val node =
265240
++ Dependencies.sttpDependencies
266241
++ Dependencies.mockitoDependencies
267242
++ Dependencies.scalapbDependencies
243+
++ Dependencies.scalatestDependencies
268244
++ Seq(
269245
Dependencies.chimney,
270246
Dependencies.diffx,
@@ -280,10 +256,6 @@ lazy val node =
280256
)
281257
.enablePlugins(BuildInfoPlugin, JavaAppPackaging, DockerPlugin)
282258

283-
lazy val root = project
284-
.in(file("."))
285-
.aggregate(node)
286-
287259
Global / onChangedBuildSource := ReloadOnSourceChanges
288260

289261
// ############################
@@ -296,6 +268,6 @@ releaseProcess := Seq[ReleaseStep](
296268
runClean,
297269
runTest,
298270
setReleaseVersion,
299-
ReleaseStep(releaseStepTask(node / Docker / stage)),
271+
ReleaseStep(releaseStepTask(root / Docker / stage)),
300272
setNextVersion
301273
)

0 commit comments

Comments
 (0)