Enforce consistent formatting of BUILD files. (#412)

* Add buildifier targets.

The tool allows to check and format BUILD files in the repo.

To check if files are well formatted, run:

    bazel run //:buildifier

To fix badly-formatted files run:

    bazel run //:buildifier-fix

* Cleanup dade-copyright-headers formatting.

* Fix dade-copyright-headers on files with just the copyright.

* Run buildifier automatically on CI via 'fmt.sh'.

* Reformat all BUILD files with buildifier.

Excludes autogenerated Bazel files.
This commit is contained in:
gleber 2019-04-12 13:10:16 +02:00 committed by GitHub
parent 86b16997af
commit aa70c7f64e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
147 changed files with 5041 additions and 4703 deletions

View File

@ -2,5 +2,5 @@
# SPDX-License-Identifier: Apache-2.0
exports_files([
"zlib.BUILD"
"zlib.BUILD",
])

34
3rdparty/c/zlib.BUILD vendored
View File

@ -40,24 +40,24 @@ cc_library(
# be passed to hazel_repositories.
filegroup(
name = "lib",
srcs = [":z"],
output_group = "dynamic_library",
name = "lib",
srcs = [":z"],
output_group = "dynamic_library",
)
filegroup(
name = "headers",
srcs = [
"crc32.h",
"deflate.h",
"gzguts.h",
"inffast.h",
"inffixed.h",
"inflate.h",
"inftrees.h",
"trees.h",
"zconf.h",
"zlib.h",
"zutil.h",
],
name = "headers",
srcs = [
"crc32.h",
"deflate.h",
"gzguts.h",
"inffast.h",
"inffixed.h",
"inflate.h",
"inftrees.h",
"trees.h",
"zconf.h",
"zlib.h",
"zutil.h",
],
)

View File

@ -1,2 +1,5 @@
# This file is exported so that we can a 'hazel_symlink' in BUILD.network
exports_files(["network-package.bzl", "c2hs-package.bzl"])
exports_files([
"network-package.bzl",
"c2hs-package.bzl",
])

View File

@ -11,6 +11,9 @@
package(default_visibility = ["//visibility:public"])
load("@os_info//:os_info.bzl", is_windows = "is_windows")
load("@os_info//:os_info.bzl", "is_windows")
alias(name = "ffi", actual = "@io_tweag_rules_haskell_ghc_windows_amd64//:rts-headers") if is_windows else None
alias(
name = "ffi",
actual = "@io_tweag_rules_haskell_ghc_windows_amd64//:rts-headers",
) if is_windows else None

96
BUILD
View File

@ -1,13 +1,14 @@
package(default_visibility = ["//:__subpackages__"])
load("@io_tweag_rules_haskell//haskell:haskell.bzl",
"haskell_toolchain",
load(
"@io_tweag_rules_haskell//haskell:haskell.bzl",
"haskell_toolchain",
)
load("@io_tweag_rules_haskell//haskell:c2hs.bzl",
"c2hs_toolchain",
load(
"@io_tweag_rules_haskell//haskell:c2hs.bzl",
"c2hs_toolchain",
)
load ("//bazel_tools:haskell.bzl", "da_haskell_library")
load("//bazel_tools:haskell.bzl", "da_haskell_library")
exports_files([".hlint.yaml"])
@ -44,13 +45,15 @@ load(
"c2hs_toolchain",
)
c2hs_toolchain(
name = "c2hs-toolchain",
c2hs = "@c2hs//:bin",
)
filegroup(name = "node_modules", srcs = glob(["node_modules/**/*"]))
filegroup(
name = "node_modules",
srcs = glob(["node_modules/**/*"]),
)
config_setting(
name = "ghci_data",
@ -64,7 +67,13 @@ config_setting(
#
# The VERSION file is inlined in a few builds.
exports_files(["NOTICES", "LICENSE", "VERSION", "CHANGELOG", "tsconfig.json"])
exports_files([
"NOTICES",
"LICENSE",
"VERSION",
"CHANGELOG",
"tsconfig.json",
])
# FIXME(#448): We're currently assigning version (100+x).y.z to all components
# in SDK version x.y.z. As long as x < 10, 10x.y.z == (100+x).y.z. Since we'll
@ -82,7 +91,10 @@ genrule(
genrule(
name = "sdk-version-hs",
srcs = ["VERSION", ":component-version"],
srcs = [
"VERSION",
":component-version",
],
outs = ["SdkVersion.hs"],
cmd = """
SDK_VERSION=$$(cat $(location VERSION))
@ -105,58 +117,84 @@ da_haskell_library(
genrule(
name = "git-revision",
stamp = True,
outs = [".git-revision"],
cmd = """
grep '^STABLE_GIT_REVISION ' bazel-out/stable-status.txt | cut -d ' ' -f 2 > $@
""",
stamp = True,
)
#
# Common aliases
#
alias(
name = "damli",
actual = "//daml-foundations/daml-tools/da-hs-damli-app:damli"
name = "damli",
actual = "//daml-foundations/daml-tools/da-hs-damli-app:damli",
)
alias(
name = "damli@ghci",
actual = "//daml-foundations/daml-tools/da-hs-damli-app:damli@ghci"
name = "damli@ghci",
actual = "//daml-foundations/daml-tools/da-hs-damli-app:damli@ghci",
)
alias(
name = "damli-dist",
actual = "//daml-foundations/daml-tools/da-hs-damli-app:dist"
name = "damli-dist",
actual = "//daml-foundations/daml-tools/da-hs-damli-app:dist",
)
alias(
name = "damlc",
actual = "//daml-foundations/daml-tools/da-hs-damlc-app:da-hs-damlc-app"
name = "damlc",
actual = "//daml-foundations/daml-tools/da-hs-damlc-app:da-hs-damlc-app",
)
alias(
name = "damlc@ghci",
actual = "//daml-foundations/daml-tools/da-hs-damlc-app:da-hs-damlc-app@ghci"
name = "damlc@ghci",
actual = "//daml-foundations/daml-tools/da-hs-damlc-app:da-hs-damlc-app@ghci",
)
alias(
name = "damlc-dist",
actual = "//daml-foundations/daml-tools/da-hs-damlc-app:damlc-dist"
name = "damlc-dist",
actual = "//daml-foundations/daml-tools/da-hs-damlc-app:damlc-dist",
)
alias(
name = "daml-lf-repl",
actual = "//daml-lf/repl:repl"
name = "daml-lf-repl",
actual = "//daml-lf/repl:repl",
)
alias(
name = "bindings-java",
actual = "//language-support/java/bindings:bindings-java"
name = "bindings-java",
actual = "//language-support/java/bindings:bindings-java",
)
exports_files([
".scalafmt.conf"
".scalafmt.conf",
])
# Buildifier.
load("@com_github_bazelbuild_buildtools//buildifier:def.bzl", "buildifier")
buildifier_excluded_patterns = [
"./3rdparty/haskell/c2hs-package.bzl",
"./3rdparty/haskell/network-package.bzl",
"./3rdparty/jvm/*",
"./3rdparty/workspace.bzl",
"./hazel/packages.bzl",
]
# Run this to check if BUILD files are well-formatted.
buildifier(
name = "buildifier",
exclude_patterns = buildifier_excluded_patterns,
mode = "check",
)
# Run this to fix the errors in BUILD files.
buildifier(
name = "buildifier-fix",
exclude_patterns = buildifier_excluded_patterns,
mode = "fix",
verbose = True,
)

656
WORKSPACE
View File

@ -1,37 +1,38 @@
workspace(name = "com_github_digital_asset_daml")
load("//:deps.bzl", "daml_deps")
daml_deps()
load("@io_tweag_rules_haskell//haskell:repositories.bzl", "haskell_repositories")
haskell_repositories()
register_toolchains(
"//:c2hs-toolchain"
"//:c2hs-toolchain",
)
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("//bazel_tools/dev_env_package:dev_env_package.bzl", "dev_env_package")
load("//bazel_tools/dev_env_package:dev_env_tool.bzl", "dev_env_tool")
load(
"@io_tweag_rules_nixpkgs//nixpkgs:nixpkgs.bzl",
"nixpkgs_local_repository", "nixpkgs_package", "nixpkgs_cc_configure",
"@io_tweag_rules_nixpkgs//nixpkgs:nixpkgs.bzl",
"nixpkgs_cc_configure",
"nixpkgs_local_repository",
"nixpkgs_package",
)
load("//bazel_tools:os_info.bzl", "os_info")
os_info(name = "os_info")
load("@os_info//:os_info.bzl", "is_linux", "is_windows")
nixpkgs_local_repository(
name = "nixpkgs",
nix_file = "//nix:nixpkgs.nix",
nix_file_deps = [
"//nix:nixpkgs/nixos-18.09/default.nix",
"//nix:nixpkgs/nixos-18.09/default.src.json",
"//nix:nixpkgs/nixos-18.09/default.nix",
"//nix:nixpkgs/nixos-18.09/default.src.json",
],
)
@ -63,16 +64,16 @@ common_nix_file_deps = [
# Use Nix provisioned cc toolchain
nixpkgs_cc_configure(
nix_file = "//nix:bazel-cc-toolchain.nix",
repositories = dev_env_nix_repos,
nix_file_deps = common_nix_file_deps + [
"//nix:bazel-cc-toolchain.nix",
],
repositories = dev_env_nix_repos,
)
# Curl system dependency
nixpkgs_package(
name = 'curl_nix',
attribute_path = 'curl',
name = "curl_nix",
attribute_path = "curl",
nix_file = "//nix:bazel.nix",
nix_file_deps = common_nix_file_deps,
repositories = dev_env_nix_repos,
@ -80,8 +81,8 @@ nixpkgs_package(
# Patchelf system dependency
nixpkgs_package(
name = 'patchelf_nix',
attribute_path = 'patchelf',
name = "patchelf_nix",
attribute_path = "patchelf",
nix_file = "//nix:bazel.nix",
nix_file_deps = common_nix_file_deps,
repositories = dev_env_nix_repos,
@ -89,53 +90,56 @@ nixpkgs_package(
# Tar & gzip dependency
nixpkgs_package(
name = 'tar_nix',
attribute_path = 'gnutar',
name = "tar_nix",
attribute_path = "gnutar",
fail_not_supported = False,
nix_file = "//nix:bazel.nix",
nix_file_deps = common_nix_file_deps,
repositories = dev_env_nix_repos,
fail_not_supported = False,
)
dev_env_tool(
name = "tar_dev_env",
tool = "tar",
win_tool = "msys2-20180531",
win_include = ["usr/bin/tar.exe"],
win_path = "usr/bin/tar.exe",
nix_label = "@tar_nix",
nix_include = ["bin/tar"],
nix_path = "bin/tar",
name = "tar_dev_env",
nix_include = ["bin/tar"],
nix_label = "@tar_nix",
nix_path = "bin/tar",
tool = "tar",
win_include = ["usr/bin/tar.exe"],
win_path = "usr/bin/tar.exe",
win_tool = "msys2-20180531",
)
nixpkgs_package(
name = 'gzip_nix',
attribute_path = 'gzip',
name = "gzip_nix",
attribute_path = "gzip",
fail_not_supported = False,
nix_file = "//nix:bazel.nix",
nix_file_deps = common_nix_file_deps,
repositories = dev_env_nix_repos,
fail_not_supported = False,
)
dev_env_tool(
name = "gzip_dev_env",
tool = "gzip",
win_tool = "msys2-20180531",
win_include = ["usr/bin/gzip.exe"],
win_path = "usr/bin/gzip.exe",
nix_label = "@gzip_nix",
nix_include = ["bin/gzip"],
nix_path = "bin/gzip",
name = "gzip_dev_env",
nix_include = ["bin/gzip"],
nix_label = "@gzip_nix",
nix_path = "bin/gzip",
tool = "gzip",
win_include = ["usr/bin/gzip.exe"],
win_path = "usr/bin/gzip.exe",
win_tool = "msys2-20180531",
)
nixpkgs_package(
name = 'awk_nix',
attribute_path = 'gawk',
name = "awk_nix",
attribute_path = "gawk",
nix_file = "//nix:bazel.nix",
nix_file_deps = common_nix_file_deps,
repositories = dev_env_nix_repos,
)
nixpkgs_package(
name = 'hlint_nix',
attribute_path = 'hlint',
name = "hlint_nix",
attribute_path = "hlint",
nix_file = "//nix:bazel.nix",
nix_file_deps = common_nix_file_deps + [
"//nix:overrides/hlint-2.1.15.nix",
@ -145,40 +149,30 @@ nixpkgs_package(
)
nixpkgs_package(
name = 'zip_nix',
attribute_path = 'zip',
name = "zip_nix",
attribute_path = "zip",
fail_not_supported = False,
nix_file = "//nix:bazel.nix",
nix_file_deps = common_nix_file_deps,
repositories = dev_env_nix_repos,
fail_not_supported = False,
)
dev_env_tool(
name = "zip_dev_env",
tool = "zip",
win_tool = "msys2-20180531",
win_include = ["usr/bin/zip.exe"],
win_path = "usr/bin/zip.exe",
nix_label = "@zip_nix",
nix_include = ["bin/zip"],
nix_path = "bin/zip",
name = "zip_dev_env",
nix_include = ["bin/zip"],
nix_label = "@zip_nix",
nix_path = "bin/zip",
tool = "zip",
win_include = ["usr/bin/zip.exe"],
win_path = "usr/bin/zip.exe",
win_tool = "msys2-20180531",
)
# c2hs
nixpkgs_package(
name = "c2hs",
repositories = dev_env_nix_repos,
attribute_path = "ghcWithC2hs",
nix_file = "//nix:bazel.nix",
nix_file_deps = common_nix_file_deps + [
"//nix:ghc.nix",
"//nix:with-packages-wrapper.nix",
"//nix:overrides/ghc-8.6.4.nix",
"//nix:overrides/c2hs-0.28.6.nix",
"//nix:overrides/ghc-8.6.3-binary.nix",
"//nix:overrides/language-c-0.8.2.nix",
],
build_file_content = '''
name = "c2hs",
attribute_path = "ghcWithC2hs",
build_file_content = '''
package(default_visibility = [ "//visibility:public" ])
@ -186,7 +180,17 @@ filegroup(
name = "bin",
srcs = ["bin/c2hs"],
)
'''
''',
nix_file = "//nix:bazel.nix",
nix_file_deps = common_nix_file_deps + [
"//nix:ghc.nix",
"//nix:with-packages-wrapper.nix",
"//nix:overrides/ghc-8.6.4.nix",
"//nix:overrides/c2hs-0.28.6.nix",
"//nix:overrides/ghc-8.6.3-binary.nix",
"//nix:overrides/language-c-0.8.2.nix",
],
repositories = dev_env_nix_repos,
)
load(
@ -212,31 +216,37 @@ filegroup(
# Used by Darwin and Linux
haskell_register_ghc_nixpkgs(
version = "8.6.4",
build_file = "@io_tweag_rules_haskell//haskell:ghc.BUILD",
attribute_path = "ghcWithC2hs",
nix_file = "//nix:bazel.nix",
nix_file_deps = common_nix_file_deps + [
"//nix:ghc.nix",
"//nix:with-packages-wrapper.nix",
"//nix:overrides/ghc-8.6.4.nix",
"//nix:overrides/c2hs-0.28.6.nix",
"//nix:overrides/ghc-8.6.3-binary.nix",
"//nix:overrides/language-c-0.8.2.nix",
],
locale_archive = "@glibc_locales//:locale-archive",
repositories = dev_env_nix_repos,
attribute_path = "ghcWithC2hs",
build_file = "@io_tweag_rules_haskell//haskell:ghc.BUILD",
# -fexternal-dynamic-refs is required so that we produce position-independent
# relocations against some functions (-fPIC alone isnt sufficient).
# -fexternal-dynamic-refs is required so that we produce position-independent
# relocations against some functions (-fPIC alone isnt sufficient).
# -split-sections would allow us to produce significantly smaller binaries, e.g., for damlc,
# the binary shrinks from 186MB to 83MB. -split-sections only works on Linux but
# we get a similar behavior on Darwin by default.
# However, we had to disable split-sections for now as it seems to interact very badly
# with the GHCi linker to the point where :main takes several minutes rather than several seconds.
compiler_flags = ["-O1", "-fexternal-dynamic-refs"],
repl_ghci_args = ["-O0", "-fexternal-interpreter"],
# -split-sections would allow us to produce significantly smaller binaries, e.g., for damlc,
# the binary shrinks from 186MB to 83MB. -split-sections only works on Linux but
# we get a similar behavior on Darwin by default.
# However, we had to disable split-sections for now as it seems to interact very badly
# with the GHCi linker to the point where :main takes several minutes rather than several seconds.
compiler_flags = [
"-O1",
"-fexternal-dynamic-refs",
],
locale_archive = "@glibc_locales//:locale-archive",
nix_file = "//nix:bazel.nix",
nix_file_deps = common_nix_file_deps + [
"//nix:ghc.nix",
"//nix:with-packages-wrapper.nix",
"//nix:overrides/ghc-8.6.4.nix",
"//nix:overrides/c2hs-0.28.6.nix",
"//nix:overrides/ghc-8.6.3-binary.nix",
"//nix:overrides/language-c-0.8.2.nix",
],
repl_ghci_args = [
"-O0",
"-fexternal-interpreter",
],
repositories = dev_env_nix_repos,
version = "8.6.4",
)
# Used by Windows
@ -245,111 +255,117 @@ haskell_register_ghc_bindists(
) if is_windows else None
nixpkgs_package(
name = "jq",
attribute_path = "jq",
nix_file = "//nix:bazel.nix",
nix_file_deps = common_nix_file_deps,
repositories = dev_env_nix_repos,
name = "jq",
attribute_path = "jq",
nix_file = "//nix:bazel.nix",
nix_file_deps = common_nix_file_deps,
repositories = dev_env_nix_repos,
)
#node & npm
nixpkgs_package(
name = "node_nix",
attribute_path = "nodejs",
nix_file = "//nix:bazel.nix",
nix_file_deps = common_nix_file_deps,
repositories = dev_env_nix_repos,
fail_not_supported = False
name = "node_nix",
attribute_path = "nodejs",
fail_not_supported = False,
nix_file = "//nix:bazel.nix",
nix_file_deps = common_nix_file_deps,
repositories = dev_env_nix_repos,
)
nixpkgs_package(
name = "npm_nix",
attribute_path = "nodejs",
nix_file = "//nix:bazel.nix",
nix_file_deps = common_nix_file_deps,
repositories = dev_env_nix_repos,
name = "npm_nix",
attribute_path = "nodejs",
nix_file = "//nix:bazel.nix",
nix_file_deps = common_nix_file_deps,
repositories = dev_env_nix_repos,
)
#sass
nixpkgs_package(
name = "sass_nix",
attribute_path = "sass",
nix_file = "//nix:bazel.nix",
nix_file_deps = common_nix_file_deps + [
"//nix:overrides/sass/default.nix",
"//nix:overrides/sass/gemset.nix",
],
repositories = dev_env_nix_repos,
name = "sass_nix",
attribute_path = "sass",
nix_file = "//nix:bazel.nix",
nix_file_deps = common_nix_file_deps + [
"//nix:overrides/sass/default.nix",
"//nix:overrides/sass/gemset.nix",
],
repositories = dev_env_nix_repos,
)
#tex
nixpkgs_package(
name = "texlive_nix",
attribute_path = "texlive",
nix_file = "//nix:bazel.nix",
nix_file_deps = common_nix_file_deps,
repositories = dev_env_nix_repos,
name = "texlive_nix",
attribute_path = "texlive",
nix_file = "//nix:bazel.nix",
nix_file_deps = common_nix_file_deps,
repositories = dev_env_nix_repos,
)
#sphinx
nixpkgs_package(
name = "sphinx_nix",
attribute_path = "sphinx183",
nix_file = "//nix:bazel.nix",
nix_file_deps = common_nix_file_deps + [
"//nix:tools/sphinx183/default.nix",
],
repositories = dev_env_nix_repos,
name = "sphinx_nix",
attribute_path = "sphinx183",
nix_file = "//nix:bazel.nix",
nix_file_deps = common_nix_file_deps + [
"//nix:tools/sphinx183/default.nix",
],
repositories = dev_env_nix_repos,
)
#Imagemagick
nixpkgs_package(
name = "imagemagick_nix",
attribute_path = "imagemagick",
nix_file = "//nix:bazel.nix",
nix_file_deps = common_nix_file_deps,
repositories = dev_env_nix_repos,
name = "imagemagick_nix",
attribute_path = "imagemagick",
nix_file = "//nix:bazel.nix",
nix_file_deps = common_nix_file_deps,
repositories = dev_env_nix_repos,
)
#Docker
nixpkgs_package(
name = "docker_nix",
attribute_path = "docker",
nix_file = "//nix:bazel.nix",
nix_file_deps = common_nix_file_deps,
repositories = dev_env_nix_repos,
name = "docker_nix",
attribute_path = "docker",
nix_file = "//nix:bazel.nix",
nix_file_deps = common_nix_file_deps,
repositories = dev_env_nix_repos,
)
#Pandoc
nixpkgs_package(
name = "pandoc_nix",
attribute_path = "pandoc",
nix_file = "//nix:bazel.nix",
nix_file_deps = common_nix_file_deps,
repositories = dev_env_nix_repos,
name = "pandoc_nix",
attribute_path = "pandoc",
nix_file = "//nix:bazel.nix",
nix_file_deps = common_nix_file_deps,
repositories = dev_env_nix_repos,
)
#Javadoc
nixpkgs_package(
name = "jdk_nix",
attribute_path = "jdk8",
nix_file = "//nix:bazel.nix",
nix_file_deps = common_nix_file_deps,
repositories = dev_env_nix_repos,
fail_not_supported = False,
name = "jdk_nix",
attribute_path = "jdk8",
fail_not_supported = False,
nix_file = "//nix:bazel.nix",
nix_file_deps = common_nix_file_deps,
repositories = dev_env_nix_repos,
)
# This will not be needed after merge of the PR to bazel adding proper javadoc filegroups:
# https://github.com/bazelbuild/bazel/pull/7898
# `@javadoc_dev_env//:javadoc` could be then replaced with `@local_jdk//:javadoc` and the below removed
dev_env_tool(
name = "javadoc_dev_env",
tool = "javadoc",
win_tool = "java-openjdk-8u201",
win_include = ["bin", "include", "jre", "lib"],
win_path = "bin/javadoc.exe",
nix_label = "@jdk_nix",
nix_include = ["bin/javadoc"],
nix_path = "bin/javadoc",
name = "javadoc_dev_env",
nix_include = ["bin/javadoc"],
nix_label = "@jdk_nix",
nix_path = "bin/javadoc",
tool = "javadoc",
win_include = [
"bin",
"include",
"jre",
"lib",
],
win_path = "bin/javadoc.exe",
win_tool = "java-openjdk-8u201",
)
# Dummy target //external:python_headers.
@ -360,9 +376,8 @@ bind(
actual = "@com_google_protobuf//util/python:python_headers",
)
load("@ai_formation_hazel//:hazel.bzl", "hazel_repositories", "hazel_custom_package_github", "hazel_custom_package_hackage")
load("@ai_formation_hazel//:hazel.bzl", "hazel_custom_package_github", "hazel_custom_package_hackage", "hazel_repositories")
load("//hazel:packages.bzl", "core_packages", "packages")
load("//bazel_tools:haskell.bzl", "add_extra_packages")
# XXX: We do not have access to an integer-simple version of GHC on Windows.
@ -370,126 +385,187 @@ load("//bazel_tools:haskell.bzl", "add_extra_packages")
use_integer_simple = not is_windows
hazel_repositories(
core_packages = core_packages + {
"integer-simple": "0.1.1.1",
core_packages = core_packages + {
"integer-simple": "0.1.1.1",
# this is a core package, but not reflected in hazel/packages.bzl.
"haskeline": "0.7.4.2",
"Win32": "2.6.1.0",
},
packages = add_extra_packages(
pkgs = packages,
extra =
[ # Read [Working on ghc-lib] for ghc-lib update instructions at
# https://github.com/DACH-NY/daml/blob/master/ghc-lib/working-on-ghc-lib.md
("ghc-lib-parser", {"url": "https://digitalassetsdk.bintray.com/ghc-lib/ghc-lib-parser-0.20190411.1.tar.gz", "stripPrefix": "ghc-lib-parser-0.20190411.1", "sha256": "01e7fe236cdea54d51831d4941772214a843e937dac2d22f7e8a6f6339c87deb"})
, ("ghc-lib", {"url": "https://digitalassetsdk.bintray.com/ghc-lib/ghc-lib-0.20190411.1.tar.gz", "stripPrefix": "ghc-lib-0.20190411.1", "sha256": "1f99517659417225dfe172628cf3154624cc8ab6fb850953033f628f66b86492"})
, ("bytestring-nums", {"version": "0.3.6", "sha256": "bdca97600d91f00bb3c0f654784e3fbd2d62fcf4671820578105487cdf39e7cd"})
, ("unix-time", {"version": "0.4.5", "sha256": "fe7805c62ad682589567afeee265e6e230170c3941cdce479a2318d1c5088faf"})
, ("zip-archive", {"version": "0.3.3", "sha256": "988adee77c806e0b497929b24d5526ea68bd3297427da0d0b30b99c094efc84d"})
, ("js-dgtable", {"version": "0.5.2", "sha256": "e28dd65bee8083b17210134e22e01c6349dc33c3b7bd17705973cd014e9f20ac"})
, ("shake", {"version": "0.17.8", "sha256": "ade4162f7540f044f0446981120800076712d1f98d30c5b5344c0f7828ec49a2"})
, ("filepattern", {"version": "0.1.1", "sha256": "f7fc5bdcfef0d43a793a3c64e7c0fd3b1d35eea97a37f0e69d6612ab255c9b4b"})
, ("terminal-progress-bar", {"version": "0.4.0.1", "sha256": "c5a9720fcbcd9d83f9551e431ee3975c61d7da6432aa687aef0c0e04e59ae277"})
]
),
exclude_packages = [
"arx",
"clock",
"c2hs",
"streaming-commons",
"wai-app-static",
"zlib",
] + (["network"] if is_windows else []),
extra_flags = {
"blaze-textual": { "integer-simple": use_integer_simple },
"cryptonite": { "integer-gmp": not use_integer_simple },
"hashable": { "integer-gmp": not use_integer_simple },
"integer-logarithms": { "integer-gmp": not use_integer_simple},
"text": { "integer-simple": use_integer_simple },
"scientific": { "integer-simple": use_integer_simple },
},
extra_libs = {
"z": "@com_github_madler_zlib//:z",
"ffi": "@com_github_digital_asset_daml//3rdparty/haskell/ffi_windows:ffi" if is_windows else "@libffi_nix//:ffi",
},
ghc_workspaces = {
"k8": "@io_tweag_rules_haskell_ghc-nixpkgs",
"darwin": "@io_tweag_rules_haskell_ghc-nixpkgs",
# although windows is not quite supported yet
"x64_windows": "@io_tweag_rules_haskell_ghc_windows_amd64",
},
# this is a core package, but not reflected in hazel/packages.bzl.
"haskeline": "0.7.4.2",
"Win32": "2.6.1.0",
},
exclude_packages = [
"arx",
"clock",
"c2hs",
"streaming-commons",
"wai-app-static",
"zlib",
] + (["network"] if is_windows else []),
extra_flags = {
"blaze-textual": {"integer-simple": use_integer_simple},
"cryptonite": {"integer-gmp": not use_integer_simple},
"hashable": {"integer-gmp": not use_integer_simple},
"integer-logarithms": {"integer-gmp": not use_integer_simple},
"text": {"integer-simple": use_integer_simple},
"scientific": {"integer-simple": use_integer_simple},
},
extra_libs = {
"z": "@com_github_madler_zlib//:z",
"ffi": "@com_github_digital_asset_daml//3rdparty/haskell/ffi_windows:ffi" if is_windows else "@libffi_nix//:ffi",
},
ghc_workspaces = {
"k8": "@io_tweag_rules_haskell_ghc-nixpkgs",
"darwin": "@io_tweag_rules_haskell_ghc-nixpkgs",
# although windows is not quite supported yet
"x64_windows": "@io_tweag_rules_haskell_ghc_windows_amd64",
},
packages = add_extra_packages(
extra =
[
# Read [Working on ghc-lib] for ghc-lib update instructions at
# https://github.com/DACH-NY/daml/blob/master/ghc-lib/working-on-ghc-lib.md
(
"ghc-lib-parser",
{
"url": "https://digitalassetsdk.bintray.com/ghc-lib/ghc-lib-parser-0.20190411.1.tar.gz",
"stripPrefix": "ghc-lib-parser-0.20190411.1",
"sha256": "01e7fe236cdea54d51831d4941772214a843e937dac2d22f7e8a6f6339c87deb",
},
),
(
"ghc-lib",
{
"url": "https://digitalassetsdk.bintray.com/ghc-lib/ghc-lib-0.20190411.1.tar.gz",
"stripPrefix": "ghc-lib-0.20190411.1",
"sha256": "1f99517659417225dfe172628cf3154624cc8ab6fb850953033f628f66b86492",
},
),
(
"bytestring-nums",
{
"version": "0.3.6",
"sha256": "bdca97600d91f00bb3c0f654784e3fbd2d62fcf4671820578105487cdf39e7cd",
},
),
(
"unix-time",
{
"version": "0.4.5",
"sha256": "fe7805c62ad682589567afeee265e6e230170c3941cdce479a2318d1c5088faf",
},
),
(
"zip-archive",
{
"version": "0.3.3",
"sha256": "988adee77c806e0b497929b24d5526ea68bd3297427da0d0b30b99c094efc84d",
},
),
(
"js-dgtable",
{
"version": "0.5.2",
"sha256": "e28dd65bee8083b17210134e22e01c6349dc33c3b7bd17705973cd014e9f20ac",
},
),
(
"shake",
{
"version": "0.17.8",
"sha256": "ade4162f7540f044f0446981120800076712d1f98d30c5b5344c0f7828ec49a2",
},
),
(
"filepattern",
{
"version": "0.1.1",
"sha256": "f7fc5bdcfef0d43a793a3c64e7c0fd3b1d35eea97a37f0e69d6612ab255c9b4b",
},
),
(
"terminal-progress-bar",
{
"version": "0.4.0.1",
"sha256": "c5a9720fcbcd9d83f9551e431ee3975c61d7da6432aa687aef0c0e04e59ae277",
},
),
],
pkgs = packages,
),
)
c2hs_version = "0.28.3"
c2hs_hash = "80cc6db945ee7c0328043b4e69213b2a1cb0806fb35c8362f9dea4a2c312f1cc"
c2hs_package_id = "c2hs-{0}".format(c2hs_version)
c2hs_url = "https://hackage.haskell.org/package/{0}/{1}.tar.gz".format(
c2hs_package_id,
c2hs_package_id,
c2hs_package_id,
c2hs_package_id,
)
c2hs_build_file = "//3rdparty/haskell:BUILD.c2hs"
http_archive(
name = "haskell_c2hs",
build_file = c2hs_build_file,
sha256 = c2hs_hash,
strip_prefix = c2hs_package_id,
urls = [c2hs_url],
patches = ["@com_github_digital_asset_daml//bazel_tools:haskell-c2hs.patch"],
patch_args = ["-p1"]
name = "haskell_c2hs",
build_file = c2hs_build_file,
patch_args = ["-p1"],
patches = ["@com_github_digital_asset_daml//bazel_tools:haskell-c2hs.patch"],
sha256 = c2hs_hash,
strip_prefix = c2hs_package_id,
urls = [c2hs_url],
)
hazel_custom_package_hackage(
package_name = "clock",
version = "0.7.2",
sha256 = "886601978898d3a91412fef895e864576a7125d661e1f8abc49a2a08840e691f",
build_file = "//3rdparty/haskell:BUILD.clock",
package_name = "clock",
build_file = "//3rdparty/haskell:BUILD.clock",
sha256 = "886601978898d3a91412fef895e864576a7125d661e1f8abc49a2a08840e691f",
version = "0.7.2",
)
# We only use a custom build on Windows
hazel_custom_package_hackage(
package_name = "network",
version = "2.8.0.0",
sha256 = "c8905268b7e3b4cf624a40245bf11b35274a6dd836a5d4d531b5760075645303",
build_file = "//3rdparty/haskell:BUILD.network",
) if is_windows else None
package_name = "network",
build_file = "//3rdparty/haskell:BUILD.network",
sha256 = "c8905268b7e3b4cf624a40245bf11b35274a6dd836a5d4d531b5760075645303",
version = "2.8.0.0",
) if is_windows else None
hazel_custom_package_hackage(
package_name = "zlib",
version = "0.6.2",
sha256 = "0dcc7d925769bdbeb323f83b66884101084167501f11d74d21eb9bc515707fed",
build_file = "//3rdparty/haskell:BUILD.zlib",
package_name = "zlib",
build_file = "//3rdparty/haskell:BUILD.zlib",
sha256 = "0dcc7d925769bdbeb323f83b66884101084167501f11d74d21eb9bc515707fed",
version = "0.6.2",
)
hazel_custom_package_hackage(
package_name = "streaming-commons",
version = "0.2.1.0",
sha256 = "d8d1fe588924479ea7eefce8c6af77dfb373ee6bde7f4691bdfcbd782b36d68d",
build_file = "//3rdparty/haskell:BUILD.streaming-commons",
package_name = "streaming-commons",
build_file = "//3rdparty/haskell:BUILD.streaming-commons",
sha256 = "d8d1fe588924479ea7eefce8c6af77dfb373ee6bde7f4691bdfcbd782b36d68d",
version = "0.2.1.0",
)
hazel_custom_package_github(
package_name = "wai-app-static",
github_user = "nmattia-da",
github_repo = "wai",
strip_prefix = "wai-app-static",
repo_sha = "05179164831432f207f3d43580c51161d519d191",
build_file = "//3rdparty/haskell:BUILD.wai-app-static",
package_name = "wai-app-static",
build_file = "//3rdparty/haskell:BUILD.wai-app-static",
github_repo = "wai",
github_user = "nmattia-da",
repo_sha = "05179164831432f207f3d43580c51161d519d191",
strip_prefix = "wai-app-static",
)
hazel_custom_package_github(
package_name = "arx",
github_user = "solidsnack",
github_repo = "arx",
repo_sha = "7561fed76bb613302d1ae104f0eb2ad13daa9fac",
build_file = "//3rdparty/haskell:BUILD.arx",
patches = ["@com_github_digital_asset_daml//bazel_tools:haskell-arx.patch"],
patch_args = ["-p1"],
package_name = "arx",
build_file = "//3rdparty/haskell:BUILD.arx",
github_repo = "arx",
github_user = "solidsnack",
patch_args = ["-p1"],
patches = ["@com_github_digital_asset_daml//bazel_tools:haskell-arx.patch"],
repo_sha = "7561fed76bb613302d1ae104f0eb2ad13daa9fac",
)
load("//bazel_tools:java.bzl", "java_home_runtime")
java_home_runtime(name = "java_home")
# rules_go used here to compile a wrapper around the protoc-gen-scala plugin
@ -498,9 +574,6 @@ load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_depe
nixpkgs_package(
name = "go_nix",
attribute_path = "go",
nix_file = "//nix:bazel.nix",
nix_file_deps = common_nix_file_deps,
repositories = dev_env_nix_repos,
build_file_content = """
filegroup(
name = "sdk",
@ -508,14 +581,14 @@ nixpkgs_package(
visibility = ["//visibility:public"],
)
""",
nix_file = "//nix:bazel.nix",
nix_file_deps = common_nix_file_deps,
repositories = dev_env_nix_repos,
)
nixpkgs_package(
name = "libffi_nix",
attribute_path = "libffi.dev",
nix_file = "//nix:bazel.nix",
nix_file_deps = common_nix_file_deps,
repositories = dev_env_nix_repos,
build_file_content = """
package(default_visibility = ["//visibility:public"])
@ -530,6 +603,9 @@ cc_library(
strip_include_prefix = "include",
)
""",
nix_file = "//nix:bazel.nix",
nix_file_deps = common_nix_file_deps,
repositories = dev_env_nix_repos,
)
# A repository that generates the Go SDK imports, see
@ -544,51 +620,59 @@ load("@io_bazel_rules_go//go:deps.bzl", "go_wrap_sdk")
# On Nix platforms we use the Nix provided Go SDK, on Windows we let Bazel pull
# an upstream one.
go_wrap_sdk(
name = "go_sdk",
root_file = "@go_nix//:share/go/README.md",
) if not is_windows else None
name = "go_sdk",
root_file = "@go_nix//:share/go/README.md",
) if not is_windows else None
go_rules_dependencies()
go_register_toolchains()
load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies", "go_repository")
gazelle_dependencies()
# protoc-gen-doc repo
go_repository(
name = "com_github_pseudomuto_protoc_gen_doc",
importpath = "github.com/pseudomuto/protoc-gen-doc",
commit = "0c4d666cfe1175663cf067963396a0b9b34f543f",
importpath = "github.com/pseudomuto/protoc-gen-doc",
)
# protokit repo
go_repository(
name = "com_github_pseudomuto_protokit",
importpath = "github.com/pseudomuto/protokit",
commit = "7037620bf27b13fcdc10b1b17ddef82540db670b",
importpath = "github.com/pseudomuto/protokit",
)
load(
'@io_bazel_rules_scala//scala:scala.bzl',
'scala_repositories'
"@io_bazel_rules_scala//scala:scala.bzl",
"scala_repositories",
)
scala_repositories(("2.12.6", {
"scala_compiler": "3023b07cc02f2b0217b2c04f8e636b396130b3a8544a8dfad498a19c3e57a863",
"scala_library": "f81d7144f0ce1b8123335b72ba39003c4be2870767aca15dd0888ba3dab65e98",
"scala_reflect": "ffa70d522fc9f9deec14358aa674e6dd75c9dfa39d4668ef15bb52f002ce99fa"
}))
load('@io_bazel_rules_scala//scala:toolchains.bzl', 'scala_register_toolchains')
scala_repositories((
"2.12.6",
{
"scala_compiler": "3023b07cc02f2b0217b2c04f8e636b396130b3a8544a8dfad498a19c3e57a863",
"scala_library": "f81d7144f0ce1b8123335b72ba39003c4be2870767aca15dd0888ba3dab65e98",
"scala_reflect": "ffa70d522fc9f9deec14358aa674e6dd75c9dfa39d4668ef15bb52f002ce99fa",
},
))
load("@io_bazel_rules_scala//scala:toolchains.bzl", "scala_register_toolchains")
scala_register_toolchains()
load("@io_bazel_rules_scala//jmh:jmh.bzl", "jmh_repositories")
jmh_repositories()
dev_env_package(
name = "nodejs_dev_env",
nix_label = "@node_nix",
win_tool = "nodejs-10.12.0",
symlink_path = "nodejs_dev_env",
name = "nodejs_dev_env",
nix_label = "@node_nix",
symlink_path = "nodejs_dev_env",
win_tool = "nodejs-10.12.0",
)
# Setup the Node.js toolchain
@ -617,41 +701,47 @@ ts_setup_workspace()
# TODO use fine-grained managed dependency
yarn_install(
name = "daml_extension_deps",
package_json = "//daml-foundations/daml-tools/daml-extension:package.json",
yarn_lock = "//daml-foundations/daml-tools/daml-extension:yarn.lock",
name = "daml_extension_deps",
package_json = "//daml-foundations/daml-tools/daml-extension:package.json",
yarn_lock = "//daml-foundations/daml-tools/daml-extension:yarn.lock",
)
# TODO use fine-grained managed dependency
yarn_install(
name = "language_server_tests_deps",
package_json = "//daml-foundations/daml-tools/language-server-tests:package.json",
yarn_lock = "//daml-foundations/daml-tools/language-server-tests:yarn.lock",
name = "language_server_tests_deps",
package_json = "//daml-foundations/daml-tools/language-server-tests:package.json",
yarn_lock = "//daml-foundations/daml-tools/language-server-tests:yarn.lock",
)
# TODO use fine-grained managed dependency
yarn_install(
name = "navigator_frontend_deps",
package_json = "//navigator/frontend:package.json",
yarn_lock = "//navigator/frontend:yarn.lock",
name = "navigator_frontend_deps",
package_json = "//navigator/frontend:package.json",
yarn_lock = "//navigator/frontend:yarn.lock",
)
# Bazel Skydoc - Build rule documentation generator
load("@io_bazel_rules_sass//:package.bzl", "rules_sass_dependencies")
rules_sass_dependencies()
load("@io_bazel_rules_sass//:defs.bzl", "sass_repositories")
sass_repositories()
load("//3rdparty:workspace.bzl", "maven_dependencies")
maven_dependencies()
load("@io_bazel_skydoc//skylark:skylark.bzl", "skydoc_repositories")
skydoc_repositories()
# We usually use the _deploy_jar target to produce self-contained jars, but here we're using jar_jar because the size
# of codegen tool is substantially reduced (as shown below) and that the presence of JVM internal com.sun classes could
# theoretically stop the codegen running against JVMs other the OpenJDK 8 (the current JVM used for building).
load("@com_github_johnynek_bazel_jar_jar//:jar_jar.bzl", "jar_jar_repositories")
jar_jar_repositories()
# The following is advertised by rules_proto, but we define our own dependencies
@ -664,4 +754,18 @@ jar_jar_repositories()
# Load the grpc deps last, since it won't try to load already loaded
# dependencies.
load("@com_github_grpc_grpc//bazel:grpc_deps.bzl", "grpc_deps")
grpc_deps()
# Buildifier.
# It is written in Go and hence needs rules_go to be available.
http_archive(
name = "com_github_bazelbuild_buildtools",
sha256 = "7525deb4d74e3aa4cb2b960da7d1c400257a324be4e497f75d265f2f508c518f",
strip_prefix = "buildtools-0.22.0",
url = "https://github.com/bazelbuild/buildtools/archive/0.22.0.tar.gz",
)
load("@com_github_bazelbuild_buildtools//buildifier:deps.bzl", "buildifier_dependencies")
buildifier_dependencies()

View File

@ -3,17 +3,18 @@
# Export Bazel sources for Bazel API docs.
exports_files(
[ "haskell.bzl",
"scala.bzl",
"haskell-c2hs.patch",
"haskell-static-linking.patch",
"haskell-hazel-shorten-source-dirs.patch",
"haskell-arx.patch",
"haskell-win-sys-includes.patch",
"hackage_mirror.patch",
"haskell-ld-library-path.patch",
"haskell-win-so-name.patch",
"pom_template.xml",
[
"haskell.bzl",
"scala.bzl",
"haskell-c2hs.patch",
"haskell-static-linking.patch",
"haskell-hazel-shorten-source-dirs.patch",
"haskell-arx.patch",
"haskell-win-sys-includes.patch",
"hackage_mirror.patch",
"haskell-ld-library-path.patch",
"haskell-win-so-name.patch",
"pom_template.xml",
],
visibility = ["//:__subpackages__"]
visibility = ["//:__subpackages__"],
)

View File

@ -2,4 +2,7 @@
# SPDX-License-Identifier: Apache-2.0
# Export Bazel sources for Bazel API docs.
exports_files(["client_server_test.bzl"], visibility = ["//bazel_tools/docs:__pkg__"])
exports_files(
["client_server_test.bzl"],
visibility = ["//bazel_tools/docs:__pkg__"],
)

View File

@ -2,61 +2,60 @@
# SPDX-License-Identifier: Apache-2.0
def _expand_args(ctx, args):
return " ".join([ ctx.expand_location(a, ctx.attr.data).replace("'", "'\\''") for a in args])
return " ".join([ctx.expand_location(a, ctx.attr.data).replace("'", "'\\''") for a in args])
def _client_server_test_impl(ctx):
# Construct wrapper to execute the runner, which in turn
# will start the client and server.
wrapper = ctx.actions.declare_file(ctx.label.name + "_wrapper.sh")
ctx.actions.write(
output = wrapper,
content = """#!/usr/bin/env bash
# Construct wrapper to execute the runner, which in turn
# will start the client and server.
wrapper = ctx.actions.declare_file(ctx.label.name + "_wrapper.sh")
ctx.actions.write(
output = wrapper,
content = """#!/usr/bin/env bash
{runner} '{client}' '{client_args}' '{server}' '{server_args}'
""".format(
runner = ctx.executable._runner.short_path,
client = ctx.executable.client.short_path,
client_args = _expand_args(ctx, ctx.attr.client_args),
server = ctx.executable.server.short_path,
server_args = _expand_args(ctx, ctx.attr.server_args),
),
is_executable = True
)
runner = ctx.executable._runner.short_path,
client = ctx.executable.client.short_path,
client_args = _expand_args(ctx, ctx.attr.client_args),
server = ctx.executable.server.short_path,
server_args = _expand_args(ctx, ctx.attr.server_args),
),
is_executable = True,
)
runfiles = ctx.runfiles(files = [wrapper], collect_data = True)
runfiles = runfiles.merge(ctx.attr._runner[DefaultInfo].default_runfiles)
runfiles = runfiles.merge(ctx.attr.client[DefaultInfo].default_runfiles)
runfiles = runfiles.merge(ctx.attr.server[DefaultInfo].default_runfiles)
runfiles = ctx.runfiles(files = [wrapper], collect_data = True)
runfiles = runfiles.merge(ctx.attr._runner[DefaultInfo].default_runfiles)
runfiles = runfiles.merge(ctx.attr.client[DefaultInfo].default_runfiles)
runfiles = runfiles.merge(ctx.attr.server[DefaultInfo].default_runfiles)
return DefaultInfo(
executable = wrapper,
files = depset([wrapper]),
runfiles = runfiles,
)
return DefaultInfo(
executable = wrapper,
files = depset([wrapper]),
runfiles = runfiles,
)
client_server_test = rule(
implementation = _client_server_test_impl,
test = True,
executable = True,
attrs = {
"_runner": attr.label(
cfg = "host",
allow_single_file = True,
executable = True,
default = Label("@//bazel_tools/client_server_test/runner:runner"),
),
"client": attr.label(
cfg = "target",
executable = True,
),
"client_args": attr.string_list(),
"server": attr.label(
cfg = "target",
executable = True,
),
"server_args": attr.string_list(),
"data": attr.label_list(allow_files = True),
},
implementation = _client_server_test_impl,
test = True,
executable = True,
attrs = {
"_runner": attr.label(
cfg = "host",
allow_single_file = True,
executable = True,
default = Label("@//bazel_tools/client_server_test/runner:runner"),
),
"client": attr.label(
cfg = "target",
executable = True,
),
"client_args": attr.string_list(),
"server": attr.label(
cfg = "target",
executable = True,
),
"server_args": attr.string_list(),
"data": attr.label_list(allow_files = True),
},
)
"""Create a client-server test.

View File

@ -1,12 +1,11 @@
# Copyright (c) 2019 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")
load("//bazel_tools:haskell.bzl", "da_haskell_binary")
da_haskell_binary(
name = "runner",
srcs = ["Main.hs"],
deps = [],
hazel_deps = [
"base",
"process",
@ -20,5 +19,5 @@ da_haskell_binary(
"split",
],
visibility = ["//visibility:public"],
deps = [],
)

View File

@ -2,45 +2,43 @@
# SPDX-License-Identifier: Apache-2.0
load(
"//bazel_tools/client_server_test:client_server_test.bzl",
"client_server_test"
"//bazel_tools/client_server_test:client_server_test.bzl",
"client_server_test",
)
load(
"//bazel_tools:scala.bzl",
"da_scala_binary",
"//bazel_tools:scala.bzl",
"da_scala_binary",
)
sh_binary(
name = "client",
srcs = ["client.sh"],
name = "client",
srcs = ["client.sh"],
)
exports_files(["client_input_file"])
da_scala_binary(
name = "server",
main_class = "Main",
srcs = ["server.scala"],
deps = [
"//3rdparty/jvm/com/github/scopt:scopt",
],
name = "server",
srcs = ["server.scala"],
main_class = "Main",
deps = [
"//3rdparty/jvm/com/github/scopt",
],
)
client_server_test(
name = "test",
client = ":client",
client_args = [
"--foobar",
# Use the input file passed in via `data`.
"$(location :client_input_file)"
],
server = ":server",
name = "test",
timeout = "short",
client = ":client",
client_args = [
"--foobar",
# Use the input file passed in via `data`.
"$(location :client_input_file)",
],
# Data files available to both client and server.
data = [
":client_input_file"
],
timeout="short",
# Data files available to both client and server.
data = [
":client_input_file",
],
server = ":server",
)

View File

@ -1,3 +1,2 @@
# Copyright (c) 2019 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

View File

@ -15,12 +15,12 @@ exports_files(srcs=all_files)
def _dev_env_package_impl(ctx):
if get_cpu_value(ctx) == "x64_windows":
ps = ctx.which("powershell")
ps_result = ctx.execute([ps, "-Command", "dadew enable; dadew where"], quiet=True)
ps_result = ctx.execute([ps, "-Command", "dadew enable; dadew where"], quiet = True)
if ps_result.return_code != 0:
fail("Failed to obtain dadew location.\n Exit code %d.\n%s\n%s" %
(ps_result.return_code, ps_result.stdout, ps_result.stderr))
(ps_result.return_code, ps_result.stdout, ps_result.stderr))
dadew = ps_result.stdout.splitlines(keepends=False)[0]
dadew = ps_result.stdout.splitlines(keepends = False)[0]
tool_home = "%s\\scoop\\apps\\%s\\current" % (dadew, ctx.attr.win_tool)
else:
tool_home = "../%s" % ctx.attr.nix_label.name
@ -29,9 +29,9 @@ def _dev_env_package_impl(ctx):
build_path = ctx.path("BUILD")
build_content = _dev_env_package_build_template.format(
rule_name = ctx.name
rule_name = ctx.name,
)
ctx.file(build_path, content=build_content, executable=False)
ctx.file(build_path, content = build_content, executable = False)
dev_env_package = repository_rule(
implementation = _dev_env_package_impl,

View File

@ -27,20 +27,20 @@ config_setting(
def _dev_env_tool_impl(ctx):
if get_cpu_value(ctx) == "x64_windows":
ps = ctx.which("powershell")
ps_result = ctx.execute([ps, "-Command", "dadew enable; dadew where"], quiet=True)
ps_result = ctx.execute([ps, "-Command", "dadew enable; dadew where"], quiet = True)
if ps_result.return_code != 0:
fail("Failed to obtain dadew location.\n Exit code %d.\n%s\n%s" %
(ps_result.return_code, ps_result.stdout, ps_result.stderr))
(ps_result.return_code, ps_result.stdout, ps_result.stderr))
dadew = ps_result.stdout.splitlines(keepends=False)[0]
dadew = ps_result.stdout.splitlines(keepends = False)[0]
tool_home = "%s\\scoop\\apps\\%s\\current" % (dadew, ctx.attr.win_tool)
for i in ctx.attr.win_include:
ctx.symlink("%s\\%s"%(tool_home, i), "%s\\%s"%(ctx.path(""), i))
ctx.symlink("%s\\%s" % (tool_home, i), "%s\\%s" % (ctx.path(""), i))
else:
tool_home = "../%s" % ctx.attr.nix_label.name
for i in ctx.attr.nix_include:
ctx.symlink("%s/%s"%(tool_home, i), "%s/%s"%(ctx.path(""), i))
ctx.symlink("%s/%s" % (tool_home, i), "%s/%s" % (ctx.path(""), i))
build_path = ctx.path("BUILD")
build_content = _dev_env_tool_build_template.format(
@ -51,7 +51,7 @@ def _dev_env_tool_impl(ctx):
lbrace = "{",
rbrace = "}",
)
ctx.file(build_path, content=build_content, executable=False)
ctx.file(build_path, content = build_content, executable = False)
dev_env_tool = repository_rule(
implementation = _dev_env_tool_impl,

View File

@ -7,14 +7,14 @@ def da_doc_package(**args):
native.filegroup(
name = src_name,
srcs = native.glob(["source/**"]),
)
)
prepare = args.get("prepare", "")
extra_srcs = args.get("extra_srcs", [])
native.genrule(
name = args["name"],
outs = ["sources.tar.gz"],
srcs = [src_name, "@tar_dev_env//:tar", "@gzip_dev_env//:gzip"] + extra_srcs,
cmd = """
name = args["name"],
outs = ["sources.tar.gz"],
srcs = [src_name, "@tar_dev_env//:tar", "@gzip_dev_env//:gzip"] + extra_srcs,
cmd = """
export PATH=$$(dirname $(location {gzip})):$$PATH
# Bazel makes it fairly hard to get the directory in a robust way so
# we take the first file and strip everything after source.
@ -23,9 +23,9 @@ def da_doc_package(**args):
{prepare}
$(location {tar}) czhf $(location sources.tar.gz) -C $$BASEDIR source
""".format(
srcs = ":" + src_name,
prepare = prepare,
tar = "@tar_dev_env//:tar",
gzip = "@gzip_dev_env//:gzip",
)
)
srcs = ":" + src_name,
prepare = prepare,
tar = "@tar_dev_env//:tar",
gzip = "@gzip_dev_env//:gzip",
),
)

View File

@ -7,6 +7,7 @@ def _fat_cc_library_impl(ctx):
input_lib = ctx.attr.input_lib
cc_info = input_lib[CcInfo]
static_libs = []
# For now we assume that we have static PIC libs for all libs.
# It should be possible to extend this but we do not have a need
# for it so far and it would complicate things.
@ -19,7 +20,7 @@ def _fat_cc_library_impl(ctx):
static_lib = lib.static_library
else:
fail("No (PIC) static library found for '{}'.".format(
str(lib.dynamic_library.path)
str(lib.dynamic_library.path),
))
static_libs += [static_lib]
@ -51,13 +52,13 @@ def _fat_cc_library_impl(ctx):
# On Windows some libs seems to depend on Windows sockets
(["-lws2_32"] if is_windows else []),
inputs = static_libs,
env = {"PATH": ""},
env = {"PATH": ""},
)
mri_script_content = "\n".join(
["create {}".format(static_lib.path)] +
["addlib {}".format(lib.path) for lib in static_libs] +
["save", "end"]
["save", "end"],
) + "\n"
mri_script = ctx.actions.declare_file(ctx.label.name + "_mri")
@ -75,7 +76,7 @@ def _fat_cc_library_impl(ctx):
inputs = static_libs,
arguments =
["-no_warning_for_no_symbols", "-static", "-o", static_lib.path] +
[f.path for f in static_libs]
[f.path for f in static_libs],
)
else:
ctx.actions.run_shell(
@ -123,12 +124,11 @@ fat_cc_library = rule(
),
"_cc_compiler": attr.label(
allow_files = True,
executable =True,
executable = True,
cfg = "host",
default =
# bin/cc is gcc on Darwin which fails to find libc++
Label("@nixpkgs_cc_toolchain//:bin/clang") if is_darwin
else None,
Label("@nixpkgs_cc_toolchain//:bin/clang") if is_darwin else None,
),
"whole_archive_flag": attr.string_list(
# ld on MacOS doesnt understand --whole-archive

View File

@ -3,20 +3,20 @@
load(
"@io_tweag_rules_haskell//haskell:haskell.bzl",
"haskell_library",
"haskell_binary",
"haskell_test",
"haskell_library",
"haskell_repl",
"haskell_test",
)
load("@io_tweag_rules_haskell//haskell:c2hs.bzl",
load(
"@io_tweag_rules_haskell//haskell:c2hs.bzl",
"c2hs_library",
)
load(
"@ai_formation_hazel//:hazel.bzl",
"hazel_library",
)
load ("//bazel_tools:hlint.bzl", "haskell_hlint")
load("//bazel_tools:hlint.bzl", "haskell_hlint")
load("@os_info//:os_info.bzl", "is_windows")
# This file defines common Haskell language extensions and compiler flags used
@ -51,17 +51,21 @@ common_haskell_exts = [
]
common_haskell_flags = [
"-Wall", "-Werror", "-Wincomplete-uni-patterns", "-Wno-name-shadowing",
"-fno-omit-yields",
"-threaded", "-rtsopts",
"-Wall",
"-Werror",
"-Wincomplete-uni-patterns",
"-Wno-name-shadowing",
"-fno-omit-yields",
"-threaded",
"-rtsopts",
# run on two cores, disable idle & parallel GC
"-with-rtsopts=-N2 -qg -I0",
# run on two cores, disable idle & parallel GC
"-with-rtsopts=-N2 -qg -I0",
]
def _wrap_rule(rule, name = "", deps = [], hazel_deps = [], compiler_flags = [], **kwargs):
ext_flags = [ "-X%s" % ext for ext in common_haskell_exts ]
hazel_libs = [ hazel_library(dep) for dep in hazel_deps ]
ext_flags = ["-X%s" % ext for ext in common_haskell_exts]
hazel_libs = [hazel_library(dep) for dep in hazel_deps]
rule(
name = name,
compiler_flags = ext_flags + common_haskell_flags + compiler_flags,
@ -76,6 +80,7 @@ def _wrap_rule(rule, name = "", deps = [], hazel_deps = [], compiler_flags = [],
deps = [name],
testonly = True,
)
# Load Main module on executable rules.
repl_ghci_commands = []
if "main_function" in kwargs:
@ -105,7 +110,7 @@ def _wrap_rule(rule, name = "", deps = [], hazel_deps = [], compiler_flags = [],
collect_data = select({
"//:ghci_data": True,
"//conditions:default": False,
})
}),
)
def da_haskell_library(**kwargs):
@ -138,7 +143,6 @@ def da_haskell_library(**kwargs):
"""
_wrap_rule(haskell_library, **kwargs)
def da_haskell_binary(main_function = "Main.main", **kwargs):
"""
Define a Haskell executable.
@ -175,7 +179,6 @@ def da_haskell_binary(main_function = "Main.main", **kwargs):
**kwargs
)
def da_haskell_test(main_function = "Main.main", testonly = True, **kwargs):
"""
Define a Haskell test suite.
@ -215,7 +218,6 @@ def da_haskell_test(main_function = "Main.main", testonly = True, **kwargs):
**kwargs
)
def da_haskell_repl(**kwargs):
"""
Define a Haskell repl.
@ -255,43 +257,43 @@ def da_haskell_repl(**kwargs):
```
"""
# The common_haskell_exts and common_haskell_flags are already passed on
# the library/binary/test rule wrappers. haskell_repl will pick these up
# automatically, if such targets are loaded by source.
# Right now we don't set any default flags.
haskell_repl(**kwargs)
def _sanitize_string_for_usage(s):
res_array = []
for idx in range(len(s)):
c = s[idx]
if c.isalnum() or c == ".":
res_array.append(c)
else:
res_array.append("_")
return "".join(res_array)
res_array = []
for idx in range(len(s)):
c = s[idx]
if c.isalnum() or c == ".":
res_array.append(c)
else:
res_array.append("_")
return "".join(res_array)
def c2hs_suite(name, hazel_deps, deps = [], srcs=[], c2hs_srcs=[], c2hs_src_strip_prefix="", **kwargs):
ts = []
for file in c2hs_srcs:
n = _sanitize_string_for_usage(file)
c2hs_library(
name = n,
srcs = [file],
deps = deps + [ ':' + t for t in ts ],
src_strip_prefix = c2hs_src_strip_prefix,
def c2hs_suite(name, hazel_deps, deps = [], srcs = [], c2hs_srcs = [], c2hs_src_strip_prefix = "", **kwargs):
ts = []
for file in c2hs_srcs:
n = _sanitize_string_for_usage(file)
c2hs_library(
name = n,
srcs = [file],
deps = deps + [":" + t for t in ts],
src_strip_prefix = c2hs_src_strip_prefix,
)
ts.append(n)
da_haskell_library(
name = name,
srcs = [":" + t for t in ts] + srcs,
deps = deps,
hazel_deps = hazel_deps,
**kwargs
)
ts.append(n)
da_haskell_library(
name = name,
srcs = [ ':' + t for t in ts ] + srcs,
deps = deps,
hazel_deps = hazel_deps,
**kwargs
)
# Add extra packages, e.g., packages that are on Hackage but not in Stackage.
# This cannot be inlined since it is impossible to create a struct in WORKSPACE.
def add_extra_packages(pkgs, extra):
return pkgs + { k: struct(**v) for (k, v) in extra }
return pkgs + {k: struct(**v) for (k, v) in extra}

View File

@ -32,16 +32,18 @@ def _haskell_hlint_rule_impl(ctx):
def _haskell_hlint_aspect_impl(target, ctx):
inputFiles = []
inputPaths = []
if hasattr(ctx.rule.attr, 'srcs'):
if hasattr(ctx.rule.attr, "srcs"):
for src in ctx.rule.attr.srcs:
for f in src.files:
# We want to only do native Haskell source files, which
# seems to involve ignoring these generated paths
# (the f.is_source almost always returns True)
if all([f.path.endswith(".hs")
,f.path.startswith("external/") == False
,f.path.startswith("bazel-out/") == False
,f.path.startswith("nix/") == False]):
if all([
f.path.endswith(".hs"),
f.path.startswith("external/") == False,
f.path.startswith("bazel-out/") == False,
f.path.startswith("nix/") == False,
]):
inputFiles.append(f)
inputPaths.append(f.path)
@ -68,7 +70,6 @@ def _haskell_hlint_aspect_impl(target, ctx):
output_files = OutputGroupInfo(default = outputs)
return [lint_info, output_files]
haskell_hlint_aspect = aspect(
_haskell_hlint_aspect_impl,
attr_aspects = ["deps"],
@ -93,5 +94,5 @@ haskell_hlint = rule(
aspects = [haskell_hlint_aspect],
doc = "List of Haskell targets to lint.",
),
}
},
)

View File

@ -19,7 +19,7 @@ def _java_home_runtime_impl(ctx):
name = "javabase",
java_home = ctx.path(java_home),
)
ctx.file("BUILD", content=build_content, executable=False)
ctx.file("BUILD", content = build_content, executable = False)
java_home_runtime = repository_rule(
implementation = _java_home_runtime_impl,

View File

@ -2,4 +2,7 @@
# SPDX-License-Identifier: Apache-2.0
# Export Bazel sources for Bazel API docs.
exports_files(["java_test_suite.bzl"], visibility = ["//bazel_tools/docs:__pkg__"])
exports_files(
["java_test_suite.bzl"],
visibility = ["//bazel_tools/docs:__pkg__"],
)

View File

@ -3,25 +3,23 @@
# Taken from https://github.com/bazelbuild/rules_scala/blob/2676400bed17b03fdd0fe13a8794eb0ff0129284/scala/scala.bzl#L413
def _sanitize_string_for_usage(s):
res_array = []
for idx in range(len(s)):
c = s[idx]
if c.isalnum() or c == ".":
res_array.append(c)
else:
res_array.append("_")
return "".join(res_array)
res_array = []
for idx in range(len(s)):
c = s[idx]
if c.isalnum() or c == ".":
res_array.append(c)
else:
res_array.append("_")
return "".join(res_array)
def _junit_class_name(test_file, strip):
(_, _, stripped) = test_file.partition(strip)
(sansext, _, _) = stripped.rpartition('.')
c = sansext.replace('/', '.')
return c
(_, _, stripped) = test_file.partition(strip)
(sansext, _, _) = stripped.rpartition(".")
c = sansext.replace("/", ".")
return c
# Similar to https://github.com/bazelbuild/rules_scala/blob/2676400bed17b03fdd0fe13a8794eb0ff0129284/scala/scala.bzl#L425
def java_test_suite(name, srcs=[], strip='', visibility = None, **kwargs):
def java_test_suite(name, srcs = [], strip = "", visibility = None, **kwargs):
"""Define a Java test-suite.
Generates a java_test for each given source file and bundles them in a

View File

@ -1,4 +1,7 @@
# Copyright (c) 2019 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
exports_files(["packaging.bzl", "package-app.sh"])
exports_files([
"packaging.bzl",
"package-app.sh",
])

View File

@ -3,22 +3,21 @@
"""Packaging of Linux and macOS binaries into tarballs"""
def _package_app_impl(ctx):
files = depset(ctx.attr.binary.files)
runfiles = ctx.attr.binary.default_runfiles.files
datafiles = ctx.attr.binary[DefaultInfo].data_runfiles.files
files = depset(ctx.attr.binary.files)
runfiles = ctx.attr.binary.default_runfiles.files
datafiles = ctx.attr.binary[DefaultInfo].data_runfiles.files
args = ctx.actions.args()
inputs = depset([], transitive = [files, runfiles, datafiles] + [r.files for r in ctx.attr.resources])
ctx.actions.run_shell(
outputs = [ctx.outputs.out],
inputs =
[ctx.executable.package_app, ctx.executable.patchelf, ctx.executable.tar, ctx.executable.gzip]
+ inputs.to_list(),
arguments = [args],
progress_message = "Packaging " + ctx.attr.name,
command = """
args = ctx.actions.args()
inputs = depset([], transitive = [files, runfiles, datafiles] + [r.files for r in ctx.attr.resources])
ctx.actions.run_shell(
outputs = [ctx.outputs.out],
inputs =
[ctx.executable.package_app, ctx.executable.patchelf, ctx.executable.tar, ctx.executable.gzip] +
inputs.to_list(),
arguments = [args],
progress_message = "Packaging " + ctx.attr.name,
command = """
set -eu
export PATH=$PATH:$PWD/`dirname {patchelf}`:$PWD/`dirname {tar}`:$PWD/`dirname {gzip}`
{package_app} \
@ -26,78 +25,79 @@ def _package_app_impl(ctx):
"$PWD/{output}" \
{resources}
""".format(
patchelf = ctx.executable.patchelf.path,
tar = ctx.executable.tar.path,
gzip = ctx.executable.gzip.path,
output = ctx.outputs.out.path,
name = ctx.attr.name,
package_app = ctx.executable.package_app.path,
binary = ctx.executable.binary.path,
resources = " ".join([
_get_resource_path(r)
for r in ctx.attr.resources
])
patchelf = ctx.executable.patchelf.path,
tar = ctx.executable.tar.path,
gzip = ctx.executable.gzip.path,
output = ctx.outputs.out.path,
name = ctx.attr.name,
package_app = ctx.executable.package_app.path,
binary = ctx.executable.binary.path,
resources = " ".join([
_get_resource_path(r)
for r in ctx.attr.resources
]),
),
)
)
def _get_resource_path(r):
"""Get the path to use for a resource.
If the resource has a single file, it'll be copied to
the resource root directory. With multiple files the
relative directory structure is preserved.
"""Get the path to use for a resource.
If the resource has a single file, it'll be copied to
the resource root directory. With multiple files the
relative directory structure is preserved.
This mirrors how rules that produce directories work
in Buck.
"""
files = r.files.to_list()
if len(files) > 1:
first_file = files[0].path
prefix_end = first_file.index(r.label.package)
# e.g. package foo/bar,
# first file at bazel-out/k8-fastbuild/bleh/foo/bar/baz/quux
# return path as bazel-out/k8-fastbuild/bleh/foo/bar.
return first_file[0:(prefix_end + len(r.label.package))]
else:
return files[0].path
This mirrors how rules that produce directories work
in Buck.
"""
files = r.files.to_list()
if len(files) > 1:
first_file = files[0].path
prefix_end = first_file.index(r.label.package)
# e.g. package foo/bar,
# first file at bazel-out/k8-fastbuild/bleh/foo/bar/baz/quux
# return path as bazel-out/k8-fastbuild/bleh/foo/bar.
return first_file[0:(prefix_end + len(r.label.package))]
else:
return files[0].path
package_app = rule(
implementation = _package_app_impl,
attrs = dict({
"binary": attr.label(
cfg = "target",
executable = True
),
"resources": attr.label_list(
allow_files = True
),
"patchelf": attr.label(
default = Label("@patchelf_nix//:bin/patchelf"),
cfg = "host",
executable = True,
allow_files = True
),
"tar": attr.label(
default = Label("@tar_dev_env//:tar"),
cfg = "host",
executable = True,
allow_files = True
),
"gzip": attr.label(
default = Label("@gzip_dev_env//:gzip"),
cfg = "host",
executable = True,
allow_files = True
),
"package_app": attr.label(
default = Label("//bazel_tools/packaging:package-app.sh"),
cfg = "host",
executable = True,
allow_files = True
)
}),
outputs = {
"out": "%{name}.tar.gz",
}
implementation = _package_app_impl,
attrs = dict({
"binary": attr.label(
cfg = "target",
executable = True,
),
"resources": attr.label_list(
allow_files = True,
),
"patchelf": attr.label(
default = Label("@patchelf_nix//:bin/patchelf"),
cfg = "host",
executable = True,
allow_files = True,
),
"tar": attr.label(
default = Label("@tar_dev_env//:tar"),
cfg = "host",
executable = True,
allow_files = True,
),
"gzip": attr.label(
default = Label("@gzip_dev_env//:gzip"),
cfg = "host",
executable = True,
allow_files = True,
),
"package_app": attr.label(
default = Label("//bazel_tools/packaging:package-app.sh"),
cfg = "host",
executable = True,
allow_files = True,
),
}),
outputs = {
"out": "%{name}.tar.gz",
},
)
"""Package a binary along with its dynamic library dependencies and data dependencies
into a tarball. The data dependencies are placed in 'resources' directory.

View File

@ -262,4 +262,3 @@ def pkg_tar(**kwargs):
"Consider renaming it in your BUILD file.")
kwargs["srcs"] = kwargs.pop("files")
_real_pkg_tar(**kwargs)

View File

@ -98,17 +98,18 @@ def _collect_maven_info_impl(_target, ctx):
deps = depset([], transitive = [depset([d]) for d in _maven_coordinates(deps + exports + jars)])
filtered_deps = [
d for d in deps
if not (only_external_deps and (d.split(":")[0].startswith("com.daml") or
d.split(":")[0].startswith("com.digitalasset")))
d
for d in deps
if not (only_external_deps and (d.split(":")[0].startswith("com.daml") or
d.split(":")[0].startswith("com.digitalasset")))
]
if maven_coordinates:
return [
MavenInfo(
maven_coordinates = maven_coordinates,
maven_dependencies = [] if fat_jar else filtered_deps
)
maven_dependencies = [] if fat_jar else filtered_deps,
),
]
else:
return _EMPTY_MAVEN_INFO
@ -152,7 +153,7 @@ def _pom_file(ctx):
maven_coordinates = ctx.attr.target[MavenInfo].maven_coordinates.split(":")
groupId = maven_coordinates[0]
artifactId = maven_coordinates[1]
version= maven_coordinates[2]
version = maven_coordinates[2]
formatted_deps = []
for dep in [":".join(d) for d in sorted([d.split(":") for d in mvn_deps])]:

View File

@ -3,7 +3,6 @@
load("//bazel_tools:pkg.bzl", "pkg_tar")
# taken from rules_proto:
# https://github.com/stackb/rules_proto/blob/f5d6eea6a4528bef3c1d3a44d486b51a214d61c2/compile.bzl#L369-L393
def get_plugin_runfiles(tool, plugin_runfiles):
@ -47,10 +46,10 @@ def _proto_gen_impl(ctx):
args = []
args += [
"--descriptor_set_in=" + descriptor_set_delim.join([d.path for d in descriptors])
"--descriptor_set_in=" + descriptor_set_delim.join([d.path for d in descriptors]),
]
args += [
"--{}_out={}:{}".format(ctx.attr.plugin_name, ",".join(ctx.attr.plugin_options), sources_out.path)
"--{}_out={}:{}".format(ctx.attr.plugin_name, ",".join(ctx.attr.plugin_options), sources_out.path),
]
plugins = []
plugin_runfiles = []
@ -58,7 +57,7 @@ def _proto_gen_impl(ctx):
plugins = [ctx.executable.plugin_exec]
plugin_runfiles = get_plugin_runfiles(ctx.attr.plugin_exec, ctx.attr.plugin_runfiles)
args += [
"--plugin=protoc-gen-{}={}".format(ctx.attr.plugin_name, ctx.executable.plugin_exec.path)
"--plugin=protoc-gen-{}={}".format(ctx.attr.plugin_name, ctx.executable.plugin_exec.path),
]
inputs = []
@ -67,9 +66,10 @@ def _proto_gen_impl(ctx):
src_root = src.proto.proto_source_root
for direct_source in src.proto.direct_sources:
path = ""
# in some cases the paths of src_root and direct_source are only partially
# overlapping. the following for loop finds the maximum overlap of these two paths
for i in range(len(src_root)+1):
for i in range(len(src_root) + 1):
if direct_source.path.startswith(src_root[-i:]):
path = direct_source.path[i:]
else:
@ -89,10 +89,9 @@ def _proto_gen_impl(ctx):
inputs = descriptors + [ctx.executable.protoc] + plugin_runfiles,
command = "mkdir -p " + sources_out.path + " && " + ctx.executable.protoc.path + " " + " ".join(args),
tools = plugins,
use_default_shell_env = True
use_default_shell_env = True,
)
# since we only have the output directory of the protoc compilation,
# we need to find all the files below sources_out and add them to the zipper args file
zipper_args_file = ctx.actions.declare_file(ctx.label.name + ".zipper_args")
@ -101,11 +100,11 @@ def _proto_gen_impl(ctx):
outputs = [zipper_args_file],
inputs = [sources_out],
command = "find -L {src_path} -type f | sed -E 's#^{src_path}/(.*)$#\\1={src_path}/\\1#' | sort > {args_file}".format(
src_path = sources_out.path,
args_file = zipper_args_file.path
src_path = sources_out.path,
args_file = zipper_args_file.path,
),
progress_message = "zipper_args_file %s" % zipper_args_file.path,
use_default_shell_env = True
use_default_shell_env = True,
)
# Call zipper to create srcjar
@ -123,14 +122,13 @@ def _proto_gen_impl(ctx):
proto_gen = rule(
implementation = _proto_gen_impl,
attrs = {
attrs = {
"srcs": attr.label_list(allow_files = True),
"deps": attr.label_list(providers = [ProtoInfo]),
"plugin_name": attr.string(),
"plugin_exec": attr.label(
cfg = "host",
executable = True
executable = True,
),
"plugin_options": attr.string_list(),
"plugin_runfiles": attr.label_list(
@ -151,12 +149,10 @@ proto_gen = rule(
),
},
outputs = {
"out" : "%{name}.srcjar"
"out": "%{name}.srcjar",
},
output_to_genfiles = True
output_to_genfiles = True,
)
def _is_windows(ctx):
return ctx.configuration.host_path_separator == ";"
return ctx.configuration.host_path_separator == ";"

View File

@ -2,21 +2,18 @@
# SPDX-License-Identifier: Apache-2.0
load(
'@io_bazel_rules_scala//scala:scala.bzl',
'scala_library',
'scala_macro_library',
'scala_binary',
'scala_test',
'scala_test_suite'
"@io_bazel_rules_scala//scala:scala.bzl",
"scala_binary",
"scala_library",
"scala_macro_library",
"scala_test",
"scala_test_suite",
)
load(
'@io_bazel_rules_scala//jmh:jmh.bzl',
'scala_benchmark_jmh'
"@io_bazel_rules_scala//jmh:jmh.bzl",
"scala_benchmark_jmh",
)
load("//bazel_tools:pom_file.bzl", "pom_file")
load("@os_info//:os_info.bzl", "is_windows")
# This file defines common Scala compiler flags and plugins used throughout
@ -29,86 +26,86 @@ load("@os_info//:os_info.bzl", "is_windows")
# `scala_*` from `rules_scala` in order for these default flags to take effect.
common_scalacopts = [
# doesn't allow advance features of the language without explict import
# (higherkinds, implicits)
"-feature",
"-target:jvm-1.8",
"-encoding", "UTF-8",
# more detailed information about type-erasure related warnings
"-unchecked",
# warn if using deprecated stuff
"-deprecation",
"-Xfuture",
# better error reporting for pureconfig
"-Xmacro-settings:materialize-derivations",
"-Xfatal-warnings",
# adapted args is a deprecated feature:
# `def foo(a: (A, B))` can be called with `foo(a, b)`.
# properly it should be `foo((a,b))`
"-Yno-adapted-args",
"-Ywarn-dead-code",
# Warn about implicit conversion between numerical types
"-Ywarn-numeric-widen",
# Gives a warning for functions declared as returning Unit, but the body returns a value
"-Ywarn-value-discard",
"-Ywarn-unused-import"
# unfortunately give false warning for the `(a, b) = someTuple`
# line inside a for comprehension
# "-Ywarn-unused"
# doesn't allow advance features of the language without explict import
# (higherkinds, implicits)
"-feature",
"-target:jvm-1.8",
"-encoding",
"UTF-8",
# more detailed information about type-erasure related warnings
"-unchecked",
# warn if using deprecated stuff
"-deprecation",
"-Xfuture",
# better error reporting for pureconfig
"-Xmacro-settings:materialize-derivations",
"-Xfatal-warnings",
# adapted args is a deprecated feature:
# `def foo(a: (A, B))` can be called with `foo(a, b)`.
# properly it should be `foo((a,b))`
"-Yno-adapted-args",
"-Ywarn-dead-code",
# Warn about implicit conversion between numerical types
"-Ywarn-numeric-widen",
# Gives a warning for functions declared as returning Unit, but the body returns a value
"-Ywarn-value-discard",
"-Ywarn-unused-import",
# unfortunately give false warning for the `(a, b) = someTuple`
# line inside a for comprehension
# "-Ywarn-unused"
]
plugin_deps = [
"//3rdparty/jvm/org/wartremover:wartremover",
"//3rdparty/jvm/org/wartremover:wartremover",
]
common_plugins = [
"//external:jar/org/wartremover/wartremover_2_12",
"//external:jar/org/wartremover/wartremover_2_12",
]
plugin_scalacopts = [
# do not enable wart remover for now, because we need to fix a lot of
# test code, which didn't have wart remover enabled before
"-Xplugin-require:wartremover",
# do not enable wart remover for now, because we need to fix a lot of
# test code, which didn't have wart remover enabled before
"-Xplugin-require:wartremover",
# This lists all wartremover linting passes.
# The list of enabled ones is pretty arbitrary, please ping Francesco for
# info
"-P:wartremover:traverser:org.wartremover.warts.Any",
"-P:wartremover:traverser:org.wartremover.warts.AnyVal",
"-P:wartremover:traverser:org.wartremover.warts.ArrayEquals",
# "-P:wartremover:traverser:org.wartremover.warts.AsInstanceOf",
# "-P:wartremover:traverser:org.wartremover.warts.DefaultArguments",
# "-P:wartremover:traverser:org.wartremover.warts.EitherProjectionPartial",
"-P:wartremover:traverser:org.wartremover.warts.Enumeration",
# "-P:wartremover:traverser:org.wartremover.warts.Equals",
"-P:wartremover:traverser:org.wartremover.warts.ExplicitImplicitTypes",
# "-P:wartremover:traverser:org.wartremover.warts.FinalCaseClass",
# "-P:wartremover:traverser:org.wartremover.warts.FinalVal",
# "-P:wartremover:traverser:org.wartremover.warts.ImplicitConversion",
# "-P:wartremover:traverser:org.wartremover.warts.ImplicitParameter",
# "-P:wartremover:traverser:org.wartremover.warts.IsInstanceOf",
"-P:wartremover:traverser:org.wartremover.warts.JavaSerializable",
"-P:wartremover:traverser:org.wartremover.warts.LeakingSealed",
# "-P:wartremover:traverser:org.wartremover.warts.MutableDataStructures",
# "-P:wartremover:traverser:org.wartremover.warts.NonUnitStatements",
# "-P:wartremover:traverser:org.wartremover.warts.Nothing",
# "-P:wartremover:traverser:org.wartremover.warts.Null",
"-P:wartremover:traverser:org.wartremover.warts.Option2Iterable",
# "-P:wartremover:traverser:org.wartremover.warts.OptionPartial",
# "-P:wartremover:traverser:org.wartremover.warts.Overloading",
"-P:wartremover:traverser:org.wartremover.warts.Product",
# "-P:wartremover:traverser:org.wartremover.warts.PublicInference",
# "-P:wartremover:traverser:org.wartremover.warts.Recursion",
# "-P:wartremover:traverser:org.wartremover.warts.Return",
"-P:wartremover:traverser:org.wartremover.warts.Serializable",
"-P:wartremover:traverser:org.wartremover.warts.StringPlusAny",
# "-P:wartremover:traverser:org.wartremover.warts.Throw",
# "-P:wartremover:traverser:org.wartremover.warts.ToString",
# "-P:wartremover:traverser:org.wartremover.warts.TraversableOps",
# "-P:wartremover:traverser:org.wartremover.warts.TryPartial",
# "-P:wartremover:traverser:org.wartremover.warts.Var",
# "-P:wartremover:traverser:org.wartremover.warts.While",
# This lists all wartremover linting passes.
# The list of enabled ones is pretty arbitrary, please ping Francesco for
# info
"-P:wartremover:traverser:org.wartremover.warts.Any",
"-P:wartremover:traverser:org.wartremover.warts.AnyVal",
"-P:wartremover:traverser:org.wartremover.warts.ArrayEquals",
# "-P:wartremover:traverser:org.wartremover.warts.AsInstanceOf",
# "-P:wartremover:traverser:org.wartremover.warts.DefaultArguments",
# "-P:wartremover:traverser:org.wartremover.warts.EitherProjectionPartial",
"-P:wartremover:traverser:org.wartremover.warts.Enumeration",
# "-P:wartremover:traverser:org.wartremover.warts.Equals",
"-P:wartremover:traverser:org.wartremover.warts.ExplicitImplicitTypes",
# "-P:wartremover:traverser:org.wartremover.warts.FinalCaseClass",
# "-P:wartremover:traverser:org.wartremover.warts.FinalVal",
# "-P:wartremover:traverser:org.wartremover.warts.ImplicitConversion",
# "-P:wartremover:traverser:org.wartremover.warts.ImplicitParameter",
# "-P:wartremover:traverser:org.wartremover.warts.IsInstanceOf",
"-P:wartremover:traverser:org.wartremover.warts.JavaSerializable",
"-P:wartremover:traverser:org.wartremover.warts.LeakingSealed",
# "-P:wartremover:traverser:org.wartremover.warts.MutableDataStructures",
# "-P:wartremover:traverser:org.wartremover.warts.NonUnitStatements",
# "-P:wartremover:traverser:org.wartremover.warts.Nothing",
# "-P:wartremover:traverser:org.wartremover.warts.Null",
"-P:wartremover:traverser:org.wartremover.warts.Option2Iterable",
# "-P:wartremover:traverser:org.wartremover.warts.OptionPartial",
# "-P:wartremover:traverser:org.wartremover.warts.Overloading",
"-P:wartremover:traverser:org.wartremover.warts.Product",
# "-P:wartremover:traverser:org.wartremover.warts.PublicInference",
# "-P:wartremover:traverser:org.wartremover.warts.Recursion",
# "-P:wartremover:traverser:org.wartremover.warts.Return",
"-P:wartremover:traverser:org.wartremover.warts.Serializable",
"-P:wartremover:traverser:org.wartremover.warts.StringPlusAny",
# "-P:wartremover:traverser:org.wartremover.warts.Throw",
# "-P:wartremover:traverser:org.wartremover.warts.ToString",
# "-P:wartremover:traverser:org.wartremover.warts.TraversableOps",
# "-P:wartremover:traverser:org.wartremover.warts.TryPartial",
# "-P:wartremover:traverser:org.wartremover.warts.Var",
# "-P:wartremover:traverser:org.wartremover.warts.While",
]
# delete items from lf_scalacopts as they are restored to common_scalacopts and plugin_scalacopts
@ -119,174 +116,172 @@ plugin_scalacopts = [
# []
# ^ means nothing to remove
lf_scalacopts = [
"-Ywarn-unused",
"-Ywarn-unused",
]
def _wrap_rule(rule, name = "", scalacopts = [], plugins = [], **kwargs):
rule(
name = name,
scalacopts = common_scalacopts + plugin_scalacopts + scalacopts,
plugins = common_plugins + plugins,
**kwargs
)
rule(
name = name,
scalacopts = common_scalacopts + plugin_scalacopts + scalacopts,
plugins = common_plugins + plugins,
**kwargs
)
def _wrap_rule_no_plugins(rule, scalacopts = [], **kwargs):
rule(
scalacopts = common_scalacopts + scalacopts,
**kwargs
)
rule(
scalacopts = common_scalacopts + scalacopts,
**kwargs
)
def _strip_path_upto(path, upto):
idx = path.find(upto)
if idx >= 0:
return [path[idx + len(upto):].strip("/")]
else:
return []
idx = path.find(upto)
if idx >= 0:
return [path[idx + len(upto):].strip("/")]
else:
return []
def _scala_source_jar_impl(ctx):
zipper_args = [
"%s=%s" % (new_path, src.path)
for src in ctx.files.srcs
for new_path in _strip_path_upto(src.path, ctx.attr.strip_upto)
]
zipper_args_file = ctx.actions.declare_file(
ctx.label.name + ".zipper_args")
zipper_args = [
"%s=%s" % (new_path, src.path)
for src in ctx.files.srcs
for new_path in _strip_path_upto(src.path, ctx.attr.strip_upto)
]
zipper_args_file = ctx.actions.declare_file(
ctx.label.name + ".zipper_args",
)
manifest_file = ctx.actions.declare_file(
ctx.label.name + "_MANIFEST.MF",
sibling = zipper_args_file,
)
ctx.actions.write(manifest_file, "Manifest-Version: 1.0\n")
zipper_args += ["META-INF/MANIFEST.MF=" + manifest_file.path + "\n"]
manifest_file = ctx.actions.declare_file(
ctx.label.name + "_MANIFEST.MF",
sibling = zipper_args_file,
)
ctx.actions.write(manifest_file, "Manifest-Version: 1.0\n")
zipper_args += ["META-INF/MANIFEST.MF=" + manifest_file.path + "\n"]
ctx.actions.write(zipper_args_file, "\n".join(zipper_args))
ctx.actions.write(zipper_args_file, "\n".join(zipper_args))
ctx.actions.run(
executable = ctx.executable._zipper,
inputs = ctx.files.srcs + [manifest_file, zipper_args_file],
outputs = [ctx.outputs.out],
arguments = ["c", ctx.outputs.out.path, "@" + zipper_args_file.path],
mnemonic = "ScalaSourceJar",
)
ctx.actions.run(
executable = ctx.executable._zipper,
inputs = ctx.files.srcs + [manifest_file, zipper_args_file],
outputs = [ctx.outputs.out],
arguments = ["c", ctx.outputs.out.path, "@" + zipper_args_file.path],
mnemonic = "ScalaSourceJar",
)
scala_source_jar = rule(
implementation = _scala_source_jar_impl,
attrs = {
"srcs": attr.label_list(allow_files = True),
implementation = _scala_source_jar_impl,
attrs = {
"srcs": attr.label_list(allow_files = True),
# The string to strip up to from source file paths.
# E.g. "main/scala" strips "foo/src/main/scala/com/daml/Foo.scala"
# to "com/daml/Foo.scala".
# Files not matching are not included in the source jar,
# so you may end up with empty source jars.
# TODO(JM): Add support for multiple options.
"strip_upto": attr.string(default = "main/scala"),
"_zipper": attr.label(
default = Label("@bazel_tools//tools/zip:zipper"),
cfg = "host",
executable = True,
allow_files = True,
),
},
outputs = {
"out": "%{name}.jar",
},
# The string to strip up to from source file paths.
# E.g. "main/scala" strips "foo/src/main/scala/com/daml/Foo.scala"
# to "com/daml/Foo.scala".
# Files not matching are not included in the source jar,
# so you may end up with empty source jars.
# TODO(JM): Add support for multiple options.
"strip_upto": attr.string(default = "main/scala"),
"_zipper": attr.label(
default = Label("@bazel_tools//tools/zip:zipper"),
cfg = "host",
executable = True,
allow_files = True,
),
},
outputs = {
"out": "%{name}.jar",
},
)
def _create_scala_source_jar(**kwargs):
# Try to not create empty source jars. We may still end up
# with them if the "strip_upto" does not match any of the
# paths.
if len(kwargs["srcs"]) > 0:
scala_source_jar(
name = kwargs["name"] + "_src",
srcs = kwargs["srcs"]
)
# Try to not create empty source jars. We may still end up
# with them if the "strip_upto" does not match any of the
# paths.
if len(kwargs["srcs"]) > 0:
scala_source_jar(
name = kwargs["name"] + "_src",
srcs = kwargs["srcs"],
)
def da_scala_library(name, **kwargs):
"""
Define a Scala library.
"""
Define a Scala library.
Applies common Scala options defined in `bazel_tools/scala.bzl`.
And forwards to `scala_library` from `rules_scala`.
Refer to the [`rules_scala` documentation][rules_scala_docs].
Applies common Scala options defined in `bazel_tools/scala.bzl`.
And forwards to `scala_library` from `rules_scala`.
Refer to the [`rules_scala` documentation][rules_scala_docs].
[rules_scala_docs]: https://github.com/bazelbuild/rules_scala#scala_library
"""
_wrap_rule(scala_library, name, **kwargs)
_create_scala_source_jar(**kwargs + {"name": name})
[rules_scala_docs]: https://github.com/bazelbuild/rules_scala#scala_library
"""
_wrap_rule(scala_library, name, **kwargs)
_create_scala_source_jar(**(kwargs + {"name": name}))
if "tags" in kwargs:
for tag in kwargs["tags"]:
if tag.startswith("maven_coordinates="):
pom_file(
name = name + "_pom",
target = ":" + name,
)
break
if "tags" in kwargs:
for tag in kwargs["tags"]:
if tag.startswith("maven_coordinates="):
pom_file(
name = name + "_pom",
target = ":" + name,
)
break
def da_scala_macro_library(**kwargs):
"""
Define a Scala library that contains macros.
"""
Define a Scala library that contains macros.
Applies common Scala options defined in `bazel_tools/scala.bzl`.
And forwards to `scala_macro_library` from `rules_scala`.
Refer to the [`rules_scala` documentation][rules_scala_docs].
Applies common Scala options defined in `bazel_tools/scala.bzl`.
And forwards to `scala_macro_library` from `rules_scala`.
Refer to the [`rules_scala` documentation][rules_scala_docs].
[rules_scala_docs]: https://github.com/bazelbuild/rules_scala#scala_library
"""
_wrap_rule(scala_macro_library, **kwargs)
_create_scala_source_jar(**kwargs)
[rules_scala_docs]: https://github.com/bazelbuild/rules_scala#scala_library
"""
_wrap_rule(scala_macro_library, **kwargs)
_create_scala_source_jar(**kwargs)
def da_scala_binary(name, **kwargs):
"""
Define a Scala executable.
"""
Define a Scala executable.
Applies common Scala options defined in `bazel_tools/scala.bzl`.
And forwards to `scala_binary` from `rules_scala`.
Refer to the [`rules_scala` documentation][rules_scala_docs].
Applies common Scala options defined in `bazel_tools/scala.bzl`.
And forwards to `scala_binary` from `rules_scala`.
Refer to the [`rules_scala` documentation][rules_scala_docs].
[rules_scala_docs]: https://github.com/bazelbuild/rules_scala#scala_binary
"""
_wrap_rule(scala_binary, name, **kwargs)
[rules_scala_docs]: https://github.com/bazelbuild/rules_scala#scala_binary
"""
_wrap_rule(scala_binary, name, **kwargs)
if "tags" in kwargs:
for tag in kwargs["tags"]:
if tag.startswith("maven_coordinates="):
pom_file(
name = name + "_pom",
target = ":" + name,
)
break
if "tags" in kwargs:
for tag in kwargs["tags"]:
if tag.startswith("maven_coordinates="):
pom_file(
name = name + "_pom",
target = ":" + name,
)
break
def da_scala_test(**kwargs):
"""
Define a Scala executable that runs the unit tests in the given source files.
"""
Define a Scala executable that runs the unit tests in the given source files.
Applies common Scala options defined in `bazel_tools/scala.bzl`.
And forwards to `scala_test` from `rules_scala`.
Refer to the [`rules_scala` documentation][rules_scala_docs].
Applies common Scala options defined in `bazel_tools/scala.bzl`.
And forwards to `scala_test` from `rules_scala`.
Refer to the [`rules_scala` documentation][rules_scala_docs].
[rules_scala_docs]: https://github.com/bazelbuild/rules_scala#scala_test
"""
_wrap_rule(scala_test, **kwargs)
[rules_scala_docs]: https://github.com/bazelbuild/rules_scala#scala_test
"""
_wrap_rule(scala_test, **kwargs)
def da_scala_test_suite(**kwargs):
"""
Define a Scala test executable for each source file and bundle them into one target.
"""
Define a Scala test executable for each source file and bundle them into one target.
Applies common Scala options defined in `bazel_tools/scala.bzl`.
And forwards to `scala_test_suite` from `rules_scala`.
Refer to the [`rules_scala` documentation][rules_scala_docs].
[rules_scala_docs]: https://github.com/bazelbuild/rules_scala#scala_test_suite
"""
_wrap_rule(scala_test_suite, use_short_names = is_windows, **kwargs)
Applies common Scala options defined in `bazel_tools/scala.bzl`.
And forwards to `scala_test_suite` from `rules_scala`.
Refer to the [`rules_scala` documentation][rules_scala_docs].
[rules_scala_docs]: https://github.com/bazelbuild/rules_scala#scala_test_suite
"""
_wrap_rule(scala_test_suite, use_short_names = is_windows, **kwargs)
# TODO make the jmh rule work with plugins -- probably
# just a matter of passing the flag in
def da_scala_benchmark_jmh(**kwargs):
_wrap_rule_no_plugins(scala_benchmark_jmh, **kwargs)
_wrap_rule_no_plugins(scala_benchmark_jmh, **kwargs)

View File

@ -1,31 +1,31 @@
# Copyright (c) 2019 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
load ("//bazel_tools:haskell.bzl", "da_haskell_library")
load("//bazel_tools:haskell.bzl", "da_haskell_library")
da_haskell_library (
name = "daml-lf-ast"
, src_strip_prefix = "src"
, srcs = glob (["src/**/*.hs"])
, deps = [
"//libs-haskell/da-hs-pretty"
, "//libs-haskell/da-hs-base"
]
, hazel_deps = [
"aeson",
"base",
"containers",
"deepseq",
"extra",
"lens",
"mtl",
"recursion-schemes",
"safe",
"scientific",
"tagged",
"text",
"time",
"unordered-containers",
]
, visibility = ["//visibility:public"]
da_haskell_library(
name = "daml-lf-ast",
srcs = glob(["src/**/*.hs"]),
hazel_deps = [
"aeson",
"base",
"containers",
"deepseq",
"extra",
"lens",
"mtl",
"recursion-schemes",
"safe",
"scientific",
"tagged",
"text",
"time",
"unordered-containers",
],
src_strip_prefix = "src",
visibility = ["//visibility:public"],
deps = [
"//libs-haskell/da-hs-base",
"//libs-haskell/da-hs-pretty",
],
)

View File

@ -1,20 +1,12 @@
# Copyright (c) 2019 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
load ("//bazel_tools:haskell.bzl", "da_haskell_library")
load("//bazel_tools:haskell.bzl", "da_haskell_library")
da_haskell_library (
da_haskell_library(
name = "daml-lf-proto",
src_strip_prefix = "src",
srcs = glob (["src/**/*.hs"]),
srcs = glob(["src/**/*.hs"]),
extra_srcs = ["//daml-lf/archive:da/daml_lf_dev.proto"],
deps = [
"//compiler/daml-lf-ast",
"//libs-haskell/da-hs-base",
"//libs-haskell/da-hs-pretty",
"//daml-lf/archive:daml_lf_haskell_proto",
"//nix/third-party/proto3-suite:proto3-suite",
],
hazel_deps = [
"base",
"bytestring",
@ -28,5 +20,13 @@ da_haskell_library (
"text",
"vector",
],
src_strip_prefix = "src",
visibility = ["//visibility:public"],
deps = [
"//compiler/daml-lf-ast",
"//daml-lf/archive:daml_lf_haskell_proto",
"//libs-haskell/da-hs-base",
"//libs-haskell/da-hs-pretty",
"//nix/third-party/proto3-suite",
],
)

View File

@ -1,17 +1,11 @@
# Copyright (c) 2019 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
load ("//bazel_tools:haskell.bzl", "da_haskell_library")
load("//bazel_tools:haskell.bzl", "da_haskell_library")
da_haskell_library (
da_haskell_library(
name = "daml-lf-tools",
src_strip_prefix = "src",
srcs = glob (["src/**/*.hs"]),
deps = [
"//libs-haskell/da-hs-pretty",
"//libs-haskell/da-hs-base",
"//compiler/daml-lf-ast",
],
srcs = glob(["src/**/*.hs"]),
hazel_deps = [
"base",
"containers",
@ -26,5 +20,11 @@ da_haskell_library (
"uniplate",
"unordered-containers",
],
src_strip_prefix = "src",
visibility = ["//visibility:public"],
deps = [
"//compiler/daml-lf-ast",
"//libs-haskell/da-hs-base",
"//libs-haskell/da-hs-pretty",
],
)

View File

@ -4,38 +4,38 @@
load("//bazel_tools:haskell.bzl", "da_haskell_library")
da_haskell_library(
name = "haskell-ide-core"
, srcs = glob(["src/**/*.hs"])
, src_strip_prefix = "src"
, deps = [
"//libs-haskell/prettyprinter-syntax",
]
, hazel_deps = [
"aeson",
"base",
"binary",
"bytestring",
"containers",
"deepseq",
"directory",
"either",
"extra",
"filepath",
"ghc-lib",
"ghc-lib-parser",
"hashable",
"mtl",
"pretty",
"safe-exceptions",
"shake",
"stm",
"syb",
"text",
"time",
"transformers",
"uniplate",
"unordered-containers",
"uri-encode",
]
, visibility = ["//visibility:public"]
name = "haskell-ide-core",
srcs = glob(["src/**/*.hs"]),
hazel_deps = [
"aeson",
"base",
"binary",
"bytestring",
"containers",
"deepseq",
"directory",
"either",
"extra",
"filepath",
"ghc-lib",
"ghc-lib-parser",
"hashable",
"mtl",
"pretty",
"safe-exceptions",
"shake",
"stm",
"syb",
"text",
"time",
"transformers",
"uniplate",
"unordered-containers",
"uri-encode",
],
src_strip_prefix = "src",
visibility = ["//visibility:public"],
deps = [
"//libs-haskell/prettyprinter-syntax",
],
)

View File

@ -4,51 +4,49 @@
load("//bazel_tools:haskell.bzl", "da_haskell_library")
da_haskell_library(
name = "client",
srcs = glob(["src/**/*.hs"]),
src_strip_prefix = "src",
deps = [
"//libs-haskell/da-hs-base",
"//libs-haskell/da-hs-pretty",
"//libs-haskell/bazel-runfiles",
"//compiler/daml-lf-ast",
"//compiler/daml-lf-proto",
"//compiler/scenario-service/protos:scenario_service_haskell_proto",
"//nix/third-party/proto3-suite:proto3-suite",
"//nix/third-party/proto3-wire:proto3-wire",
"//nix/third-party/gRPC-haskell:grpc-haskell",
"//nix/third-party/gRPC-haskell/core:grpc-haskell-core",
],
hazel_deps = [
"async",
"base",
"blaze-html",
"binary",
"bytestring",
"conduit",
"conduit-extra",
"containers",
"cryptonite",
"deepseq",
"directory",
"extra",
"filepath",
"hashable",
"lens",
"managed",
"mtl",
"process",
"split",
"stm",
"system-filepath",
"tagged",
"text",
"time",
"transformers",
"uri-encode",
"vector",
],
visibility = ['//visibility:public'],
name = "client",
srcs = glob(["src/**/*.hs"]),
hazel_deps = [
"async",
"base",
"blaze-html",
"binary",
"bytestring",
"conduit",
"conduit-extra",
"containers",
"cryptonite",
"deepseq",
"directory",
"extra",
"filepath",
"hashable",
"lens",
"managed",
"mtl",
"process",
"split",
"stm",
"system-filepath",
"tagged",
"text",
"time",
"transformers",
"uri-encode",
"vector",
],
src_strip_prefix = "src",
visibility = ["//visibility:public"],
deps = [
"//compiler/daml-lf-ast",
"//compiler/daml-lf-proto",
"//compiler/scenario-service/protos:scenario_service_haskell_proto",
"//libs-haskell/bazel-runfiles",
"//libs-haskell/da-hs-base",
"//libs-haskell/da-hs-pretty",
"//nix/third-party/gRPC-haskell:grpc-haskell",
"//nix/third-party/gRPC-haskell/core:grpc-haskell-core",
"//nix/third-party/proto3-suite",
"//nix/third-party/proto3-wire",
],
)

View File

@ -5,27 +5,25 @@ load("//bazel_tools:haskell.bzl", "da_haskell_library", "da_haskell_test")
load("//bazel_tools:proto.bzl", "proto_gen")
proto_library(
name = "scenario_service_proto",
srcs = ["scenario_service.proto"],
deps = [],
visibility = ["//visibility:public"]
)
proto_gen(
name = "scenario_service_java_proto_src",
srcs = [":scenario_service_proto"],
plugin_name = "java",
visibility = ["//visibility:public"]
name = "scenario_service_proto",
srcs = ["scenario_service.proto"],
visibility = ["//visibility:public"],
deps = [],
)
proto_gen(
name = "scenario_service_java_proto_grpc_src",
srcs = [":scenario_service_proto"],
plugin_name = "java-grpc",
plugin_exec = "@io_grpc_grpc_java//compiler:grpc_java_plugin",
visibility = ["//visibility:public"]
name = "scenario_service_java_proto_src",
srcs = [":scenario_service_proto"],
plugin_name = "java",
visibility = ["//visibility:public"],
)
proto_gen(
name = "scenario_service_java_proto_grpc_src",
srcs = [":scenario_service_proto"],
plugin_exec = "@io_grpc_grpc_java//compiler:grpc_java_plugin",
plugin_name = "java-grpc",
visibility = ["//visibility:public"],
)
# FIXME(JM): java_grpc_library should do this for us,
@ -33,50 +31,52 @@ proto_gen(
# makes sense to mix the //3rdparty dependencies with
# the stuff it pulls in...
java_library(
name = "scenario_service_java_proto",
srcs = [":scenario_service_java_proto_src", ":scenario_service_java_proto_grpc_src"],
deps = [
"//3rdparty/jvm/com/google/protobuf:protobuf_java",
"//3rdparty/jvm/io/grpc:grpc_protobuf",
"//3rdparty/jvm/io/grpc:grpc_core",
"//3rdparty/jvm/io/grpc:grpc_stub",
],
visibility = ["//visibility:public"]
name = "scenario_service_java_proto",
srcs = [
":scenario_service_java_proto_grpc_src",
":scenario_service_java_proto_src",
],
visibility = ["//visibility:public"],
deps = [
"//3rdparty/jvm/com/google/protobuf:protobuf_java",
"//3rdparty/jvm/io/grpc:grpc_core",
"//3rdparty/jvm/io/grpc:grpc_protobuf",
"//3rdparty/jvm/io/grpc:grpc_stub",
],
)
# FIXME(JM): Modify compile-proto-file to allow specifying
# the output file and module name rather than directory.
genrule(
name = "scenario_service_haskell_proto_src",
outs = ["ScenarioService.hs"],
srcs = ["scenario_service.proto"],
tools = [
"//nix/third-party/proto3-suite:compile-proto-file"
],
cmd = """
name = "scenario_service_haskell_proto_src",
srcs = ["scenario_service.proto"],
outs = ["ScenarioService.hs"],
cmd = """
ORIGPWD=$$PWD
cd compiler/scenario-service/protos
$$ORIGPWD/$(location //nix/third-party/proto3-suite:compile-proto-file) \
--proto scenario_service.proto --out "$$ORIGPWD/$(@D)"
"""
""",
tools = [
"//nix/third-party/proto3-suite:compile-proto-file",
],
)
da_haskell_library(
name = "scenario_service_haskell_proto",
srcs = [":scenario_service_haskell_proto_src"],
deps = [
"//nix/third-party/proto3-suite:proto3-suite",
"//nix/third-party/proto3-wire:proto3-wire",
"//nix/third-party/gRPC-haskell:grpc-haskell",
"//nix/third-party/gRPC-haskell/core:grpc-haskell-core",
],
hazel_deps = [
"base",
"bytestring",
"deepseq",
"text",
"vector",
],
visibility = ["//visibility:public"]
name = "scenario_service_haskell_proto",
srcs = [":scenario_service_haskell_proto_src"],
hazel_deps = [
"base",
"bytestring",
"deepseq",
"text",
"vector",
],
visibility = ["//visibility:public"],
deps = [
"//nix/third-party/gRPC-haskell:grpc-haskell",
"//nix/third-party/gRPC-haskell/core:grpc-haskell-core",
"//nix/third-party/proto3-suite",
"//nix/third-party/proto3-wire",
],
)

View File

@ -2,40 +2,38 @@
# SPDX-License-Identifier: Apache-2.0
load(
"//bazel_tools:scala.bzl",
"da_scala_library",
"da_scala_binary",
"da_scala_test_suite",
"//bazel_tools:scala.bzl",
"da_scala_binary",
"da_scala_library",
"da_scala_test_suite",
)
genrule(
name = "scenario_service_jar",
srcs = [":scenario-service-raw_deploy.jar"],
outs = ["scenario-service.jar"],
cmd = "cp $< $@",
visibility = ['//visibility:public']
name = "scenario_service_jar",
srcs = [":scenario-service-raw_deploy.jar"],
outs = ["scenario-service.jar"],
cmd = "cp $< $@",
visibility = ["//visibility:public"],
)
da_scala_binary(
name = "scenario-service-raw",
srcs = glob(["src/main/scala/**/*.scala"]),
main_class = "com.digitalasset.daml.lf.scenario.ScenarioServiceMain",
deps = [
"//compiler/scenario-service/protos:scenario_service_java_proto",
"//daml-lf/archive:daml_lf_java_proto",
"//daml-lf/archive:daml_lf_archive_scala",
"//daml-lf/data",
"//daml-lf/transaction",
"//daml-lf/lfpackage",
"//daml-lf/interpreter",
"//daml-lf/validation",
"//daml-lf/scenario-interpreter",
"//3rdparty/jvm/io/grpc:grpc_protobuf",
"//3rdparty/jvm/io/grpc:grpc_netty",
"//3rdparty/jvm/io/grpc:grpc_core",
"//3rdparty/jvm/io/grpc:grpc_stub",
"//3rdparty/jvm/org/scalaz:scalaz_core",
],
name = "scenario-service-raw",
srcs = glob(["src/main/scala/**/*.scala"]),
main_class = "com.digitalasset.daml.lf.scenario.ScenarioServiceMain",
deps = [
"//3rdparty/jvm/io/grpc:grpc_core",
"//3rdparty/jvm/io/grpc:grpc_netty",
"//3rdparty/jvm/io/grpc:grpc_protobuf",
"//3rdparty/jvm/io/grpc:grpc_stub",
"//3rdparty/jvm/org/scalaz:scalaz_core",
"//compiler/scenario-service/protos:scenario_service_java_proto",
"//daml-lf/archive:daml_lf_archive_scala",
"//daml-lf/archive:daml_lf_java_proto",
"//daml-lf/data",
"//daml-lf/interpreter",
"//daml-lf/lfpackage",
"//daml-lf/scenario-interpreter",
"//daml-lf/transaction",
"//daml-lf/validation",
],
)

View File

@ -1,100 +1,162 @@
# Copyright (c) 2019 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_test')
load ("//bazel_tools:packaging/packaging.bzl", "package_app")
load("//bazel_tools:haskell.bzl", "da_haskell_binary", "da_haskell_test")
load("//bazel_tools:packaging/packaging.bzl", "package_app")
load("@ai_formation_hazel//:hazel.bzl", "hazel_binary")
da_cli_version = '114-7582c1a0bd'
da_cli_version = "114-7582c1a0bd"
da_cli_version_flag = '-DDA_CLI_VERSION="%s"' % da_cli_version
da_cli_hazel_deps = [
'aeson', 'aeson-extra', 'attoparsec',
'base', 'bytestring', 'conduit', 'conduit-extra',
'containers', 'cryptohash', 'directory', 'either',
'exceptions', 'extra', 'filepath', 'foldl', 'hashable',
'haskeline', 'http-api-data', 'http-client', 'http-client-tls',
'http-conduit', 'http-media', 'http-types', 'lens',
'lifted-base', 'monad-control', 'monad-logger',
'mtl', 'multimap', 'network', 'natural-sort',
'optparse-applicative', 'pipes-bytestring', 'pipes-http',
'pipes', 'pretty-simple', 'prettyprinter', 'process',
'safe-exceptions', 'safe', 'servant', 'servant-client',
'servant-client-core', 'servant-server', 'split', 'sqlite-simple',
'system-filepath', 'tar-conduit', 'tasty', 'tasty-hunit',
'temporary', 'terminal-size', 'text', 'these',
'tagged', 'time', 'transformers', 'transformers-base',
'random', 'QuickCheck', 'turtle', 'unix', 'unix-compat',
'unordered-containers', 'uri-encode', 'utf8-string', 'vector',
'warp', 'yaml',
"aeson",
"aeson-extra",
"attoparsec",
"base",
"bytestring",
"conduit",
"conduit-extra",
"containers",
"cryptohash",
"directory",
"either",
"exceptions",
"extra",
"filepath",
"foldl",
"hashable",
"haskeline",
"http-api-data",
"http-client",
"http-client-tls",
"http-conduit",
"http-media",
"http-types",
"lens",
"lifted-base",
"monad-control",
"monad-logger",
"mtl",
"multimap",
"network",
"natural-sort",
"optparse-applicative",
"pipes-bytestring",
"pipes-http",
"pipes",
"pretty-simple",
"prettyprinter",
"process",
"safe-exceptions",
"safe",
"servant",
"servant-client",
"servant-client-core",
"servant-server",
"split",
"sqlite-simple",
"system-filepath",
"tar-conduit",
"tasty",
"tasty-hunit",
"temporary",
"terminal-size",
"text",
"these",
"tagged",
"time",
"transformers",
"transformers-base",
"random",
"QuickCheck",
"turtle",
"unix",
"unix-compat",
"unordered-containers",
"uri-encode",
"utf8-string",
"vector",
"warp",
"yaml",
]
da_haskell_binary (
name = 'da'
, srcs = native.glob(
[ 'DA/**/*.hs'
, 'Data/**/*.hs'
, 'apps/Main.hs'
]
)
, main_function = "DA.Sdk.Cli.main"
, deps = [ "//libs-haskell/da-hs-base" ]
, compiler_flags = [da_cli_version_flag]
, hazel_deps = da_cli_hazel_deps
, visibility = ["//visibility:public"]
da_haskell_binary(
name = "da",
srcs = native.glob(
[
"DA/**/*.hs",
"Data/**/*.hs",
"apps/Main.hs",
],
),
compiler_flags = [da_cli_version_flag],
hazel_deps = da_cli_hazel_deps,
main_function = "DA.Sdk.Cli.main",
visibility = ["//visibility:public"],
deps = ["//libs-haskell/da-hs-base"],
)
native.genrule(
name = 'version_file',
outs = ['VERSION'],
cmd = "echo -n " + da_cli_version + " > $(OUTS)"
name = "version_file",
outs = ["VERSION"],
cmd = "echo -n " + da_cli_version + " > $(OUTS)",
)
# Rule to package the DA application along with its dynamic libraries
dist_name = 'dist'
dist_name = "dist"
package_app(
name = dist_name,
binary = ':da',
visibility = ["//visibility:public"]
binary = ":da",
visibility = ["//visibility:public"],
)
installer_name = "installer.run"
native.genrule(
name = "installer_run",
outs = [installer_name],
visibility = ["//visibility:public"],
srcs = [dist_name + ".tar.gz", "setup.sh"],
srcs = [
dist_name + ".tar.gz",
"setup.sh",
],
tools = [hazel_binary("arx")],
cmd = "$(location " + hazel_binary("arx") + ") tmpx -o ./$(location " + installer_name + ") ./$(location " + dist_name + ".tar.gz ) -e ./$(location setup.sh)"
cmd = "$(location " + hazel_binary("arx") + ") tmpx -o ./$(location " + installer_name + ") ./$(location " + dist_name + ".tar.gz ) -e ./$(location setup.sh)",
)
exports_files(
srcs = ['setup.sh'],
visibility = ["//visibility:public"]
srcs = ["setup.sh"],
visibility = ["//visibility:public"],
)
da_haskell_test(
name = 'test',
name = "test",
srcs = glob(
[ 'DA/**/*.hs'
, 'Data/**/*.hs'
, 'apps/Test.hs'
]),
deps = ['//libs-haskell/da-hs-base:da-hs-base'],
[
"DA/**/*.hs",
"Data/**/*.hs",
"apps/Test.hs",
],
),
compiler_flags = [da_cli_version_flag],
hazel_deps = da_cli_hazel_deps,
visibility = ["//visibility:public"],
deps = ["//libs-haskell/da-hs-base"],
)
da_haskell_binary(
name = 'mockserver-binary',
name = "mockserver-binary",
srcs = glob(
[ 'DA/**/*.hs'
, 'Data/**/*.hs'
, 'apps/Mockserver.hs'
]),
deps = ['//libs-haskell/da-hs-base:da-hs-base'],
[
"DA/**/*.hs",
"Data/**/*.hs",
"apps/Mockserver.hs",
],
),
compiler_flags = [da_cli_version_flag],
hazel_deps = da_cli_hazel_deps,
visibility = ["//visibility:public"],
deps = ["//libs-haskell/da-hs-base"],
)

View File

@ -1,16 +1,14 @@
# Copyright (c) 2019 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("//bazel_tools:haskell.bzl", "da_haskell_binary", "da_haskell_library", "da_haskell_test")
load("//bazel_tools:packaging/packaging.bzl", "package_app")
# This library is intended to be used by applications called by the assistant,
# e.g., damlc, to get the names of the various environment variables set by the assistant.
da_haskell_library(
name = 'daml-project-config',
srcs = native.glob(['daml-project-config/**/*.hs']),
src_strip_prefix = 'daml-project-config',
deps = [],
name = "daml-project-config",
srcs = native.glob(["daml-project-config/**/*.hs"]),
hazel_deps = [
"base",
"directory",
@ -22,49 +20,51 @@ da_haskell_library(
"text",
"yaml",
],
visibility = ["//visibility:public"]
src_strip_prefix = "daml-project-config",
visibility = ["//visibility:public"],
deps = [],
)
# TODO Factor shared code between the binary and the test suite into a library
# instead of compiling it twice.
da_haskell_binary (
name = 'daml',
src_strip_prefix = "src",
srcs = native.glob(['src/**/*.hs']),
main_function = "DAML.Assistant.main",
deps = [
"//libs-haskell/da-hs-base",
":daml-project-config",
],
da_haskell_binary(
name = "daml",
srcs = native.glob(["src/**/*.hs"]),
hazel_deps = [
'base',
'bytestring',
'conduit',
'conduit-extra',
'directory',
'extra',
'filepath',
'http-conduit',
'lens',
'main-tester',
'optparse-applicative',
'process',
'safe',
'safe-exceptions',
'semver',
'tar-conduit',
'tasty',
'tasty-hunit',
'tasty-quickcheck',
'temporary',
'terminal-progress-bar',
'text',
'unix-compat',
'utf8-string',
'yaml',
"base",
"bytestring",
"conduit",
"conduit-extra",
"directory",
"extra",
"filepath",
"http-conduit",
"lens",
"main-tester",
"optparse-applicative",
"process",
"safe",
"safe-exceptions",
"semver",
"tar-conduit",
"tasty",
"tasty-hunit",
"tasty-quickcheck",
"temporary",
"terminal-progress-bar",
"text",
"unix-compat",
"utf8-string",
"yaml",
],
main_function = "DAML.Assistant.main",
src_strip_prefix = "src",
visibility = ["//visibility:public"],
deps = [
":daml-project-config",
"//libs-haskell/da-hs-base",
],
)
package_app(
@ -74,41 +74,41 @@ package_app(
)
da_haskell_test(
name = 'test',
srcs = native.glob(['src/**/*.hs']),
main_function = "DAML.Assistant.runTests",
deps = [
"//libs-haskell/da-hs-base",
":daml-project-config",
],
name = "test",
srcs = native.glob(["src/**/*.hs"]),
hazel_deps = [
'base',
'bytestring',
'conduit',
'conduit-extra',
'directory',
'extra',
'filepath',
'http-conduit',
'lens',
'main-tester',
'optparse-applicative',
'process',
'safe',
'safe-exceptions',
'semver',
'tar-conduit',
'tasty',
'tasty-hunit',
'tasty-quickcheck',
'temporary',
'terminal-progress-bar',
'text',
'unix-compat',
'utf8-string',
'yaml',
"base",
"bytestring",
"conduit",
"conduit-extra",
"directory",
"extra",
"filepath",
"http-conduit",
"lens",
"main-tester",
"optparse-applicative",
"process",
"safe",
"safe-exceptions",
"semver",
"tar-conduit",
"tasty",
"tasty-hunit",
"tasty-quickcheck",
"temporary",
"terminal-progress-bar",
"text",
"unix-compat",
"utf8-string",
"yaml",
],
main_function = "DAML.Assistant.runTests",
visibility = ["//visibility:public"],
deps = [
":daml-project-config",
"//libs-haskell/da-hs-base",
],
)
exports_files(["daml-studio.py"])

View File

@ -1,15 +1,15 @@
# Copyright (c) 2019 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("//bazel_tools:haskell.bzl", "da_haskell_binary", "da_haskell_library", "da_haskell_test")
load("//bazel_tools:packaging/packaging.bzl", "package_app")
da_haskell_library(
name = "daml-helper-lib",
srcs = glob(["src/**/*.hs"], exclude = ["src/Main.hs"]),
deps = [
"//daml-assistant:daml-project-config",
],
srcs = glob(
["src/**/*.hs"],
exclude = ["src/Main.hs"],
),
hazel_deps = [
"aeson",
"async",
@ -27,17 +27,20 @@ da_haskell_library(
"text",
],
visibility = ["//visibility:public"],
deps = [
"//daml-assistant:daml-project-config",
],
)
da_haskell_binary(
name = "daml-helper",
srcs = ["src/Main.hs"],
deps = [":daml-helper-lib"],
hazel_deps = [
"base",
"optparse-applicative",
],
visibility = ["//visibility:public"],
deps = [":daml-helper-lib"],
)
package_app(

View File

@ -4,10 +4,11 @@ load("//bazel_tools:haskell.bzl", "da_haskell_test")
da_haskell_test(
name = "integration-tests",
timeout = "long",
srcs = ["src/Main.hs"],
deps = [
"//libs-haskell/bazel-runfiles",
"//daml-assistant/daml-helper:daml-helper-lib",
data = [
"//release:sdk-release-tarball",
"@local_jdk//:bin/java",
],
hazel_deps = [
"async",
@ -21,9 +22,8 @@ da_haskell_test(
"tasty",
"tasty-hunit",
],
data = [
"//release:sdk-release-tarball",
"@local_jdk//:bin/java",
deps = [
"//daml-assistant/daml-helper:daml-helper-lib",
"//libs-haskell/bazel-runfiles",
],
timeout = "long",
)

View File

@ -1,155 +1,166 @@
# Copyright (c) 2019 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
load ("//bazel_tools:haskell.bzl"
, "da_haskell_library", "da_haskell_binary", "da_haskell_test")
load ("//daml-foundations/daml-ghc:util.bzl"
, "daml_ghc_compile_test", "daml_ghc_integration_test")
load(
"//bazel_tools:haskell.bzl",
"da_haskell_binary",
"da_haskell_library",
"da_haskell_test",
)
load(
"//daml-foundations/daml-ghc:util.bzl",
"daml_ghc_compile_test",
"daml_ghc_integration_test",
)
da_haskell_library(
name = "daml-ghc-lib"
, srcs = glob([
"src/DA/Daml/GHC/**/*.hs"
, "src/DA/Service/**/*.hs"
, "src/Development/IDE/**/*.hs"
])
, src_strip_prefix = "src"
, deps = [
"//compiler/daml-lf-ast"
, "//compiler/daml-lf-proto"
, "//compiler/daml-lf-tools"
, "//daml-lf/archive:daml_lf_haskell_proto"
, "//libs-haskell/bazel-runfiles"
, "//libs-haskell/da-hs-pretty"
, "//libs-haskell/da-hs-base"
, "//libs-haskell/prettyprinter-syntax"
, "//compiler/haskell-ide-core"
, "//libs-haskell/da-hs-language-server"
, "//compiler/scenario-service/client"
, "//nix/third-party/proto3-suite"
]
, hazel_deps = [
"aeson",
"aeson-pretty",
"async",
"base",
"binary",
"blaze-html",
"bytestring",
"cmark-gfm",
"containers",
"deepseq",
"Diff",
"directory",
"either",
"extra",
"filepath",
"filepattern",
"ghc-lib",
"ghc-lib-parser",
"hashable",
"http-types",
"lens",
"managed",
"mtl",
"network-uri",
"prettyprinter",
"process",
"recursion-schemes",
"safe",
"safe-exceptions",
"shake",
"stm",
"syb",
"tagged",
"temporary",
"text",
"time",
"transformers",
"transformers-base",
"uniplate",
"unordered-containers",
"uri-encode",
"vector",
"zip-archive",
]
, visibility = ["//visibility:public"]
name = "daml-ghc-lib",
srcs = glob([
"src/DA/Daml/GHC/**/*.hs",
"src/DA/Service/**/*.hs",
"src/Development/IDE/**/*.hs",
]),
hazel_deps = [
"aeson",
"aeson-pretty",
"async",
"base",
"binary",
"blaze-html",
"bytestring",
"cmark-gfm",
"containers",
"deepseq",
"Diff",
"directory",
"either",
"extra",
"filepath",
"filepattern",
"ghc-lib",
"ghc-lib-parser",
"hashable",
"http-types",
"lens",
"managed",
"mtl",
"network-uri",
"prettyprinter",
"process",
"recursion-schemes",
"safe",
"safe-exceptions",
"shake",
"stm",
"syb",
"tagged",
"temporary",
"text",
"time",
"transformers",
"transformers-base",
"uniplate",
"unordered-containers",
"uri-encode",
"vector",
"zip-archive",
],
src_strip_prefix = "src",
visibility = ["//visibility:public"],
deps = [
"//compiler/daml-lf-ast",
"//compiler/daml-lf-proto",
"//compiler/daml-lf-tools",
"//compiler/haskell-ide-core",
"//compiler/scenario-service/client",
"//daml-lf/archive:daml_lf_haskell_proto",
"//libs-haskell/bazel-runfiles",
"//libs-haskell/da-hs-base",
"//libs-haskell/da-hs-language-server",
"//libs-haskell/da-hs-pretty",
"//libs-haskell/prettyprinter-syntax",
"//nix/third-party/proto3-suite",
],
)
daml_ghc_integration_test("daml-ghc-test-newest", "DA.Test.GHC.mainVersionNewest")
daml_ghc_integration_test("daml-ghc-test-default", "DA.Test.GHC.mainVersionDefault")
da_haskell_test (
name = "tasty-test"
, srcs = ["src/DA/Test/TastyMain.hs"]
, src_strip_prefix = "src"
, main_function = "DA.Test.TastyMain.main"
, deps = [
":daml-ghc-lib"
, "//libs-haskell/da-hs-base"
, "//daml-foundations/daml-tools/da-hs-daml-cli"
]
, data = [
":tests"
, "//daml-foundations/daml-ghc/package-database:package-db"
]
, hazel_deps = [
"base",
"tasty-hunit",
"text",
]
, visibility = ["//visibility:public"]
da_haskell_test(
name = "tasty-test",
srcs = ["src/DA/Test/TastyMain.hs"],
data = [
":tests",
"//daml-foundations/daml-ghc/package-database:package-db",
],
hazel_deps = [
"base",
"tasty-hunit",
"text",
],
main_function = "DA.Test.TastyMain.main",
src_strip_prefix = "src",
visibility = ["//visibility:public"],
deps = [
":daml-ghc-lib",
"//daml-foundations/daml-tools/da-hs-daml-cli",
"//libs-haskell/da-hs-base",
],
)
da_haskell_test (
name = "daml-ghc-shake-test-ci"
, srcs = ["src/DA/Test/ShakeIdeClient.hs"]
, src_strip_prefix = "src"
, main_function = "DA.Test.ShakeIdeClient.main"
, deps = [
":daml-ghc-lib"
, "//libs-haskell/da-hs-base"
, "//compiler/haskell-ide-core"
]
, data = [
"//compiler/scenario-service/server:scenario_service_jar"
, "//daml-foundations/daml-ghc/package-database:package-db"
]
, hazel_deps = [
"base",
"directory",
"managed",
"tasty-hunit",
"text",
]
, visibility = ["//visibility:public"]
# this test takes a while and often time out -- tell that to bazel
, timeout = "long"
, size = "large"
da_haskell_test(
name = "daml-ghc-shake-test-ci",
size = "large",
# this test takes a while and often time out -- tell that to bazel
timeout = "long",
srcs = ["src/DA/Test/ShakeIdeClient.hs"],
data = [
"//compiler/scenario-service/server:scenario_service_jar",
"//daml-foundations/daml-ghc/package-database:package-db",
],
hazel_deps = [
"base",
"directory",
"managed",
"tasty-hunit",
"text",
],
main_function = "DA.Test.ShakeIdeClient.main",
src_strip_prefix = "src",
visibility = ["//visibility:public"],
deps = [
":daml-ghc-lib",
"//compiler/haskell-ide-core",
"//libs-haskell/da-hs-base",
],
)
da_haskell_binary(
name = "generate-module-tree"
, srcs = ["src/DA/Test/GenerateModuleTree.hs"]
, src_strip_prefix = "src"
, main_function = "DA.Test.GenerateModuleTree.main"
, deps = ["//libs-haskell/da-hs-base"]
, hazel_deps = ["base", "filepath"]
name = "generate-module-tree",
srcs = ["src/DA/Test/GenerateModuleTree.hs"],
hazel_deps = [
"base",
"filepath",
],
main_function = "DA.Test.GenerateModuleTree.main",
src_strip_prefix = "src",
deps = ["//libs-haskell/da-hs-base"],
)
genrule(
name = "module-tree-test",
outs = ["FatTree{i}.daml".format(i = i) for i in range(1, 19)],
cmd = "$(location :generate-module-tree) $(@D) 18",
outs = ["FatTree{i}.daml".format(i=i) for i in range(1,19)],
tools = [":generate-module-tree"],
visibility = ['//visibility:public']
visibility = ["//visibility:public"],
)
daml_ghc_compile_test(
name = "module-tree-memory",
srcs = [":module-tree-test"],
main = "FatTree18.daml",
visibility = ['//visibility:public'],
visibility = ["//visibility:public"],
)
daml_ghc_compile_test(
@ -159,96 +170,104 @@ daml_ghc_compile_test(
)
daml_ghc_compile_test(
name = 'compile-empty',
srcs = [":tests"],
main = 'tests/Empty.daml',
name = "compile-empty",
srcs = [":tests"],
main = "tests/Empty.daml",
)
daml_ghc_compile_test(
name = "examples-memory",
srcs = [":tests"],
main = 'tests/Examples.daml',
heap_limit = "200M",
main = "tests/Examples.daml",
stack_limit = "230K",
)
daml_ghc_compile_test(
name = "bond-trading-memory",
srcs = [":bond-trading"],
main = 'bond-trading/Test.daml',
heap_limit = "100M",
main = "bond-trading/Test.daml",
stack_limit = "35K",
)
filegroup(
name = "tests",
srcs = glob(["tests/**"]),
visibility = [
"__pkg__",
"//daml-foundations/integration-tests:__pkg__"
]
name = "tests",
srcs = glob(["tests/**"]),
visibility = [
"__pkg__",
"//daml-foundations/integration-tests:__pkg__",
],
)
filegroup(
name = "bond-trading",
srcs = glob(["bond-trading/**"]),
visibility = [
"__pkg__",
"//daml-foundations/integration-tests:__pkg__"
]
name = "bond-trading",
srcs = glob(["bond-trading/**"]),
visibility = [
"__pkg__",
"//daml-foundations/integration-tests:__pkg__",
],
)
# Check that DAML compilation is deterministic.
sh_test(
name = "daml-ghc-deterministic",
srcs = ["tests/daml-ghc-deterministic.sh"],
args = [
"$(location //daml-foundations/daml-tools/da-hs-damlc-app)",
"$(location @com_google_protobuf//:protoc)",
],
data = [
"//daml-foundations/daml-tools/da-hs-damlc-app",
"//daml-foundations/daml-ghc/package-database:package-db",
":tests",
"@com_google_protobuf//:protoc",
]
name = "daml-ghc-deterministic",
srcs = ["tests/daml-ghc-deterministic.sh"],
args = [
"$(location //daml-foundations/daml-tools/da-hs-damlc-app)",
"$(location @com_google_protobuf//:protoc)",
],
data = [
":tests",
"//daml-foundations/daml-ghc/package-database:package-db",
"//daml-foundations/daml-tools/da-hs-damlc-app",
"@com_google_protobuf//:protoc",
],
)
# Generating DAML stdlib docs.
filegroup(
name = "daml-base-files", # DAML files to be included in DAML base docs.
srcs = ['//daml-foundations/daml-ghc/daml-stdlib-src'
,'//daml-foundations/daml-ghc/daml-prim-src'],
visibility = ["__pkg__"]
name = "daml-base-files", # DAML files to be included in DAML base docs.
srcs = [
"//daml-foundations/daml-ghc/daml-prim-src",
"//daml-foundations/daml-ghc/daml-stdlib-src",
],
visibility = ["__pkg__"],
)
filegroup(
name = "daml-base-hoogle-prefix",
srcs = ['base-hoogle-prefix.txt'],
visibility = ["__pkg__"]
name = "daml-base-hoogle-prefix",
srcs = ["base-hoogle-prefix.txt"],
visibility = ["__pkg__"],
)
filegroup(
name = "daml-base-rst-prefix",
srcs = ['base-rst-prefix.rst'],
visibility = ["__pkg__"]
name = "daml-base-rst-prefix",
srcs = ["base-rst-prefix.rst"],
visibility = ["__pkg__"],
)
genrule(
name = 'daml-base-hoogle-docs',
outs = ['daml-base-hoogle.txt'],
tools = ['//daml-foundations/daml-tools/da-hs-damlc-app'],
srcs = [':daml-base-files', ':daml-base-hoogle-prefix'],
cmd = '$(location //daml-foundations/daml-tools/da-hs-damlc-app) -- docs --output=$(OUTS) --format=Hoogle $(locations :daml-base-files) --prefix=$(location :daml-base-hoogle-prefix)',
visibility = ["//visibility:public"],
name = "daml-base-hoogle-docs",
srcs = [
":daml-base-files",
":daml-base-hoogle-prefix",
],
outs = ["daml-base-hoogle.txt"],
cmd = "$(location //daml-foundations/daml-tools/da-hs-damlc-app) -- docs --output=$(OUTS) --format=Hoogle $(locations :daml-base-files) --prefix=$(location :daml-base-hoogle-prefix)",
tools = ["//daml-foundations/daml-tools/da-hs-damlc-app"],
visibility = ["//visibility:public"],
)
genrule(
name = 'daml-base-rst-docs',
outs = ['daml-base.rst'],
tools = ['//daml-foundations/daml-tools/da-hs-damlc-app'],
srcs = [':daml-base-files', ':daml-base-rst-prefix'],
cmd = '$(location //daml-foundations/daml-tools/da-hs-damlc-app) -- docs --output=$(OUTS) --format=Rst $(locations :daml-base-files) --prefix=$(location :daml-base-rst-prefix)',
visibility = ["//visibility:public"],
name = "daml-base-rst-docs",
srcs = [
":daml-base-files",
":daml-base-rst-prefix",
],
outs = ["daml-base.rst"],
cmd = "$(location //daml-foundations/daml-tools/da-hs-damlc-app) -- docs --output=$(OUTS) --format=Rst $(locations :daml-base-files) --prefix=$(location :daml-base-rst-prefix)",
tools = ["//daml-foundations/daml-tools/da-hs-damlc-app"],
visibility = ["//visibility:public"],
)

View File

@ -1,9 +1,8 @@
# Copyright (c) 2019 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
filegroup(
name = "daml-prim-and-stdlib-src",
srcs = glob(["**/*.daml"]),
visibility = ["//visibility:public"]
name = "daml-prim-and-stdlib-src",
srcs = glob(["**/*.daml"]),
visibility = ["//visibility:public"],
)

View File

@ -1,9 +1,8 @@
# Copyright (c) 2019 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
filegroup(
name = "daml-prim-src",
srcs = glob(["**/*.daml"]),
visibility = ["//visibility:public"]
name = "daml-prim-src",
srcs = glob(["**/*.daml"]),
visibility = ["//visibility:public"],
)

View File

@ -1,9 +1,11 @@
# Copyright (c) 2019 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
filegroup(
name = "daml-stdlib-src",
srcs = glob(["*.daml", "**/*.daml"]),
visibility = ["//visibility:public"]
name = "daml-stdlib-src",
srcs = glob([
"*.daml",
"**/*.daml",
]),
visibility = ["//visibility:public"],
)

View File

@ -1,11 +1,18 @@
# Copyright (c) 2019 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
load ("//bazel_tools:haskell.bzl"
, "da_haskell_library", "da_haskell_binary", "da_haskell_test")
load ("//daml-foundations/daml-ghc/package-database:util.bzl"
, "daml_package_rule", "daml_package_db", "bundled_package_db")
load(
"//bazel_tools:haskell.bzl",
"da_haskell_binary",
"da_haskell_library",
"da_haskell_test",
)
load(
"//daml-foundations/daml-ghc/package-database:util.bzl",
"bundled_package_db",
"daml_package_db",
"daml_package_rule",
)
daml_package_db(
name = "package_db_for_daml-prim",
@ -14,152 +21,163 @@ daml_package_db(
)
daml_package_rule(
name = "daml-prim-1.0",
pkg_name = "daml-prim",
srcs = "//daml-foundations/daml-ghc/daml-prim-src",
pkg_root = "daml-foundations/daml-ghc/daml-prim-src",
package_db = ":package_db_for_daml-prim",
visibility = ["//visibility:public"],
daml_lf_version = "1.0",
name = "daml-prim-1.0",
srcs = "//daml-foundations/daml-ghc/daml-prim-src",
daml_lf_version = "1.0",
package_db = ":package_db_for_daml-prim",
pkg_name = "daml-prim",
pkg_root = "daml-foundations/daml-ghc/daml-prim-src",
visibility = ["//visibility:public"],
)
daml_package_rule(
name = "daml-prim-1.1",
pkg_name = "daml-prim",
srcs = "//daml-foundations/daml-ghc/daml-prim-src",
pkg_root = "daml-foundations/daml-ghc/daml-prim-src",
package_db = ":package_db_for_daml-prim",
visibility = ["//visibility:public"],
daml_lf_version = "1.1",
name = "daml-prim-1.1",
srcs = "//daml-foundations/daml-ghc/daml-prim-src",
daml_lf_version = "1.1",
package_db = ":package_db_for_daml-prim",
pkg_name = "daml-prim",
pkg_root = "daml-foundations/daml-ghc/daml-prim-src",
visibility = ["//visibility:public"],
)
daml_package_rule(
name = "daml-prim-1.2",
pkg_name = "daml-prim",
srcs = "//daml-foundations/daml-ghc/daml-prim-src",
pkg_root = "daml-foundations/daml-ghc/daml-prim-src",
package_db = ":package_db_for_daml-prim",
visibility = ["//visibility:public"],
daml_lf_version = "1.2",
name = "daml-prim-1.2",
srcs = "//daml-foundations/daml-ghc/daml-prim-src",
daml_lf_version = "1.2",
package_db = ":package_db_for_daml-prim",
pkg_name = "daml-prim",
pkg_root = "daml-foundations/daml-ghc/daml-prim-src",
visibility = ["//visibility:public"],
)
daml_package_rule(
name = "daml-prim-1.3",
pkg_name = "daml-prim",
srcs = "//daml-foundations/daml-ghc/daml-prim-src",
pkg_root = "daml-foundations/daml-ghc/daml-prim-src",
package_db = ":package_db_for_daml-prim",
visibility = ["//visibility:public"],
daml_lf_version = "1.3",
name = "daml-prim-1.3",
srcs = "//daml-foundations/daml-ghc/daml-prim-src",
daml_lf_version = "1.3",
package_db = ":package_db_for_daml-prim",
pkg_name = "daml-prim",
pkg_root = "daml-foundations/daml-ghc/daml-prim-src",
visibility = ["//visibility:public"],
)
daml_package_rule(
name = "daml-prim-dev",
pkg_name = "daml-prim",
srcs = "//daml-foundations/daml-ghc/daml-prim-src",
pkg_root = "daml-foundations/daml-ghc/daml-prim-src",
package_db = ":package_db_for_daml-prim",
visibility = ["//visibility:public"],
daml_lf_version = "dev",
name = "daml-prim-dev",
srcs = "//daml-foundations/daml-ghc/daml-prim-src",
daml_lf_version = "dev",
package_db = ":package_db_for_daml-prim",
pkg_name = "daml-prim",
pkg_root = "daml-foundations/daml-ghc/daml-prim-src",
visibility = ["//visibility:public"],
)
daml_package_rule(
name = "daml-stdlib-1.0",
pkg_name = "daml-stdlib",
srcs = "//daml-foundations/daml-ghc/daml-stdlib-src",
pkg_root = "daml-foundations/daml-ghc/daml-stdlib-src",
package_db = ":package_db_for_daml-stdlib",
daml_lf_version = "1.0",
dependencies = [":daml-prim-1.0"],
visibility = ["//visibility:public"]
name = "daml-stdlib-1.0",
srcs = "//daml-foundations/daml-ghc/daml-stdlib-src",
daml_lf_version = "1.0",
dependencies = [":daml-prim-1.0"],
package_db = ":package_db_for_daml-stdlib",
pkg_name = "daml-stdlib",
pkg_root = "daml-foundations/daml-ghc/daml-stdlib-src",
visibility = ["//visibility:public"],
)
daml_package_rule(
name = "daml-stdlib-1.1",
pkg_name = "daml-stdlib",
srcs = "//daml-foundations/daml-ghc/daml-stdlib-src",
pkg_root = "daml-foundations/daml-ghc/daml-stdlib-src",
package_db = ":package_db_for_daml-stdlib",
daml_lf_version = "1.1",
dependencies = [":daml-prim-1.1"],
visibility = ["//visibility:public"]
name = "daml-stdlib-1.1",
srcs = "//daml-foundations/daml-ghc/daml-stdlib-src",
daml_lf_version = "1.1",
dependencies = [":daml-prim-1.1"],
package_db = ":package_db_for_daml-stdlib",
pkg_name = "daml-stdlib",
pkg_root = "daml-foundations/daml-ghc/daml-stdlib-src",
visibility = ["//visibility:public"],
)
daml_package_rule(
name = "daml-stdlib-1.2",
pkg_name = "daml-stdlib",
srcs = "//daml-foundations/daml-ghc/daml-stdlib-src",
pkg_root = "daml-foundations/daml-ghc/daml-stdlib-src",
package_db = ":package_db_for_daml-stdlib",
daml_lf_version = "1.2",
dependencies = [":daml-prim-1.2"],
visibility = ["//visibility:public"]
name = "daml-stdlib-1.2",
srcs = "//daml-foundations/daml-ghc/daml-stdlib-src",
daml_lf_version = "1.2",
dependencies = [":daml-prim-1.2"],
package_db = ":package_db_for_daml-stdlib",
pkg_name = "daml-stdlib",
pkg_root = "daml-foundations/daml-ghc/daml-stdlib-src",
visibility = ["//visibility:public"],
)
daml_package_rule(
name = "daml-stdlib-1.3",
pkg_name = "daml-stdlib",
srcs = "//daml-foundations/daml-ghc/daml-stdlib-src",
pkg_root = "daml-foundations/daml-ghc/daml-stdlib-src",
package_db = ":package_db_for_daml-stdlib",
daml_lf_version = "1.3",
dependencies = [":daml-prim-1.3"],
visibility = ["//visibility:public"]
name = "daml-stdlib-1.3",
srcs = "//daml-foundations/daml-ghc/daml-stdlib-src",
daml_lf_version = "1.3",
dependencies = [":daml-prim-1.3"],
package_db = ":package_db_for_daml-stdlib",
pkg_name = "daml-stdlib",
pkg_root = "daml-foundations/daml-ghc/daml-stdlib-src",
visibility = ["//visibility:public"],
)
daml_package_rule(
name = "daml-stdlib-dev",
pkg_name = "daml-stdlib",
srcs = "//daml-foundations/daml-ghc/daml-stdlib-src",
pkg_root = "daml-foundations/daml-ghc/daml-stdlib-src",
package_db = ":package_db_for_daml-stdlib",
daml_lf_version = "dev",
dependencies = [":daml-prim-dev"],
visibility = ["//visibility:public"]
name = "daml-stdlib-dev",
srcs = "//daml-foundations/daml-ghc/daml-stdlib-src",
daml_lf_version = "dev",
dependencies = [":daml-prim-dev"],
package_db = ":package_db_for_daml-stdlib",
pkg_name = "daml-stdlib",
pkg_root = "daml-foundations/daml-ghc/daml-stdlib-src",
visibility = ["//visibility:public"],
)
daml_package_db(
name = "package_db_for_daml-stdlib",
pkgs = [":daml-prim-1.0", ":daml-prim-1.1", ":daml-prim-1.2", ":daml-prim-1.3", ":daml-prim-dev"],
visibility = ["//visibility:public"]
name = "package_db_for_daml-stdlib",
pkgs = [
":daml-prim-1.0",
":daml-prim-1.1",
":daml-prim-1.2",
":daml-prim-1.3",
":daml-prim-dev",
],
visibility = ["//visibility:public"],
)
daml_package_db(
name = "package_db_for_damlc",
pkgs = [":daml-prim-1.0"
,":daml-prim-1.1"
,":daml-prim-1.2"
,":daml-prim-1.3"
,":daml-prim-dev"
,":daml-stdlib-1.0"
,":daml-stdlib-1.1"
,":daml-stdlib-1.2"
,":daml-stdlib-1.3"
,":daml-stdlib-dev"
],
visibility = ["//visibility:public"]
name = "package_db_for_damlc",
pkgs = [
":daml-prim-1.0",
":daml-prim-1.1",
":daml-prim-1.2",
":daml-prim-1.3",
":daml-prim-dev",
":daml-stdlib-1.0",
":daml-stdlib-1.1",
":daml-stdlib-1.2",
":daml-stdlib-1.3",
":daml-stdlib-dev",
],
visibility = ["//visibility:public"],
)
bundled_package_db(
name = "package-db",
daml_lf_versions = [
"1.0",
"1.1",
"1.2",
"1.3",
"dev",
],
pkg_db = ":package_db_for_damlc",
daml_lf_versions = ["1.0", "1.1", "1.2", "1.3", "dev"],
visibility = ["//visibility:public"],
)
# TODO Make sure that tools no longer rely on this.
# The daml-prim .dar archive. It is shipped as DAML-LF 1.0 such that we can link it from DAML-LF 1.0
# as well as DAML-LF 1.1 dalfs.
genrule(
name = "gen-daml-prim.dar",
outs = ["daml-prim.dar"],
tools = ["//daml-foundations/daml-tools/da-hs-damlc-app"],
srcs = ["//daml-foundations/daml-ghc/daml-prim-src"],
cmd = """
name = "gen-daml-prim.dar",
srcs = ["//daml-foundations/daml-ghc/daml-prim-src"],
outs = ["daml-prim.dar"],
cmd = """
$(location //daml-foundations/daml-tools/da-hs-damlc-app) \
package daml-foundations/daml-ghc/daml-prim-src/LibraryModules.daml daml-prim --target 1.0 -o $(location daml-prim.dar)
""",
visibility = ["//visibility:public"],
tools = ["//daml-foundations/daml-tools/da-hs-damlc-app"],
visibility = ["//visibility:public"],
)

View File

@ -1,63 +1,69 @@
# Copyright (c) 2019 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
load ("//daml-foundations/daml-ghc/package-database:util.bzl", "bundled_package_db", "daml_package_rule", "daml_package_db")
load("//daml-foundations/daml-ghc/package-database:util.bzl", "bundled_package_db", "daml_package_db", "daml_package_rule")
bundled_package_db(
name = "package-db",
daml_lf_versions = [
"1.0",
"1.1",
"1.2",
"1.3",
],
pkg_db = ":package_db_for_damlc",
daml_lf_versions = ["1.0", "1.1", "1.2", "1.3"],
visibility = ["//visibility:public"],
)
daml_package_rule(
name = "daml-prim-1.0",
pkg_name = "daml-prim",
srcs = "//daml-foundations/daml-ghc/daml-prim-and-stdlib-src",
pkg_root = "daml-foundations/daml-ghc/daml-prim-and-stdlib-src",
package_db = "//daml-foundations/daml-ghc/package-database:package_db_for_daml-prim",
visibility = ["//visibility:public"],
daml_lf_version = "1.0",
name = "daml-prim-1.0",
srcs = "//daml-foundations/daml-ghc/daml-prim-and-stdlib-src",
daml_lf_version = "1.0",
package_db = "//daml-foundations/daml-ghc/package-database:package_db_for_daml-prim",
pkg_name = "daml-prim",
pkg_root = "daml-foundations/daml-ghc/daml-prim-and-stdlib-src",
visibility = ["//visibility:public"],
)
daml_package_rule(
name = "daml-prim-1.1",
pkg_name = "daml-prim",
srcs = "//daml-foundations/daml-ghc/daml-prim-and-stdlib-src",
pkg_root = "daml-foundations/daml-ghc/daml-prim-and-stdlib-src",
package_db = "//daml-foundations/daml-ghc/package-database:package_db_for_daml-prim",
visibility = ["//visibility:public"],
daml_lf_version = "1.1",
name = "daml-prim-1.1",
srcs = "//daml-foundations/daml-ghc/daml-prim-and-stdlib-src",
daml_lf_version = "1.1",
package_db = "//daml-foundations/daml-ghc/package-database:package_db_for_daml-prim",
pkg_name = "daml-prim",
pkg_root = "daml-foundations/daml-ghc/daml-prim-and-stdlib-src",
visibility = ["//visibility:public"],
)
daml_package_rule(
name = "daml-prim-1.2",
pkg_name = "daml-prim",
srcs = "//daml-foundations/daml-ghc/daml-prim-and-stdlib-src",
pkg_root = "daml-foundations/daml-ghc/daml-prim-and-stdlib-src",
package_db = "//daml-foundations/daml-ghc/package-database:package_db_for_daml-prim",
visibility = ["//visibility:public"],
daml_lf_version = "1.2",
name = "daml-prim-1.2",
srcs = "//daml-foundations/daml-ghc/daml-prim-and-stdlib-src",
daml_lf_version = "1.2",
package_db = "//daml-foundations/daml-ghc/package-database:package_db_for_daml-prim",
pkg_name = "daml-prim",
pkg_root = "daml-foundations/daml-ghc/daml-prim-and-stdlib-src",
visibility = ["//visibility:public"],
)
daml_package_rule(
name = "daml-prim-1.3",
pkg_name = "daml-prim",
srcs = "//daml-foundations/daml-ghc/daml-prim-and-stdlib-src",
pkg_root = "daml-foundations/daml-ghc/daml-prim-and-stdlib-src",
package_db = "//daml-foundations/daml-ghc/package-database:package_db_for_daml-prim",
visibility = ["//visibility:public"],
daml_lf_version = "1.3",
name = "daml-prim-1.3",
srcs = "//daml-foundations/daml-ghc/daml-prim-and-stdlib-src",
daml_lf_version = "1.3",
package_db = "//daml-foundations/daml-ghc/package-database:package_db_for_daml-prim",
pkg_name = "daml-prim",
pkg_root = "daml-foundations/daml-ghc/daml-prim-and-stdlib-src",
visibility = ["//visibility:public"],
)
daml_package_db(
name = "package_db_for_damlc",
pkgs = [":daml-prim-1.0"
,":daml-prim-1.1"
,":daml-prim-1.2"
,":daml-prim-1.3"
],
visibility = ["//visibility:public"]
name = "package_db_for_damlc",
pkgs = [
":daml-prim-1.0",
":daml-prim-1.1",
":daml-prim-1.2",
":daml-prim-1.3",
],
visibility = ["//visibility:public"],
)
alias(

View File

@ -28,7 +28,6 @@
# Outputs:
# - A tarball containing the combined package database
PACKAGE_CONF_TEMPLATE = """
name: {name}
version: 1.0.0
@ -44,39 +43,39 @@ data-dir: $topdir/{name}
depends: {depends}
"""
DamlPackage = provider(fields=["daml_lf_version", "pkg_name", "pkg_conf", "iface_tar", "dalf", "modules"])
DamlPackage = provider(fields = ["daml_lf_version", "pkg_name", "pkg_conf", "iface_tar", "dalf", "modules"])
# Compile a DAML file and create the GHC package database
# for it.
def _daml_package_rule_impl(ctx):
name = ctx.attr.name
name = ctx.attr.name
# Construct mapping from module names to paths
modules = {}
for file in ctx.files.srcs:
# FIXME(JM): HACK: the `[3:]` assumes we're in
# daml-foundations/daml-ghc! Find a way to get the
# base path...
modules[".".join(file.path[:-5].split("/")[3:])] = file.path
# Construct mapping from module names to paths
modules = {}
for file in ctx.files.srcs:
# FIXME(JM): HACK: the `[3:]` assumes we're in
# daml-foundations/daml-ghc! Find a way to get the
# base path...
modules[".".join(file.path[:-5].split("/")[3:])] = file.path
# Create the package conf file
ctx.actions.write(
output = ctx.outputs.config,
content = PACKAGE_CONF_TEMPLATE.format(
name = ctx.attr.pkg_name,
modules = " ".join(modules.keys()),
depends = " ".join([dep[DamlPackage].pkg_name for dep in ctx.attr.dependencies])
# Create the package conf file
ctx.actions.write(
output = ctx.outputs.config,
content = PACKAGE_CONF_TEMPLATE.format(
name = ctx.attr.pkg_name,
modules = " ".join(modules.keys()),
depends = " ".join([dep[DamlPackage].pkg_name for dep in ctx.attr.dependencies]),
),
)
)
package_db_tar = ctx.attr.package_db[PackageDb].tar
package_db_tar = ctx.attr.package_db[PackageDb].tar
ctx.actions.run_shell(
outputs = [ctx.outputs.dalf, ctx.outputs.iface_tar],
inputs = ctx.files.srcs + [package_db_tar],
tools = [ctx.executable.damlc_bootstrap],
progress_message = "Compiling " + name + ".daml to daml-lf " + ctx.attr.daml_lf_version,
command = """
ctx.actions.run_shell(
outputs = [ctx.outputs.dalf, ctx.outputs.iface_tar],
inputs = ctx.files.srcs + [package_db_tar],
tools = [ctx.executable.damlc_bootstrap],
progress_message = "Compiling " + name + ".daml to daml-lf " + ctx.attr.daml_lf_version,
command = """
mkdir -p tmp_db
tar xf {db_tar} -C tmp_db --strip-components 1
mkdir -p tmp_db/{daml_lf_version}
@ -92,166 +91,169 @@ def _daml_package_rule_impl(ctx):
tar cf {iface_tar} '--exclude=*.daml' -C $(dirname {pkg_root}) $(basename {pkg_root})
""".format(
main = modules[ctx.attr.main],
name = name,
damlc_bootstrap = ctx.executable.damlc_bootstrap.path,
dalf_file = ctx.outputs.dalf.path,
daml_lf_version = ctx.attr.daml_lf_version,
db_tar = package_db_tar.path,
iface_tar = ctx.outputs.iface_tar.path,
pkg_root = ctx.attr.pkg_root,
pkg_name = ctx.attr.pkg_name,
)
main = modules[ctx.attr.main],
name = name,
damlc_bootstrap = ctx.executable.damlc_bootstrap.path,
dalf_file = ctx.outputs.dalf.path,
daml_lf_version = ctx.attr.daml_lf_version,
db_tar = package_db_tar.path,
iface_tar = ctx.outputs.iface_tar.path,
pkg_root = ctx.attr.pkg_root,
pkg_name = ctx.attr.pkg_name,
),
)
return [
DefaultInfo(),
DamlPackage(
pkg_name = ctx.attr.pkg_name,
daml_lf_version = ctx.attr.daml_lf_version,
pkg_conf = ctx.outputs.config,
iface_tar = ctx.outputs.iface_tar,
dalf = ctx.outputs.dalf,
modules = [k for k in modules],
),
]
return [
DefaultInfo(),
DamlPackage(
pkg_name = ctx.attr.pkg_name,
daml_lf_version = ctx.attr.daml_lf_version,
pkg_conf = ctx.outputs.config,
iface_tar = ctx.outputs.iface_tar,
dalf = ctx.outputs.dalf,
modules = [k for k in modules],
),
]
def _daml_package_outputs_impl(name):
return {
"dalf": name + ".dalf",
"config": name + ".conf",
"iface_tar": name + ".tar",
}
return {
"dalf": name + ".dalf",
"config": name + ".conf",
"iface_tar": name + ".tar",
}
daml_package_rule = rule(
implementation = _daml_package_rule_impl,
toolchains=["@io_tweag_rules_haskell//haskell:toolchain"],
attrs = {
"pkg_name": attr.string(mandatory = True),
"main": attr.string(default = "LibraryModules"),
"srcs": attr.label(allow_files = True),
"pkg_root": attr.string(),
"package_db": attr.label(
default = Label("//daml-foundations/daml-ghc/package-database:package-db"),
executable = False,
cfg = "host",),
"dependencies": attr.label_list(allow_files = False),
"damlc_bootstrap": attr.label(
default = Label("//daml-foundations/daml-tools/da-hs-damlc-app:damlc_bootstrap"),
executable = True,
cfg = "host",
),
"daml_lf_version": attr.string(
mandatory = True,
),
},
outputs = _daml_package_outputs_impl
implementation = _daml_package_rule_impl,
toolchains = ["@io_tweag_rules_haskell//haskell:toolchain"],
attrs = {
"pkg_name": attr.string(mandatory = True),
"main": attr.string(default = "LibraryModules"),
"srcs": attr.label(allow_files = True),
"pkg_root": attr.string(),
"package_db": attr.label(
default = Label("//daml-foundations/daml-ghc/package-database:package-db"),
executable = False,
cfg = "host",
),
"dependencies": attr.label_list(allow_files = False),
"damlc_bootstrap": attr.label(
default = Label("//daml-foundations/daml-tools/da-hs-damlc-app:damlc_bootstrap"),
executable = True,
cfg = "host",
),
"daml_lf_version": attr.string(
mandatory = True,
),
},
outputs = _daml_package_outputs_impl,
)
PackageDb = provider(fields=["tar", "pkgs"])
PackageDb = provider(fields = ["tar", "pkgs"])
def _daml_package_db_impl(ctx):
toolchain = ctx.toolchains["@io_tweag_rules_haskell//haskell:toolchain"]
ctx.actions.run_shell(
inputs = [inp for pkg in ctx.attr.pkgs for inp in [pkg[DamlPackage].pkg_conf, pkg[DamlPackage].iface_tar, pkg[DamlPackage].dalf]],
tools = [toolchain.tools.ghc_pkg],
outputs = [ctx.outputs.tar],
command =
"""
toolchain = ctx.toolchains["@io_tweag_rules_haskell//haskell:toolchain"]
ctx.actions.run_shell(
inputs = [inp for pkg in ctx.attr.pkgs for inp in [pkg[DamlPackage].pkg_conf, pkg[DamlPackage].iface_tar, pkg[DamlPackage].dalf]],
tools = [toolchain.tools.ghc_pkg],
outputs = [ctx.outputs.tar],
command =
"""
mkdir package_db
"""
+
"".join(
["""
""" +
"".join(
[
"""
mkdir -p package_db/{daml_lf_version}/{pkg_name}
cp {pkg_conf} package_db/{daml_lf_version}/{pkg_name}.conf
tar xf {iface_tar} --strip-components=1 -C package_db/{daml_lf_version}/{pkg_name}/
cp {dalf} package_db/{daml_lf_version}/{pkg_name}.dalf
""".format(
daml_lf_version = pkg[DamlPackage].daml_lf_version,
pkg_name = pkg[DamlPackage].pkg_name,
pkg_conf = pkg[DamlPackage].pkg_conf.path,
iface_tar = pkg[DamlPackage].iface_tar.path,
dalf = pkg[DamlPackage].dalf.path,
)
for pkg
in ctx.attr.pkgs]
)
+
"""
daml_lf_version = pkg[DamlPackage].daml_lf_version,
pkg_name = pkg[DamlPackage].pkg_name,
pkg_conf = pkg[DamlPackage].pkg_conf.path,
iface_tar = pkg[DamlPackage].iface_tar.path,
dalf = pkg[DamlPackage].dalf.path,
)
for pkg in ctx.attr.pkgs
],
) +
"""
for lf_version in package_db/*; do
{ghc_pkg} recache --package-db=$lf_version --no-expand-pkgroot
done
tar cf {db_tar} package_db
""".format(
db_tar = ctx.outputs.tar.path,
ghc_pkg = toolchain.tools.ghc_pkg.path,
),
)
return [
DefaultInfo(),
PackageDb(tar = ctx.outputs.tar, pkgs = [pkg[DamlPackage] for pkg in ctx.attr.pkgs]),
]
db_tar = ctx.outputs.tar.path,
ghc_pkg = toolchain.tools.ghc_pkg.path,
),
)
return [
DefaultInfo(),
PackageDb(tar = ctx.outputs.tar, pkgs = [pkg[DamlPackage] for pkg in ctx.attr.pkgs]),
]
def _daml_package_db_outputs_impl(name):
return {
"tar": name + ".tar",
}
return {
"tar": name + ".tar",
}
daml_package_db = rule(
implementation = _daml_package_db_impl,
toolchains=["@io_tweag_rules_haskell//haskell:toolchain"],
attrs = {
"pkgs": attr.label_list(
allow_files = False,
providers = [DamlPackage],
),
},
outputs = _daml_package_db_outputs_impl
implementation = _daml_package_db_impl,
toolchains = ["@io_tweag_rules_haskell//haskell:toolchain"],
attrs = {
"pkgs": attr.label_list(
allow_files = False,
providers = [DamlPackage],
),
},
outputs = _daml_package_db_outputs_impl,
)
# We might want to kill this rule at some point but I find the fact that
# I can just mess around with tarballs in the other rules way more convenient
# so given that we only use the bundling stuff once, this seems somewhat reasonable.
def _bundled_package_db_impl(ctx):
db_files = [f for daml_lf_version in ctx.attr.daml_lf_versions
for f in [ctx.actions.declare_file("{daml_lf_version}/package.cache".format(daml_lf_version = daml_lf_version)),
ctx.actions.declare_file("{daml_lf_version}/package.cache.lock".format(daml_lf_version = daml_lf_version))]]
pkg_db = ctx.attr.pkg_db[PackageDb]
root = ctx.actions.declare_file("ROOT")
for pkg in pkg_db.pkgs:
pkg_conf = ctx.actions.declare_file("{daml_lf_version}/{pkg_name}.conf".format(
daml_lf_version = pkg.daml_lf_version,
pkg_name = pkg.pkg_name
))
dalf = ctx.actions.declare_file("{daml_lf_version}/{pkg_name}.dalf".format(
daml_lf_version = pkg.daml_lf_version,
pkg_name = pkg.pkg_name
))
iface_files = [ctx.actions.declare_file("{daml_lf_version}/{pkg_name}/{module}.hi".format(daml_lf_version = pkg.daml_lf_version, pkg_name = pkg.pkg_name, module = module.replace(".", "/"))) for module in pkg.modules]
db_files = db_files + [pkg_conf, dalf] + iface_files
ctx.actions.run_shell(
inputs = [pkg_db.tar],
outputs = [root] + db_files,
command =
"""
db_files = [
f
for daml_lf_version in ctx.attr.daml_lf_versions
for f in [
ctx.actions.declare_file("{daml_lf_version}/package.cache".format(daml_lf_version = daml_lf_version)),
ctx.actions.declare_file("{daml_lf_version}/package.cache.lock".format(daml_lf_version = daml_lf_version)),
]
]
pkg_db = ctx.attr.pkg_db[PackageDb]
root = ctx.actions.declare_file("ROOT")
for pkg in pkg_db.pkgs:
pkg_conf = ctx.actions.declare_file("{daml_lf_version}/{pkg_name}.conf".format(
daml_lf_version = pkg.daml_lf_version,
pkg_name = pkg.pkg_name,
))
dalf = ctx.actions.declare_file("{daml_lf_version}/{pkg_name}.dalf".format(
daml_lf_version = pkg.daml_lf_version,
pkg_name = pkg.pkg_name,
))
iface_files = [ctx.actions.declare_file("{daml_lf_version}/{pkg_name}/{module}.hi".format(daml_lf_version = pkg.daml_lf_version, pkg_name = pkg.pkg_name, module = module.replace(".", "/"))) for module in pkg.modules]
db_files = db_files + [pkg_conf, dalf] + iface_files
ctx.actions.run_shell(
inputs = [pkg_db.tar],
outputs = [root] + db_files,
command =
"""
touch {root_file}
tar xf {db_tar} --strip-components=1 -C $(dirname {root_file})
""".format(db_tar = pkg_db.tar.path, root_file = root.path),
)
return [
DefaultInfo(files = depset(db_files), runfiles = ctx.runfiles(files = db_files)),
]
)
return [
DefaultInfo(files = depset(db_files), runfiles = ctx.runfiles(files = db_files)),
]
bundled_package_db = rule(
implementation = _bundled_package_db_impl,
attrs = {
"pkg_db": attr.label(
allow_files = False,
providers = [PackageDb],
),
"daml_lf_versions": attr.string_list(),
},
implementation = _bundled_package_db_impl,
attrs = {
"pkg_db": attr.label(
allow_files = False,
providers = [PackageDb],
),
"daml_lf_versions": attr.string_list(),
},
)

View File

@ -1,7 +1,7 @@
# Copyright (c) 2019 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
load ("//bazel_tools:haskell.bzl", "da_haskell_test")
load("//bazel_tools:haskell.bzl", "da_haskell_test")
def _daml_ghc_compile_test_impl(ctx):
stack_opt = "-K" + ctx.attr.stack_limit if ctx.attr.stack_limit else ""
@ -9,40 +9,42 @@ def _daml_ghc_compile_test_impl(ctx):
script = """
{damlc} compile {main} -o /dev/null +RTS {stack_opt} {heap_opt}
""".format(
damlc = ctx.executable.damlc.short_path,
main = ctx.files.main[0].short_path,
stack_opt = stack_opt,
heap_opt = heap_opt,
damlc = ctx.executable.damlc.short_path,
main = ctx.files.main[0].short_path,
stack_opt = stack_opt,
heap_opt = heap_opt,
)
ctx.actions.write(
output = ctx.outputs.executable,
content = script,
)
# To ensure the files needed by the script are available, we put them in
# the runfiles.
runfiles = ctx.runfiles(files =
ctx.files.srcs + ctx.files.main
+ [ctx.executable.damlc]
runfiles = ctx.runfiles(
files =
ctx.files.srcs + ctx.files.main +
[ctx.executable.damlc],
)
return [DefaultInfo(
runfiles = runfiles
runfiles = runfiles,
)]
daml_ghc_compile_test = rule(
implementation = _daml_ghc_compile_test_impl,
attrs = {
"srcs": attr.label_list(allow_files = True),
"main": attr.label(allow_files = True),
"damlc": attr.label(
default = Label("//daml-foundations/daml-tools/da-hs-damlc-app:da-hs-damlc-app"),
executable = True,
cfg = "target",
allow_files = True
),
"stack_limit": attr.string(),
"heap_limit": attr.string(),
},
test = True,
implementation = _daml_ghc_compile_test_impl,
attrs = {
"srcs": attr.label_list(allow_files = True),
"main": attr.label(allow_files = True),
"damlc": attr.label(
default = Label("//daml-foundations/daml-tools/da-hs-damlc-app:da-hs-damlc-app"),
executable = True,
cfg = "target",
allow_files = True,
),
"stack_limit": attr.string(),
"heap_limit": attr.string(),
},
test = True,
)
def daml_ghc_integration_test(name, main_function):
@ -52,48 +54,47 @@ def daml_ghc_integration_test(name, main_function):
src_strip_prefix = "src",
main_function = main_function,
data = [
"//daml-foundations/daml-ghc/package-database:package-db"
, "//compiler/scenario-service/server:scenario_service_jar"
, "@jq//:bin"
, ":tests"
, ":bond-trading"
"//daml-foundations/daml-ghc/package-database:package-db",
"//compiler/scenario-service/server:scenario_service_jar",
"@jq//:bin",
":tests",
":bond-trading",
],
deps = [
":daml-ghc-lib"
, "//compiler/daml-lf-ast"
, "//daml-lf/archive:daml_lf_haskell_proto"
, "//libs-haskell/da-hs-pretty"
, "//libs-haskell/da-hs-base"
, "//libs-haskell/prettyprinter-syntax"
, "//compiler/haskell-ide-core"
, "//libs-haskell/da-hs-language-server"
":daml-ghc-lib",
"//compiler/daml-lf-ast",
"//daml-lf/archive:daml_lf_haskell_proto",
"//libs-haskell/da-hs-pretty",
"//libs-haskell/da-hs-base",
"//libs-haskell/prettyprinter-syntax",
"//compiler/haskell-ide-core",
"//libs-haskell/da-hs-language-server",
],
hazel_deps = [
"aeson",
"base",
"bytestring",
"containers",
"deepseq",
"directory",
"dlist",
"extra",
"filepath",
"ghc-lib",
"ghc-lib-parser",
"lens",
"lens-aeson",
"managed",
"optparse-applicative",
"process",
"shake",
"tagged",
"tasty",
"tasty-hunit",
"text",
"time",
"aeson",
"base",
"bytestring",
"containers",
"deepseq",
"directory",
"dlist",
"extra",
"filepath",
"ghc-lib",
"ghc-lib-parser",
"lens",
"lens-aeson",
"managed",
"optparse-applicative",
"process",
"shake",
"tagged",
"tasty",
"tasty-hunit",
"text",
"time",
],
visibility = ["//visibility:public"],
# TODO fix flakiness, see #990
flaky = True,
)

View File

@ -2,6 +2,6 @@
# SPDX-License-Identifier: Apache-2.0
load(
"//rules_daml:daml.bzl",
"daml_compile"
"//rules_daml:daml.bzl",
"daml_compile",
)

View File

@ -1,99 +1,94 @@
# Copyright (c) 2019 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
load ("//bazel_tools:haskell.bzl", "da_haskell_library", "da_haskell_test")
load("//bazel_tools:haskell.bzl", "da_haskell_library", "da_haskell_test")
da_haskell_library (
name = "da-hs-daml-cli"
, extra_srcs = [
"//daml-foundations/daml-tools/docs/daml-licenses/licenses:licensing.md"
]
, srcs = glob (["DA/**/*.hs"])
, hazel_deps = [
"aeson",
"aeson-pretty",
"ansi-wl-pprint",
"base",
"bytestring",
"containers",
"cryptonite",
"directory",
"extra",
"file-embed",
"filepath",
"ghc-lib",
"gitrev",
"lens",
"lens-aeson",
"managed",
"memory",
"mtl",
"network",
"optparse-applicative",
"prettyprinter",
"safe-exceptions",
"shake",
"split",
"tasty",
"tasty-ant-xml",
"tasty-hunit",
"text",
"vector",
"xml",
"yaml",
"zip-archive"
]
, deps = [
"//compiler/daml-lf-ast"
, "//compiler/daml-lf-proto"
, "//compiler/daml-lf-tools"
, "//daml-lf/archive:daml_lf_haskell_proto"
, "//libs-haskell/da-hs-base"
, "//libs-haskell/da-hs-pretty"
, "//libs-haskell/prettyprinter-syntax"
, "//compiler/haskell-ide-core"
, "//compiler/scenario-service/client"
, "//compiler/scenario-service/protos:scenario_service_haskell_proto"
, "//daml-foundations/daml-ghc:daml-ghc-lib"
, "//:sdk-version-hs-lib"
, "//nix/third-party/proto3-suite:proto3-suite"
, "//daml-assistant:daml-project-config"
]
, visibility = ["//visibility:public"]
da_haskell_library(
name = "da-hs-daml-cli",
srcs = glob(["DA/**/*.hs"]),
extra_srcs = [
"//daml-foundations/daml-tools/docs/daml-licenses/licenses:licensing.md",
],
hazel_deps = [
"aeson",
"aeson-pretty",
"ansi-wl-pprint",
"base",
"bytestring",
"containers",
"cryptonite",
"directory",
"extra",
"file-embed",
"filepath",
"ghc-lib",
"gitrev",
"lens",
"lens-aeson",
"managed",
"memory",
"mtl",
"network",
"optparse-applicative",
"prettyprinter",
"safe-exceptions",
"shake",
"split",
"tasty",
"tasty-ant-xml",
"tasty-hunit",
"text",
"vector",
"xml",
"yaml",
"zip-archive",
],
visibility = ["//visibility:public"],
deps = [
"//:sdk-version-hs-lib",
"//compiler/daml-lf-ast",
"//compiler/daml-lf-proto",
"//compiler/daml-lf-tools",
"//compiler/haskell-ide-core",
"//compiler/scenario-service/client",
"//compiler/scenario-service/protos:scenario_service_haskell_proto",
"//daml-assistant:daml-project-config",
"//daml-foundations/daml-ghc:daml-ghc-lib",
"//daml-lf/archive:daml_lf_haskell_proto",
"//libs-haskell/da-hs-base",
"//libs-haskell/da-hs-pretty",
"//libs-haskell/prettyprinter-syntax",
"//nix/third-party/proto3-suite",
],
)
da_haskell_test(
name = "da-hs-daml-cli-tests",
srcs = ["tests/Cli.hs"],
deps = [
":da-hs-daml-cli",
],
data = [
"//daml-foundations/daml-ghc/package-database:package-db"
, "//compiler/scenario-service/server:scenario_service_jar"
"//compiler/scenario-service/server:scenario_service_jar",
"//daml-foundations/daml-ghc/package-database:package-db",
],
hazel_deps = [
"tasty",
"base",
"tasty-hunit",
],
visibility = ["//visibility:private"],
main_function = "Cli.main",
# TODO remove flakiness, see #990
flaky = True,
hazel_deps = [
"tasty",
"base",
"tasty-hunit",
],
main_function = "Cli.main",
visibility = ["//visibility:private"],
deps = [
":da-hs-daml-cli",
],
)
da_haskell_test(
name = "damlc-test-tests",
srcs = ["tests/DamlcTest.hs"],
deps = [
":da-hs-daml-cli",
"//daml-foundations/daml-ghc:daml-ghc-lib",
"//libs-haskell/da-hs-base",
],
data = [
"//daml-foundations/daml-ghc/package-database:package-db",
"//compiler/scenario-service/server:scenario_service_jar",
"//daml-foundations/daml-ghc/package-database:package-db",
],
hazel_deps = [
"base",
@ -101,6 +96,11 @@ da_haskell_test(
"tasty",
"tasty-hunit",
],
visibility = ["//visibility:private"],
main_function = "DamlcTest.main",
visibility = ["//visibility:private"],
deps = [
":da-hs-daml-cli",
"//daml-foundations/daml-ghc:daml-ghc-lib",
"//libs-haskell/da-hs-base",
],
)

View File

@ -1,85 +1,83 @@
# Copyright (c) 2019 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")
load ("//bazel_tools:packaging/packaging.bzl", "package_app")
load("//bazel_tools:haskell.bzl", "da_haskell_binary")
load("//bazel_tools:packaging/packaging.bzl", "package_app")
da_haskell_binary (
name = "da-hs-damlc-app"
, src_strip_prefix = "src"
, srcs = ['src/Main.hs']
, deps = [
"//daml-foundations/daml-tools/da-hs-daml-cli"
]
, hazel_deps = [
"base"
]
, data = [
"//daml-foundations/daml-ghc/package-database:package-db"
, "//compiler/scenario-service/server:scenario_service_jar"
]
, visibility = ["//visibility:public"]
, linkstatic = True
da_haskell_binary(
name = "da-hs-damlc-app",
srcs = ["src/Main.hs"],
data = [
"//compiler/scenario-service/server:scenario_service_jar",
"//daml-foundations/daml-ghc/package-database:package-db",
],
hazel_deps = [
"base",
],
linkstatic = True,
src_strip_prefix = "src",
visibility = ["//visibility:public"],
deps = [
"//daml-foundations/daml-tools/da-hs-daml-cli",
],
)
da_haskell_binary (
name = "da-hs-damlc-app-deprecated"
, src_strip_prefix = "src"
, srcs = ['src/Main.hs']
, deps = [
"//daml-foundations/daml-tools/da-hs-daml-cli"
]
, hazel_deps = [
"base"
]
, data = [
"//daml-foundations/daml-ghc/package-database/deprecated:package-db"
, "//compiler/scenario-service/server:scenario_service_jar"
]
, visibility = ["//visibility:public"]
, linkstatic = True
da_haskell_binary(
name = "da-hs-damlc-app-deprecated",
srcs = ["src/Main.hs"],
data = [
"//compiler/scenario-service/server:scenario_service_jar",
"//daml-foundations/daml-ghc/package-database/deprecated:package-db",
],
hazel_deps = [
"base",
],
linkstatic = True,
src_strip_prefix = "src",
visibility = ["//visibility:public"],
deps = [
"//daml-foundations/daml-tools/da-hs-daml-cli",
],
)
da_haskell_binary (
name = "damlc_bootstrap"
, src_strip_prefix = "src"
, srcs = ['src/Main.hs']
, deps = [
"//daml-foundations/daml-tools/da-hs-daml-cli"
]
, hazel_deps = [
"base"
]
, visibility = ["//visibility:public"]
da_haskell_binary(
name = "damlc_bootstrap",
srcs = ["src/Main.hs"],
hazel_deps = [
"base",
],
src_strip_prefix = "src",
visibility = ["//visibility:public"],
deps = [
"//daml-foundations/daml-tools/da-hs-daml-cli",
],
)
package_app(
name = "damlc-dist"
, binary = ":da-hs-damlc-app"
, resources = [
"//compiler/scenario-service/server:scenario_service_jar"
, "//daml-foundations/daml-ghc/package-database:package-db"
, "//daml-foundations/daml-ghc/package-database:gen-daml-prim.dar"
]
, visibility = ["//visibility:public"]
, tags = ["no-cache"]
name = "damlc-dist",
binary = ":da-hs-damlc-app",
resources = [
"//compiler/scenario-service/server:scenario_service_jar",
"//daml-foundations/daml-ghc/package-database:gen-daml-prim.dar",
"//daml-foundations/daml-ghc/package-database:package-db",
],
tags = ["no-cache"],
visibility = ["//visibility:public"],
)
sh_test(
name = "dist-test"
, srcs = ["test/check-dist.sh"]
, data = [
":damlc-dist.tar.gz"
, ":test/Main.daml"
, "@tar_nix//:bin/tar"
, "@gzip_nix//:bin/gzip"
]
, args = [
"$(location :damlc-dist.tar.gz)"
, "$(location :test/Main.daml)"
, "$(location @tar_nix//:bin/tar)"
, "$(location @gzip_nix//:bin/gzip)"
]
name = "dist-test",
srcs = ["test/check-dist.sh"],
args = [
"$(location :damlc-dist.tar.gz)",
"$(location :test/Main.daml)",
"$(location @tar_nix//:bin/tar)",
"$(location @gzip_nix//:bin/gzip)",
],
data = [
":damlc-dist.tar.gz",
":test/Main.daml",
"@gzip_nix//:bin/gzip",
"@tar_nix//:bin/tar",
],
)

View File

@ -1,35 +1,34 @@
# Copyright (c) 2019 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")
load ("//bazel_tools:packaging/packaging.bzl", "package_app")
load("//bazel_tools:haskell.bzl", "da_haskell_binary")
load("//bazel_tools:packaging/packaging.bzl", "package_app")
da_haskell_binary (
name = "damli"
, src_strip_prefix = "src"
, srcs = ['src/Main.hs']
, deps = [
"//daml-foundations/daml-tools/da-hs-daml-cli:da-hs-daml-cli"
]
, hazel_deps = [
"base"
]
, data = [
"//daml-foundations/daml-ghc/package-database:package-db"
, "//compiler/scenario-service/server:scenario_service_jar"
]
, visibility = ["//visibility:public"]
, linkstatic = True
da_haskell_binary(
name = "damli",
srcs = ["src/Main.hs"],
data = [
"//compiler/scenario-service/server:scenario_service_jar",
"//daml-foundations/daml-ghc/package-database:package-db",
],
hazel_deps = [
"base",
],
linkstatic = True,
src_strip_prefix = "src",
visibility = ["//visibility:public"],
deps = [
"//daml-foundations/daml-tools/da-hs-daml-cli",
],
)
package_app(
name = "dist"
, binary = ":damli"
, resources = [
"//compiler/scenario-service/server:scenario_service_jar"
, "//daml-foundations/daml-ghc/package-database:package-db"
]
, visibility = ["//visibility:public"]
, tags = ["no-cache"]
name = "dist",
binary = ":damli",
resources = [
"//compiler/scenario-service/server:scenario_service_jar",
"//daml-foundations/daml-ghc/package-database:package-db",
],
tags = ["no-cache"],
visibility = ["//visibility:public"],
)

View File

@ -1,7 +1,8 @@
# Copyright (c) 2019 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
package(default_visibility=["//visibility:public"])
package(default_visibility = ["//visibility:public"])
load("@build_bazel_rules_typescript//:defs.bzl", "ts_library")
load("@build_bazel_rules_nodejs//:defs.bzl", "npm_package")
load("//bazel_tools:pkg.bzl", "pkg_tar")
@ -16,48 +17,47 @@ ts_library(
tsconfig = ":tsconfig.json",
)
# With this rule we get access to extension.js, as
# the ts_library only has the .d.ts file in the outputs.
# Could possibly also use filegroup, which allows specifying
# the output group (es5_source).
npm_package(
name = "out", # named out, so it goes to same place as before
deps = [
":daml_extension_lib",
]
name = "out", # named out, so it goes to same place as before
deps = [
":daml_extension_lib",
],
)
pkg_tar(
name = "dot-dist",
extension = "tar.gz",
mode = "0755",
package_dir = "daml-extension",
remap_paths = {
"../daml_extension_deps/node_modules": "node_modules"
},
strip_prefix = "./",
srcs = glob([
"package.json",
"syntaxes/*",
"snippets/*",
"images/*",
"*.json",
"README.md",
]) + [
":out",
"@daml_extension_deps//vscode-jsonrpc:vscode-jsonrpc",
"@daml_extension_deps//vscode-languageclient:vscode-languageclient",
"@daml_extension_deps//vscode-languageserver-types:vscode-languageserver-types",
"@daml_extension_deps//which:which",
],
name = "dot-dist",
srcs = glob([
"package.json",
"syntaxes/*",
"snippets/*",
"images/*",
"*.json",
"README.md",
]) + [
":out",
"@daml_extension_deps//vscode-jsonrpc:vscode-jsonrpc",
"@daml_extension_deps//vscode-languageclient:vscode-languageclient",
"@daml_extension_deps//vscode-languageserver-types:vscode-languageserver-types",
"@daml_extension_deps//which:which",
],
extension = "tar.gz",
mode = "0755",
package_dir = "daml-extension",
remap_paths = {
"../daml_extension_deps/node_modules": "node_modules",
},
strip_prefix = "./",
)
# NOTE(MH): The `pkg_tar` rule puts a `.` at the beginning of every path, which
# would break assumptions made in the sdk assistant. Hence we need to repack
# the tarball to get rid of the `.`.
genrule(
name = 'dist',
name = "dist",
srcs = [":dot-dist"],
outs = ["dist.tar.gz"],
cmd = """

View File

@ -4,44 +4,44 @@
load("//bazel_tools:java.bzl", "da_java_binary")
java_library(
name = 'damlc_library_jar',
srcs = glob(['src/**/*.java']),
resource_jars = [
":damlc-dist-resource-jar"
],
visibility = ["//visibility:public"]
name = "damlc_library_jar",
srcs = glob(["src/**/*.java"]),
resource_jars = [
":damlc-dist-resource-jar",
],
visibility = ["//visibility:public"],
)
da_java_binary(
name = 'damlc_jar',
main_class = "com.digitalasset.damlc.Runner",
runtime_deps = [":damlc_library_jar"],
visibility = ["//visibility:public"],
tags = ["maven_coordinates=com.digitalasset:damlc:__VERSION__"],
name = "damlc_jar",
main_class = "com.digitalasset.damlc.Runner",
tags = ["maven_coordinates=com.digitalasset:damlc:__VERSION__"],
visibility = ["//visibility:public"],
runtime_deps = [":damlc_library_jar"],
)
alias(
name = "damlc",
actual = "damlc_jar_deploy.jar",
visibility = ["//visibility:public"]
name = "damlc",
actual = "damlc_jar_deploy.jar",
visibility = ["//visibility:public"],
)
genrule(
name = "damlc-dist-resource-jar",
outs = ["damlc-dist.jar"],
srcs = [
"//daml-foundations/daml-tools/da-hs-damlc-app:damlc-dist"
],
tools = [
"@tar_nix//:bin/tar",
"@gzip_nix//:bin/gzip",
"@bazel_tools//tools/jdk:current_java_runtime"
],
toolchains = ["@bazel_tools//tools/jdk:current_java_runtime"],
cmd = """
name = "damlc-dist-resource-jar",
srcs = [
"//daml-foundations/daml-tools/da-hs-damlc-app:damlc-dist",
],
outs = ["damlc-dist.jar"],
cmd = """
export PATH=$$PATH:`dirname $(location @tar_nix//:bin/tar)`:`dirname $(location @gzip_nix//:bin/gzip)`
mkdir tmp
tar xzf $< -C tmp
$(JAVABASE)/bin/jar c0Mf $@ -C tmp .
"""
""",
toolchains = ["@bazel_tools//tools/jdk:current_java_runtime"],
tools = [
"@bazel_tools//tools/jdk:current_java_runtime",
"@gzip_nix//:bin/gzip",
"@tar_nix//:bin/tar",
],
)

View File

@ -1,7 +1,8 @@
# Copyright (c) 2019 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
load ("//bazel_tools:docs.bzl", "da_doc_package")
load("//bazel_tools:docs.bzl", "da_doc_package")
da_doc_package(
name = 'daml-contract-keys-quantities',
name = "daml-contract-keys-quantities",
)

View File

@ -2,6 +2,7 @@
# SPDX-License-Identifier: Apache-2.0
load("//bazel_tools:docs.bzl", "da_doc_package")
da_doc_package(
name = 'daml-lf-specification',
name = "daml-lf-specification",
)

View File

@ -8,5 +8,5 @@ load("//bazel_tools:docs.bzl", "da_doc_package")
exports_files(["source/da-sdk-license.rst"])
da_doc_package(
name = 'daml-licenses',
name = "daml-licenses",
)

View File

@ -1,3 +1,3 @@
exports_files(
[ 'licensing.md']
["licensing.md"],
)

View File

@ -2,6 +2,7 @@
# SPDX-License-Identifier: Apache-2.0
load("//bazel_tools:docs.bzl", "da_doc_package")
da_doc_package(
name = "time-model",
extra_srcs = ["source/index.rst"],
@ -9,5 +10,5 @@ da_doc_package(
# Update version
VERSION="HEAD"
sed "s,__VERSION__,$$VERSION,g" -i $(location source/index.rst)
'''
''',
)

View File

@ -2,13 +2,13 @@
# SPDX-License-Identifier: Apache-2.0
load("@build_bazel_rules_typescript//:defs.bzl", "ts_library")
load("@build_bazel_rules_nodejs//:defs.bzl", "npm_package", "nodejs_test")
load("@build_bazel_rules_nodejs//:defs.bzl", "nodejs_test", "npm_package")
ts_library(
name = "lib",
srcs = glob(["src/**/*.ts"]),
tsconfig = "src/tsconfig.json",
node_modules = "@language_server_tests_deps//:node_modules",
tsconfig = "src/tsconfig.json",
)
# Wrap it in an npm package to make sure we get the generated JS.
@ -19,22 +19,22 @@ npm_package(
nodejs_test(
name = "language-server-tests",
node_modules = "@language_server_tests_deps//:node_modules",
entry_point = "com_github_digital_asset_daml/daml-foundations/daml-tools/language-server-tests/runner.js",
# this test is fantastically unreliably, even with flaky TODO fix the flakyness
timeout = "long",
data = [
":lib-js",
"runner.js",
":lib-js",
":tests",
"//daml-foundations/daml-tools/da-hs-damlc-app",
],
entry_point = "com_github_digital_asset_daml/daml-foundations/daml-tools/language-server-tests/runner.js",
flaky = True,
node_modules = "@language_server_tests_deps//:node_modules",
templated_args = [
"daml-foundations/daml-tools/language-server-tests/",
"$(location //daml-foundations/daml-tools/da-hs-damlc-app)",
"$(location :lib-js)/src/tests",
],
# this test is fantastically unreliably, even with flaky TODO fix the flakyness
timeout = "long",
flaky = True,
)
filegroup(

View File

@ -4,25 +4,25 @@
load("//bazel_tools:haskell.bzl", "da_haskell_library")
load("//bazel_tools:pkg.bzl", "pkg_tar")
load("//bazel_tools:proto.bzl", "proto_gen")
load(
"//bazel_tools:scala.bzl",
"lf_scalacopts",
"da_scala_library",
"da_scala_binary",
"da_scala_test_suite",
"//bazel_tools:scala.bzl",
"da_scala_binary",
"da_scala_library",
"da_scala_test_suite",
"lf_scalacopts",
)
load(
'//rules_daml:daml.bzl',
'daml_compile',
"//rules_daml:daml.bzl",
"daml_compile",
)
load("//bazel_tools:pom_file.bzl", "pom_file")
load("@os_info//:os_info.bzl", "is_windows")
LF_MAJOR_VERSIONS = ['0', '1', 'dev']
LF_MAJOR_VERSIONS = [
"0",
"1",
"dev",
]
filegroup(
name = "daml-lf-archive-srcs",
@ -30,146 +30,145 @@ filegroup(
visibility = ["//visibility:public"],
)
exports_files (
['da/daml_lf_%s.proto' % v for v in LF_MAJOR_VERSIONS]
exports_files(
["da/daml_lf_%s.proto" % v for v in LF_MAJOR_VERSIONS],
)
proto_library(
name = 'daml_lf_proto',
srcs = [':daml-lf-archive-srcs'],
proto_source_root = "daml-lf/archive",
visibility = ["//:__subpackages__"],
name = "daml_lf_proto",
srcs = [":daml-lf-archive-srcs"],
proto_source_root = "daml-lf/archive",
visibility = ["//:__subpackages__"],
)
proto_gen(
name = 'daml_lf_java_proto_srcs',
srcs = [ ':daml_lf_proto' ],
plugin_name = "java",
name = "daml_lf_java_proto_srcs",
srcs = [":daml_lf_proto"],
plugin_name = "java",
)
java_library(
name = "daml_lf_java_proto",
srcs = [':daml_lf_java_proto_srcs'],
deps = ['//3rdparty/jvm/com/google/protobuf:protobuf_java'],
exports = ['//3rdparty/jvm/com/google/protobuf:protobuf_java'],
visibility = ['//visibility:public'],
tags = ["maven_coordinates=com.digitalasset:daml-lf-archive:__VERSION__"],
name = "daml_lf_java_proto",
srcs = [":daml_lf_java_proto_srcs"],
tags = ["maven_coordinates=com.digitalasset:daml-lf-archive:__VERSION__"],
visibility = ["//visibility:public"],
exports = ["//3rdparty/jvm/com/google/protobuf:protobuf_java"],
deps = ["//3rdparty/jvm/com/google/protobuf:protobuf_java"],
)
# FIXME(JM): Clean this up
genrule(
name = 'daml_lf_haskell_proto_src',
srcs = glob(['da/*.proto']),
outs = ['Da/DamlLf.hs'] + [ 'Da/DamlLf%s.hs' % v.title() for v in LF_MAJOR_VERSIONS ],
tools = [
'//nix/third-party/proto3-suite:compile-proto-file'
],
cmd =
"ORIGPWD=`pwd`\ncd daml-lf/archive\n" +
"\n".join(
['$$ORIGPWD/$(location //nix/third-party/proto3-suite:compile-proto-file) --proto da/daml_lf%s.proto --out $$ORIGPWD/$(@D)' % vx
for vx in [''] + ['_%s' % v for v in LF_MAJOR_VERSIONS]
]
),
name = "daml_lf_haskell_proto_src",
srcs = glob(["da/*.proto"]),
outs = ["Da/DamlLf.hs"] + ["Da/DamlLf%s.hs" % v.title() for v in LF_MAJOR_VERSIONS],
cmd =
"ORIGPWD=`pwd`\ncd daml-lf/archive\n" +
"\n".join(
[
"$$ORIGPWD/$(location //nix/third-party/proto3-suite:compile-proto-file) --proto da/daml_lf%s.proto --out $$ORIGPWD/$(@D)" % vx
for vx in [""] + ["_%s" % v for v in LF_MAJOR_VERSIONS]
],
),
tools = [
"//nix/third-party/proto3-suite:compile-proto-file",
],
)
da_haskell_library(
name = 'daml_lf_haskell_proto',
srcs = [':daml_lf_haskell_proto_src'],
deps = [
'//nix/third-party/proto3-suite:proto3-suite',
'//nix/third-party/proto3-wire:proto3-wire'
],
compiler_flags = ["-O0"], # disable optimization as this is otherwise way too slow to compile.
hazel_deps = [
'base',
'bytestring',
'deepseq',
'text',
'vector',
],
visibility = ["//visibility:public"]
name = "daml_lf_haskell_proto",
srcs = [":daml_lf_haskell_proto_src"],
compiler_flags = ["-O0"], # disable optimization as this is otherwise way too slow to compile.
hazel_deps = [
"base",
"bytestring",
"deepseq",
"text",
"vector",
],
visibility = ["//visibility:public"],
deps = [
"//nix/third-party/proto3-suite",
"//nix/third-party/proto3-wire",
],
)
da_scala_library(
name = "daml_lf_archive_scala",
srcs = glob(['src/main/**/*.scala']),
# The daml_lf_dev.proto file is required for the 'dev' version
# has check.
resources = ['da/daml_lf_dev.proto'],
deps = [
"//daml-lf/data",
"//3rdparty/jvm/com/google/protobuf:protobuf_java",
"//3rdparty/jvm/org/scalaz:scalaz_core",
":daml_lf_java_proto"
],
scalacopts = lf_scalacopts,
visibility = ['//visibility:public'],
tags = ["maven_coordinates=com.digitalasset:daml-lf-archive-scala:__VERSION__"],
name = "daml_lf_archive_scala",
srcs = glob(["src/main/**/*.scala"]),
# The daml_lf_dev.proto file is required for the 'dev' version
# has check.
resources = ["da/daml_lf_dev.proto"],
scalacopts = lf_scalacopts,
tags = ["maven_coordinates=com.digitalasset:daml-lf-archive-scala:__VERSION__"],
visibility = ["//visibility:public"],
deps = [
":daml_lf_java_proto",
"//3rdparty/jvm/com/google/protobuf:protobuf_java",
"//3rdparty/jvm/org/scalaz:scalaz_core",
"//daml-lf/data",
],
)
da_scala_test_suite(
name = "daml_lf_archive_scala_tests",
srcs = glob(['src/test/**/*.scala']),
size = "small",
deps = [
":daml_lf_archive_scala",
":daml_lf_java_proto",
"//daml-lf/data",
"//3rdparty/jvm/com/google/protobuf:protobuf_java",
"//3rdparty/jvm/org/scalatest:scalatest",
"//3rdparty/jvm/org/scalacheck:scalacheck",
"//3rdparty/jvm/org/scalaz:scalaz_core",
],
data = [
":DarReaderTest.dar",
":DarReaderTest.dalf",
],
scalacopts = lf_scalacopts,
name = "daml_lf_archive_scala_tests",
size = "small",
srcs = glob(["src/test/**/*.scala"]),
data = [
":DarReaderTest.dalf",
":DarReaderTest.dar",
],
scalacopts = lf_scalacopts,
deps = [
":daml_lf_archive_scala",
":daml_lf_java_proto",
"//3rdparty/jvm/com/google/protobuf:protobuf_java",
"//3rdparty/jvm/org/scalacheck",
"//3rdparty/jvm/org/scalatest",
"//3rdparty/jvm/org/scalaz:scalaz_core",
"//daml-lf/data",
],
)
daml_compile(
name = "DarReaderTest",
main_src = "src/test/daml/DarReaderTest.daml",
name = "DarReaderTest",
main_src = "src/test/daml/DarReaderTest.daml",
)
filegroup(
name = "proto_srcs",
srcs = ['da/daml_lf.proto' ] + ['da/daml_lf_%s.proto' % v for v in LF_MAJOR_VERSIONS]
name = "proto_srcs",
srcs = ["da/daml_lf.proto"] + ["da/daml_lf_%s.proto" % v for v in LF_MAJOR_VERSIONS],
)
proto_library(
name = "daml_lf_proto_lib",
srcs = [':proto_srcs'],
proto_source_root = "daml-lf/archive"
name = "daml_lf_proto_lib",
srcs = [":proto_srcs"],
proto_source_root = "daml-lf/archive",
)
java_proto_library(
name = 'daml_lf_proto_lib_java',
deps = [':daml_lf_proto_lib'],
visibility = ['//visibility:public']
name = "daml_lf_proto_lib_java",
visibility = ["//visibility:public"],
deps = [":daml_lf_proto_lib"],
)
# NOTE(MH): The pre-bazel release process put the `.proto` files in
# `daml-lf-archive.jar` as well. This rule is replicating this old behavior.
# This will very likely change in the future to not include the `.proto` files.
genrule(
name = 'daml_lf_archive_java',
srcs = [':proto_srcs', ':daml_lf_proto_lib_java'],
outs = ['daml_lf_archive_java.jar'],
tools = ["@zip_dev_env//:zip"],
cmd = """
name = "daml_lf_archive_java",
srcs = [
":proto_srcs",
":daml_lf_proto_lib_java",
],
outs = ["daml_lf_archive_java.jar"],
cmd = """
INPUT=$$(echo "$(locations :daml_lf_proto_lib_java)" | cut -d ' ' -f 1)
cp -L $$INPUT $@
chmod u+w $@
$(location @zip_dev_env//:zip) -g $@ $(locations :proto_srcs)
""",
tags = ["maven_coordinates=com.digitalasset:daml-lf-archive:__VERSION__"],
tags = ["maven_coordinates=com.digitalasset:daml-lf-archive:__VERSION__"],
tools = ["@zip_dev_env//:zip"],
)
pom_file(
@ -178,22 +177,22 @@ pom_file(
)
genrule(
name = 'daml_lf_archive_protos_zip',
srcs = [':proto_srcs'],
outs= ['daml_lf_archive_protos_zip.zip'],
tools = ["@zip_dev_env//:zip"],
cmd = '''
name = "daml_lf_archive_protos_zip",
srcs = [":proto_srcs"],
outs = ["daml_lf_archive_protos_zip.zip"],
cmd = """
mkdir -p daml-lf-archive-protos/protobuf/com/digitalasset/daml_lf
cp $(SRCS) daml-lf-archive-protos/protobuf/com/digitalasset/daml_lf
$(location @zip_dev_env//:zip) -r $@ daml-lf-archive-protos
''',
visibility = ['//visibility:public'],
""",
tools = ["@zip_dev_env//:zip"],
visibility = ["//visibility:public"],
)
pkg_tar(
name = 'daml_lf_archive_protos_tarball',
extension = "tar.gz",
package_dir = "daml-lf-archive-protos/protobuf/com/digitalasset/daml_lf",
srcs = [':proto_srcs'],
visibility = ['//visibility:public'],
name = "daml_lf_archive_protos_tarball",
srcs = [":proto_srcs"],
extension = "tar.gz",
package_dir = "daml-lf-archive-protos/protobuf/com/digitalasset/daml_lf",
visibility = ["//visibility:public"],
)

View File

@ -2,37 +2,36 @@
# SPDX-License-Identifier: Apache-2.0
load(
"//bazel_tools:scala.bzl",
"lf_scalacopts",
"da_scala_library",
"da_scala_test",
"//bazel_tools:scala.bzl",
"da_scala_library",
"da_scala_test",
"lf_scalacopts",
)
da_scala_library(
name = "data",
srcs = glob(["src/main/**/*.scala"]),
deps = [
"//daml-lf/archive:daml_lf_java_proto",
"//3rdparty/jvm/org/scalaz:scalaz_core",
"//3rdparty/jvm/com/google/protobuf:protobuf_java",
],
scalacopts = lf_scalacopts,
visibility = [
"//visibility:public",
],
tags = ["maven_coordinates=com.digitalasset:daml-lf-data:__VERSION__"],
name = "data",
srcs = glob(["src/main/**/*.scala"]),
scalacopts = lf_scalacopts,
tags = ["maven_coordinates=com.digitalasset:daml-lf-data:__VERSION__"],
visibility = [
"//visibility:public",
],
deps = [
"//3rdparty/jvm/com/google/protobuf:protobuf_java",
"//3rdparty/jvm/org/scalaz:scalaz_core",
"//daml-lf/archive:daml_lf_java_proto",
],
)
da_scala_test(
name = "data-test",
srcs = glob(["src/test/**/*.scala"]),
size = "small",
deps = [
":data",
"//3rdparty/jvm/org/scalaz:scalaz_core",
"//3rdparty/jvm/org/scalaz:scalaz_scalacheck_binding",
"//3rdparty/jvm/org/scalacheck:scalacheck",
],
scalacopts = lf_scalacopts,
name = "data-test",
size = "small",
srcs = glob(["src/test/**/*.scala"]),
scalacopts = lf_scalacopts,
deps = [
":data",
"//3rdparty/jvm/org/scalacheck",
"//3rdparty/jvm/org/scalaz:scalaz_core",
"//3rdparty/jvm/org/scalaz:scalaz_scalacheck_binding",
],
)

View File

@ -3,15 +3,17 @@
load(
"//bazel_tools:scala.bzl",
"lf_scalacopts",
"da_scala_binary",
"da_scala_library",
"da_scala_test",
"lf_scalacopts",
)
da_scala_library(
name = "engine",
srcs = glob(["src/main/**/*.scala"]),
scalacopts = lf_scalacopts,
tags = ["maven_coordinates=com.digitalasset:daml-lf-engine:__VERSION__"],
visibility = ["//visibility:public"],
deps = [
"//3rdparty/jvm/com/google/protobuf:protobuf_java",
@ -24,8 +26,6 @@ da_scala_library(
"//daml-lf/lfpackage",
"//daml-lf/transaction",
],
scalacopts = lf_scalacopts,
tags = ["maven_coordinates=com.digitalasset:daml-lf-engine:__VERSION__"],
)
# TODO(JM): It would make sense to break up the tests
@ -43,6 +43,7 @@ da_scala_test(
"//daml-lf/tests:LargeTransaction.dalf",
"//daml-lf/tests:Optional.dalf",
],
scalacopts = lf_scalacopts,
deps = [
":engine",
"//3rdparty/jvm/com/storm_enroute:scalameter_core",
@ -57,6 +58,4 @@ da_scala_test(
"//daml-lf/scenario-interpreter",
"//daml-lf/transaction",
],
scalacopts = lf_scalacopts,
)

View File

@ -3,19 +3,21 @@
load(
"//bazel_tools:scala.bzl",
"lf_scalacopts",
"da_scala_library",
"da_scala_test",
"lf_scalacopts",
)
da_scala_library(
name = "interface",
srcs = glob(["src/main/**/*.scala"]),
scalacopts = lf_scalacopts,
tags = ["maven_coordinates=com.digitalasset:daml-lf-interface:__VERSION__"],
visibility = [
"//daml-lf:__subpackages__",
"//language-support:__subpackages__",
"//extractor:__subpackages__",
"//navigator:__subpackages__"
"//language-support:__subpackages__",
"//navigator:__subpackages__",
],
deps = [
"//3rdparty/jvm/com/google/protobuf:protobuf_java",
@ -24,14 +26,13 @@ da_scala_library(
"//daml-lf/archive:daml_lf_java_proto",
"//daml-lf/data",
],
scalacopts = lf_scalacopts,
tags = ["maven_coordinates=com.digitalasset:daml-lf-interface:__VERSION__"],
)
da_scala_test(
name = "tests",
size = "small",
srcs = glob(["src/test/**/*.scala"]),
scalacopts = lf_scalacopts,
deps = [
":interface",
"//3rdparty/jvm/com/google/protobuf:protobuf_java",
@ -44,6 +45,4 @@ da_scala_test(
"//daml-lf/lfpackage",
"//daml-lf/parser",
],
scalacopts = lf_scalacopts,
)

View File

@ -13,6 +13,7 @@ da_scala_library(
name = "interpreter",
srcs = glob(["src/main/**/*.scala"]),
scalacopts = lf_scalacopts,
tags = ["maven_coordinates=com.digitalasset:daml-lf-interpreter:__VERSION__"],
visibility = [
"//compiler/scenario-service:__subpackages__",
"//daml-lf:__subpackages__",
@ -28,7 +29,6 @@ da_scala_library(
"//daml-lf/transaction",
"//daml-lf/validation",
],
tags = ["maven_coordinates=com.digitalasset:daml-lf-interpreter:__VERSION__"],
)
da_scala_test_suite(

View File

@ -2,41 +2,39 @@
# SPDX-License-Identifier: Apache-2.0
load(
"//bazel_tools:scala.bzl",
"lf_scalacopts",
"da_scala_library",
"da_scala_test",
"//bazel_tools:scala.bzl",
"da_scala_library",
"da_scala_test",
"lf_scalacopts",
)
da_scala_library(
name = "lfpackage",
srcs = glob(["src/main/**/*.scala"]),
deps = [
"//daml-lf/archive:daml_lf_java_proto",
"//daml-lf/archive:daml_lf_archive_scala",
"//daml-lf/data",
"//3rdparty/jvm/org/scalaz:scalaz_core",
"//3rdparty/jvm/com/google/protobuf:protobuf_java",
],
scalacopts = lf_scalacopts,
visibility = ['//visibility:public'],
tags = ["maven_coordinates=com.digitalasset:daml-lf-package:__VERSION__"],
name = "lfpackage",
srcs = glob(["src/main/**/*.scala"]),
scalacopts = lf_scalacopts,
tags = ["maven_coordinates=com.digitalasset:daml-lf-package:__VERSION__"],
visibility = ["//visibility:public"],
deps = [
"//3rdparty/jvm/com/google/protobuf:protobuf_java",
"//3rdparty/jvm/org/scalaz:scalaz_core",
"//daml-lf/archive:daml_lf_archive_scala",
"//daml-lf/archive:daml_lf_java_proto",
"//daml-lf/data",
],
)
da_scala_test(
name = "lfpackage-test",
srcs = glob(["src/test/**/*.scala"]),
size = "small",
deps = [
":lfpackage",
"//daml-lf/archive:daml_lf_archive_scala",
"//daml-lf/data",
"//daml-lf/archive:daml_lf_java_proto",
"//3rdparty/jvm/org/scalaz:scalaz_core",
"//3rdparty/jvm/org/scalacheck:scalacheck",
"//3rdparty/jvm/com/google/protobuf:protobuf_java",
],
scalacopts = lf_scalacopts,
name = "lfpackage-test",
size = "small",
srcs = glob(["src/test/**/*.scala"]),
scalacopts = lf_scalacopts,
deps = [
":lfpackage",
"//3rdparty/jvm/com/google/protobuf:protobuf_java",
"//3rdparty/jvm/org/scalacheck",
"//3rdparty/jvm/org/scalaz:scalaz_core",
"//daml-lf/archive:daml_lf_archive_scala",
"//daml-lf/archive:daml_lf_java_proto",
"//daml-lf/data",
],
)

View File

@ -2,31 +2,29 @@
# SPDX-License-Identifier: Apache-2.0
load(
"//bazel_tools:scala.bzl",
"da_scala_binary",
"//bazel_tools:scala.bzl",
"da_scala_binary",
)
da_scala_binary(
name = "repl",
srcs = glob(["src/main/**/*.scala"]),
main_class = 'com.digitalasset.daml.lf.speedy.Main',
deps = [
"//daml-lf/archive:daml_lf_java_proto",
"//daml-lf/archive:daml_lf_archive_scala",
"//daml-lf/data",
"//daml-lf/transaction",
"//daml-lf/lfpackage",
"//daml-lf/interpreter",
"//daml-lf/validation",
"//daml-lf/scenario-interpreter",
"//3rdparty/jvm/org/typelevel:paiges_core",
"//3rdparty/jvm/org/jline:jline",
"//3rdparty/jvm/org/scala_lang/modules:scala_parser_combinators",
"//3rdparty/jvm/org/scalaz:scalaz_core",
"//3rdparty/jvm/com/google/protobuf:protobuf_java",
],
visibility = ['//visibility:public'],
tags = ["maven_coordinates=com.digitalasset:daml-lf-repl:__VERSION__"],
name = "repl",
srcs = glob(["src/main/**/*.scala"]),
main_class = "com.digitalasset.daml.lf.speedy.Main",
tags = ["maven_coordinates=com.digitalasset:daml-lf-repl:__VERSION__"],
visibility = ["//visibility:public"],
deps = [
"//3rdparty/jvm/com/google/protobuf:protobuf_java",
"//3rdparty/jvm/org/jline",
"//3rdparty/jvm/org/scala_lang/modules:scala_parser_combinators",
"//3rdparty/jvm/org/scalaz:scalaz_core",
"//3rdparty/jvm/org/typelevel:paiges_core",
"//daml-lf/archive:daml_lf_archive_scala",
"//daml-lf/archive:daml_lf_java_proto",
"//daml-lf/data",
"//daml-lf/interpreter",
"//daml-lf/lfpackage",
"//daml-lf/scenario-interpreter",
"//daml-lf/transaction",
"//daml-lf/validation",
],
)

View File

@ -2,25 +2,24 @@
# SPDX-License-Identifier: Apache-2.0
load(
"//bazel_tools:scala.bzl",
"da_scala_library",
"da_scala_binary",
"da_scala_test_suite",
"//bazel_tools:scala.bzl",
"da_scala_binary",
"da_scala_library",
"da_scala_test_suite",
)
da_scala_library(
name = "scenario-interpreter",
srcs = glob(["src/main/**/*.scala"]),
main_class = 'com.digitalasset.daml.lf.speedy.Main',
deps = [
"//daml-lf/data",
"//daml-lf/transaction",
"//daml-lf/lfpackage",
"//daml-lf/interpreter",
],
visibility = [
"//visibility:public"
],
tags = ["maven_coordinates=com.digitalasset:daml-lf-scenario-interpreter:__VERSION__"],
name = "scenario-interpreter",
srcs = glob(["src/main/**/*.scala"]),
main_class = "com.digitalasset.daml.lf.speedy.Main",
tags = ["maven_coordinates=com.digitalasset:daml-lf-scenario-interpreter:__VERSION__"],
visibility = [
"//visibility:public",
],
deps = [
"//daml-lf/data",
"//daml-lf/interpreter",
"//daml-lf/lfpackage",
"//daml-lf/transaction",
],
)

View File

@ -2,55 +2,54 @@
# SPDX-License-Identifier: Apache-2.0
load(
"//bazel_tools:scala.bzl",
"lf_scalacopts",
"da_scala_library",
"da_scala_test",
"//bazel_tools:scala.bzl",
"da_scala_library",
"da_scala_test",
"lf_scalacopts",
)
da_scala_library(
name = "testing-tools",
srcs = glob(["src/main/**/*.scala"]),
deps = [
"//daml-lf/data",
"//daml-lf/transaction",
"//daml-lf/lfpackage",
"//daml-lf/interpreter",
"//daml-lf/engine",
"//daml-lf/scenario-interpreter",
"//daml-lf/archive:daml_lf_java_proto",
"//daml-lf/archive:daml_lf_archive_scala",
"//3rdparty/jvm/com/google/protobuf:protobuf_java",
"//3rdparty/jvm/org/scalaz:scalaz_core"
],
scalacopts = lf_scalacopts,
visibility = ["//visibility:public"],
tags = ["maven_coordinates=com.digitalasset:daml-lf-engine-testing-tools:__VERSION__"],
name = "testing-tools",
srcs = glob(["src/main/**/*.scala"]),
scalacopts = lf_scalacopts,
tags = ["maven_coordinates=com.digitalasset:daml-lf-engine-testing-tools:__VERSION__"],
visibility = ["//visibility:public"],
deps = [
"//3rdparty/jvm/com/google/protobuf:protobuf_java",
"//3rdparty/jvm/org/scalaz:scalaz_core",
"//daml-lf/archive:daml_lf_archive_scala",
"//daml-lf/archive:daml_lf_java_proto",
"//daml-lf/data",
"//daml-lf/engine",
"//daml-lf/interpreter",
"//daml-lf/lfpackage",
"//daml-lf/scenario-interpreter",
"//daml-lf/transaction",
],
)
da_scala_test(
name = "engine-scenario-test",
srcs = glob(["src/test/**/*.scala"]),
size = "large",
timeout = "long",
resources = [
"//daml-lf/tests:BasicTests.dalf",
"//daml-lf/tests:AuthorizedDivulgence.dalf",
"//daml-lf/tests:DontDiscloseNonConsumingChoicesToObservers.dalf",
"//daml-lf/tests:LargeTransaction.dalf",
"//daml-foundations/daml-ghc/package-database/deprecated:daml-prim-1.3.dalf",
],
deps = [
":testing-tools",
"//daml-lf/interpreter:interpreter",
"//daml-lf/engine:engine",
"//daml-lf/data:data",
"//daml-lf/transaction:transaction",
"//daml-lf/lfpackage:lfpackage",
"//daml-lf/archive:daml_lf_java_proto",
"//daml-lf/archive:daml_lf_archive_scala",
"//3rdparty/jvm/org/scalaz:scalaz_core",
],
scalacopts = lf_scalacopts,
name = "engine-scenario-test",
size = "large",
timeout = "long",
srcs = glob(["src/test/**/*.scala"]),
resources = [
"//daml-foundations/daml-ghc/package-database/deprecated:daml-prim-1.3.dalf",
"//daml-lf/tests:AuthorizedDivulgence.dalf",
"//daml-lf/tests:BasicTests.dalf",
"//daml-lf/tests:DontDiscloseNonConsumingChoicesToObservers.dalf",
"//daml-lf/tests:LargeTransaction.dalf",
],
scalacopts = lf_scalacopts,
deps = [
":testing-tools",
"//3rdparty/jvm/org/scalaz:scalaz_core",
"//daml-lf/archive:daml_lf_archive_scala",
"//daml-lf/archive:daml_lf_java_proto",
"//daml-lf/data",
"//daml-lf/engine",
"//daml-lf/interpreter",
"//daml-lf/lfpackage",
"//daml-lf/transaction",
],
)

View File

@ -2,75 +2,75 @@
# SPDX-License-Identifier: Apache-2.0
load(
"//rules_daml:daml.bzl",
"daml_compile"
"//rules_daml:daml.bzl",
"daml_compile",
)
TEST_FILES = \
[ "BasicTests"
, "AuthorizedDivulgence"
, "DontDiscloseNonConsumingChoicesToObservers"
, "LargeTransaction"
, "ConjunctionChoices"
]
[
"BasicTests",
"AuthorizedDivulgence",
"DontDiscloseNonConsumingChoicesToObservers",
"LargeTransaction",
"ConjunctionChoices",
]
[
daml_compile(
name = name
, main_src = "%s.daml" % name
, visibility = ["//daml-lf:__subpackages__"]
, target = "1.3"
, damlc = "//daml-foundations/daml-tools/da-hs-damlc-app:da-hs-damlc-app-deprecated"
)
for name in TEST_FILES
daml_compile(
name = name,
damlc = "//daml-foundations/daml-tools/da-hs-damlc-app:da-hs-damlc-app-deprecated",
main_src = "%s.daml" % name,
target = "1.3",
visibility = ["//daml-lf:__subpackages__"],
)
for name in TEST_FILES
]
daml_compile(
name = "Optional"
, main_src = "Optional.daml"
, target = "1.3"
, damlc = "//daml-foundations/daml-tools/da-hs-damlc-app:da-hs-damlc-app-deprecated"
, visibility = ["//daml-lf:__subpackages__"]
name = "Optional",
damlc = "//daml-foundations/daml-tools/da-hs-damlc-app:da-hs-damlc-app-deprecated",
main_src = "Optional.daml",
target = "1.3",
visibility = ["//daml-lf:__subpackages__"],
)
[
sh_test(
name = name + "-test",
srcs = ["daml-lf-test.sh"],
size = "small",
data = [
"//daml-lf/repl:repl",
"//daml-foundations/daml-tools/da-hs-damlc-app",
":%s.dalf" % name
],
args = [
"$(location //daml-lf/repl:repl)",
"$(location //daml-foundations/daml-tools/da-hs-damlc-app)",
"$(location :%s.dalf)" % name
]
)
for name in TEST_FILES
sh_test(
name = name + "-test",
size = "small",
srcs = ["daml-lf-test.sh"],
args = [
"$(location //daml-lf/repl:repl)",
"$(location //daml-foundations/daml-tools/da-hs-damlc-app)",
"$(location :%s.dalf)" % name,
],
data = [
"//daml-foundations/daml-tools/da-hs-damlc-app",
"//daml-lf/repl",
":%s.dalf" % name,
],
)
for name in TEST_FILES
]
[
sh_test(
name = "test-scenario-1-3-" + file.split("/")[2],
srcs = ["scenario/test.sh"],
size = "small",
data = [
"//daml-lf/repl:repl",
"//daml-foundations/daml-tools/da-hs-damlc-app:da-hs-damlc-app-deprecated",
"//daml-foundations/daml-ghc/package-database/deprecated:daml-prim-1.3.dalf",
file,
"%s/EXPECTED.ledger" % "/".join(file.split("/")[0:3]),
],
args = [
"$(location //daml-lf/repl:repl)",
"$(location //daml-foundations/daml-tools/da-hs-damlc-app:da-hs-damlc-app-deprecated)",
"$(location :%s)" % file,
"$(location //daml-foundations/daml-ghc/package-database/deprecated:daml-prim-1.3.dalf)"
]
)
for file in glob(['scenario/daml-1.3/*/Test.daml'])
sh_test(
name = "test-scenario-1-3-" + file.split("/")[2],
size = "small",
srcs = ["scenario/test.sh"],
args = [
"$(location //daml-lf/repl:repl)",
"$(location //daml-foundations/daml-tools/da-hs-damlc-app:da-hs-damlc-app-deprecated)",
"$(location :%s)" % file,
"$(location //daml-foundations/daml-ghc/package-database/deprecated:daml-prim-1.3.dalf)",
],
data = [
"//daml-foundations/daml-ghc/package-database/deprecated:daml-prim-1.3.dalf",
"//daml-foundations/daml-tools/da-hs-damlc-app:da-hs-damlc-app-deprecated",
"//daml-lf/repl",
file,
"%s/EXPECTED.ledger" % "/".join(file.split("/")[0:3]),
],
)
for file in glob(["scenario/daml-1.3/*/Test.daml"])
]

View File

@ -2,25 +2,24 @@
# SPDX-License-Identifier: Apache-2.0
load(
"//bazel_tools:scala.bzl",
"lf_scalacopts",
"da_scala_library",
"//bazel_tools:scala.bzl",
"da_scala_library",
"lf_scalacopts",
)
da_scala_library(
name = "transaction-scalacheck",
srcs = glob(["src/main/**/*.scala"]),
deps = [
"//daml-lf/transaction",
"//daml-lf/transaction/src/main/protobuf:value_java_proto",
"//daml-lf/data",
"//3rdparty/jvm/org/scalaz:scalaz_core",
"//3rdparty/jvm/org/scalaz:scalaz_scalacheck_binding",
"//3rdparty/jvm/com/google/protobuf:protobuf_java",
"//3rdparty/jvm/org/scalacheck:scalacheck",
],
scalacopts = lf_scalacopts,
visibility = ["//visibility:public"],
tags = ["maven_coordinates=com.digitalasset:daml-lf-transaction-scalacheck:__VERSION__"],
name = "transaction-scalacheck",
srcs = glob(["src/main/**/*.scala"]),
scalacopts = lf_scalacopts,
tags = ["maven_coordinates=com.digitalasset:daml-lf-transaction-scalacheck:__VERSION__"],
visibility = ["//visibility:public"],
deps = [
"//3rdparty/jvm/com/google/protobuf:protobuf_java",
"//3rdparty/jvm/org/scalacheck",
"//3rdparty/jvm/org/scalaz:scalaz_core",
"//3rdparty/jvm/org/scalaz:scalaz_scalacheck_binding",
"//daml-lf/data",
"//daml-lf/transaction",
"//daml-lf/transaction/src/main/protobuf:value_java_proto",
],
)

View File

@ -2,47 +2,46 @@
# SPDX-License-Identifier: Apache-2.0
load(
"//bazel_tools:scala.bzl",
"lf_scalacopts",
"da_scala_library",
"da_scala_test",
"//bazel_tools:scala.bzl",
"da_scala_library",
"da_scala_test",
"lf_scalacopts",
)
da_scala_library(
name = "transaction",
srcs = glob(["src/main/**/*.scala"]),
deps = [
"//daml-lf/transaction/src/main/protobuf:value_java_proto",
"//daml-lf/transaction/src/main/protobuf:transaction_java_proto",
"//daml-lf/transaction/src/main/protobuf:blindinginfo_java_proto",
"//daml-lf/archive:daml_lf_java_proto",
"//daml-lf/archive:daml_lf_archive_scala",
"//daml-lf/data",
"//3rdparty/jvm/org/scalaz:scalaz_core",
"//3rdparty/jvm/com/google/protobuf:protobuf_java",
],
scalacopts = lf_scalacopts,
visibility = ["//visibility:public"],
tags = ["maven_coordinates=com.digitalasset:daml-lf-transaction:__VERSION__"],
name = "transaction",
srcs = glob(["src/main/**/*.scala"]),
scalacopts = lf_scalacopts,
tags = ["maven_coordinates=com.digitalasset:daml-lf-transaction:__VERSION__"],
visibility = ["//visibility:public"],
deps = [
"//3rdparty/jvm/com/google/protobuf:protobuf_java",
"//3rdparty/jvm/org/scalaz:scalaz_core",
"//daml-lf/archive:daml_lf_archive_scala",
"//daml-lf/archive:daml_lf_java_proto",
"//daml-lf/data",
"//daml-lf/transaction/src/main/protobuf:blindinginfo_java_proto",
"//daml-lf/transaction/src/main/protobuf:transaction_java_proto",
"//daml-lf/transaction/src/main/protobuf:value_java_proto",
],
)
da_scala_test(
name = "transaction-test",
srcs = glob(["src/test/**/*.scala"]),
size = "medium",
deps = [
":transaction",
"//daml-lf/transaction/src/main/protobuf:value_java_proto",
"//daml-lf/transaction/src/main/protobuf:transaction_java_proto",
"//daml-lf/transaction/src/main/protobuf:blindinginfo_java_proto",
"//daml-lf/archive:daml_lf_archive_scala",
"//daml-lf/data",
"//daml-lf/transaction-scalacheck",
"//3rdparty/jvm/org/scalaz:scalaz_core",
"//3rdparty/jvm/org/scalaz:scalaz_scalacheck_binding",
"//3rdparty/jvm/com/google/protobuf:protobuf_java",
"//3rdparty/jvm/org/scalacheck:scalacheck",
],
scalacopts = lf_scalacopts
name = "transaction-test",
size = "medium",
srcs = glob(["src/test/**/*.scala"]),
scalacopts = lf_scalacopts,
deps = [
":transaction",
"//3rdparty/jvm/com/google/protobuf:protobuf_java",
"//3rdparty/jvm/org/scalacheck",
"//3rdparty/jvm/org/scalaz:scalaz_core",
"//3rdparty/jvm/org/scalaz:scalaz_scalacheck_binding",
"//daml-lf/archive:daml_lf_archive_scala",
"//daml-lf/data",
"//daml-lf/transaction-scalacheck",
"//daml-lf/transaction/src/main/protobuf:blindinginfo_java_proto",
"//daml-lf/transaction/src/main/protobuf:transaction_java_proto",
"//daml-lf/transaction/src/main/protobuf:value_java_proto",
],
)

View File

@ -4,17 +4,17 @@
load("//bazel_tools:java.bzl", "da_java_proto_library")
proto_library(
name = "value_proto",
srcs = ["com/digitalasset/daml/lf/value.proto"],
deps = ["@com_google_protobuf//:empty_proto"],
visibility = ['//visibility:public'],
name = "value_proto",
srcs = ["com/digitalasset/daml/lf/value.proto"],
visibility = ["//visibility:public"],
deps = ["@com_google_protobuf//:empty_proto"],
)
da_java_proto_library(
name = "value_java_proto",
deps = [":value_proto"],
visibility = ['//visibility:public'],
tags = ["maven_coordinates=com.digitalasset:daml-lf-value-java-proto:__VERSION__"],
name = "value_java_proto",
tags = ["maven_coordinates=com.digitalasset:daml-lf-value-java-proto:__VERSION__"],
visibility = ["//visibility:public"],
deps = [":value_proto"],
)
# FIXME(JM): This hack is not needed after we upgrade to latest Bazel which has the
@ -23,32 +23,31 @@ genrule(
name = "transaction_proto_patched",
srcs = ["com/digitalasset/daml/lf/transaction.proto"],
outs = ["transaction.proto"],
cmd = "sed $(SRCS) -e 's,import \"com,import \"daml-lf/transaction/src/main/protobuf/com,' > \"$@\""
cmd = "sed $(SRCS) -e 's,import \"com,import \"daml-lf/transaction/src/main/protobuf/com,' > \"$@\"",
)
proto_library(
name = "transaction_proto",
srcs = [":transaction_proto_patched"],
deps = [":value_proto"],
visibility = ['//visibility:public'],
name = "transaction_proto",
srcs = [":transaction_proto_patched"],
visibility = ["//visibility:public"],
deps = [":value_proto"],
)
da_java_proto_library(
name = "transaction_java_proto",
deps = [":transaction_proto"],
visibility = ['//visibility:public'],
tags = ["maven_coordinates=com.digitalasset:daml-lf-transaction-java-proto:__VERSION__"],
name = "transaction_java_proto",
tags = ["maven_coordinates=com.digitalasset:daml-lf-transaction-java-proto:__VERSION__"],
visibility = ["//visibility:public"],
deps = [":transaction_proto"],
)
proto_library(
name = "blindinginfo_proto",
srcs = ["com/digitalasset/daml/lf/blindinginfo.proto"]
name = "blindinginfo_proto",
srcs = ["com/digitalasset/daml/lf/blindinginfo.proto"],
)
da_java_proto_library(
name = "blindinginfo_java_proto",
deps = [":blindinginfo_proto"],
visibility = ['//visibility:public'],
tags = ["maven_coordinates=com.digitalasset:daml-lf-blindinginfo-java-proto:__VERSION__"],
name = "blindinginfo_java_proto",
tags = ["maven_coordinates=com.digitalasset:daml-lf-blindinginfo-java-proto:__VERSION__"],
visibility = ["//visibility:public"],
deps = [":blindinginfo_proto"],
)

View File

@ -12,6 +12,7 @@ da_scala_library(
name = "validation",
srcs = glob(["src/main/**/*.scala"]),
scalacopts = lf_scalacopts,
tags = ["maven_coordinates=com.digitalasset:daml-lf-validation:__VERSION__"],
visibility = [
"//compiler/scenario-service:__subpackages__",
"//daml-lf:__subpackages__",
@ -21,7 +22,6 @@ da_scala_library(
"//daml-lf/data",
"//daml-lf/lfpackage",
],
tags = ["maven_coordinates=com.digitalasset:daml-lf-validation:__VERSION__"],
)
da_scala_test(

289
deps.bzl
View File

@ -35,154 +35,154 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
def daml_deps():
if "io_tweag_rules_haskell" not in native.existing_rules():
http_archive(
name = "io_tweag_rules_haskell",
strip_prefix = 'rules_haskell-%s' % rules_haskell_version,
urls = ["https://github.com/tweag/rules_haskell/archive/%s.tar.gz" % rules_haskell_version],
patches = [
"@com_github_digital_asset_daml//bazel_tools:haskell-static-linking.patch",
"@com_github_digital_asset_daml//bazel_tools:haskell-win-sys-includes.patch",
"@com_github_digital_asset_daml//bazel_tools:haskell-ld-library-path.patch",
"@com_github_digital_asset_daml//bazel_tools:haskell-win-so-name.patch",
],
patch_args = ["-p1"],
sha256 = rules_haskell_sha256,
)
if "io_tweag_rules_haskell" not in native.existing_rules():
http_archive(
name = "io_tweag_rules_haskell",
strip_prefix = "rules_haskell-%s" % rules_haskell_version,
urls = ["https://github.com/tweag/rules_haskell/archive/%s.tar.gz" % rules_haskell_version],
patches = [
"@com_github_digital_asset_daml//bazel_tools:haskell-static-linking.patch",
"@com_github_digital_asset_daml//bazel_tools:haskell-win-sys-includes.patch",
"@com_github_digital_asset_daml//bazel_tools:haskell-ld-library-path.patch",
"@com_github_digital_asset_daml//bazel_tools:haskell-win-so-name.patch",
],
patch_args = ["-p1"],
sha256 = rules_haskell_sha256,
)
if "io_tweag_rules_nixpkgs" not in native.existing_rules():
http_archive(
name = "io_tweag_rules_nixpkgs",
strip_prefix = "rules_nixpkgs-%s" % rules_nixpkgs_version,
urls = ["https://github.com/tweag/rules_nixpkgs/archive/%s.tar.gz" % rules_nixpkgs_version],
sha256 = "a1e113bbd69c97e49cbedce9af0f256756cc5ab1b77aafaab476f1d9d47e9d81",
)
if "io_tweag_rules_nixpkgs" not in native.existing_rules():
http_archive(
name = "io_tweag_rules_nixpkgs",
strip_prefix = "rules_nixpkgs-%s" % rules_nixpkgs_version,
urls = ["https://github.com/tweag/rules_nixpkgs/archive/%s.tar.gz" % rules_nixpkgs_version],
sha256 = "a1e113bbd69c97e49cbedce9af0f256756cc5ab1b77aafaab476f1d9d47e9d81",
)
if "ai_formation_hazel" not in native.existing_rules():
http_archive(
name = "ai_formation_hazel",
strip_prefix = "rules_haskell-{}/hazel".format(rules_haskell_version),
urls = ["https://github.com/tweag/rules_haskell/archive/%s.tar.gz" % rules_haskell_version],
sha256 = rules_haskell_sha256,
patches = [
"@com_github_digital_asset_daml//bazel_tools:hackage_mirror.patch",
],
patch_args = ["-p2"],
)
if "ai_formation_hazel" not in native.existing_rules():
http_archive(
name = "ai_formation_hazel",
strip_prefix = "rules_haskell-{}/hazel".format(rules_haskell_version),
urls = ["https://github.com/tweag/rules_haskell/archive/%s.tar.gz" % rules_haskell_version],
sha256 = rules_haskell_sha256,
patches = [
"@com_github_digital_asset_daml//bazel_tools:hackage_mirror.patch",
],
patch_args = ["-p2"],
)
if "com_github_madler_zlib" not in native.existing_rules():
http_archive(
name = "com_github_madler_zlib",
build_file = "@com_github_digital_asset_daml//3rdparty/c:zlib.BUILD",
strip_prefix = "zlib-cacf7f1d4e3d44d871b605da3b647f07d718623f",
urls = ["https://github.com/madler/zlib/archive/cacf7f1d4e3d44d871b605da3b647f07d718623f.tar.gz"],
sha256 = "6d4d6640ca3121620995ee255945161821218752b551a1a180f4215f7d124d45",
)
if "com_github_madler_zlib" not in native.existing_rules():
http_archive(
name = "com_github_madler_zlib",
build_file = "@com_github_digital_asset_daml//3rdparty/c:zlib.BUILD",
strip_prefix = "zlib-cacf7f1d4e3d44d871b605da3b647f07d718623f",
urls = ["https://github.com/madler/zlib/archive/cacf7f1d4e3d44d871b605da3b647f07d718623f.tar.gz"],
sha256 = "6d4d6640ca3121620995ee255945161821218752b551a1a180f4215f7d124d45",
)
if "io_bazel_rules_go" not in native.existing_rules():
http_archive(
name = "io_bazel_rules_go",
urls = ["https://github.com/bazelbuild/rules_go/releases/download/0.17.0/rules_go-0.17.0.tar.gz"],
sha256 = "492c3ac68ed9dcf527a07e6a1b2dcbf199c6bf8b35517951467ac32e421c06c1",
)
if "io_bazel_rules_go" not in native.existing_rules():
http_archive(
name = "io_bazel_rules_go",
urls = ["https://github.com/bazelbuild/rules_go/releases/download/0.17.0/rules_go-0.17.0.tar.gz"],
sha256 = "492c3ac68ed9dcf527a07e6a1b2dcbf199c6bf8b35517951467ac32e421c06c1",
)
if "io_bazel_rules_scala" not in native.existing_rules():
http_archive(
name = 'io_bazel_rules_scala',
# TODO: switch back to bazelbuild/rules_scala repo after merge of these PRs:
# https://github.com/bazelbuild/rules_scala/pull/717
# https://github.com/bazelbuild/rules_scala/pull/718
#url = 'https://github.com/bazelbuild/rules_scala/archive/%s.zip' % rules_scala_version,
url = 'https://github.com/majcherm-da/rules_scala/archive/%s.zip' % rules_scala_version,
type = 'zip',
strip_prefix = 'rules_scala-%s' % rules_scala_version,
sha256 = "9774acd82267cdf486af38b325b410abf34965dc173e7188406852dd28ed6660",
)
if "io_bazel_rules_scala" not in native.existing_rules():
http_archive(
name = "io_bazel_rules_scala",
# TODO: switch back to bazelbuild/rules_scala repo after merge of these PRs:
# https://github.com/bazelbuild/rules_scala/pull/717
# https://github.com/bazelbuild/rules_scala/pull/718
#url = 'https://github.com/bazelbuild/rules_scala/archive/%s.zip' % rules_scala_version,
url = "https://github.com/majcherm-da/rules_scala/archive/%s.zip" % rules_scala_version,
type = "zip",
strip_prefix = "rules_scala-%s" % rules_scala_version,
sha256 = "9774acd82267cdf486af38b325b410abf34965dc173e7188406852dd28ed6660",
)
if "com_google_protobuf" not in native.existing_rules():
http_archive(
name = "com_google_protobuf",
sha256 = "9510dd2afc29e7245e9e884336f848c8a6600a14ae726adb6befdb4f786f0be2",
strip_prefix = "protobuf-3.6.1.3",
urls = ["https://github.com/google/protobuf/archive/v3.6.1.3.zip"],
)
if "com_google_protobuf" not in native.existing_rules():
http_archive(
name = "com_google_protobuf",
sha256 = "9510dd2afc29e7245e9e884336f848c8a6600a14ae726adb6befdb4f786f0be2",
strip_prefix = "protobuf-3.6.1.3",
urls = ["https://github.com/google/protobuf/archive/v3.6.1.3.zip"],
)
if "com_google_protobuf_javalite" not in native.existing_rules():
http_archive(
if "com_google_protobuf_javalite" not in native.existing_rules():
http_archive(
name = "com_google_protobuf_javalite",
sha256 = "79d102c61e2a479a0b7e5fc167bcfaa4832a0c6aad4a75fa7da0480564931bcc",
strip_prefix = "protobuf-384989534b2246d413dbcd750744faab2607b516",
urls = ["https://github.com/google/protobuf/archive/384989534b2246d413dbcd750744faab2607b516.zip"],
)
)
if "io_bazel_skydoc" not in native.existing_rules():
http_archive(
name = "io_bazel_skydoc",
sha256 = "19eb6c162075707df5703c274d3348127625873dbfa5ff83b1ef4b8f5dbaa449",
strip_prefix = "skydoc-0.2.0",
urls = ["https://github.com/bazelbuild/skydoc/archive/0.2.0.tar.gz"],
)
if "io_bazel_skydoc" not in native.existing_rules():
http_archive(
name = "io_bazel_skydoc",
sha256 = "19eb6c162075707df5703c274d3348127625873dbfa5ff83b1ef4b8f5dbaa449",
strip_prefix = "skydoc-0.2.0",
urls = ["https://github.com/bazelbuild/skydoc/archive/0.2.0.tar.gz"],
)
if "bazel_gazelle" not in native.existing_rules():
http_archive(
name = "bazel_gazelle",
urls = ["https://github.com/bazelbuild/bazel-gazelle/releases/download/0.16.0/bazel-gazelle-0.16.0.tar.gz"],
sha256 = "7949fc6cc17b5b191103e97481cf8889217263acf52e00b560683413af204fcb",
)
if "bazel_gazelle" not in native.existing_rules():
http_archive(
name = "bazel_gazelle",
urls = ["https://github.com/bazelbuild/bazel-gazelle/releases/download/0.16.0/bazel-gazelle-0.16.0.tar.gz"],
sha256 = "7949fc6cc17b5b191103e97481cf8889217263acf52e00b560683413af204fcb",
)
if "io_bazel_rules_sass" not in native.existing_rules():
http_archive(
name = "io_bazel_rules_sass",
sha256 = "1e135452dc627f52eab39a50f4d5b8d13e8ed66cba2e6da56ac4cbdbd776536c",
strip_prefix = "rules_sass-1.15.2",
urls = ["https://github.com/bazelbuild/rules_sass/archive/1.15.2.tar.gz"],
)
if "io_bazel_rules_sass" not in native.existing_rules():
http_archive(
name = "io_bazel_rules_sass",
sha256 = "1e135452dc627f52eab39a50f4d5b8d13e8ed66cba2e6da56ac4cbdbd776536c",
strip_prefix = "rules_sass-1.15.2",
urls = ["https://github.com/bazelbuild/rules_sass/archive/1.15.2.tar.gz"],
)
# Fetch rules_nodejs so we can install our npm dependencies
if "build_bazel_rules_nodejs" not in native.existing_rules():
http_archive(
name = "build_bazel_rules_nodejs",
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/0.27.8/rules_nodejs-0.27.8.tar.gz"],
sha256 = "88e5e579fb9edfbd19791b8a3c6bfbe16ae3444dba4b428e5efd36856db7cf16",
patches = ["@com_github_digital_asset_daml//bazel_tools:rules_nodejs_default_shell_env.patch"],
patch_args = ["-p1"],
)
# Fetch rules_nodejs so we can install our npm dependencies
if "build_bazel_rules_nodejs" not in native.existing_rules():
http_archive(
name = "build_bazel_rules_nodejs",
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/0.27.8/rules_nodejs-0.27.8.tar.gz"],
sha256 = "88e5e579fb9edfbd19791b8a3c6bfbe16ae3444dba4b428e5efd36856db7cf16",
patches = ["@com_github_digital_asset_daml//bazel_tools:rules_nodejs_default_shell_env.patch"],
patch_args = ["-p1"],
)
if "com_github_grpc_grpc" not in native.existing_rules():
http_archive(
name = "com_github_grpc_grpc",
strip_prefix = "grpc-1.19.0",
urls = ["https://github.com/grpc/grpc/archive/v1.19.0.tar.gz"],
sha256 = "1d54cd95ed276c42c276e0a3df8ab33ee41968b73af14023c03a19db48f82e73",
patches = [
"@com_github_digital_asset_daml//bazel_tools:grpc-bazel-mingw.patch",
],
patch_args = ["-p1"],
)
if "com_github_grpc_grpc" not in native.existing_rules():
http_archive(
name = "com_github_grpc_grpc",
strip_prefix = "grpc-1.19.0",
urls = ["https://github.com/grpc/grpc/archive/v1.19.0.tar.gz"],
sha256 = "1d54cd95ed276c42c276e0a3df8ab33ee41968b73af14023c03a19db48f82e73",
patches = [
"@com_github_digital_asset_daml//bazel_tools:grpc-bazel-mingw.patch",
],
patch_args = ["-p1"],
)
if "io_grpc_grpc_java" not in native.existing_rules():
http_archive(
name = "io_grpc_grpc_java",
strip_prefix = "grpc-java-1.19.0",
urls = ["https://github.com/grpc/grpc-java/archive/v1.19.0.tar.gz"],
sha256 = "81d1e12bf0f8bd1560eed7c75f24d8bb8e7368dcf07802586e439c85cf89b005",
)
if "io_grpc_grpc_java" not in native.existing_rules():
http_archive(
name = "io_grpc_grpc_java",
strip_prefix = "grpc-java-1.19.0",
urls = ["https://github.com/grpc/grpc-java/archive/v1.19.0.tar.gz"],
sha256 = "81d1e12bf0f8bd1560eed7c75f24d8bb8e7368dcf07802586e439c85cf89b005",
)
if "com_github_johnynek_bazel_jar_jar" not in native.existing_rules():
http_archive(
name = "com_github_johnynek_bazel_jar_jar",
sha256 = "ee227e7f304e9b7f26d033af677f31066f68b1c94ee8f8d04fbecfb371c3caef",
strip_prefix = "bazel_jar_jar-16e48f319048e090a2fe7fd39a794312d191fc6f",
urls = ["https://github.com/johnynek/bazel_jar_jar/archive/16e48f319048e090a2fe7fd39a794312d191fc6f.zip"], # Latest commit SHA as at 2019/02/13
)
if "com_github_johnynek_bazel_jar_jar" not in native.existing_rules():
http_archive(
name = "com_github_johnynek_bazel_jar_jar",
sha256 = "ee227e7f304e9b7f26d033af677f31066f68b1c94ee8f8d04fbecfb371c3caef",
strip_prefix = "bazel_jar_jar-16e48f319048e090a2fe7fd39a794312d191fc6f",
urls = ["https://github.com/johnynek/bazel_jar_jar/archive/16e48f319048e090a2fe7fd39a794312d191fc6f.zip"], # Latest commit SHA as at 2019/02/13
)
if "com_github_scalapb_scalapb" not in native.existing_rules():
http_archive(
name = "com_github_scalapb_scalapb",
url = "https://github.com/scalapb/ScalaPB/releases/download/v0.8.0/scalapbc-0.8.0.zip",
sha256 = "bda0b44b50f0a816342a52c34e6a341b1a792f2a6d26f4f060852f8f10f5d854",
strip_prefix = "scalapbc-0.8.0/lib",
build_file_content = """
if "com_github_scalapb_scalapb" not in native.existing_rules():
http_archive(
name = "com_github_scalapb_scalapb",
url = "https://github.com/scalapb/ScalaPB/releases/download/v0.8.0/scalapbc-0.8.0.zip",
sha256 = "bda0b44b50f0a816342a52c34e6a341b1a792f2a6d26f4f060852f8f10f5d854",
strip_prefix = "scalapbc-0.8.0/lib",
build_file_content = """
java_import(
name = "compilerplugin",
jars = ["com.thesamet.scalapb.compilerplugin-0.8.0.jar"],
@ -196,20 +196,19 @@ java_import(
""",
)
if "com_github_googleapis_googleapis" not in native.existing_rules():
http_archive(
name = "com_github_googleapis_googleapis",
strip_prefix = "googleapis-6c48ab5aef47dc14e02e2dc718d232a28067129d",
urls = ["https://github.com/googleapis/googleapis/archive/6c48ab5aef47dc14e02e2dc718d232a28067129d.tar.gz"],
sha256 = "70d7be6ad49b4424313aad118c8622aab1c5fdd5a529d4215d3884ff89264a71",
)
native.bind(
name = "guava",
actual = "@com_google_guava_guava//jar",
)
native.bind(
name = "gson",
actual = "@com_google_code_gson_gson//jar",
)
if "com_github_googleapis_googleapis" not in native.existing_rules():
http_archive(
name = "com_github_googleapis_googleapis",
strip_prefix = "googleapis-6c48ab5aef47dc14e02e2dc718d232a28067129d",
urls = ["https://github.com/googleapis/googleapis/archive/6c48ab5aef47dc14e02e2dc718d232a28067129d.tar.gz"],
sha256 = "70d7be6ad49b4424313aad118c8622aab1c5fdd5a529d4215d3884ff89264a71",
)
native.bind(
name = "guava",
actual = "@com_google_guava_guava//jar",
)
native.bind(
name = "gson",
actual = "@com_google_code_gson_gson//jar",
)

View File

@ -31,38 +31,38 @@ import sys
# skip: Optional prefix for lines to skip when adding header initially.
filetypes = \
{ 'daml' : { 'start' : '-' * 80 , 'line' : '--' , 'end' : '' , 'empty_line' : '' } ,
'hs' : { 'start' : '-' * 80 , 'line' : '--' , 'end' : '' , 'empty_line' : '', 'skip' : '#!' } ,
'lhs' : { 'start' : '-' * 80 , 'line' : '--' , 'end' : '' , 'empty_line' : '' } ,
'chs' : { 'start' : '-' * 80 , 'line' : '--' , 'end' : '' , 'empty_line' : '' } ,
'js' : { 'start' : '' , 'line' : '//' , 'end' : '' , 'empty_line' : '' } ,
'ts' : { 'start' : '' , 'line' : '//' , 'end' : '' , 'empty_line' : '' } ,
'tsx' : { 'start' : '' , 'line' : '//' , 'end' : '' , 'empty_line' : '' } ,
'java' : { 'start' : '' , 'line' : '//' , 'end' : '' , 'empty_line' : '' } ,
'scala' : { 'start' : '' , 'line' : '//' , 'end' : '' , 'empty_line' : '' } ,
'rst' : { 'start' : '' , 'line' : '..' , 'end' : '' , 'empty_line' : '' } ,
'tex' : { 'start' : '%' * 80 , 'line' : '%' , 'end' : '' , 'empty_line' : '' } ,
'py' : { 'start' : '#' * 80 , 'line' : '#' , 'end' : '' , 'empty_line' : '', 'skip' : '#!' } ,
'proto' : { 'start' : '/*' , 'line' : '//' , 'end' : '' , 'empty_line' : '' } ,
'c' : { 'start' : '/*' , 'line' : '//' , 'end' : '' , 'empty_line' : '' } ,
'cpp' : { 'start' : '/*' , 'line' : '//' , 'end' : '' , 'empty_line' : '' } ,
'cc' : { 'start' : '/*' , 'line' : '//' , 'end' : '' , 'empty_line' : '' } ,
'h' : { 'start' : '/*' , 'line' : '//' , 'end' : '' , 'empty_line' : '' } ,
'hpp' : { 'start' : '/*' , 'line' : '//' , 'end' : '' , 'empty_line' : '' } ,
'hh' : { 'start' : '/*' , 'line' : '//' , 'end' : '' , 'empty_line' : '' } ,
'groovy' : { 'start' : '/*' , 'line' : '//' , 'end' : '' , 'empty_line' : '' } ,
'sql' : { 'start' : '/*' , 'line' : '--' , 'end' : '' , 'empty_line' : '' } ,
'css' : { 'start' : '/*' , 'line' : '' , 'end' : ' */' } ,
'scss' : { 'start' : '/*' , 'line' : '' , 'end' : ' */' } ,
'sh' : { 'start' : '#' * 80 , 'line' : '#' , 'end' : '', 'empty_line' : '', 'skip' : '#!' } ,
'bats' : { 'start' : '#' * 80 , 'line' : '#' , 'end' : '', 'empty_line' : '', 'skip' : '#!' } ,
'html' : { 'start' : '<!--' , 'line' : '' , 'end' : '-->' , 'skip' : '<!' } ,
'bat' : { 'start' : '::' , 'line' : '::' , 'end' : '' , 'empty_line' : '' } ,
'cmd' : { 'start' : '::' , 'line' : '::' , 'end' : '' , 'empty_line' : '' } ,
'bazel' : { 'start' : '#' * 80 , 'line' : '#' , 'end' : '', 'empty_line' : '', 'skip': '#!' } ,
'bzl' : { 'start' : '#' * 80 , 'line' : '#' , 'end' : '', 'empty_line' : '', 'skip': '#!' } ,
'rb' : { 'start' : '#' * 80 , 'line' : '#' , 'end' : '' , 'empty_line' : '' } ,
'tf' : { 'start' : '#' * 80 , 'line' : '#' , 'end' : '' , 'empty_line' : '' } ,
{ 'daml' : { 'start' : '-' * 80 , 'line' : '--' , 'end' : '' , 'empty_line' : '' } ,
'hs' : { 'start' : '-' * 80 , 'line' : '--' , 'end' : '' , 'empty_line' : '', 'skip' : '#!' } ,
'lhs' : { 'start' : '-' * 80 , 'line' : '--' , 'end' : '' , 'empty_line' : '' } ,
'chs' : { 'start' : '-' * 80 , 'line' : '--' , 'end' : '' , 'empty_line' : '' } ,
'js' : { 'start' : '' , 'line' : '//' , 'end' : '' , 'empty_line' : '' } ,
'ts' : { 'start' : '' , 'line' : '//' , 'end' : '' , 'empty_line' : '' } ,
'tsx' : { 'start' : '' , 'line' : '//' , 'end' : '' , 'empty_line' : '' } ,
'java' : { 'start' : '' , 'line' : '//' , 'end' : '' , 'empty_line' : '' } ,
'scala' : { 'start' : '' , 'line' : '//' , 'end' : '' , 'empty_line' : '' } ,
'rst' : { 'start' : '' , 'line' : '..' , 'end' : '' , 'empty_line' : '' } ,
'tex' : { 'start' : '%' * 80 , 'line' : '%' , 'end' : '' , 'empty_line' : '' } ,
'py' : { 'start' : '#' * 80 , 'line' : '#' , 'end' : '' , 'empty_line' : '', 'skip' : '#!' } ,
'proto' : { 'start' : '/*' , 'line' : '//' , 'end' : '' , 'empty_line' : '' } ,
'c' : { 'start' : '/*' , 'line' : '//' , 'end' : '' , 'empty_line' : '' } ,
'cpp' : { 'start' : '/*' , 'line' : '//' , 'end' : '' , 'empty_line' : '' } ,
'cc' : { 'start' : '/*' , 'line' : '//' , 'end' : '' , 'empty_line' : '' } ,
'h' : { 'start' : '/*' , 'line' : '//' , 'end' : '' , 'empty_line' : '' } ,
'hpp' : { 'start' : '/*' , 'line' : '//' , 'end' : '' , 'empty_line' : '' } ,
'hh' : { 'start' : '/*' , 'line' : '//' , 'end' : '' , 'empty_line' : '' } ,
'groovy' : { 'start' : '/*' , 'line' : '//' , 'end' : '' , 'empty_line' : '' } ,
'sql' : { 'start' : '/*' , 'line' : '--' , 'end' : '' , 'empty_line' : '' } ,
'sh' : { 'start' : '#' * 80 , 'line' : '#' , 'end' : '' , 'empty_line' : '', 'skip' : '#!' } ,
'bats' : { 'start' : '#' * 80 , 'line' : '#' , 'end' : '' , 'empty_line' : '', 'skip' : '#!' } ,
'html' : { 'start' : '<!--' , 'line' : '' , 'end' : '-->' , 'skip' : '<!' } ,
'bat' : { 'start' : '::' , 'line' : '::' , 'end' : '' , 'empty_line' : '' } ,
'cmd' : { 'start' : '::' , 'line' : '::' , 'end' : '' , 'empty_line' : '' } ,
'bazel' : { 'start' : '#' * 80 , 'line' : '#' , 'end' : '' , 'empty_line' : '', 'skip': '#!' } ,
'bzl' : { 'start' : '#' * 80 , 'line' : '#' , 'end' : '' , 'empty_line' : '', 'skip': '#!' } ,
'rb' : { 'start' : '#' * 80 , 'line' : '#' , 'end' : '' , 'empty_line' : '' } ,
'tf' : { 'start' : '#' * 80 , 'line' : '#' , 'end' : '' , 'empty_line' : '' } ,
'css' : { 'start' : '/*' , 'line' : '' , 'end' : ' */' } ,
'scss' : { 'start' : '/*' , 'line' : '' , 'end' : ' */' } ,
}
#########################
@ -127,6 +127,9 @@ def process_file(filename, check_only):
# Read all lines from the file
with open(filename, 'r', encoding="UTF-8") as fp:
lines = fp.readlines()
# Pretend that the file has extra empty line at the end to handle files,
# which consist only of the copyright notice and nothing else.
lines.append('\n')
# Process the file:
# If we find an existing copyright header with the same starting line

View File

@ -6,18 +6,37 @@ load("@os_info//:os_info.bzl", "is_linux")
load("//rules_daml:daml.bzl", "daml_test")
nodejs_binary(
name="grunt",
data=['@npm//matchdep', '@npm//grunt-cli'],
entry_point='grunt-cli/bin/grunt'
name = "grunt",
data = [
"@npm//grunt-cli",
"@npm//matchdep",
],
entry_point = "grunt-cli/bin/grunt",
)
genrule(
name = "theme",
srcs = glob(["theme/**"], exclude=["theme/bower_components/**", "theme/node_modules/**", "theme/da_theme/**"]) +
['@npm//browserify', '@npm//grunt-banner', '@npm//grunt-browserify', '@npm//grunt-contrib-clean'
, '@npm//grunt-contrib-connect', '@npm//grunt-contrib-copy', '@npm//grunt-contrib-sass', '@npm//grunt-contrib-uglify'
, '@npm//grunt-contrib-watch', '@npm//grunt-exec', '@npm//grunt-open', '@npm//matchdep'],
tools = ["@sass_nix//:bin/sass", ':grunt'],
srcs = glob(
["theme/**"],
exclude = [
"theme/bower_components/**",
"theme/node_modules/**",
"theme/da_theme/**",
],
) + [
"@npm//browserify",
"@npm//grunt-banner",
"@npm//grunt-browserify",
"@npm//grunt-contrib-clean",
"@npm//grunt-contrib-connect",
"@npm//grunt-contrib-copy",
"@npm//grunt-contrib-sass",
"@npm//grunt-contrib-uglify",
"@npm//grunt-contrib-watch",
"@npm//grunt-exec",
"@npm//grunt-open",
"@npm//matchdep",
],
outs = ["da_theme.tar.gz"],
cmd = """
cp -rL docs/theme theme
@ -48,16 +67,21 @@ genrule(
--sort=name \
-czf ../$(location da_theme.tar.gz) \
da_theme
"""
""",
tools = [
":grunt",
"@sass_nix//:bin/sass",
],
)
genrule(
name = "sources",
srcs = glob(["source/**"]) +
[ "//daml-foundations/daml-ghc:daml-base-rst-docs"
, "//ledger-api/grpc-definitions:docs"
, "//:LICENSE"
, "//:NOTICES"],
srcs = glob(["source/**"]) + [
"//daml-foundations/daml-ghc:daml-base-rst-docs",
"//ledger-api/grpc-definitions:docs",
"//:LICENSE",
"//:NOTICES",
],
outs = ["source.tar.gz"],
cmd = """
cp -rL docs/source source
@ -73,16 +97,17 @@ genrule(
cp -L $(location //:NOTICES) source/NOTICES
tar -zcf $(location source.tar.gz) source
"""
""",
)
genrule(
name = "pdf-docs",
srcs = glob(["configs/pdf/**", "configs/static/pygments_daml_lexer.py"]) +
[":sources"],
tools =
["@texlive_nix//:bin/lualatex", "@sphinx_nix//:bin/sphinx-build", "@imagemagick_nix//:bin/convert"] +
(["@glibc_locales//:locale-archive"] if is_linux else []),
srcs = glob([
"configs/pdf/**",
"configs/static/pygments_daml_lexer.py",
]) + [
":sources",
],
outs = ["DigitalAssetSDK.pdf"],
cmd = ("""
export LOCALE_ARCHIVE="$$PWD/$(location @glibc_locales//:locale-archive)"
@ -113,22 +138,28 @@ genrule(
../$(location @texlive_nix//:bin/lualatex) -halt-on-error -interaction=batchmode --shell-escape *.tex
# Move output to target
mv DigitalAssetSDK.pdf ../$(location DigitalAssetSDK.pdf)"""
mv DigitalAssetSDK.pdf ../$(location DigitalAssetSDK.pdf)""",
tools =
[
"@texlive_nix//:bin/lualatex",
"@sphinx_nix//:bin/sphinx-build",
"@imagemagick_nix//:bin/convert",
] + (["@glibc_locales//:locale-archive"] if is_linux else []),
)
genrule(
name = "docs-no-pdf",
srcs = glob(["configs/html/**", "configs/static/pygments_daml_lexer.py"]) +
[ ":sources"
, ":theme"
, "//daml-foundations/daml-ghc:daml-base-rst-docs"
, "//daml-foundations/daml-ghc:daml-base-hoogle-docs"
, "//language-support/java:javadocs"
, "//language-support/js/docs"
],
tools =
["@sphinx_nix//:bin/sphinx-build"] +
(["@glibc_locales//:locale-archive"] if is_linux else []),
srcs = glob([
"configs/html/**",
"configs/static/pygments_daml_lexer.py",
]) + [
":sources",
":theme",
"//daml-foundations/daml-ghc:daml-base-rst-docs",
"//daml-foundations/daml-ghc:daml-base-hoogle-docs",
"//language-support/java:javadocs",
"//language-support/js/docs",
],
outs = ["html-only.tar.gz"],
cmd = ("""
export LOCALE_ARCHIVE="$$PWD/$(location @glibc_locales//:locale-archive)"
@ -168,12 +199,18 @@ genrule(
cp -rL ../$(location //daml-foundations/daml-ghc:daml-base-hoogle-docs) html/hoogle_db/base.txt
tar -zcf ../$(location html-only.tar.gz) html
"""
""",
tools =
["@sphinx_nix//:bin/sphinx-build"] +
(["@glibc_locales//:locale-archive"] if is_linux else []),
)
genrule(
name = "redirects",
srcs = ["redirects.map", "redirect_template.html"],
srcs = [
"redirects.map",
"redirect_template.html",
],
outs = ["redirects.tar.gz"],
cmd = """
mkdir redirects
@ -188,12 +225,17 @@ genrule(
fi
done <docs/redirects.map
tar -zcf $(location redirects.tar.gz) redirects
"""
""",
)
genrule(
name = "docs",
srcs = [":docs-no-pdf", ":pdf-docs", ":redirects", "error.html"],
srcs = [
":docs-no-pdf",
":pdf-docs",
":redirects",
"error.html",
],
outs = ["html.tar.gz"],
cmd = """
tar -zxf $(location :redirects)
@ -216,10 +258,10 @@ genrule(
cp -L $(location :pdf-docs) html/_downloads
tar -zcf $(location html.tar.gz) html
""".format(
"""<?xml version='1.0' encoding='UTF-8'?><urlset xmlns='http://www.sitemaps.org/schemas/sitemap/0.9' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd'>""",
"""<url><loc>%LOC%</loc><lastmod>%DATE%</lastmod><changefreq>daily</changefreq><priority>0.8</priority></url>""",
"""</urlset>"""
)
"""<?xml version='1.0' encoding='UTF-8'?><urlset xmlns='http://www.sitemaps.org/schemas/sitemap/0.9' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd'>""",
"""<url><loc>%LOC%</loc><lastmod>%DATE%</lastmod><changefreq>daily</changefreq><priority>0.8</priority></url>""",
"""</urlset>""",
),
)
genrule(
@ -240,16 +282,16 @@ load("//rules_daml:daml.bzl", "daml_compile")
load("//language-support/java/codegen:codegen.bzl", "dar_to_java")
daml_compile(
name = "quickstart-model",
main_src = "source/getting-started/quickstart/template-root/daml/Main.daml",
srcs = glob(["source/getting-started/quickstart/template-root/**/*.daml"]),
target = "1.1",
name = "quickstart-model",
srcs = glob(["source/getting-started/quickstart/template-root/**/*.daml"]),
main_src = "source/getting-started/quickstart/template-root/daml/Main.daml",
target = "1.1",
)
dar_to_java(
name = "quickstart-model",
src = "quickstart-model.dar",
package_prefix = "com.digitalasset.quickstart.model"
package_prefix = "com.digitalasset.quickstart.model",
)
java_binary(
@ -258,56 +300,54 @@ java_binary(
main_class = "com.digitalasset.quickstart.iou.IouMain",
deps = [
"//3rdparty/jvm/ch/qos/logback:logback_classic",
"//3rdparty/jvm/com/google/code/gson",
"//3rdparty/jvm/com/google/guava",
"//3rdparty/jvm/com/google/protobuf:protobuf_java",
"//3rdparty/jvm/com/sparkjava:spark_core",
"//3rdparty/jvm/com/google/guava:guava",
"//3rdparty/jvm/com/google/code/gson:gson",
"//3rdparty/jvm/io/reactivex/rxjava2:rxjava",
"//daml-lf/archive:daml_lf_java_proto",
"//language-support/java/bindings-rxjava:bindings-rxjava",
"//language-support/java/bindings:bindings-java",
]
"//language-support/java/bindings-rxjava",
],
)
daml_test(
name = "ledger-api-introduction-daml-test",
srcs = glob(["source/app-dev/ledger-api-introduction/code-snippets/**/*.daml"])
srcs = glob(["source/app-dev/ledger-api-introduction/code-snippets/**/*.daml"]),
)
daml_test(
name = "patterns-daml-test",
srcs = glob(["source/daml/patterns/daml/**/*.daml"])
srcs = glob(["source/daml/patterns/daml/**/*.daml"]),
)
daml_test(
name = "daml-studio-daml-test",
srcs = glob(["source/daml/daml-studio/daml/**/*.daml"])
srcs = glob(["source/daml/daml-studio/daml/**/*.daml"]),
)
daml_test(
name = "daml-ref-daml-test",
srcs = glob(["source/daml/code-snippets/**/*.daml"]),
timeout = "long",
srcs = glob(["source/daml/code-snippets/**/*.daml"]),
)
daml_test(
name = "introduction-daml-test",
srcs = glob(["source/getting-started/introduction/code/**/*.daml"])
srcs = glob(["source/getting-started/introduction/code/**/*.daml"]),
)
daml_test(
name = "quickstart-daml-test",
srcs = glob(["source/getting-started/quickstart/template-root/daml/**/*.daml"])
srcs = glob(["source/getting-started/quickstart/template-root/daml/**/*.daml"]),
)
daml_test(
name = "ledger-model-daml-test",
srcs = glob(["source/concepts/ledger-model/daml/**/*.daml"])
srcs = glob(["source/concepts/ledger-model/daml/**/*.daml"]),
)
daml_test(
name = "java-bindings-docs-daml-test",
srcs = glob(["source/app-dev/bindings-java/daml/**/*.daml"])
srcs = glob(["source/app-dev/bindings-java/daml/**/*.daml"]),
)

View File

@ -2,112 +2,111 @@
# SPDX-License-Identifier: Apache-2.0
load(
'//bazel_tools:scala.bzl',
'da_scala_test_suite',
'da_scala_library',
'da_scala_binary',
"//bazel_tools:scala.bzl",
"da_scala_binary",
"da_scala_library",
"da_scala_test_suite",
)
load(
"//rules_daml:daml.bzl",
"daml_compile"
"//rules_daml:daml.bzl",
"daml_compile",
)
compileDependencies = [
# this has to come first other as somehow a different instance of grpc-core.jar
'//3rdparty/jvm/io/grpc:grpc_services',
'//daml-lf/archive:daml_lf_java_proto',
'//daml-lf/archive:daml_lf_archive_scala',
'//daml-lf/data',
'//daml-lf/interface',
'//ledger-api/rs-grpc-bridge',
'//ledger-api/rs-grpc-akka',
'//language-support/scala/bindings',
'//ledger/ledger-api-client',
'//3rdparty/jvm/io/netty:netty_tcnative_boringssl_static',
'//3rdparty/jvm/com/chuusai:shapeless',
'//3rdparty/jvm/org/spire_math:kind_projector',
'//3rdparty/jvm/com/github/scopt:scopt',
'//3rdparty/jvm/com/lihaoyi:pprint',
'//3rdparty/jvm/org/tpolecat:doobie_core',
'//3rdparty/jvm/org/tpolecat:doobie_postgres',
'//3rdparty/jvm/com/typesafe/akka:akka_stream',
'//3rdparty/jvm/org/scalaz:scalaz_core',
'//3rdparty/jvm/org/slf4j:slf4j_api',
'//3rdparty/jvm/io/circe:circe_core',
'//3rdparty/jvm/io/circe:circe_generic',
'//3rdparty/jvm/io/circe:circe_parser',
'//3rdparty/jvm/io/grpc:grpc_netty',
# this has to come first other as somehow a different instance of grpc-core.jar
"//3rdparty/jvm/io/grpc:grpc_services",
"//daml-lf/archive:daml_lf_java_proto",
"//daml-lf/archive:daml_lf_archive_scala",
"//daml-lf/data",
"//daml-lf/interface",
"//ledger-api/rs-grpc-bridge",
"//ledger-api/rs-grpc-akka",
"//language-support/scala/bindings",
"//ledger/ledger-api-client",
"//3rdparty/jvm/io/netty:netty_tcnative_boringssl_static",
"//3rdparty/jvm/com/chuusai:shapeless",
"//3rdparty/jvm/org/spire_math:kind_projector",
"//3rdparty/jvm/com/github/scopt:scopt",
"//3rdparty/jvm/com/lihaoyi:pprint",
"//3rdparty/jvm/org/tpolecat:doobie_core",
"//3rdparty/jvm/org/tpolecat:doobie_postgres",
"//3rdparty/jvm/com/typesafe/akka:akka_stream",
"//3rdparty/jvm/org/scalaz:scalaz_core",
"//3rdparty/jvm/org/slf4j:slf4j_api",
"//3rdparty/jvm/io/circe:circe_core",
"//3rdparty/jvm/io/circe:circe_generic",
"//3rdparty/jvm/io/circe:circe_parser",
"//3rdparty/jvm/io/grpc:grpc_netty",
]
daml_compile(
name = "RecordsAndVariants",
main_src = "src/test/resources/damls/RecordsAndVariants.daml",
target = "1.3",
damlc = "//daml-foundations/daml-tools/da-hs-damlc-app:da-hs-damlc-app-deprecated"
name = "RecordsAndVariants",
damlc = "//daml-foundations/daml-tools/da-hs-damlc-app:da-hs-damlc-app-deprecated",
main_src = "src/test/resources/damls/RecordsAndVariants.daml",
target = "1.3",
)
daml_compile(
name = "PrimitiveTypes",
main_src = "src/test/resources/damls/PrimitiveTypes.daml",
target = "1.3",
damlc = "//daml-foundations/daml-tools/da-hs-damlc-app:da-hs-damlc-app-deprecated"
name = "PrimitiveTypes",
damlc = "//daml-foundations/daml-tools/da-hs-damlc-app:da-hs-damlc-app-deprecated",
main_src = "src/test/resources/damls/PrimitiveTypes.daml",
target = "1.3",
)
daml_compile(
name = "TransactionExample",
main_src = "src/test/resources/damls/TransactionExample.daml",
target = "1.3",
damlc = "//daml-foundations/daml-tools/da-hs-damlc-app:da-hs-damlc-app-deprecated"
name = "TransactionExample",
damlc = "//daml-foundations/daml-tools/da-hs-damlc-app:da-hs-damlc-app-deprecated",
main_src = "src/test/resources/damls/TransactionExample.daml",
target = "1.3",
)
testDependencies = [
':extractor',
'//ledger/sandbox:sandbox',
'//ledger-api/testing-utils',
'//ledger/sandbox:sandbox-scala-tests-lib',
'//3rdparty/jvm/org/scalatest:scalatest',
":extractor",
"//ledger/sandbox:sandbox",
"//ledger-api/testing-utils",
"//ledger/sandbox:sandbox-scala-tests-lib",
"//3rdparty/jvm/org/scalatest:scalatest",
] + compileDependencies
da_scala_library(
name = 'extractor',
srcs = glob(['src/main/scala/**/*.scala']),
resources = glob(['src/main/resources/**/*']),
deps = compileDependencies,
runtime_deps = [
'//3rdparty/jvm/ch/qos/logback:logback_core',
'//3rdparty/jvm/ch/qos/logback:logback_classic'
],
name = "extractor",
srcs = glob(["src/main/scala/**/*.scala"]),
resources = glob(["src/main/resources/**/*"]),
runtime_deps = [
"//3rdparty/jvm/ch/qos/logback:logback_classic",
"//3rdparty/jvm/ch/qos/logback:logback_core",
],
deps = compileDependencies,
)
da_scala_binary(
name = "extractor-binary",
main_class = 'com.digitalasset.extractor.Main',
deps = [
":extractor",
],
visibility = ["//visibility:public"],
tags = ["maven_coordinates=com.digitalasset:extractor:__VERSION__"],
name = "extractor-binary",
main_class = "com.digitalasset.extractor.Main",
tags = ["maven_coordinates=com.digitalasset:extractor:__VERSION__"],
visibility = ["//visibility:public"],
deps = [
":extractor",
],
)
da_scala_library(
name = "extractor-scala-tests-lib",
srcs = glob(['src/test/lib/**/*.scala']),
deps = testDependencies
name = "extractor-scala-tests-lib",
srcs = glob(["src/test/lib/**/*.scala"]),
deps = testDependencies,
)
da_scala_test_suite(
name = "extractor-scala-tests",
srcs = glob(['src/test/suite/**/*.scala']),
resources = glob(['src/test/resources/**/*']),
size = "small",
srcs = glob(["src/test/suite/**/*.scala"]),
data = [
'//extractor:RecordsAndVariants.dalf',
'//extractor:PrimitiveTypes.dalf',
'//extractor:TransactionExample.dalf',
'//daml-foundations/daml-ghc/package-database/deprecated:daml-prim-1.3.dalf'
"//daml-foundations/daml-ghc/package-database/deprecated:daml-prim-1.3.dalf",
"//extractor:PrimitiveTypes.dalf",
"//extractor:RecordsAndVariants.dalf",
"//extractor:TransactionExample.dalf",
],
resources = glob(["src/test/resources/**/*"]),
deps = [
':extractor-scala-tests-lib'
":extractor-scala-tests-lib",
] + testDependencies,
size = "small"
)

4
fmt.sh
View File

@ -15,6 +15,7 @@ eval "$(dev-env/bin/dade-assist)"
is_test=
scalafmt_args=()
dade_copyright_arg=update
buildifier_target=//:buildifier-fix
## Functions ##
@ -54,6 +55,7 @@ USAGE
is_test=1
scalafmt_args+=(--test)
dade_copyright_arg=check
buildifier_target=//:buildifier
;;
*)
echo "fmt.sh: unknown argument $1" >&2
@ -81,3 +83,5 @@ trap - EXIT
# check for scala code style
run ./scalafmt.sh "${scalafmt_args[@]}"
# check for Bazel build files code formatting
run bazel run "$buildifier_target"

View File

@ -3,11 +3,11 @@
load(
"//bazel_tools:scala.bzl",
"da_scala_binary"
"da_scala_binary",
)
load(
"@com_github_johnynek_bazel_jar_jar//:jar_jar.bzl",
"jar_jar"
"jar_jar",
)
da_scala_binary(
@ -16,14 +16,14 @@ da_scala_binary(
main_class = "com.digitalasset.codegen.CodegenMain",
visibility = ["//visibility:public"],
deps = [
"//3rdparty/jvm/com/typesafe/scala_logging",
"//language-support/java/codegen:lib",
"//language-support/scala/codegen:codegen-main",
"//3rdparty/jvm/com/typesafe/scala_logging",
],
)
jar_jar(
name = "codegen-main",
input_jar = ":codegen-main-bin_deploy.jar",
rules = "shade_rule"
)
rules = "shade_rule",
)

View File

@ -6,12 +6,12 @@ load("@os_info//:os_info.bzl", "is_windows")
genrule(
name = "javadocs",
srcs = [
'//language-support/java/bindings-rxjava:sources',
"//language-support/java/bindings-rxjava:sources",
"//language-support/java/bindings:sources",
'//language-support/java/bindings-rxjava:bindings-rxjava',
"//language-support/java/bindings-rxjava",
"//language-support/java/bindings:bindings-java",
'//external:jar/org/slf4j/slf4j_api',
'//ledger-api/rs-grpc-bridge:rs-grpc-bridge',
"//external:jar/org/slf4j/slf4j_api",
"//ledger-api/rs-grpc-bridge",
"//external:jar/io/reactivex/rxjava2/rxjava",
"//external:jar/com/google/protobuf/protobuf_java",
"//external:jar/org/pcollections/pcollections",
@ -22,7 +22,6 @@ genrule(
"//external:jar/io/netty/netty_handler",
"//external:jar/com/google/code/findbugs/jsr305",
],
tools = ["@javadoc_dev_env//:javadoc"],
outs = ["javadocs.tar.gz"],
cmd = """
CP=$(location //external:jar/org/slf4j/slf4j_api)
@ -44,7 +43,8 @@ genrule(
""".format(
delim = "\;" if is_windows else ":",
),
tools = ["@javadoc_dev_env//:javadoc"],
visibility = [
'//visibility:public',
]
)
"//visibility:public",
],
)

View File

@ -2,37 +2,33 @@
# SPDX-License-Identifier: Apache-2.0
load(
"//bazel_tools:scala.bzl",
"da_scala_test_suite",
"da_scala_library"
"//bazel_tools:scala.bzl",
"da_scala_library",
"da_scala_test_suite",
)
load("//bazel_tools:pom_file.bzl", "pom_file")
java_library(
name = 'bindings-rxjava',
srcs = glob(['src/main/java/**/*.java']),
name = "bindings-rxjava",
srcs = glob(["src/main/java/**/*.java"]),
tags = ["maven_coordinates=com.daml.ledger:bindings-rxjava:__VERSION__"],
visibility = [
"//visibility:public",
],
deps = [
'//3rdparty/jvm/org/slf4j:slf4j_api',
"//3rdparty/jvm/io/reactivex/rxjava2:rxjava",
"//3rdparty/jvm/org/pcollections:pcollections",
"//3rdparty/jvm/org/checkerframework:checker",
"//3rdparty/jvm/io/grpc:grpc_netty",
"//3rdparty/jvm/com/google/protobuf:protobuf_java",
"//3rdparty/jvm/io/grpc:grpc_core",
"//3rdparty/jvm/io/grpc:grpc_netty",
"//3rdparty/jvm/io/grpc:grpc_protobuf",
"//3rdparty/jvm/io/grpc:grpc_stub",
"//3rdparty/jvm/com/google/protobuf:protobuf_java",
"//3rdparty/jvm/io/netty:netty_handler",
'//ledger-api/rs-grpc-bridge:rs-grpc-bridge',
"//language-support/java/bindings:bindings-java"
"//3rdparty/jvm/io/reactivex/rxjava2:rxjava",
"//3rdparty/jvm/org/checkerframework:checker",
"//3rdparty/jvm/org/pcollections",
"//3rdparty/jvm/org/slf4j:slf4j_api",
"//language-support/java/bindings:bindings-java",
"//ledger-api/rs-grpc-bridge",
],
visibility = [
'//visibility:public',
],
tags = ["maven_coordinates=com.daml.ledger:bindings-rxjava:__VERSION__"],
)
pom_file(
@ -41,39 +37,48 @@ pom_file(
)
testDependencies = [
'//3rdparty/jvm/io/grpc:grpc_core',
'//3rdparty/jvm/io/grpc:grpc_netty',
":bindings-rxjava",
'//3rdparty/jvm/org/slf4j:slf4j_api',
'//ledger-api/grpc-definitions:ledger-api-scalapb',
'//language-support/java/testkit:testkit',
'//ledger-api/rs-grpc-bridge:rs-grpc-bridge',
"//3rdparty/jvm/org/scalatest:scalatest",
"//3rdparty/jvm/io/reactivex/rxjava2:rxjava",
"//3rdparty/jvm/com/google/protobuf:protobuf_java",
"//3rdparty/jvm/org/scalacheck:scalacheck",
'//3rdparty/jvm/org/reactivestreams:reactive_streams',
"//3rdparty/jvm/org/pcollections:pcollections",
'//3rdparty/jvm/org/scalactic:scalactic',
"//language-support/java/bindings:bindings-java",
]
"//3rdparty/jvm/io/grpc:grpc_core",
"//3rdparty/jvm/io/grpc:grpc_netty",
":bindings-rxjava",
"//3rdparty/jvm/org/slf4j:slf4j_api",
"//ledger-api/grpc-definitions:ledger-api-scalapb",
"//language-support/java/testkit:testkit",
"//ledger-api/rs-grpc-bridge:rs-grpc-bridge",
"//3rdparty/jvm/org/scalatest:scalatest",
"//3rdparty/jvm/io/reactivex/rxjava2:rxjava",
"//3rdparty/jvm/com/google/protobuf:protobuf_java",
"//3rdparty/jvm/org/scalacheck:scalacheck",
"//3rdparty/jvm/org/reactivestreams:reactive_streams",
"//3rdparty/jvm/org/pcollections:pcollections",
"//3rdparty/jvm/org/scalactic:scalactic",
"//language-support/java/bindings:bindings-java",
]
da_scala_library(
name = "bindings-java-tests-lib",
srcs = glob(['src/test/**/*.scala'], exclude = ['src/test/**/*Spec.scala', 'src/test/**/*Test.scala']),
deps = testDependencies,
name = "bindings-java-tests-lib",
srcs = glob(
["src/test/**/*.scala"],
exclude = [
"src/test/**/*Spec.scala",
"src/test/**/*Test.scala",
],
),
deps = testDependencies,
)
da_scala_test_suite(
name = "bindings-java-tests",
srcs = glob(['src/test/**/*Spec.scala', 'src/test/**/*Test.scala']),
srcs = glob([
"src/test/**/*Spec.scala",
"src/test/**/*Test.scala",
]),
deps = [
":bindings-java-tests-lib",
] + testDependencies
] + testDependencies,
)
filegroup (
filegroup(
name = "sources",
srcs = glob(['src/main/java/**/*.java']),
visibility = [ '//visibility:public', ],
srcs = glob(["src/main/java/**/*.java"]),
visibility = ["//visibility:public"],
)

View File

@ -2,9 +2,9 @@
# SPDX-License-Identifier: Apache-2.0
load(
"//bazel_tools:scala.bzl",
"da_scala_test_suite",
"da_scala_library"
"//bazel_tools:scala.bzl",
"da_scala_library",
"da_scala_test_suite",
)
load("//bazel_tools:proto.bzl", "proto_gen")
load("//bazel_tools:java.bzl", "da_java_library")
@ -12,78 +12,89 @@ load("//bazel_tools:java.bzl", "da_java_library")
proto_gen(
name = "ledger-api-java",
srcs = ["//ledger-api/grpc-definitions:protos"],
deps = ['@com_google_protobuf//:empty_proto',
'@com_google_protobuf//:timestamp_proto',
'@com_google_protobuf//:duration_proto',
'@com_google_protobuf//:wrappers_proto',
'@com_google_protobuf//:any_proto',
'@com_google_protobuf//:descriptor_proto',
'@com_github_googleapis_googleapis//google/rpc:status_proto',
],
plugin_name = "java",
visibility = [
'//visibility:public',
"//visibility:public",
],
deps = [
"@com_github_googleapis_googleapis//google/rpc:status_proto",
"@com_google_protobuf//:any_proto",
"@com_google_protobuf//:descriptor_proto",
"@com_google_protobuf//:duration_proto",
"@com_google_protobuf//:empty_proto",
"@com_google_protobuf//:timestamp_proto",
"@com_google_protobuf//:wrappers_proto",
],
)
proto_gen(
name = "ledger-api-java-grpc",
srcs = ["//ledger-api/grpc-definitions:protos"],
deps = ['@com_google_protobuf//:empty_proto',
'@com_google_protobuf//:timestamp_proto',
'@com_google_protobuf//:duration_proto',
'@com_google_protobuf//:wrappers_proto',
'@com_google_protobuf//:any_proto',
'@com_google_protobuf//:descriptor_proto',
'@com_github_googleapis_googleapis//google/rpc:status_proto',
],
plugin_name = "java-grpc",
plugin_exec = "@io_grpc_grpc_java//compiler:grpc_java_plugin",
plugin_name = "java-grpc",
visibility = [
'//visibility:public',
"//visibility:public",
],
deps = [
"@com_github_googleapis_googleapis//google/rpc:status_proto",
"@com_google_protobuf//:any_proto",
"@com_google_protobuf//:descriptor_proto",
"@com_google_protobuf//:duration_proto",
"@com_google_protobuf//:empty_proto",
"@com_google_protobuf//:timestamp_proto",
"@com_google_protobuf//:wrappers_proto",
],
)
da_java_library(
name = 'bindings-java',
srcs = glob(['src/main/java/**/*.java']) + [':ledger-api-java', ':ledger-api-java-grpc'],
deps = [
"//3rdparty/jvm/org/checkerframework:checker",
"//3rdparty/jvm/io/grpc:grpc_stub",
"//3rdparty/jvm/io/grpc:grpc_protobuf",
],
visibility = [
'//visibility:public',
name = "bindings-java",
srcs = glob(["src/main/java/**/*.java"]) + [
":ledger-api-java",
":ledger-api-java-grpc",
],
tags = ["maven_coordinates=com.daml.ledger:bindings-java:__VERSION__"],
visibility = [
"//visibility:public",
],
deps = [
"//3rdparty/jvm/io/grpc:grpc_protobuf",
"//3rdparty/jvm/io/grpc:grpc_stub",
"//3rdparty/jvm/org/checkerframework:checker",
],
)
testDependencies = [
":bindings-java",
"//3rdparty/jvm/org/scalatest:scalatest",
"//3rdparty/jvm/com/google/protobuf:protobuf_java",
"//3rdparty/jvm/org/scalacheck:scalacheck",
]
":bindings-java",
"//3rdparty/jvm/org/scalatest:scalatest",
"//3rdparty/jvm/com/google/protobuf:protobuf_java",
"//3rdparty/jvm/org/scalacheck:scalacheck",
]
da_scala_library(
name = "bindings-java-tests-lib",
srcs = glob(['src/test/**/*.scala'], exclude = ['src/test/**/*Spec.scala', 'src/test/**/*Test.scala']),
deps = testDependencies,
name = "bindings-java-tests-lib",
srcs = glob(
["src/test/**/*.scala"],
exclude = [
"src/test/**/*Spec.scala",
"src/test/**/*Test.scala",
],
),
deps = testDependencies,
)
da_scala_test_suite(
name = "bindings-java-tests",
srcs = glob(['src/test/**/*Spec.scala', 'src/test/**/*Test.scala']),
srcs = glob([
"src/test/**/*Spec.scala",
"src/test/**/*Test.scala",
]),
deps = [
":bindings-java-tests-lib",
] + testDependencies
] + testDependencies,
)
filegroup (
filegroup(
name = "sources",
srcs = glob(['src/main/java/**/*.java']),
visibility = [ '//visibility:public', ],
srcs = glob(["src/main/java/**/*.java"]),
visibility = ["//visibility:public"],
)

View File

@ -7,48 +7,47 @@ load(
"da_scala_library",
"da_scala_test",
)
load(
"//rules_daml:daml.bzl",
"daml_compile",
)
load(
":codegen.bzl",
"dar_to_java",
"mangle_for_java"
"mangle_for_java",
)
load(
"@com_github_johnynek_bazel_jar_jar//:jar_jar.bzl",
"jar_jar"
"jar_jar",
)
load("//bazel_tools:pom_file.bzl", "pom_file")
da_scala_binary(
name = "codegen",
data = ["//:COMPONENT-VERSION"],
main_class = "com.digitalasset.daml.lf.codegen.StandaloneMain",
visibility = ["//visibility:public"],
deps = [":lib"],
data = [ "//:COMPONENT-VERSION" ]
)
da_scala_library(
name = "lib",
srcs = glob(["src/main/**/*.scala"]),
resources = ["src/main/resources/logback.xml", "//:COMPONENT-VERSION" ],
resources = [
"src/main/resources/logback.xml",
"//:COMPONENT-VERSION",
],
visibility = ["//visibility:public"],
deps = [
"//3rdparty/jvm/ch/qos/logback:logback_classic",
"//3rdparty/jvm/com/github/scopt",
"//3rdparty/jvm/com/google/protobuf:protobuf_java",
"//3rdparty/jvm/com/squareup:javapoet",
"//3rdparty/jvm/com/typesafe/scala_logging",
"//3rdparty/jvm/org/scalaz:scalaz_core",
"//3rdparty/jvm/com/google/protobuf:protobuf_java",
"//daml-lf/archive:daml_lf_archive_scala",
"//daml-lf/archive:daml_lf_java_proto",
"//daml-lf/data",
"//daml-lf/archive:daml_lf_archive_scala",
"//daml-lf/interface",
"//language-support/java/bindings:bindings-java",
],
@ -67,7 +66,7 @@ test_deps = [
"//daml-lf/archive:daml_lf_java_proto",
"//daml-lf/data",
"//daml-lf/interface",
"//language-support/java/bindings:bindings-java"
"//language-support/java/bindings:bindings-java",
]
########################################################
@ -76,16 +75,16 @@ test_deps = [
da_scala_test(
name = "test",
srcs = glob(["src/test/**/*.scala"]),
data = [":test-daml.dar"],
resource_strip_prefix = "language-support/java/codegen/src/test/resources",
resources = glob(["src/test/resources/**/*"]),
data = [":test-daml.dar"],
deps = test_deps,
)
daml_compile(
name = "test-daml",
main_src = "src/test/daml/test.daml",
target = "1.3"
target = "1.3",
)
jar_jar(
@ -100,7 +99,11 @@ pom_file(
target = ":shaded_binary",
)
daml_lf_target_versions = ["1.0", "1.1", "1.3"]
daml_lf_target_versions = [
"1.0",
"1.1",
"1.3",
]
########################################################
#### Integration Tests
@ -116,8 +119,8 @@ daml_lf_target_versions = ["1.0", "1.1", "1.3"]
[
daml_compile(
name = "integration-tests-model-%s" % target,
main_src = "src/it/daml/Lib.daml",
srcs = glob(["src/it/daml/**/*.daml"]),
main_src = "src/it/daml/Lib.daml",
target = target,
),
dar_to_java(
@ -127,8 +130,8 @@ daml_lf_target_versions = ["1.0", "1.1", "1.3"]
dar_to_java(
name = "integration-tests-model-%s" % target,
src = ":integration-tests-model-%s.dar" % target,
package_prefix = "lf%s" % mangle_for_java(target)
)
package_prefix = "lf%s" % mangle_for_java(target),
),
]
for target in daml_lf_target_versions
]
@ -136,33 +139,36 @@ daml_lf_target_versions = ["1.0", "1.1", "1.3"]
[
java_test(
name = "integration-tests-%s" % target,
srcs = glob(["src/it/java-%s/**/*.java" % target, "src/it/java/**/*.java"]),
srcs = glob([
"src/it/java-%s/**/*.java" % target,
"src/it/java/**/*.java",
]),
test_class = "com.digitalasset.lf%s.AllTests" % mangle_for_java(target),
deps = [
":integration-tests-model-%s.jar" % target,
":integration-tests-model-noprefix-%s.jar" % target,
"//3rdparty/jvm/com/google/protobuf:protobuf_java",
"//3rdparty/jvm/org/junit/jupiter:junit_jupiter_api",
"//3rdparty/jvm/org/junit/jupiter:junit_jupiter_engine",
"//3rdparty/jvm/org/junit/platform:junit_platform_runner",
"//language-support/java/bindings:bindings-java",
"//3rdparty/jvm/com/google/protobuf:protobuf_java",
"//ledger/sandbox:sandbox-scala-tests-lib",
],
)
for target in daml_lf_target_versions
]
########################################################
#### Ledger Tests
########################################################
daml_compile(
name = "ledger-tests-model",
main_src = "src/ledger-tests/daml/Wolpertinger.daml",
srcs = glob(["src/ledger-tests/daml/**/*.daml"]),
main_src = "src/ledger-tests/daml/Wolpertinger.daml",
target = "1.1",
)
dar_to_java(
name = "ledger-tests-model",
src = "ledger-tests-model.dar",
@ -171,6 +177,9 @@ dar_to_java(
da_scala_test(
name = "ledger-tests",
srcs = glob(["src/ledger-tests/scala/**/*.scala"]),
data = [
":ledger-tests-model.dar",
],
resource_strip_prefix = "language-support/java/codegen/src/ledger-tests/resources",
resources = glob(["src/it/resources/**/*"]),
deps = test_deps + [
@ -183,8 +192,4 @@ da_scala_test(
"//3rdparty/jvm/io/grpc:grpc_stub",
"//3rdparty/jvm/io/reactivex/rxjava2:rxjava",
],
data = [
":ledger-tests-model.dar"
]
)

View File

@ -27,11 +27,11 @@ def dar_to_java(**kwargs):
$(execpath @local_jdk//:bin/jar) -cf $@ -C {gen_out} .
""".format(
gen_in = "$(location %s)=%s" % (dar, package_prefix),
gen_out = src_out
gen_out = src_out,
),
tools = [
"//language-support/java/codegen:codegen",
"@local_jdk//:bin/jar"
"@local_jdk//:bin/jar",
],
)

View File

@ -2,22 +2,20 @@
# SPDX-License-Identifier: Apache-2.0
load(
"//bazel_tools:scala.bzl",
"da_scala_library"
"//bazel_tools:scala.bzl",
"da_scala_library",
)
da_scala_library(
name = 'testkit',
srcs = glob(['src/main/scala/**/*.scala']),
deps = [
'//ledger-api/grpc-definitions:ledger-api-scalapb',
'//ledger-api/rs-grpc-bridge:rs-grpc-bridge',
"//3rdparty/jvm/com/google/code/findbugs:jsr305",
"//3rdparty/jvm/io/reactivex/rxjava2:rxjava"
],
visibility = [
'//visibility:public',
]
)
name = "testkit",
srcs = glob(["src/main/scala/**/*.scala"]),
visibility = [
"//visibility:public",
],
deps = [
"//3rdparty/jvm/com/google/code/findbugs:jsr305",
"//3rdparty/jvm/io/reactivex/rxjava2:rxjava",
"//ledger-api/grpc-definitions:ledger-api-scalapb",
"//ledger-api/rs-grpc-bridge",
],
)

View File

@ -7,7 +7,7 @@ nodejs_binary(
"@npm//grpc-tools",
],
entry_point = "grpc-tools/bin/protoc.js",
visibility = ["//language-support/js:__subpackages__"]
visibility = ["//language-support/js:__subpackages__"],
)
nodejs_binary(
@ -16,7 +16,7 @@ nodejs_binary(
"@npm//grpc-tools",
],
entry_point = "grpc-tools/bin/protoc_plugin.js",
visibility = ["//language-support/js:__subpackages__"]
visibility = ["//language-support/js:__subpackages__"],
)
nodejs_binary(
@ -25,7 +25,7 @@ nodejs_binary(
"@npm//grpc_tools_node_protoc_ts",
],
entry_point = "grpc_tools_node_protoc_ts/bin/protoc-gen-ts",
visibility = ["//language-support/js:__subpackages__"]
visibility = ["//language-support/js:__subpackages__"],
)
nodejs_binary(

View File

@ -8,7 +8,7 @@ ts_config(
filegroup(
name = "src",
srcs = glob(["*.ts"])
srcs = glob(["*.ts"]),
)
# ts_library does not accept arbitrary inputs, so we use a genrule
@ -43,4 +43,4 @@ genrule(
tools = [
"//language-support/js:tsc",
],
)
)

View File

@ -5,65 +5,71 @@ load("//bazel_tools:proto.bzl", "proto_gen")
proto_gen(
name = "ledger-api-nodejs",
srcs = ["//ledger-api/grpc-definitions:protos"],
plugin_exec = "//language-support/js:grpc_tools_node_protoc_js",
plugin_name = "js",
plugin_options = [
"import_style=commonjs",
"binary",
],
deps = [
"@com_google_protobuf//:empty_proto",
"@com_google_protobuf//:timestamp_proto",
"@com_google_protobuf//:duration_proto",
"@com_google_protobuf//:wrappers_proto",
"@com_github_googleapis_googleapis//google/rpc:status_proto",
"@com_google_protobuf//:any_proto",
"@com_google_protobuf//:descriptor_proto",
"@com_github_googleapis_googleapis//google/rpc:status_proto",
"@com_google_protobuf//:duration_proto",
"@com_google_protobuf//:empty_proto",
"@com_google_protobuf//:timestamp_proto",
"@com_google_protobuf//:wrappers_proto",
],
plugin_name = "js",
plugin_options = ["import_style=commonjs", "binary"],
plugin_exec = "//language-support/js:grpc_tools_node_protoc_js",
)
proto_gen(
name = "ledger-api-nodejs-grpc",
srcs = ["//ledger-api/grpc-definitions:protos"],
plugin_exec = "//language-support/js:grpc_tools_node_protoc_js",
plugin_name = "grpc",
deps = [
"@com_google_protobuf//:empty_proto",
"@com_google_protobuf//:timestamp_proto",
"@com_google_protobuf//:duration_proto",
"@com_google_protobuf//:wrappers_proto",
"@com_github_googleapis_googleapis//google/rpc:status_proto",
"@com_google_protobuf//:any_proto",
"@com_google_protobuf//:descriptor_proto",
"@com_github_googleapis_googleapis//google/rpc:status_proto",
"@com_google_protobuf//:duration_proto",
"@com_google_protobuf//:empty_proto",
"@com_google_protobuf//:timestamp_proto",
"@com_google_protobuf//:wrappers_proto",
],
plugin_name = "grpc",
plugin_exec = "//language-support/js:grpc_tools_node_protoc_js",
)
proto_gen(
name = "ledger-api-d.ts",
srcs = ["//ledger-api/grpc-definitions:protos"],
plugin_exec = "//language-support/js:grpc_tools_node_protoc_ts",
plugin_name = "ts",
deps = [
"@com_google_protobuf//:empty_proto",
"@com_google_protobuf//:timestamp_proto",
"@com_google_protobuf//:duration_proto",
"@com_google_protobuf//:wrappers_proto",
"@com_github_googleapis_googleapis//google/rpc:status_proto",
"@com_google_protobuf//:any_proto",
"@com_google_protobuf//:descriptor_proto",
"@com_github_googleapis_googleapis//google/rpc:status_proto",
"@com_google_protobuf//:duration_proto",
"@com_google_protobuf//:empty_proto",
"@com_google_protobuf//:timestamp_proto",
"@com_google_protobuf//:wrappers_proto",
],
plugin_name = "ts",
plugin_exec = "//language-support/js:grpc_tools_node_protoc_ts",
)
proto_gen(
name = "daml_lf_proto-nodejs",
srcs = ["//daml-lf/archive:daml_lf_proto"],
plugin_name = "js",
plugin_options = ["import_style=commonjs", "binary"],
plugin_exec = "//language-support/js:grpc_tools_node_protoc_js",
plugin_name = "js",
plugin_options = [
"import_style=commonjs",
"binary",
],
)
proto_gen(
name = "daml_lf_proto-d.ts",
srcs = ["//daml-lf/archive:daml_lf_proto"],
plugin_name = "ts",
plugin_exec = "//language-support/js:grpc_tools_node_protoc_ts",
plugin_name = "ts",
)
proto_gen(
@ -71,17 +77,20 @@ proto_gen(
srcs = [
"@com_github_googleapis_googleapis//google/rpc:status_proto",
],
plugin_exec = "//language-support/js:grpc_tools_node_protoc_js",
plugin_name = "js",
plugin_options = [
"import_style=commonjs",
"binary",
],
deps = [
"@com_google_protobuf//:empty_proto",
"@com_google_protobuf//:timestamp_proto",
"@com_google_protobuf//:duration_proto",
"@com_google_protobuf//:wrappers_proto",
"@com_google_protobuf//:any_proto",
"@com_google_protobuf//:descriptor_proto",
"@com_google_protobuf//:duration_proto",
"@com_google_protobuf//:empty_proto",
"@com_google_protobuf//:timestamp_proto",
"@com_google_protobuf//:wrappers_proto",
],
plugin_name = "js",
plugin_options = ["import_style=commonjs", "binary"],
plugin_exec = "//language-support/js:grpc_tools_node_protoc_js",
)
proto_gen(
@ -89,16 +98,16 @@ proto_gen(
srcs = [
"@com_github_googleapis_googleapis//google/rpc:status_proto",
],
plugin_exec = "//language-support/js:grpc_tools_node_protoc_ts",
plugin_name = "ts",
deps = [
"@com_google_protobuf//:empty_proto",
"@com_google_protobuf//:timestamp_proto",
"@com_google_protobuf//:duration_proto",
"@com_google_protobuf//:wrappers_proto",
"@com_google_protobuf//:any_proto",
"@com_google_protobuf//:descriptor_proto",
"@com_google_protobuf//:duration_proto",
"@com_google_protobuf//:empty_proto",
"@com_google_protobuf//:timestamp_proto",
"@com_google_protobuf//:wrappers_proto",
],
plugin_name = "ts",
plugin_exec = "//language-support/js:grpc_tools_node_protoc_ts",
)
ts_config(
@ -151,7 +160,7 @@ genrule(
tools = [
"//language-support/js:tsc",
],
visibility = ["//:__subpackages__"]
visibility = ["//:__subpackages__"],
)
# nodejs_test does not support mocha, so we use sh_test
@ -159,8 +168,8 @@ sh_test(
name = "test",
srcs = ["test.sh"],
data = [
":daml-grpc",
"test.ts",
":daml-grpc",
"@nodejs//:node",
"@npm//@types/chai",
"@npm//@types/google-protobuf",

View File

@ -9,18 +9,18 @@ ts_config(
filegroup(
name = "README",
srcs = ["README.md"],
visibility = ['//language-support/js:__subpackages__'],
visibility = ["//language-support/js:__subpackages__"],
)
filegroup(
name = "src",
srcs = glob(["src/**/*.ts"]),
visibility = ['//language-support/js:__subpackages__'],
visibility = ["//language-support/js:__subpackages__"],
)
filegroup(
name = "tests",
srcs = glob(["tests/**/*"])
srcs = glob(["tests/**/*"]),
)
# ts_library does not accept arbitrary inputs, so we use a genrule
@ -51,7 +51,7 @@ genrule(
tools = [
"//language-support/js:tsc",
],
visibility = ["//:__subpackages__"]
visibility = ["//:__subpackages__"],
)
# nodejs_test does not support mocha, so we use sh_test
@ -59,9 +59,9 @@ sh_test(
name = "test",
srcs = ["test.sh"],
data = [
"//language-support/js/daml-grpc",
":src",
":tests",
"//language-support/js/daml-grpc",
"@nodejs//:node",
"@npm//@types/chai",
"@npm//@types/google-protobuf",

View File

@ -1,20 +1,20 @@
genrule(
name = "docs",
tools = ['@npm//jsdoc/bin:jsdoc'],
srcs = [
'//language-support/js/daml-ledger:src',
'//language-support/js/daml-ledger:README',
'jsdoc.json',
'@npm//ink-docstrap'
"//language-support/js/daml-ledger:src",
"//language-support/js/daml-ledger:README",
"jsdoc.json",
"@npm//ink-docstrap",
],
outs = ['docs.tar.gz'],
outs = ["docs.tar.gz"],
cmd = """
mv language-support/js/daml-ledger/* .
ln -s external/npm/node_modules .
$(execpath @npm//jsdoc/bin:jsdoc) -c $(location jsdoc.json)
tar czf $@ docs
""",
tools = ["@npm//jsdoc/bin:jsdoc"],
visibility = [
'//:__subpackages__',
]
"//:__subpackages__",
],
)

View File

@ -2,30 +2,30 @@
# SPDX-License-Identifier: Apache-2.0
load(
'//bazel_tools:scala.bzl',
'da_scala_library',
"//bazel_tools:scala.bzl",
"da_scala_library",
)
da_scala_library(
name = 'bindings-akka-testing',
deps = [
'//3rdparty/jvm/com/typesafe/akka:akka_http',
'//3rdparty/jvm/com/typesafe/akka:akka_stream',
'//3rdparty/jvm/org/scalatest:scalatest',
'//3rdparty/jvm/com/typesafe/scala_logging:scala_logging',
'//3rdparty/jvm/ch/qos/logback:logback_classic',
'//3rdparty/jvm/org/slf4j:slf4j_api',
'//3rdparty/jvm/com/typesafe/akka:akka_slf4j',
'//3rdparty/jvm/com/github/pureconfig:pureconfig',
'//3rdparty/jvm/com/github/zafarkhaja:java_semver',
'//ledger/ledger-api-client',
'//ledger-api/rs-grpc-bridge',
],
runtime_deps = [],
exports = [],
visibility = [
'//visibility:public',
],
srcs = glob(['src/main/scala/**/*.scala']),
resources = glob(['src/main/resources/**/*']),
name = "bindings-akka-testing",
srcs = glob(["src/main/scala/**/*.scala"]),
resources = glob(["src/main/resources/**/*"]),
visibility = [
"//visibility:public",
],
exports = [],
runtime_deps = [],
deps = [
"//3rdparty/jvm/ch/qos/logback:logback_classic",
"//3rdparty/jvm/com/github/pureconfig",
"//3rdparty/jvm/com/github/zafarkhaja:java_semver",
"//3rdparty/jvm/com/typesafe/akka:akka_http",
"//3rdparty/jvm/com/typesafe/akka:akka_slf4j",
"//3rdparty/jvm/com/typesafe/akka:akka_stream",
"//3rdparty/jvm/com/typesafe/scala_logging",
"//3rdparty/jvm/org/scalatest",
"//3rdparty/jvm/org/slf4j:slf4j_api",
"//ledger-api/rs-grpc-bridge",
"//ledger/ledger-api-client",
],
)

View File

@ -2,42 +2,46 @@
# SPDX-License-Identifier: Apache-2.0
load(
'//bazel_tools:scala.bzl',
'da_scala_library', 'da_scala_test_suite',
"//bazel_tools:scala.bzl",
"da_scala_library",
"da_scala_test_suite",
)
da_scala_library(
name = 'bindings-akka',
deps = [
'//3rdparty/jvm/ch/qos/logback:logback_classic',
'//language-support/scala/bindings',
'//language-support/java/bindings:bindings-java',
'//ledger-api/rs-grpc-akka',
'//ledger/ledger-api-client',
'//3rdparty/jvm/com/github/pureconfig:pureconfig',
'//3rdparty/jvm/com/typesafe/akka:akka_stream',
'//3rdparty/jvm/com/typesafe/scala_logging:scala_logging',
'//3rdparty/jvm/io/netty:netty_tcnative_boringssl_static',
'//3rdparty/jvm/io/grpc:grpc_netty',
'//3rdparty/jvm/io/netty:netty_handler',
'//3rdparty/jvm/org/scalaz:scalaz_core',
],
plugins = [
'//external:jar/org/spire_math/kind_projector_2_12',
],
# TODO SC DEL-6727 for old Identifier field, to be removed when TemplateId.unapply changes back
# NOTE(JM): commented out deprecation warnings to get this to compile with the
# versions matching sbt. Please reenable when deprecations are fixed.
# scalacopts = ['-deprecation', '-Xfatal-warnings'],
scalacopts = ['-deprecation:false', '-Xfatal-warnings'],
runtime_deps = [],
exports = [],
visibility = [
'//visibility:public',
],
srcs = glob(['src/main/**/*.scala']),
resources = glob(['src/main/resources/**/*']),
tags = ["maven_coordinates=com.daml.scala:bindings-akka:__VERSION__"],
name = "bindings-akka",
srcs = glob(["src/main/**/*.scala"]),
plugins = [
"//external:jar/org/spire_math/kind_projector_2_12",
],
resources = glob(["src/main/resources/**/*"]),
# TODO SC DEL-6727 for old Identifier field, to be removed when TemplateId.unapply changes back
# NOTE(JM): commented out deprecation warnings to get this to compile with the
# versions matching sbt. Please reenable when deprecations are fixed.
# scalacopts = ['-deprecation', '-Xfatal-warnings'],
scalacopts = [
"-deprecation:false",
"-Xfatal-warnings",
],
tags = ["maven_coordinates=com.daml.scala:bindings-akka:__VERSION__"],
visibility = [
"//visibility:public",
],
exports = [],
runtime_deps = [],
deps = [
"//3rdparty/jvm/ch/qos/logback:logback_classic",
"//3rdparty/jvm/com/github/pureconfig",
"//3rdparty/jvm/com/typesafe/akka:akka_stream",
"//3rdparty/jvm/com/typesafe/scala_logging",
"//3rdparty/jvm/io/grpc:grpc_netty",
"//3rdparty/jvm/io/netty:netty_handler",
"//3rdparty/jvm/io/netty:netty_tcnative_boringssl_static",
"//3rdparty/jvm/org/scalaz:scalaz_core",
"//language-support/java/bindings:bindings-java",
"//language-support/scala/bindings",
"//ledger-api/rs-grpc-akka",
"//ledger/ledger-api-client",
],
)
# Sources that do not define test-cases but utilities
@ -46,68 +50,70 @@ da_scala_library(
# Consider moving these files into a separate sub-directory
# to enable source globbing for them.
testing_utils = [
'src/test/scala/com/digitalasset/ledger/client/binding/SandboxBinding.scala',
"src/test/scala/com/digitalasset/ledger/client/binding/SandboxBinding.scala",
]
da_scala_library(
name = 'bindings-akka-testing',
deps = [
'//3rdparty/jvm/ch/qos/logback:logback_classic',
'//language-support/scala/bindings',
'//ledger/ledger-api-client',
'//3rdparty/jvm/com/github/pureconfig:pureconfig',
'//3rdparty/jvm/com/typesafe/akka:akka_stream',
'//3rdparty/jvm/com/typesafe/akka:akka_stream_testkit',
'//3rdparty/jvm/com/typesafe/scala_logging:scala_logging',
'//3rdparty/jvm/org/scalacheck:scalacheck',
'//3rdparty/jvm/org/scalatest:scalatest',
'//language-support/scala/bindings-akka-testing',
'//language-support/scala/sandbox-control',
'//3rdparty/jvm/io/grpc:grpc_netty',
'//3rdparty/jvm/io/netty:netty_handler',
'//ledger-api/rs-grpc-bridge',
':bindings-akka',
],
plugins = [
'//external:jar/org/spire_math/kind_projector_2_12',
],
runtime_deps = [],
exports = [],
visibility = [
'//visibility:public',
],
srcs = testing_utils,
name = "bindings-akka-testing",
srcs = testing_utils,
plugins = [
"//external:jar/org/spire_math/kind_projector_2_12",
],
visibility = [
"//visibility:public",
],
exports = [],
runtime_deps = [],
deps = [
":bindings-akka",
"//3rdparty/jvm/ch/qos/logback:logback_classic",
"//3rdparty/jvm/com/github/pureconfig",
"//3rdparty/jvm/com/typesafe/akka:akka_stream",
"//3rdparty/jvm/com/typesafe/akka:akka_stream_testkit",
"//3rdparty/jvm/com/typesafe/scala_logging",
"//3rdparty/jvm/io/grpc:grpc_netty",
"//3rdparty/jvm/io/netty:netty_handler",
"//3rdparty/jvm/org/scalacheck",
"//3rdparty/jvm/org/scalatest",
"//language-support/scala/bindings",
"//language-support/scala/bindings-akka-testing",
"//language-support/scala/sandbox-control",
"//ledger-api/rs-grpc-bridge",
"//ledger/ledger-api-client",
],
)
da_scala_test_suite(
name = 'tests',
deps = [
'//3rdparty/jvm/ch/qos/logback:logback_classic',
'//language-support/scala/bindings',
'//ledger/ledger-api-client',
'//ledger-api/rs-grpc-bridge',
'//language-support/java/bindings:bindings-java',
'//3rdparty/jvm/com/github/pureconfig:pureconfig',
'//3rdparty/jvm/com/typesafe/akka:akka_stream',
'//3rdparty/jvm/com/typesafe/akka:akka_stream_testkit',
'//3rdparty/jvm/com/typesafe/scala_logging:scala_logging',
'//3rdparty/jvm/org/scalacheck:scalacheck',
'//3rdparty/jvm/org/scalatest:scalatest',
'//3rdparty/jvm/org/scalaz:scalaz_core',
'//language-support/scala/bindings-akka-testing',
'//language-support/scala/sandbox-control',
':bindings-akka',
':bindings-akka-testing',
],
runtime_deps = [],
visibility = [
'//visibility:public',
],
srcs = glob([
'src/test/**/*.scala'
], exclude = testing_utils
),
# NOTE(JM): commented out deprecation warnings to get this to compile with the
# versions matching sbt. Please remove when deprecations are fixed.
scalacopts = ['-deprecation:false'],
name = "tests",
srcs = glob(
[
"src/test/**/*.scala",
],
exclude = testing_utils,
),
# NOTE(JM): commented out deprecation warnings to get this to compile with the
# versions matching sbt. Please remove when deprecations are fixed.
scalacopts = ["-deprecation:false"],
visibility = [
"//visibility:public",
],
runtime_deps = [],
deps = [
":bindings-akka",
":bindings-akka-testing",
"//3rdparty/jvm/ch/qos/logback:logback_classic",
"//3rdparty/jvm/com/github/pureconfig",
"//3rdparty/jvm/com/typesafe/akka:akka_stream",
"//3rdparty/jvm/com/typesafe/akka:akka_stream_testkit",
"//3rdparty/jvm/com/typesafe/scala_logging",
"//3rdparty/jvm/org/scalacheck",
"//3rdparty/jvm/org/scalatest",
"//3rdparty/jvm/org/scalaz:scalaz_core",
"//language-support/java/bindings:bindings-java",
"//language-support/scala/bindings",
"//language-support/scala/bindings-akka-testing",
"//language-support/scala/sandbox-control",
"//ledger-api/rs-grpc-bridge",
"//ledger/ledger-api-client",
],
)

View File

@ -2,51 +2,59 @@
# SPDX-License-Identifier: Apache-2.0
load(
"//bazel_tools:scala.bzl",
"da_scala_test_suite",
"da_scala_library"
"//bazel_tools:scala.bzl",
"da_scala_library",
"da_scala_test_suite",
)
da_scala_library(
name = "bindings",
srcs = glob(["src/main/**/*.scala"]),
deps = [
"//ledger-api/grpc-definitions:ledger-api-scalapb",
"//3rdparty/jvm/io/grpc:grpc_core",
"//3rdparty/jvm/org/scalaz:scalaz_core",
"//3rdparty/jvm/com/github/ghik:silencer_lib",
],
exports = [
"//ledger-api/grpc-definitions:ledger-api-scalapb"
],
plugins = [
"//external:jar/org/spire_math/kind_projector_2_12",
"//external:jar/com/github/ghik/silencer_plugin_2_12",
],
# NOTE(JM): commented out deprecation warnings to get this to compile with the
# versions matching sbt. Please remove when deprecations are fixed.
scalacopts = ["-deprecation", "-Xfatal-warnings:false", "-Xsource:2.13"],
visibility = [
'//visibility:public',
],
tags = ["maven_coordinates=com.daml.scala:bindings:__VERSION__"],
name = "bindings",
srcs = glob(["src/main/**/*.scala"]),
plugins = [
"//external:jar/org/spire_math/kind_projector_2_12",
"//external:jar/com/github/ghik/silencer_plugin_2_12",
],
# NOTE(JM): commented out deprecation warnings to get this to compile with the
# versions matching sbt. Please remove when deprecations are fixed.
scalacopts = [
"-deprecation",
"-Xfatal-warnings:false",
"-Xsource:2.13",
],
tags = ["maven_coordinates=com.daml.scala:bindings:__VERSION__"],
visibility = [
"//visibility:public",
],
exports = [
"//ledger-api/grpc-definitions:ledger-api-scalapb",
],
deps = [
"//3rdparty/jvm/com/github/ghik:silencer_lib",
"//3rdparty/jvm/io/grpc:grpc_core",
"//3rdparty/jvm/org/scalaz:scalaz_core",
"//ledger-api/grpc-definitions:ledger-api-scalapb",
],
)
da_scala_test_suite(
name = "tests",
size = "small",
srcs = glob(['src/test/**/*.scala']),
deps = [
":bindings",
"//3rdparty/jvm/org/scalacheck:scalacheck",
"//3rdparty/jvm/org/scalaz:scalaz_core",
"//3rdparty/jvm/com/chuusai:shapeless",
"//3rdparty/jvm/org/scalatest:scalatest",
],
plugins = [
"//external:jar/org/spire_math/kind_projector_2_12",
],
# NOTE(JM): commented out deprecation warnings to get this to compile with the
# versions matching sbt. Please remove when deprecations are fixed.
scalacopts = ["-deprecation", "-Xfatal-warnings:false", "-Xsource:2.13"],
name = "tests",
size = "small",
srcs = glob(["src/test/**/*.scala"]),
plugins = [
"//external:jar/org/spire_math/kind_projector_2_12",
],
# NOTE(JM): commented out deprecation warnings to get this to compile with the
# versions matching sbt. Please remove when deprecations are fixed.
scalacopts = [
"-deprecation",
"-Xfatal-warnings:false",
"-Xsource:2.13",
],
deps = [
":bindings",
"//3rdparty/jvm/com/chuusai:shapeless",
"//3rdparty/jvm/org/scalacheck",
"//3rdparty/jvm/org/scalatest",
"//3rdparty/jvm/org/scalaz:scalaz_core",
],
)

View File

@ -2,78 +2,74 @@
# SPDX-License-Identifier: Apache-2.0
load(
'//bazel_tools:scala.bzl',
'da_scala_binary',
'da_scala_library',
'da_scala_test',
"//bazel_tools:scala.bzl",
"da_scala_binary",
"da_scala_library",
"da_scala_test",
)
load(
'//rules_daml:daml.bzl',
'daml_compile',
"//rules_daml:daml.bzl",
"daml_compile",
)
load("@os_info//:os_info.bzl", "is_linux")
daml_compile(
name = 'MyMain',
main_src = 'src/main/daml/MyMain.daml',
target = '1.3',
damlc = "//daml-foundations/daml-tools/da-hs-damlc-app:da-hs-damlc-app-deprecated"
name = "MyMain",
damlc = "//daml-foundations/daml-tools/da-hs-damlc-app:da-hs-damlc-app-deprecated",
main_src = "src/main/daml/MyMain.daml",
target = "1.3",
)
genrule(
name = 'MyMain-codegen',
srcs = [':MyMain'],
outs = ['MyMain-codegen-out'],
cmd = '$(execpath //language-support/scala/codegen:codegen-main) \
--input-file $(location :MyMain.dalf) \
--dependencies $(location //daml-foundations/daml-ghc/package-database/deprecated:daml-prim-1.3.dalf) \
--package-name com.digitalasset.sample \
--output-dir $@',
tools = [
'//daml-foundations/daml-ghc/package-database/deprecated:daml-prim-1.3.dalf',
'//language-support/scala/codegen:codegen-main',
':MyMain.dalf',
],
name = "MyMain-codegen",
srcs = [":MyMain"],
outs = ["MyMain-codegen-out"],
cmd = "$(execpath //language-support/scala/codegen:codegen-main) --input-file $(location :MyMain.dalf) --dependencies $(location //daml-foundations/daml-ghc/package-database/deprecated:daml-prim-1.3.dalf) --package-name com.digitalasset.sample --output-dir $@",
tools = [
":MyMain.dalf",
"//daml-foundations/daml-ghc/package-database/deprecated:daml-prim-1.3.dalf",
"//language-support/scala/codegen:codegen-main",
],
)
genrule(
name = 'MyMain-codegen.srcjar',
srcs = [':MyMain-codegen'],
outs = ['MyMain-codegen-out.srcjar'],
cmd = '$(execpath @local_jdk//:bin/jar) -cf $@ -C $(location :MyMain-codegen) .',
tools = [
'@local_jdk//:bin/jar',
],
name = "MyMain-codegen.srcjar",
srcs = [":MyMain-codegen"],
outs = ["MyMain-codegen-out.srcjar"],
cmd = "$(execpath @local_jdk//:bin/jar) -cf $@ -C $(location :MyMain-codegen) .",
tools = [
"@local_jdk//:bin/jar",
],
)
da_scala_library(
name = 'daml-lf-codegen-sample-app',
srcs = ['MyMain-codegen-out.srcjar'] + glob(['src/main/**/*.scala']),
plugins = [
# Plugins have to be specified as JARs.
'//external:jar/org/spire_math/kind_projector_2_12',
],
# Bump stack size to avoid stack overflow in reflection.
scalac_jvm_flags = [
'-Xmx2G',
'-Xss2M',
],
visibility = [
'//visibility:public',
],
exports = [],
runtime_deps = [],
deps = [
'//3rdparty/jvm/ch/qos/logback:logback_classic',
'//3rdparty/jvm/com/typesafe/scala_logging:scala_logging',
'//3rdparty/jvm/org/scalaz:scalaz_core',
'//3rdparty/jvm/org/slf4j:slf4j_api',
'//daml-foundations/daml-tools/da-hs-damlc-app',
'//language-support/scala/codegen-testing',
'//language-support/scala/bindings-akka',
'//language-support/scala/bindings',
'//ledger/ledger-api-client',
],
name = "daml-lf-codegen-sample-app",
srcs = ["MyMain-codegen-out.srcjar"] + glob(["src/main/**/*.scala"]),
plugins = [
# Plugins have to be specified as JARs.
"//external:jar/org/spire_math/kind_projector_2_12",
],
# Bump stack size to avoid stack overflow in reflection.
scalac_jvm_flags = [
"-Xmx2G",
"-Xss2M",
],
visibility = [
"//visibility:public",
],
exports = [],
runtime_deps = [],
deps = [
"//3rdparty/jvm/ch/qos/logback:logback_classic",
"//3rdparty/jvm/com/typesafe/scala_logging",
"//3rdparty/jvm/org/scalaz:scalaz_core",
"//3rdparty/jvm/org/slf4j:slf4j_api",
"//daml-foundations/daml-tools/da-hs-damlc-app",
"//language-support/scala/bindings",
"//language-support/scala/bindings-akka",
"//language-support/scala/codegen-testing",
"//ledger/ledger-api-client",
],
)
# Sources that do not define test-cases but utilities
@ -82,74 +78,73 @@ da_scala_library(
# Consider moving these files into a separate sub-directory
# to enable source globbing for them.
testing_utils = [
'src/test/scala/com/digitalasset/codegen/util/TestUtil.scala',
"src/test/scala/com/digitalasset/codegen/util/TestUtil.scala",
]
da_scala_library(
name = 'daml-lf-codegen-sample-app-testing',
srcs = testing_utils,
resources = glob(['src/test/resources/**/*']),
scalacopts = ['-Xsource:2.13'],
deps = [
'//3rdparty/jvm/org/scalacheck:scalacheck',
'//3rdparty/jvm/org/scalatest:scalatest',
'//3rdparty/jvm/org/scalaz:scalaz_core',
'//language-support/scala/bindings-akka',
'//language-support/scala/bindings',
':daml-lf-codegen-sample-app',
],
name = "daml-lf-codegen-sample-app-testing",
srcs = testing_utils,
resources = glob(["src/test/resources/**/*"]),
scalacopts = ["-Xsource:2.13"],
deps = [
":daml-lf-codegen-sample-app",
"//3rdparty/jvm/org/scalacheck",
"//3rdparty/jvm/org/scalatest",
"//3rdparty/jvm/org/scalaz:scalaz_core",
"//language-support/scala/bindings",
"//language-support/scala/bindings-akka",
],
)
test_dependencies = [
'//3rdparty/jvm/io/spray:spray_json',
'//3rdparty/jvm/org/scalacheck:scalacheck',
'//3rdparty/jvm/org/scalaz:scalaz_core',
'//language-support/scala/codegen-testing',
'//language-support/scala/bindings',
':daml-lf-codegen-sample-app',
':daml-lf-codegen-sample-app-testing',
"//3rdparty/jvm/io/spray:spray_json",
"//3rdparty/jvm/org/scalacheck:scalacheck",
"//3rdparty/jvm/org/scalaz:scalaz_core",
"//language-support/scala/codegen-testing",
"//language-support/scala/bindings",
":daml-lf-codegen-sample-app",
":daml-lf-codegen-sample-app-testing",
]
da_scala_test(
name = 'tests',
size = 'small',
srcs = glob(
[
'src/test/**/*.scala',
],
exclude = testing_utils + [
'src/test/scala/com/digitalasset/codegen/ScalaCodeGenIT.scala',
],
),
scalacopts = ['-Xsource:2.13'],
deps = test_dependencies,
name = "tests",
size = "small",
srcs = glob(
[
"src/test/**/*.scala",
],
exclude = testing_utils + [
"src/test/scala/com/digitalasset/codegen/ScalaCodeGenIT.scala",
],
),
scalacopts = ["-Xsource:2.13"],
deps = test_dependencies,
)
da_scala_test(
name = 'ScalaCodeGenIT',
size = 'large',
timeout = 'moderate',
srcs = [
'src/test/scala/com/digitalasset/codegen/ScalaCodeGenIT.scala',
],
data = [
'src/test/resources/logback-sandbox.xml',
':MyMain.dalf',
'//daml-foundations/daml-ghc/package-database/deprecated:daml-prim-1.3.dalf',
'//ledger/sandbox:sandbox-binary_deploy.jar',
],
jvm_flags = [
'-Dcom.digitalasset.sandbox.jar=ledger/sandbox/sandbox-binary_deploy.jar',
],
scalacopts = ['-Xsource:2.13'],
deps = test_dependencies + [
'//3rdparty/jvm/com/typesafe/akka:akka_stream_testkit',
'//language-support/scala/bindings-akka',
'//ledger-api/rs-grpc-bridge:rs-grpc-bridge',
'//ledger-api/rs-grpc-akka',
'//ledger/ledger-api-client',
'//ledger/ledger-api-common',
'//ledger/sandbox',
],
name = "ScalaCodeGenIT",
size = "large",
timeout = "moderate",
srcs = [
"src/test/scala/com/digitalasset/codegen/ScalaCodeGenIT.scala",
],
data = [
"src/test/resources/logback-sandbox.xml",
":MyMain.dalf",
"//daml-foundations/daml-ghc/package-database/deprecated:daml-prim-1.3.dalf",
"//ledger/sandbox:sandbox-binary_deploy.jar",
],
jvm_flags = [
"-Dcom.digitalasset.sandbox.jar=ledger/sandbox/sandbox-binary_deploy.jar",
],
scalacopts = ["-Xsource:2.13"],
deps = test_dependencies + [
"//3rdparty/jvm/com/typesafe/akka:akka_stream_testkit",
"//language-support/scala/bindings-akka",
"//ledger-api/rs-grpc-bridge:rs-grpc-bridge",
"//ledger-api/rs-grpc-akka",
"//ledger/ledger-api-client",
"//ledger/ledger-api-common",
"//ledger/sandbox",
],
)

View File

@ -2,31 +2,30 @@
# SPDX-License-Identifier: Apache-2.0
load(
'//bazel_tools:scala.bzl',
'da_scala_library',
'da_scala_test_suite',
"//bazel_tools:scala.bzl",
"da_scala_library",
"da_scala_test_suite",
)
da_scala_library(
name = 'codegen-testing',
deps = [
'//language-support/scala/bindings',
'//ledger/ledger-api-client',
'//3rdparty/jvm/org/scalacheck:scalacheck',
'//3rdparty/jvm/org/scalaz:scalaz_core',
'//3rdparty/jvm/org/scalaz:scalaz_scalacheck_binding',
],
plugins = [
# Plugins have to be specified as JARs.
'//external:jar/org/spire_math/kind_projector_2_12',
],
runtime_deps = [],
exports = [],
visibility = [
'//visibility:public',
],
srcs = glob(['src/main/**/*.scala']),
name = "codegen-testing",
srcs = glob(["src/main/**/*.scala"]),
plugins = [
# Plugins have to be specified as JARs.
"//external:jar/org/spire_math/kind_projector_2_12",
],
visibility = [
"//visibility:public",
],
exports = [],
runtime_deps = [],
deps = [
"//3rdparty/jvm/org/scalacheck",
"//3rdparty/jvm/org/scalaz:scalaz_core",
"//3rdparty/jvm/org/scalaz:scalaz_scalacheck_binding",
"//language-support/scala/bindings",
"//ledger/ledger-api-client",
],
)
# Sources that do not define test-cases but utilities
@ -35,50 +34,51 @@ da_scala_library(
# Consider moving these files into a separate sub-directory
# to enable source globbing for them.
testing_utils = [
'src/test/scala/com/digitalasset/scalatest/CustomMatcher.scala',
'src/test/scala/com/digitalasset/ledger/client/binding/encoding/LfTypeEncodingSpec.scala',
'src/test/scala/com/digitalasset/ledger/client/binding/EncodingTestUtil.scala',
'src/test/scala/com/digitalasset/ledger/client/binding/ValueSpec.scala',
"src/test/scala/com/digitalasset/scalatest/CustomMatcher.scala",
"src/test/scala/com/digitalasset/ledger/client/binding/encoding/LfTypeEncodingSpec.scala",
"src/test/scala/com/digitalasset/ledger/client/binding/EncodingTestUtil.scala",
"src/test/scala/com/digitalasset/ledger/client/binding/ValueSpec.scala",
]
da_scala_library(
name = 'codegen-testing-testing',
deps = [
'//language-support/scala/bindings',
'//ledger/ledger-api-client',
'//3rdparty/jvm/org/scalacheck:scalacheck',
'//3rdparty/jvm/org/scalatest:scalatest',
'//3rdparty/jvm/org/scalaz:scalaz_core',
':codegen-testing',
],
plugins = [
# Plugins have to be specified as JARs.
'//external:jar/org/spire_math/kind_projector_2_12',
],
runtime_deps = [],
exports = [],
visibility = [
'//visibility:public',
],
srcs = testing_utils,
name = "codegen-testing-testing",
srcs = testing_utils,
plugins = [
# Plugins have to be specified as JARs.
"//external:jar/org/spire_math/kind_projector_2_12",
],
visibility = [
"//visibility:public",
],
exports = [],
runtime_deps = [],
deps = [
":codegen-testing",
"//3rdparty/jvm/org/scalacheck",
"//3rdparty/jvm/org/scalatest",
"//3rdparty/jvm/org/scalaz:scalaz_core",
"//language-support/scala/bindings",
"//ledger/ledger-api-client",
],
)
da_scala_test_suite(
name = 'tests',
size = 'small',
deps = [
'//3rdparty/jvm/com/chuusai:shapeless',
'//language-support/scala/bindings',
'//3rdparty/jvm/org/apache/commons:commons_text',
'//3rdparty/jvm/org/scalacheck:scalacheck',
'//3rdparty/jvm/org/scalatest:scalatest',
'//3rdparty/jvm/org/scalaz:scalaz_core',
':codegen-testing',
':codegen-testing-testing',
],
srcs = glob([
'src/test/**/*.scala'
], exclude = testing_utils
),
name = "tests",
size = "small",
srcs = glob(
[
"src/test/**/*.scala",
],
exclude = testing_utils,
),
deps = [
":codegen-testing",
":codegen-testing-testing",
"//3rdparty/jvm/com/chuusai:shapeless",
"//3rdparty/jvm/org/apache/commons:commons_text",
"//3rdparty/jvm/org/scalacheck",
"//3rdparty/jvm/org/scalatest",
"//3rdparty/jvm/org/scalaz:scalaz_core",
"//language-support/scala/bindings",
],
)

View File

@ -2,87 +2,88 @@
# SPDX-License-Identifier: Apache-2.0
load(
'//bazel_tools:scala.bzl',
'da_scala_library',
'da_scala_binary',
'da_scala_test_suite',
"//bazel_tools:scala.bzl",
"da_scala_binary",
"da_scala_library",
"da_scala_test_suite",
)
common_scalacopts = [
'-Xelide-below', 'CONFIG',
"-Xelide-below",
"CONFIG",
]
common_jvm_flags = [
'-Xmx2G',
"-Xmx2G",
]
da_scala_library(
name = 'codegen',
deps = [
'//3rdparty/jvm/com/typesafe/scala_logging:scala_logging',
'//3rdparty/jvm/ch/qos/logback:logback_classic',
'//3rdparty/jvm/org/slf4j:slf4j_api',
'//daml-lf/archive:daml_lf_archive_scala',
'//daml-lf/archive:daml_lf_java_proto',
'//daml-lf/interface',
'//daml-lf/data',
'//3rdparty/jvm/org/scalaz:scalaz_core',
'//3rdparty/jvm/io/spray:spray_json',
'//3rdparty/jvm/com/google/protobuf:protobuf_java'
],
scalacopts = common_scalacopts,
scalac_jvm_flags = common_jvm_flags,
plugins = [
# Plugins have to be specified as JARs.
'//external:jar/org/spire_math/kind_projector_2_12',
],
runtime_deps = [],
exports = [],
visibility = [
'//visibility:public',
],
srcs =
glob([
'src/main/scala/com/digitalasset/codegen/**/*.scala'
name = "codegen",
srcs =
glob(
[
"src/main/scala/com/digitalasset/codegen/**/*.scala",
],
exclude = [
"src/main/scala/com/digitalasset/codegen/Main.scala",
],
),
plugins = [
# Plugins have to be specified as JARs.
"//external:jar/org/spire_math/kind_projector_2_12",
],
scalac_jvm_flags = common_jvm_flags,
scalacopts = common_scalacopts,
tags = ["maven_coordinates=com.daml.scala:codegen:__VERSION__"],
visibility = [
"//visibility:public",
],
exports = [],
runtime_deps = [],
deps = [
"//3rdparty/jvm/ch/qos/logback:logback_classic",
"//3rdparty/jvm/com/google/protobuf:protobuf_java",
"//3rdparty/jvm/com/typesafe/scala_logging",
"//3rdparty/jvm/io/spray:spray_json",
"//3rdparty/jvm/org/scalaz:scalaz_core",
"//3rdparty/jvm/org/slf4j:slf4j_api",
"//daml-lf/archive:daml_lf_archive_scala",
"//daml-lf/archive:daml_lf_java_proto",
"//daml-lf/data",
"//daml-lf/interface",
],
exclude = [
'src/main/scala/com/digitalasset/codegen/Main.scala',
]),
tags = ["maven_coordinates=com.daml.scala:codegen:__VERSION__"],
)
da_scala_binary(
name = 'codegen-main',
deps = [
':codegen',
'//3rdparty/jvm/com/github/scopt:scopt',
],
main_class = 'com.digitalasset.codegen.Main',
srcs = [
'src/main/scala/com/digitalasset/codegen/Main.scala'
],
visibility = [
'//visibility:public',
],
tags = ["maven_coordinates=com.daml.scala:codegen-main:__VERSION__"],
name = "codegen-main",
srcs = [
"src/main/scala/com/digitalasset/codegen/Main.scala",
],
main_class = "com.digitalasset.codegen.Main",
tags = ["maven_coordinates=com.daml.scala:codegen-main:__VERSION__"],
visibility = [
"//visibility:public",
],
deps = [
":codegen",
"//3rdparty/jvm/com/github/scopt",
],
)
da_scala_test_suite(
name = "tests",
size = "small",
srcs = glob(['src/test/scala/**/*.scala']),
deps = [
':codegen',
'//daml-lf/archive:daml_lf_archive_scala',
'//daml-lf/interface',
'//daml-lf/data',
'//3rdparty/jvm/org/scalacheck:scalacheck',
'//3rdparty/jvm/org/scalatest:scalatest',
'//3rdparty/jvm/org/mockito:mockito_core',
'//3rdparty/jvm/org/scalaz:scalaz_core'
],
scalacopts = common_scalacopts,
jvm_flags = common_jvm_flags,
name = "tests",
size = "small",
srcs = glob(["src/test/scala/**/*.scala"]),
jvm_flags = common_jvm_flags,
scalacopts = common_scalacopts,
deps = [
":codegen",
"//3rdparty/jvm/org/mockito:mockito_core",
"//3rdparty/jvm/org/scalacheck",
"//3rdparty/jvm/org/scalatest",
"//3rdparty/jvm/org/scalaz:scalaz_core",
"//daml-lf/archive:daml_lf_archive_scala",
"//daml-lf/data",
"//daml-lf/interface",
],
)

View File

@ -1,39 +1,42 @@
# Copyright (c) 2019 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
load('//bazel_tools:scala.bzl', 'da_scala_library')
load('//bazel_tools/java_testing:java_test_suite.bzl', 'java_test_suite')
load("//bazel_tools:scala.bzl", "da_scala_library")
load("//bazel_tools/java_testing:java_test_suite.bzl", "java_test_suite")
da_scala_library(
name = 'sandbox-control',
deps = [
'//3rdparty/jvm/commons_io:commons_io',
'//3rdparty/jvm/com/typesafe/scala_logging:scala_logging',
],
runtime_deps = [],
exports = [],
visibility = [
'//visibility:public',
],
data = [
'//daml-foundations/daml-ghc/package-database:gen-daml-prim.dar',
],
srcs = glob(['src/main/scala/**/*.scala', 'src/main/java/**/*.java']),
name = "sandbox-control",
srcs = glob([
"src/main/scala/**/*.scala",
"src/main/java/**/*.java",
]),
data = [
"//daml-foundations/daml-ghc/package-database:gen-daml-prim.dar",
],
visibility = [
"//visibility:public",
],
exports = [],
runtime_deps = [],
deps = [
"//3rdparty/jvm/com/typesafe/scala_logging",
"//3rdparty/jvm/commons_io",
],
)
java_test_suite(
name = 'tests',
deps = [
':sandbox-control',
'//3rdparty/jvm/com/github/stefanbirkner:system_rules',
'//3rdparty/jvm/junit:junit',
'//3rdparty/jvm/org/hamcrest:hamcrest_all',
'//3rdparty/jvm/org/junit/jupiter:junit_jupiter_api',
'//3rdparty/jvm/org/junit/jupiter:junit_jupiter_engine',
'//3rdparty/jvm/org/junit/platform:junit_platform_runner',
],
strip = 'src/test/java/',
srcs = glob([
'src/test/java/**/*.java',
]),
name = "tests",
srcs = glob([
"src/test/java/**/*.java",
]),
strip = "src/test/java/",
deps = [
":sandbox-control",
"//3rdparty/jvm/com/github/stefanbirkner:system_rules",
"//3rdparty/jvm/junit",
"//3rdparty/jvm/org/hamcrest:hamcrest_all",
"//3rdparty/jvm/org/junit/jupiter:junit_jupiter_api",
"//3rdparty/jvm/org/junit/jupiter:junit_jupiter_engine",
"//3rdparty/jvm/org/junit/platform:junit_platform_runner",
],
)

View File

@ -1,3 +1,2 @@
# Copyright (c) 2019 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

View File

@ -7,81 +7,79 @@ load("//bazel_tools:pom_file.bzl", "pom_file")
load("@io_bazel_rules_scala//scala:scala.bzl", "scala_library")
proto_library(
name = 'protos',
proto_source_root = 'ledger-api/grpc-definitions',
srcs = glob(["**/*.proto"]),
deps = ['@com_google_protobuf//:empty_proto',
'@com_google_protobuf//:timestamp_proto',
'@com_google_protobuf//:duration_proto',
'@com_google_protobuf//:wrappers_proto',
'@com_google_protobuf//:any_proto',
'@com_google_protobuf//:descriptor_proto',
'@com_github_googleapis_googleapis//google/rpc:status_proto'
],
name = "protos",
srcs = glob(["**/*.proto"]),
proto_source_root = "ledger-api/grpc-definitions",
visibility = [
'//visibility:public',
]
"//visibility:public",
],
deps = [
"@com_github_googleapis_googleapis//google/rpc:status_proto",
"@com_google_protobuf//:any_proto",
"@com_google_protobuf//:descriptor_proto",
"@com_google_protobuf//:duration_proto",
"@com_google_protobuf//:empty_proto",
"@com_google_protobuf//:timestamp_proto",
"@com_google_protobuf//:wrappers_proto",
],
)
pkg_tar(
name = 'ledger-api-protos',
strip_prefix = './',
srcs = glob(['**/*.proto']),
extension = 'tar.gz',
name = "ledger-api-protos",
srcs = glob(["**/*.proto"]),
extension = "tar.gz",
strip_prefix = "./",
visibility = [
'//visibility:public',
]
"//visibility:public",
],
)
# FIXME(#448): This has the same contents as `:ledger-api-protos` but a
# directory structure which is suitable for the SDK.
pkg_tar(
name = 'ledger-api-protos-tarball',
strip_prefix = './',
package_dir = 'grpc-definitions',
srcs = glob(['**/*.proto']),
extension = 'tar.gz',
name = "ledger-api-protos-tarball",
srcs = glob(["**/*.proto"]),
extension = "tar.gz",
package_dir = "grpc-definitions",
strip_prefix = "./",
visibility = [
'//visibility:public',
]
"//visibility:public",
],
)
proto_gen(
name = "ledger-api-scalapb-sources",
srcs = [":protos"],
deps = [
'@com_google_protobuf//:empty_proto',
'@com_google_protobuf//:timestamp_proto',
'@com_google_protobuf//:duration_proto',
'@com_google_protobuf//:wrappers_proto',
'@com_google_protobuf//:any_proto',
'@com_google_protobuf//:descriptor_proto',
'@com_github_googleapis_googleapis//google/rpc:status_proto',
'@com_github_googleapis_googleapis//google/rpc:code_proto',
],
plugin_name = "scalapb",
plugin_exec = "//scala-protoc-plugins/scalapb:protoc-gen-scalapb",
plugin_name = "scalapb",
plugin_options = ["grpc"],
visibility = [
'//visibility:public',
"//visibility:public",
],
deps = [
"@com_github_googleapis_googleapis//google/rpc:code_proto",
"@com_github_googleapis_googleapis//google/rpc:status_proto",
"@com_google_protobuf//:any_proto",
"@com_google_protobuf//:descriptor_proto",
"@com_google_protobuf//:duration_proto",
"@com_google_protobuf//:empty_proto",
"@com_google_protobuf//:timestamp_proto",
"@com_google_protobuf//:wrappers_proto",
],
)
scalapb_deps = [
'//3rdparty/jvm/com/thesamet/scalapb:scalapb_runtime',
'//3rdparty/jvm/com/thesamet/scalapb:scalapb_runtime_grpc',
'//3rdparty/jvm/com/thesamet/scalapb:lenses',
'//3rdparty/jvm/com/google/protobuf:protobuf_java',
'//3rdparty/jvm/io/grpc:grpc_stub',
'//3rdparty/jvm/io/grpc:grpc_protobuf',
"//3rdparty/jvm/com/thesamet/scalapb:scalapb_runtime",
"//3rdparty/jvm/com/thesamet/scalapb:scalapb_runtime_grpc",
"//3rdparty/jvm/com/thesamet/scalapb:lenses",
"//3rdparty/jvm/com/google/protobuf:protobuf_java",
"//3rdparty/jvm/io/grpc:grpc_stub",
"//3rdparty/jvm/io/grpc:grpc_protobuf",
]
scala_library(
name = "ledger-api-scalapb",
srcs = [':ledger-api-scalapb-sources'],
deps = scalapb_deps + [':google-rpc-scalapb'],
exports = scalapb_deps + [':google-rpc-scalapb'],
visibility = ['//visibility:public', ],
srcs = [":ledger-api-scalapb-sources"],
tags = [
"maven_coordinates=com.digitalasset.ledger-api.grpc-definitions:ledger-api-scalapb:__VERSION__",
# the bazel rules depend on the source .proto files, which we do not release.
@ -89,6 +87,9 @@ scala_library(
# deps.
"only_external_deps",
],
visibility = ["//visibility:public"],
exports = scalapb_deps + [":google-rpc-scalapb"],
deps = scalapb_deps + [":google-rpc-scalapb"],
)
pom_file(
@ -99,62 +100,65 @@ pom_file(
proto_gen(
name = "google-rpc-sources",
srcs = [
'@com_github_googleapis_googleapis//google/rpc:status_proto',
'@com_github_googleapis_googleapis//google/rpc:code_proto',
"@com_github_googleapis_googleapis//google/rpc:code_proto",
"@com_github_googleapis_googleapis//google/rpc:status_proto",
],
deps = [
'@com_google_protobuf//:any_proto',
],
plugin_name = "scalapb",
plugin_exec = "//scala-protoc-plugins/scalapb:protoc-gen-scalapb",
plugin_name = "scalapb",
plugin_options = ["grpc"],
visibility = [
'//visibility:public',
"//visibility:public",
],
deps = [
"@com_google_protobuf//:any_proto",
],
)
scala_library(
name = "google-rpc-scalapb",
srcs = [':google-rpc-sources'],
deps = scalapb_deps,
exports = scalapb_deps,
visibility = ['//visibility:public', ],
srcs = [":google-rpc-sources"],
tags = ["maven_coordinates=com.digitalasset.ledger-api.grpc-definitions:ledger-api-scalapb:__VERSION__"],
visibility = ["//visibility:public"],
exports = scalapb_deps,
deps = scalapb_deps,
)
proto_gen(
name = "ledger-api-docs",
srcs = [':protos'],
deps = [
'@com_google_protobuf//:empty_proto',
'@com_google_protobuf//:timestamp_proto',
'@com_google_protobuf//:duration_proto',
'@com_google_protobuf//:wrappers_proto',
'@com_google_protobuf//:any_proto',
'@com_google_protobuf//:descriptor_proto',
'@com_github_googleapis_googleapis//google/rpc:status_proto',
'@com_github_googleapis_googleapis//google/rpc:code_proto',
],
plugin_name = "doc",
srcs = [":protos"],
plugin_exec = "@com_github_pseudomuto_protoc_gen_doc//cmd/protoc-gen-doc:protoc-gen-doc",
plugin_name = "doc",
plugin_options = [
"ledger-api/grpc-definitions/rst_mmd.tmpl",
"docs.rst",
],
# this is _slightly_ hacky. we need to include the markdown template in the plugin_runfiles
# and refer to the file with a workspace relative path in plugin_options
plugin_runfiles = ["rst_mmd.tmpl"],
plugin_options = ["ledger-api/grpc-definitions/rst_mmd.tmpl", "docs.rst"],
visibility = [
'//visibility:public',
"//visibility:public",
],
deps = [
"@com_github_googleapis_googleapis//google/rpc:code_proto",
"@com_github_googleapis_googleapis//google/rpc:status_proto",
"@com_google_protobuf//:any_proto",
"@com_google_protobuf//:descriptor_proto",
"@com_google_protobuf//:duration_proto",
"@com_google_protobuf//:empty_proto",
"@com_google_protobuf//:timestamp_proto",
"@com_google_protobuf//:wrappers_proto",
],
)
genrule(
name = 'docs',
srcs = [':ledger-api-docs'],
tools = ["post-process.sh"],
outs = ['proto-docs.rst'],
name = "docs",
srcs = [":ledger-api-docs"],
outs = ["proto-docs.rst"],
cmd = """
unzip -q $(location :ledger-api-docs)
$(location post-process.sh)
mv docs.rst '$@'
""",
visibility = ['//visibility:public', ],
tools = ["post-process.sh"],
visibility = ["//visibility:public"],
)

View File

@ -2,20 +2,20 @@
# SPDX-License-Identifier: Apache-2.0
load(
"//bazel_tools:scala.bzl",
"da_scala_library"
"//bazel_tools:scala.bzl",
"da_scala_library",
)
da_scala_library(
name = "perf-testing",
srcs = glob(['src/**/*.scala']),
deps = [
'//ledger-api/testing-utils:testing-utils',
"//3rdparty/jvm/com/storm_enroute:scalameter",
'//3rdparty/jvm/com/typesafe/akka:akka_stream',
'//3rdparty/jvm/org/slf4j:slf4j_api',
],
srcs = glob(["src/**/*.scala"]),
visibility = [
'//visibility:public',
]
)
"//visibility:public",
],
deps = [
"//3rdparty/jvm/com/storm_enroute:scalameter",
"//3rdparty/jvm/com/typesafe/akka:akka_stream",
"//3rdparty/jvm/org/slf4j:slf4j_api",
"//ledger-api/testing-utils",
],
)

View File

@ -1,71 +1,77 @@
# Copyright (c) 2019 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
load("//bazel_tools:scala.bzl", "da_scala_library", "da_scala_test_suite", "da_scala_binary")
load("//bazel_tools:scala.bzl", "da_scala_binary", "da_scala_library", "da_scala_test_suite")
da_scala_library(
name = 'rs-grpc-akka',
srcs = glob(['src/main/scala/**/*.scala']),
deps = [
'//ledger-api/rs-grpc-bridge:rs-grpc-bridge',
'//3rdparty/jvm/io/grpc:grpc_stub',
'//3rdparty/jvm/org/slf4j:slf4j_api',
'//3rdparty/jvm/com/typesafe/akka:akka_stream',
'//3rdparty/jvm/com/typesafe/akka:akka_slf4j',
],
visibility = [
'//visibility:public',
],
name = "rs-grpc-akka",
srcs = glob(["src/main/scala/**/*.scala"]),
tags = ["maven_coordinates=com.digitalasset.ledger-api:rs-grpc-akka:__VERSION__"],
visibility = [
"//visibility:public",
],
deps = [
"//3rdparty/jvm/com/typesafe/akka:akka_slf4j",
"//3rdparty/jvm/com/typesafe/akka:akka_stream",
"//3rdparty/jvm/io/grpc:grpc_stub",
"//3rdparty/jvm/org/slf4j:slf4j_api",
"//ledger-api/rs-grpc-bridge",
],
)
testDependencies = [
'//3rdparty/jvm/io/grpc:grpc_netty',
'//3rdparty/jvm/io/grpc:grpc_stub',
':rs-grpc-akka',
'//ledger-api/testing-utils:testing-utils',
'//ledger-api/sample-service:sample-service',
'//ledger-api/rs-grpc-bridge:rs-grpc-bridge',
'//ledger-api/rs-grpc-bridge:rs-grpc-bridge-test',
'//3rdparty/jvm/org/scalatest:scalatest',
'//3rdparty/jvm/ch/qos/logback:logback_classic',
'//3rdparty/jvm/com/typesafe/akka:akka_stream_testkit',
"//3rdparty/jvm/io/grpc:grpc_netty",
"//3rdparty/jvm/io/grpc:grpc_stub",
":rs-grpc-akka",
"//ledger-api/testing-utils:testing-utils",
"//ledger-api/sample-service:sample-service",
"//ledger-api/rs-grpc-bridge:rs-grpc-bridge",
"//ledger-api/rs-grpc-bridge:rs-grpc-bridge-test",
"//3rdparty/jvm/org/scalatest:scalatest",
"//3rdparty/jvm/ch/qos/logback:logback_classic",
"//3rdparty/jvm/com/typesafe/akka:akka_stream_testkit",
"//3rdparty/jvm/com/google/protobuf:protobuf_java",
"//3rdparty/jvm/org/awaitility:awaitility",
'//3rdparty/jvm/com/thesamet/scalapb:scalapb_runtime_grpc',
"//3rdparty/jvm/com/thesamet/scalapb:scalapb_runtime_grpc",
]
da_scala_library(
name = "rs-grpc-akka-tests-lib",
srcs = glob(['src/test/**/*.scala'], exclude = ['src/test/**/*Spec.scala', 'src/test/**/*Test.scala']),
deps = testDependencies,
name = "rs-grpc-akka-tests-lib",
srcs = glob(
["src/test/**/*.scala"],
exclude = [
"src/test/**/*Spec.scala",
"src/test/**/*Test.scala",
],
),
deps = testDependencies,
)
da_scala_test_suite(
name = "rs-grpc-akka-tests",
srcs = glob(['src/test/**/*Spec.scala', 'src/test/**/*Test.scala']),
srcs = glob([
"src/test/**/*Spec.scala",
"src/test/**/*Test.scala",
]),
deps = [
":rs-grpc-akka-tests-lib",
] + testDependencies
] + testDependencies,
)
da_scala_binary(
name = "rs-grpc-akka-perf",
srcs = glob(['src/perf/**/*.scala']),
srcs = glob(["src/perf/**/*.scala"]),
main_class = "com.digitalasset.grpc.adapter.ServerStreamingBenchmark",
deps = [
'//3rdparty/jvm/io/grpc:grpc_core',
':rs-grpc-akka',
':rs-grpc-akka-tests-lib',
'//ledger-api/perf-testing:perf-testing',
'//ledger-api/testing-utils:testing-utils',
'//ledger-api/sample-service:sample-service',
'//ledger-api/rs-grpc-bridge:rs-grpc-bridge',
":rs-grpc-akka",
":rs-grpc-akka-tests-lib",
"//3rdparty/jvm/com/storm_enroute:scalameter",
'//3rdparty/jvm/com/typesafe/akka:akka_stream',
'//3rdparty/jvm/com/thesamet/scalapb:scalapb_runtime_grpc',
]
"//3rdparty/jvm/com/thesamet/scalapb:scalapb_runtime_grpc",
"//3rdparty/jvm/com/typesafe/akka:akka_stream",
"//3rdparty/jvm/io/grpc:grpc_core",
"//ledger-api/perf-testing",
"//ledger-api/rs-grpc-bridge",
"//ledger-api/sample-service",
"//ledger-api/testing-utils",
],
)

Some files were not shown because too many files have changed in this diff Show More