daml/language-support/hs/bindings/BUILD.bazel
Paul Brauner 35e255e6b0
Address LF2 TODOs in the daml repo (#18386)
run-all-tests: true
2024-02-06 10:45:28 +01:00

116 lines
3.0 KiB
Python

# Copyright (c) 2024 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
load("//bazel_tools:haskell.bzl", "da_haskell_binary", "da_haskell_library", "da_haskell_repl", "da_haskell_test")
load("//rules_daml:daml.bzl", "daml_compile")
load("@os_info//:os_info.bzl", "is_darwin")
da_haskell_library(
name = "hs-ledger",
srcs = glob(["src/**/*.hs"]),
hackage_deps = [
"aeson",
"async",
"base",
"bytestring",
"containers",
"exceptions",
"extra",
"grpc-haskell",
"grpc-haskell-core",
"mtl",
"proto3-suite",
"retry",
"sorted-list",
"text",
"time",
"transformers",
"unliftio",
"utf8-string",
"vector",
"scientific",
],
src_strip_prefix = "src",
visibility = ["//visibility:public"],
deps = [
"//canton:ledger-api-haskellpb",
],
)
daml_compile(
name = "for-tests",
srcs = glob(["test/daml/for-tests/*.daml"]),
)
daml_compile(
name = "for-upload",
srcs = ["test/daml/for-upload/ExtraModule.daml"],
)
da_haskell_test(
name = "test",
srcs = glob(["test/**/*.hs"]),
data = [
":for-tests.dar",
":for-upload.dar",
] + (["@sysctl_nix//:bin/sysctl"] if is_darwin else []),
# The tests throw flaky timeout errors. It looks like this comes
# from a fundamental issue in the Haskell bindings: they eagerly pull
# from streams and those stream receives have a timeout. If we create the
# stream too early and do a bunch of other stuff in between, this will then timeout.
# We could increase the timeout to an absurd value but that also seems silly
# and affects other operations as well so for now, we still keep it flaky
# and try not to cry.
flaky = True,
hackage_deps = [
"aeson",
"async",
"base",
"bytestring",
"containers",
"filepath",
"directory",
"extra",
"jwt",
"process",
"random",
"retry",
"safe",
"tasty",
"tasty-hunit",
"text",
"time",
"utf8-string",
"uuid",
"vector",
"zip-archive",
],
main_function = "DA.Ledger.Tests.main",
src_strip_prefix = "test",
# We spin up Sandbox as a separate process, so
# try not to overload the machine.
tags = [
"cpu:4",
"main-only",
] + (["manual"] if is_darwin else []),
visibility = ["//visibility:public"],
deps = [
"//compiler/daml-lf-ast",
"//compiler/daml-lf-proto",
"//compiler/daml-lf-reader",
"//language-support/hs/bindings:hs-ledger",
"//libs-haskell/bazel-runfiles",
"//libs-haskell/canton-test-utils",
],
)
da_haskell_repl(
name = "repl",
testonly = True,
visibility = ["//visibility:public"],
deps = [
"//language-support/hs/bindings:hs-ledger",
"//language-support/hs/bindings:test",
],
)