2019-04-04 11:33:38 +03:00
|
|
|
package(default_visibility = ["//:__subpackages__"])
|
|
|
|
|
2019-07-05 17:04:47 +03:00
|
|
|
load("@bazel_tools//tools/python:toolchain.bzl", "py_runtime_pair")
|
2019-04-12 14:10:16 +03:00
|
|
|
load(
|
2019-08-13 17:46:31 +03:00
|
|
|
"@rules_haskell//haskell:defs.bzl",
|
2019-04-12 14:10:16 +03:00
|
|
|
"haskell_toolchain",
|
2019-04-04 11:33:38 +03:00
|
|
|
)
|
2019-04-12 14:10:16 +03:00
|
|
|
load(
|
2019-08-13 17:46:31 +03:00
|
|
|
"@rules_haskell//haskell:c2hs.bzl",
|
2019-04-12 14:10:16 +03:00
|
|
|
"c2hs_toolchain",
|
2019-04-04 11:33:38 +03:00
|
|
|
)
|
2019-06-24 18:39:41 +03:00
|
|
|
load("//bazel_tools:haskell.bzl", "da_haskell_library", "da_haskell_repl")
|
2019-06-28 13:55:31 +03:00
|
|
|
load("@os_info//:os_info.bzl", "is_windows")
|
2019-04-04 11:33:38 +03:00
|
|
|
|
|
|
|
exports_files([".hlint.yaml"])
|
|
|
|
|
|
|
|
config_setting(
|
|
|
|
name = "on_linux",
|
|
|
|
constraint_values = [
|
|
|
|
"@bazel_tools//platforms:linux",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
config_setting(
|
|
|
|
name = "on_osx",
|
|
|
|
constraint_values = [
|
|
|
|
"@bazel_tools//platforms:osx",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
config_setting(
|
|
|
|
name = "on_freebsd",
|
|
|
|
constraint_values = [
|
|
|
|
"@bazel_tools//platforms:freebsd",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
config_setting(
|
|
|
|
name = "on_windows",
|
|
|
|
constraint_values = [
|
|
|
|
"@bazel_tools//platforms:windows",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
2019-07-02 15:51:09 +03:00
|
|
|
config_setting(
|
|
|
|
name = "profiling_build",
|
|
|
|
values = {
|
|
|
|
"compilation_mode": "dbg",
|
|
|
|
},
|
|
|
|
)
|
|
|
|
|
2019-04-04 11:33:38 +03:00
|
|
|
load(
|
2019-08-13 17:46:31 +03:00
|
|
|
"@rules_haskell//haskell:c2hs.bzl",
|
2019-04-04 11:33:38 +03:00
|
|
|
"c2hs_toolchain",
|
|
|
|
)
|
|
|
|
|
|
|
|
c2hs_toolchain(
|
|
|
|
name = "c2hs-toolchain",
|
2019-11-22 17:24:08 +03:00
|
|
|
c2hs = "@c2hs//:c2hs",
|
2019-04-04 11:33:38 +03:00
|
|
|
)
|
|
|
|
|
2019-07-05 17:04:47 +03:00
|
|
|
#
|
|
|
|
# Python toolchain
|
|
|
|
#
|
|
|
|
|
|
|
|
py_runtime(
|
|
|
|
name = "nix_python3_runtime",
|
|
|
|
interpreter = "@python3_nix//:bin/python",
|
|
|
|
python_version = "PY3",
|
|
|
|
) if not is_windows else None
|
|
|
|
|
|
|
|
py_runtime_pair(
|
|
|
|
name = "nix_python_runtime_pair",
|
|
|
|
py3_runtime = ":nix_python3_runtime",
|
|
|
|
) if not is_windows else None
|
|
|
|
|
|
|
|
toolchain(
|
|
|
|
name = "nix_python_toolchain",
|
|
|
|
exec_compatible_with = [
|
2019-08-13 17:46:31 +03:00
|
|
|
"@rules_haskell//haskell/platforms:nixpkgs",
|
2019-07-05 17:04:47 +03:00
|
|
|
],
|
|
|
|
toolchain = ":nix_python_runtime_pair",
|
|
|
|
toolchain_type = "@bazel_tools//tools/python:toolchain_type",
|
|
|
|
) if not is_windows else None
|
|
|
|
|
2019-04-12 14:10:16 +03:00
|
|
|
filegroup(
|
|
|
|
name = "node_modules",
|
|
|
|
srcs = glob(["node_modules/**/*"]),
|
|
|
|
)
|
2019-04-04 11:33:38 +03:00
|
|
|
|
|
|
|
config_setting(
|
|
|
|
name = "ghci_data",
|
|
|
|
define_values = {
|
|
|
|
"ghci_data": "True",
|
|
|
|
},
|
|
|
|
)
|
|
|
|
|
2019-06-16 16:42:48 +03:00
|
|
|
config_setting(
|
|
|
|
name = "hie_bios_ghci",
|
|
|
|
define_values = {
|
|
|
|
"hie_bios_ghci": "True",
|
|
|
|
},
|
|
|
|
)
|
|
|
|
|
2019-04-04 11:33:38 +03:00
|
|
|
#
|
|
|
|
# Metadata
|
|
|
|
#
|
|
|
|
|
|
|
|
# The VERSION file is inlined in a few builds.
|
2019-04-12 14:10:16 +03:00
|
|
|
exports_files([
|
|
|
|
"NOTICES",
|
|
|
|
"LICENSE",
|
|
|
|
"VERSION",
|
|
|
|
"CHANGELOG",
|
|
|
|
"tsconfig.json",
|
|
|
|
])
|
2019-04-04 11:33:38 +03:00
|
|
|
|
|
|
|
# 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
|
|
|
|
# stop splitting the SDK into individual components _very_ soon, this rule
|
|
|
|
# will not survive until x >= 10.
|
|
|
|
genrule(
|
|
|
|
name = "component-version",
|
|
|
|
srcs = ["VERSION"],
|
|
|
|
outs = ["COMPONENT-VERSION"],
|
|
|
|
cmd = """
|
|
|
|
echo -n 10 > $@
|
|
|
|
cat $(location VERSION) >> $@
|
|
|
|
""",
|
|
|
|
)
|
|
|
|
|
|
|
|
genrule(
|
|
|
|
name = "sdk-version-hs",
|
2019-04-12 14:10:16 +03:00
|
|
|
srcs = [
|
|
|
|
"VERSION",
|
|
|
|
":component-version",
|
|
|
|
],
|
2019-04-04 11:33:38 +03:00
|
|
|
outs = ["SdkVersion.hs"],
|
|
|
|
cmd = """
|
|
|
|
SDK_VERSION=$$(cat $(location VERSION))
|
|
|
|
COMPONENT_VERSION=$$(cat $(location :component-version))
|
|
|
|
cat > $@ <<EOF
|
|
|
|
module SdkVersion where
|
2019-08-12 17:05:28 +03:00
|
|
|
sdkVersion, componentVersion, damlStdlib :: String
|
2019-04-04 11:33:38 +03:00
|
|
|
sdkVersion = "$$SDK_VERSION"
|
|
|
|
componentVersion = "$$COMPONENT_VERSION"
|
2019-08-12 17:05:28 +03:00
|
|
|
damlStdlib = "daml-stdlib-" ++ sdkVersion
|
2019-04-04 11:33:38 +03:00
|
|
|
EOF
|
|
|
|
""",
|
|
|
|
)
|
|
|
|
|
|
|
|
da_haskell_library(
|
|
|
|
name = "sdk-version-hs-lib",
|
|
|
|
srcs = [":sdk-version-hs"],
|
2019-09-06 12:01:09 +03:00
|
|
|
hackage_deps = ["base"],
|
2019-04-04 11:33:38 +03:00
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
)
|
|
|
|
|
|
|
|
#
|
|
|
|
# Common aliases
|
|
|
|
#
|
|
|
|
|
|
|
|
alias(
|
2019-04-12 14:10:16 +03:00
|
|
|
name = "damlc",
|
2019-07-08 12:40:48 +03:00
|
|
|
actual = "//compiler/damlc:damlc",
|
2019-04-04 11:33:38 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
alias(
|
2019-04-12 14:10:16 +03:00
|
|
|
name = "damlc@ghci",
|
2019-07-08 12:40:48 +03:00
|
|
|
actual = "//compiler/damlc:damlc@ghci",
|
2019-04-04 11:33:38 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
alias(
|
2019-04-12 14:10:16 +03:00
|
|
|
name = "damlc-dist",
|
2019-07-08 12:40:48 +03:00
|
|
|
actual = "//compiler/damlc:damlc-dist",
|
2019-04-04 11:33:38 +03:00
|
|
|
)
|
|
|
|
|
2019-11-19 18:51:17 +03:00
|
|
|
alias(
|
|
|
|
name = "daml2ts",
|
|
|
|
actual = "//language-support/ts/codegen:daml2ts",
|
|
|
|
)
|
|
|
|
|
|
|
|
alias(
|
|
|
|
name = "daml2ts@ghci",
|
|
|
|
actual = "//language-support/ts/codegen:daml2ts@ghci",
|
|
|
|
)
|
|
|
|
|
2019-04-04 11:33:38 +03:00
|
|
|
alias(
|
2019-04-12 14:10:16 +03:00
|
|
|
name = "daml-lf-repl",
|
|
|
|
actual = "//daml-lf/repl:repl",
|
2019-04-04 11:33:38 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
alias(
|
2019-04-12 14:10:16 +03:00
|
|
|
name = "bindings-java",
|
|
|
|
actual = "//language-support/java/bindings:bindings-java",
|
2019-04-04 11:33:38 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
exports_files([
|
2019-04-12 14:10:16 +03:00
|
|
|
".scalafmt.conf",
|
2019-04-04 11:33:38 +03:00
|
|
|
])
|
2019-04-12 14:10:16 +03:00
|
|
|
|
|
|
|
# Buildifier.
|
|
|
|
|
|
|
|
load("@com_github_bazelbuild_buildtools//buildifier:def.bzl", "buildifier")
|
|
|
|
|
|
|
|
buildifier_excluded_patterns = [
|
|
|
|
"./3rdparty/haskell/c2hs-package.bzl",
|
|
|
|
"./3rdparty/haskell/network-package.bzl",
|
2019-07-02 13:41:03 +03:00
|
|
|
"./node_modules/*",
|
2019-04-12 14:10:16 +03:00
|
|
|
]
|
|
|
|
|
|
|
|
# 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,
|
|
|
|
)
|
2019-06-24 18:39:41 +03:00
|
|
|
|
|
|
|
# Default target for da-ghci, da-ghcid.
|
|
|
|
da_haskell_repl(
|
|
|
|
name = "repl",
|
2019-11-05 21:45:04 +03:00
|
|
|
testonly = True,
|
2019-06-24 18:39:41 +03:00
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
deps = [
|
|
|
|
":damlc",
|
2019-11-06 21:35:40 +03:00
|
|
|
"//compiler/damlc/tests:generate-simple-dalf",
|
2019-06-24 18:39:41 +03:00
|
|
|
"//daml-assistant:daml",
|
|
|
|
"//daml-assistant/daml-helper",
|
2019-11-05 21:45:04 +03:00
|
|
|
"//daml-assistant/integration-tests",
|
2019-06-24 18:39:41 +03:00
|
|
|
],
|
|
|
|
)
|