mirror of
https://github.com/digital-asset/daml.git
synced 2024-09-20 17:28:46 +03:00
2371d173b1
I’ve also changed some of the names to be more sensible.
194 lines
5.3 KiB
Python
194 lines
5.3 KiB
Python
# 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("//rules_daml:daml.bzl", "daml_compile")
|
|
load("@os_info//:os_info.bzl", "is_windows")
|
|
load("//bazel_tools/packaging:packaging.bzl", "package_app")
|
|
|
|
da_haskell_binary(
|
|
name = "damlc",
|
|
srcs = ["exe/Main.hs"],
|
|
|
|
# We need to tell the linker to statically link pthread on Windows
|
|
# otherwise the library is not found at runtime.
|
|
compiler_flags = [
|
|
"-optl-static",
|
|
"-optl-pthread",
|
|
] if is_windows else [],
|
|
data = [
|
|
"//compiler/damlc/pkg-db",
|
|
"//compiler/scenario-service/server:scenario_service_jar",
|
|
],
|
|
hazel_deps = [
|
|
"base",
|
|
],
|
|
src_strip_prefix = "src",
|
|
visibility = ["//visibility:public"],
|
|
deps = [
|
|
":damlc-lib",
|
|
],
|
|
)
|
|
|
|
# damlc without runfiles. We use that to build the daml-prim and daml-stdlib
|
|
# package databases.
|
|
da_haskell_binary(
|
|
name = "damlc-bootstrap",
|
|
srcs = ["exe/Main.hs"],
|
|
|
|
# We need to tell the linker to statically link pthread on Windows
|
|
# otherwise the library is not found at runtime.
|
|
compiler_flags = [
|
|
"-optl-static",
|
|
"-optl-pthread",
|
|
] if is_windows else [],
|
|
hazel_deps = [
|
|
"base",
|
|
],
|
|
src_strip_prefix = "src",
|
|
visibility = ["//visibility:public"],
|
|
deps = [
|
|
":damlc-lib",
|
|
],
|
|
)
|
|
|
|
package_app(
|
|
name = "damlc-dist",
|
|
binary = ":damlc",
|
|
resources = [
|
|
":ghc-pkg-dist",
|
|
"//compiler/damlc/pkg-db",
|
|
"//compiler/scenario-service/server:scenario_service_jar",
|
|
],
|
|
tags = ["no-cache"],
|
|
visibility = ["//visibility:public"],
|
|
)
|
|
|
|
# ghc-pkg is linked dynamically on Linux by default so we need to run it through package_app
|
|
# before we distribute it.
|
|
package_app(
|
|
name = "ghc-pkg-dist",
|
|
# bin/ghc-pkg is actually a wrapper script on Unix systems so it is
|
|
# important that we use lib/ghc-$VERSION/bin/ghc-pkg instead which is the
|
|
# actual executable.
|
|
binary = "@io_tweag_rules_haskell_ghc_windows_amd64//:bin/ghc-pkg.exe" if is_windows else "@ghc_nix//:lib/ghc-8.6.5/bin/ghc-pkg",
|
|
visibility = ["//visibility:public"],
|
|
)
|
|
|
|
da_haskell_library(
|
|
name = "damlc-lib",
|
|
srcs = glob(["lib/**/*.hs"]),
|
|
extra_srcs = [
|
|
"//compiler/daml-licenses/licenses:licensing.md",
|
|
],
|
|
hazel_deps = [
|
|
"aeson-pretty",
|
|
"aeson",
|
|
"ansi-wl-pprint",
|
|
"base",
|
|
"bytestring",
|
|
"containers",
|
|
"cryptonite",
|
|
"directory",
|
|
"extra",
|
|
"file-embed",
|
|
"filepath",
|
|
"ghc-lib",
|
|
"ghc-lib-parser",
|
|
"gitrev",
|
|
"haskell-lsp",
|
|
"lens-aeson",
|
|
"lens",
|
|
"memory",
|
|
"mtl",
|
|
"network",
|
|
"optparse-applicative",
|
|
"prettyprinter",
|
|
"process",
|
|
"proto3-suite",
|
|
"safe",
|
|
"safe-exceptions",
|
|
"shake",
|
|
"split",
|
|
"tasty-ant-xml",
|
|
"tasty-hunit",
|
|
"tasty",
|
|
"temporary",
|
|
"text",
|
|
"vector",
|
|
"xml",
|
|
"yaml",
|
|
"zip-archive",
|
|
"unordered-containers",
|
|
"uniplate",
|
|
],
|
|
visibility = ["//visibility:public"],
|
|
deps = [
|
|
"//:sdk-version-hs-lib",
|
|
"//compiler/daml-lf-ast",
|
|
"//compiler/daml-lf-proto",
|
|
"//compiler/daml-lf-reader",
|
|
"//compiler/daml-lf-tools",
|
|
"//compiler/damlc/daml-compiler",
|
|
"//compiler/damlc/daml-doc",
|
|
"//compiler/damlc/daml-ide",
|
|
"//compiler/damlc/daml-ide-core",
|
|
"//compiler/damlc/daml-opts",
|
|
"//compiler/damlc/daml-opts:daml-opts-types",
|
|
"//compiler/hie-core",
|
|
"//compiler/scenario-service/client",
|
|
"//compiler/scenario-service/protos:scenario_service_haskell_proto",
|
|
"//daml-assistant:daml-project-config",
|
|
"//daml-lf/archive:daml_lf_haskell_proto",
|
|
"//libs-haskell/bazel-runfiles",
|
|
"//libs-haskell/da-hs-base",
|
|
],
|
|
)
|
|
|
|
# Generating DAML stdlib docs.
|
|
|
|
filegroup(
|
|
name = "daml-base-files", # DAML files to be included in DAML base docs.
|
|
srcs = [
|
|
"//compiler/damlc/daml-prim-src",
|
|
"//compiler/damlc/daml-stdlib-src",
|
|
],
|
|
visibility = ["__pkg__"],
|
|
)
|
|
|
|
filegroup(
|
|
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__"],
|
|
)
|
|
|
|
genrule(
|
|
name = "daml-base-hoogle-docs",
|
|
srcs = [
|
|
":daml-base-files",
|
|
":daml-base-hoogle-prefix",
|
|
],
|
|
outs = ["daml-base-hoogle.txt"],
|
|
cmd = "$(location //compiler/damlc) -- docs --output=$(OUTS) --format=Hoogle $(locations :daml-base-files) --prefix=$(location :daml-base-hoogle-prefix)",
|
|
tools = ["//compiler/damlc"],
|
|
visibility = ["//visibility:public"],
|
|
)
|
|
|
|
genrule(
|
|
name = "daml-base-rst-docs",
|
|
srcs = [
|
|
":daml-base-files",
|
|
":daml-base-rst-prefix",
|
|
],
|
|
outs = ["daml-base.rst"],
|
|
cmd = "$(location //compiler/damlc) -- docs --output=$(OUTS) --format=Rst $(locations :daml-base-files) --prefix=$(location :daml-base-rst-prefix)",
|
|
tools = ["//compiler/damlc"],
|
|
visibility = ["//visibility:public"],
|
|
)
|