daml/ledger/ledger-api-client/BUILD.bazel

126 lines
4.1 KiB
Python
Raw Normal View History

# Copyright (c) 2023 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
2019-04-04 11:33:38 +03:00
# SPDX-License-Identifier: Apache-2.0
load(
"//bazel_tools:scala.bzl",
"da_scala_library",
"da_scala_test_suite",
2019-04-04 11:33:38 +03:00
)
load("@scala_version//:index.bzl", "scala_major_version")
2019-04-04 11:33:38 +03:00
da_scala_library(
name = "ledger-api-client",
srcs = glob(["src/main/scala/**/*.scala"]),
scala_deps = [
"@maven//:com_typesafe_akka_akka_actor",
"@maven//:com_typesafe_akka_akka_stream",
],
tags = ["maven_coordinates=com.daml:ledger-api-client:__VERSION__"],
visibility = [
"//visibility:public",
],
deps = [
"//daml-lf/data",
"//language-support/scala/bindings",
"//ledger-api/rs-grpc-akka",
"//ledger-api/rs-grpc-bridge",
"//ledger/error",
"//ledger/ledger-api-auth-client",
"//ledger/ledger-api-common",
"//ledger/ledger-api-domain",
"//libs-scala/grpc-utils",
"//libs-scala/ledger-resources",
2020-07-21 18:50:33 +03:00
"//libs-scala/ports",
"//libs-scala/resources",
"//observability/metrics",
"//observability/tracing",
Track command - use types for error handling instead of grpc statuses [KVL-1005] (#10503) * Track command response using an Either instead of passing the completion with the grpc code. This makes it clearer as to the result of command tracking. We no longer count on the grpc status to determine if there was an error or not, and instead use types for that. CHANGELOG_BEGIN akka-bindings: `LedgerClientBinding.commands` now returns a flow of `Either[CompletionFailure, CompletionSuccess]` instead of `Completion` for clearer error handling. For backwards compatiblity the new return type can be turned back into a `Completion` using `CompletionResponse.toCompletion` CHANGELOG_END * Fix formatting * Code review changes - remove usages of Symbol in tests - clean curly braces * Remove change added from another PR * Fix import * Fix import * Fix retry flow and extract one more match case * Un-nest matches to a single level for simplicity * fix typo Co-authored-by: Samir Talwar <samir.talwar@digitalasset.com> * Be consistent in assertions and prefer `inside` for pattern matching * Inline CompletionResponse to use the full type * Use simpler matcher * Formatting * Add a way to convert back an `Either[CompletionFailure, CompletionSuccess]` to a `Completion` for backwards compatibility. This simplifies update for systems that are tightly coupled to `Completion` * Add test for converting to/from CompletionResponse * Remove unnecessary brackets * Add missing header * Use checked exceptions to preserve backwards compatiblity * Fix unapply Co-authored-by: Samir Talwar <samir.talwar@digitalasset.com>
2021-08-12 09:37:53 +03:00
"@maven//:com_google_api_grpc_proto_google_common_protos",
"@maven//:com_google_protobuf_protobuf_java",
"@maven//:io_dropwizard_metrics_metrics_core",
"@maven//:io_grpc_grpc_netty",
"@maven//:io_netty_netty_handler",
"@maven//:org_slf4j_slf4j_api",
],
2019-04-04 11:33:38 +03:00
)
da_scala_test_suite(
name = "ledger-api-client-tests",
srcs = glob(["src/test/suite/**/*.scala"]),
scala_deps = [
"@maven//:com_typesafe_akka_akka_actor",
"@maven//:com_typesafe_akka_akka_stream",
"@maven//:com_typesafe_akka_akka_stream_testkit",
"@maven//:org_mockito_mockito_scala",
"@maven//:org_scalatest_scalatest_core",
"@maven//:org_scalatest_scalatest_matchers_core",
"@maven//:org_scalatest_scalatest_shouldmatchers",
"@maven//:org_scalatest_scalatest_wordspec",
],
2019-04-04 11:33:38 +03:00
deps = [
":ledger-api-client",
"//language-support/scala/bindings",
"//ledger-api/rs-grpc-bridge",
"//ledger-api/testing-utils",
"//ledger/error",
"//ledger/ledger-api-common",
"//ledger/ledger-api-domain",
"//libs-scala/caching",
"//libs-scala/concurrent",
"//libs-scala/contextualized-logging",
"//libs-scala/grpc-utils",
"//observability/metrics",
"//observability/tracing",
"@maven//:com_google_api_grpc_proto_google_common_protos",
"@maven//:com_google_protobuf_protobuf_java",
"@maven//:io_dropwizard_metrics_metrics_core",
"@maven//:org_mockito_mockito_core",
"@maven//:org_reactivestreams_reactive_streams",
"@maven//:org_scalatest_scalatest_compatible",
],
2019-04-04 11:33:38 +03:00
)
da_scala_test_suite(
name = "ledger-api-client-integration-tests",
srcs = glob(["src/it/**/*.scala"]),
data = [
"//test-common:dar-files-default",
],
resources = [
"src/it/resources/logback-test.xml",
],
scala_deps = [
"@maven//:com_typesafe_akka_akka_actor",
"@maven//:com_typesafe_akka_akka_stream",
],
tags = ["cpu:4"],
deps = [
":ledger-api-client",
"//bazel_tools/runfiles:scala_runfiles",
"//canton/it-lib",
"//daml-lf/engine",
"//daml-lf/transaction",
"//language-support/scala/bindings",
"//ledger-api/rs-grpc-bridge",
"//ledger-api/testing-utils",
"//ledger/error",
"//ledger/ledger-api-auth",
"//ledger/ledger-api-common",
"//ledger/ledger-api-domain",
"//libs-scala/caching",
"//libs-scala/concurrent",
contextualized-logging: Introduce different logging types for more structure. [KVL-996] (#10134) * contextualized-logging: Automatically convert logging values to strings. For now, this has almost the same behavior, but it allows us to customize the output in the future. The main change is that the log format has gone from: context: {a=b, x=1, foo=bar} to: context: {a: "b", x: "1", foo: "bar"} * contextualized-logging: Move `writeTo` inside `LoggingValue`. * contextualized-logging: Allow for more than just strings. `null`, numbers, and sequences are now correctly logged. The log format has gone from: context: {a: "b", x: "1", foo: "bar", parties: "[alice, bob]"} to: context: {a: "b", x: 1, foo: "bar", parties: ["alice", "bob"]} CHANGELOG_BEGIN - The log output of Daml components has changed so that the structured part is closer to JSON. This allows us to distinguish and parse numbers and lists. If you are parsing this log output, you may need to change your parser. The log output has changed from: .. code-block:: context: {a=b, x=1, foo=bar, parties=[alice, bob]} to: .. code-block:: context: {a: "b", x: 1, foo: "bar", parties: ["alice", "bob"]} CHANGELOG_END * contextualized-logging: Extract the string serializer. * Use non-string logging where possible. * contextualized-logging: Split logging values from serialization. So that callers don't have to know about Jackson. * contextualized-logging: `SeqView` is `Iterable`. Don't need both. * contextualized-logging: Make `ToStringToLoggingValue` a `val`. Co-Authored-By: Stephen Compall <stephen.compall@daml.com> * contextualized-logging: Add a transient dependency for 2.12 only. This required more infrastructure than I thought it would. * kvutils: Make it explicit that we're logging the hashes of archives. The implicit was found to be a little confusing. Co-authored-by: Stephen Compall <stephen.compall@daml.com>
2021-06-29 12:16:26 +03:00
"//libs-scala/contextualized-logging",
"//libs-scala/grpc-utils",
"//libs-scala/jwt",
"//libs-scala/ledger-resources",
"//libs-scala/logging-entries",
"//libs-scala/ports",
"//libs-scala/resources",
"//observability/metrics",
"//observability/tracing",
"//test-common",
"//test-common:dar-files-default-lib",
"@maven//:ch_qos_logback_logback_classic",
"@maven//:io_netty_netty_handler",
],
)