# Copyright (c) 2022 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_test") load("//bazel_tools/packaging:packaging.bzl", "package_app") load("@os_info//:os_info.bzl", "is_windows") load("//rules_daml:daml.bzl", "daml_compile") da_haskell_library( name = "daml-helper-lib", srcs = glob( ["src/**/*.hs"], exclude = ["src/DA/Daml/Helper/Main.hs"], ), hackage_deps = [ "aeson", "ansi-terminal", "async", "base", "bytestring", "conduit", "conduit-extra", "containers", "directory", "extra", "filepath", "grpc-haskell-core", "http-conduit", "http-types", "jwt", "lens", "lens-aeson", "monad-loops", "network", "open-browser", "optparse-applicative", "process", "safe-exceptions", "text", "typed-process", "unordered-containers", "utf8-string", "uuid", "vector", "yaml", ], visibility = ["//visibility:public"], deps = [ "//:sdk-version-hs-lib", "//compiler/daml-lf-ast", "//compiler/daml-lf-proto", "//compiler/damlc/daml-compiler", "//compiler/damlc/daml-package-config", "//daml-assistant:daml-project-config", "//language-support/hs/bindings:hs-ledger", "//ledger-api/grpc-definitions:ledger-api-haskellpb", "//libs-haskell/da-hs-base", ], ) da_haskell_binary( name = "daml-helper", srcs = ["src/DA/Daml/Helper/Main.hs"], hackage_deps = [ "base", "extra", "filepath", "process", "safe-exceptions", "typed-process", ], main_function = "DA.Daml.Helper.Main.main", visibility = ["//visibility:public"], deps = [ ":daml-helper-lib", "//daml-assistant:daml-project-config", "//language-support/hs/bindings:hs-ledger", "//libs-haskell/bazel-runfiles", "//libs-haskell/da-hs-base", ], ) package_app( name = "daml-helper-dist", binary = ":daml-helper", visibility = ["//visibility:public"], ) da_haskell_test( name = "test-tls", srcs = ["test/DA/Daml/Helper/Test/Tls.hs"], data = [ "daml-helper", "//ledger/sandbox:sandbox-binary", "//ledger/test-common/test-certificates", ], hackage_deps = [ "base", "extra", "filepath", "process", "tasty", "tasty-hunit", ], main_function = "DA.Daml.Helper.Test.Tls.main", visibility = ["//visibility:public"], deps = [ "//libs-haskell/bazel-runfiles", "//libs-haskell/da-hs-base", "//libs-haskell/test-utils", ], ) da_haskell_test( name = "test-deployment", srcs = glob(["test/DA/Daml/Helper/Test/Deployment.hs"]), data = [ "//compiler/damlc", "//daml-assistant/daml-helper", "//ledger/sandbox:sandbox-binary", ], # TODO (MK) https://github.com/digital-asset/daml/issues/9768 flaky = True, hackage_deps = [ "aeson", "async", "base", "bytestring", "containers", "extra", "filepath", "jwt", "main-tester", "network", "process", "tasty", "tasty-hunit", "text", "uuid", "zip-archive", ], main_function = "DA.Daml.Helper.Test.Deployment.main", src_strip_prefix = "test", visibility = ["//visibility:public"], deps = [ "//:sdk-version-hs-lib", "//compiler/daml-lf-ast", "//compiler/daml-lf-proto", "//compiler/daml-lf-reader", "//libs-haskell/bazel-runfiles", "//libs-haskell/test-utils", ], ) da_haskell_test( name = "test-daml-ledger", srcs = ["test/DA/Daml/Helper/Test/Ledger.hs"], data = [ "daml-helper", ":test.dar", "//ledger-service/http-json:http-json-binary", "//ledger/sandbox:sandbox-binary", ], hackage_deps = [ "base", "bytestring", "extra", "filepath", "process", "tasty", "tasty-hunit", "text", "zip-archive", ], main_function = "DA.Daml.Helper.Test.Ledger.main", # Starts Sandbox & JSON-API so needs more resources. tags = ["cpu:3"], visibility = ["//visibility:public"], deps = [ "//compiler/daml-lf-ast", "//compiler/damlc:damlc-lib", "//language-support/hs/bindings:hs-ledger", "//libs-haskell/bazel-runfiles", "//libs-haskell/da-hs-base", "//libs-haskell/test-utils", ], ) da_haskell_test( name = "test-daml-packages", srcs = ["test/DA/Daml/Helper/Test/Packages.hs"], data = [ "daml-helper", ":test.dar", "//ledger-service/http-json:http-json-binary", "//ledger/sandbox:sandbox-binary", ], hackage_deps = [ "base", "bytestring", "extra", "filepath", "process", "tasty", "tasty-hunit", "text", "zip-archive", ], main_function = "DA.Daml.Helper.Test.Packages.main", # Starts Sandbox & JSON-API so needs more resources. tags = ["cpu:3"], visibility = ["//visibility:public"], deps = [ "//compiler/daml-lf-ast", "//compiler/damlc:damlc-lib", "//language-support/hs/bindings:hs-ledger", "//libs-haskell/bazel-runfiles", "//libs-haskell/da-hs-base", "//libs-haskell/test-utils", ], ) daml_compile( name = "test", srcs = glob(["test-data/Test.daml"]), )