daml/ledger/error/BUILD.bazel
pbatko-da d3dad75d00
[DPP-592] Generate docs for self-service error codes. (#11129)
Adding `Daml Documentation >> Building applications >> "Self-Service Error Codes (Experimental)` section in the HTML documentation. 

The section is populated automatically with error code information retrieved from the classpath.
The process of generating documentation for error codes looks like this:
- first we find error codes information from the classpath,
- then we save it to a json file,
- then the json file is made available to a custom Sphinx extension,
- then the custom Sphinx extension generates documentation wherever we put a new custom Sphinx directive.

Try it out with
`./docs/scripts/live-preview.sh`
or
`./docs/scripts/preview.sh`


CHANGELOG_BEGIN
CHANGELOG_END
2021-10-20 08:47:54 +02:00

98 lines
3.2 KiB
Python

# Copyright (c) 2021 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
load(
"//bazel_tools:scala.bzl",
"da_scala_binary",
"da_scala_library",
"da_scala_test_suite",
)
da_scala_binary(
name = "export-error-codes-json-app",
srcs = [],
main_class = "com.daml.error.generator.Main",
visibility = ["//visibility:public"],
deps = [
"//ledger/error",
"//ledger/participant-integration-api",
],
)
da_scala_library(
name = "error",
srcs = glob(["src/main/scala/**/*.scala"]),
scala_deps = [
"@maven//:org_typelevel_cats_core",
"@maven//:io_spray_spray_json",
"@maven//:io_circe_circe_core",
],
tags = ["maven_coordinates=com.daml:error:__VERSION__"],
versioned_scala_deps = {
"2.12": ["@maven//:org_scala_lang_modules_scala_collection_compat"],
},
visibility = ["//visibility:public"],
deps = [
"//daml-lf/data",
"//daml-lf/engine",
"//daml-lf/language",
"//daml-lf/transaction",
"//daml-lf/validation",
"//ledger-api/grpc-definitions:ledger_api_proto_scala",
"//ledger/participant-integration-api:participant-integration-api-proto_scala",
"//ledger/participant-state",
"//libs-scala/contextualized-logging",
"//libs-scala/logging-entries",
"@maven//:com_google_api_grpc_proto_google_common_protos",
"@maven//:com_google_protobuf_protobuf_java",
"@maven//:io_grpc_grpc_api",
"@maven//:io_grpc_grpc_protobuf",
"@maven//:org_reflections_reflections",
"@maven//:org_slf4j_slf4j_api",
],
)
da_scala_library(
name = "error-test-utils",
srcs = glob(["src/test/utils/**/*.scala"]),
scala_deps = [],
tags = ["maven_coordinates=com.daml:error-test-package:__VERSION__"],
visibility = ["//visibility:private"],
deps = [
":error",
"//libs-scala/contextualized-logging",
"@maven//:com_google_api_grpc_proto_google_common_protos",
"@maven//:com_google_protobuf_protobuf_java",
"@maven//:io_grpc_grpc_api",
"@maven//:org_slf4j_slf4j_api",
],
)
da_scala_test_suite(
name = "error-test-suite",
srcs = glob(["src/test/suite/scala/**/*.scala"]),
resources = ["src/test/resources/logback-test.xml"],
scala_deps = [
"@maven//:org_scalactic_scalactic",
"@maven//:org_scalatest_scalatest_core",
"@maven//:org_scalatest_scalatest_matchers_core",
"@maven//:org_scalatest_scalatest_shouldmatchers",
],
versioned_scala_deps = {
"2.12": ["@maven//:org_scala_lang_modules_scala_collection_compat"],
},
deps = [
":error",
":error-test-utils",
"//ledger/test-common",
"//libs-scala/contextualized-logging",
"@maven//:ch_qos_logback_logback_classic",
"@maven//:com_google_api_grpc_proto_google_common_protos",
"@maven//:com_google_protobuf_protobuf_java",
"@maven//:io_grpc_grpc_api",
"@maven//:io_grpc_grpc_protobuf",
"@maven//:org_scalatest_scalatest_compatible",
"@maven//:org_slf4j_slf4j_api",
],
)