daml/compiler/damlc/stable-packages/BUILD.bazel
Gary Verhaegen 151e12b81a
bump copyright (#16002)
This is the result of:

- Updating `./COPY` to say `2023`.
- Running `./dev-env/bin/dade-copyright-headers update .`
2023-01-04 18:21:15 +01:00

169 lines
7.9 KiB
Python

# Copyright (c) 2023 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_library(
name = "stable-packages-lib",
srcs = glob(["lib/**/*.hs"]),
hackage_deps = [
"base",
"bytestring",
"containers",
"text",
],
src_strip_prefix = "lib",
visibility = ["//visibility:public"],
deps = [
"//compiler/daml-lf-ast",
"//compiler/daml-lf-proto:daml-lf-proto-encode",
"//compiler/damlc/daml-lf-util",
"//libs-haskell/da-hs-base",
],
)
da_haskell_binary(
name = "generate-stable-package",
srcs = glob(["src/**/*.hs"]),
hackage_deps = [
"base",
"bytestring",
"containers",
"optparse-applicative",
"text",
],
main_function = "GenerateStablePackage.main",
src_strip_prefix = "src",
visibility = ["//visibility:public"],
deps = [
":stable-packages-lib",
"//compiler/daml-lf-ast",
"//compiler/daml-lf-proto:daml-lf-proto-encode",
"//libs-haskell/da-hs-base",
],
)
genrule(
name = "gen-stable-packages",
srcs = [],
outs = [
"daml-prim/GHC-Types.dalf",
"daml-prim/GHC-Prim.dalf",
"daml-prim/GHC-Tuple.dalf",
"daml-prim/DA-Internal-Erased.dalf",
"daml-prim/DA-Internal-NatSyn.dalf",
"daml-prim/DA-Internal-PromotedText.dalf",
"daml-prim/DA-Exception-GeneralError.dalf",
"daml-prim/DA-Exception-ArithmeticError.dalf",
"daml-prim/DA-Exception-AssertionFailed.dalf",
"daml-prim/DA-Exception-PreconditionFailed.dalf",
"daml-prim/DA-Types.dalf",
"daml-stdlib/DA-Internal-Template.dalf",
"daml-stdlib/DA-Internal-Any.dalf",
"daml-stdlib/DA-Time-Types.dalf",
"daml-stdlib/DA-NonEmpty-Types.dalf",
"daml-stdlib/DA-Date-Types.dalf",
"daml-stdlib/DA-Semigroup-Types.dalf",
"daml-stdlib/DA-Set-Types.dalf",
"daml-stdlib/DA-Monoid-Types.dalf",
"daml-stdlib/DA-Logic-Types.dalf",
"daml-stdlib/DA-Validation-Types.dalf",
"daml-stdlib/DA-Internal-Down.dalf",
"daml-stdlib/DA-Internal-Interface-AnyView-Types.dalf",
"daml-stdlib/DA-Action-State-Type.dalf",
"daml-stdlib/DA-Random-Types.dalf",
"daml-stdlib/DA-Stack-Types.dalf",
],
cmd = """
$(location :generate-stable-package) --module GHC.Types -o $(location daml-prim/GHC-Types.dalf)
$(location :generate-stable-package) --module GHC.Prim -o $(location daml-prim/GHC-Prim.dalf)
$(location :generate-stable-package) --module GHC.Tuple -o $(location daml-prim/GHC-Tuple.dalf)
$(location :generate-stable-package) --module DA.Internal.Erased -o $(location daml-prim/DA-Internal-Erased.dalf)
$(location :generate-stable-package) --module DA.Internal.NatSyn -o $(location daml-prim/DA-Internal-NatSyn.dalf)
$(location :generate-stable-package) --module DA.Internal.PromotedText -o $(location daml-prim/DA-Internal-PromotedText.dalf)
$(location :generate-stable-package) --module DA.Exception.GeneralError -o $(location daml-prim/DA-Exception-GeneralError.dalf)
$(location :generate-stable-package) --module DA.Exception.ArithmeticError -o $(location daml-prim/DA-Exception-ArithmeticError.dalf)
$(location :generate-stable-package) --module DA.Exception.AssertionFailed -o $(location daml-prim/DA-Exception-AssertionFailed.dalf)
$(location :generate-stable-package) --module DA.Exception.PreconditionFailed -o $(location daml-prim/DA-Exception-PreconditionFailed.dalf)
$(location :generate-stable-package) --module DA.Types -o $(location daml-prim/DA-Types.dalf)
$(location :generate-stable-package) --module DA.Time.Types -o $(location daml-stdlib/DA-Time-Types.dalf)
$(location :generate-stable-package) --module DA.NonEmpty.Types -o $(location daml-stdlib/DA-NonEmpty-Types.dalf)
$(location :generate-stable-package) --module DA.Date.Types -o $(location daml-stdlib/DA-Date-Types.dalf)
$(location :generate-stable-package) --module DA.Semigroup.Types -o $(location daml-stdlib/DA-Semigroup-Types.dalf)
$(location :generate-stable-package) --module DA.Set.Types -o $(location daml-stdlib/DA-Set-Types.dalf)
$(location :generate-stable-package) --module DA.Monoid.Types -o $(location daml-stdlib/DA-Monoid-Types.dalf)
$(location :generate-stable-package) --module DA.Logic.Types -o $(location daml-stdlib/DA-Logic-Types.dalf)
$(location :generate-stable-package) --module DA.Validation.Types -o $(location daml-stdlib/DA-Validation-Types.dalf)
$(location :generate-stable-package) --module DA.Internal.Down -o $(location daml-stdlib/DA-Internal-Down.dalf)
# These types are not serializable but they leak into typeclass methods so they need to be stable.
$(location :generate-stable-package) --module DA.Internal.Any -o $(location daml-stdlib/DA-Internal-Any.dalf)
$(location :generate-stable-package) --module DA.Internal.Template -o $(location daml-stdlib/DA-Internal-Template.dalf)
$(location :generate-stable-package) --module DA.Internal.Interface.AnyView.Types -o $(location daml-stdlib/DA-Internal-Interface-AnyView-Types.dalf)
# These types are not serializable but they need to be stable so users can reuse functions from data-dependencies.
$(location :generate-stable-package) --module DA.Action.State.Type -o $(location daml-stdlib/DA-Action-State-Type.dalf)
$(location :generate-stable-package) --module DA.Random.Types -o $(location daml-stdlib/DA-Random-Types.dalf)
$(location :generate-stable-package) --module DA.Stack.Types -o $(location daml-stdlib/DA-Stack-Types.dalf)
""",
tools = [":generate-stable-package"],
visibility = ["//visibility:public"],
)
# If you change this you also need to update generateStablePackages in Development.IDE.Core.Rules.Daml
filegroup(
name = "stable-packages",
srcs = [
"daml-prim/DA-Exception-ArithmeticError.dalf",
"daml-prim/DA-Exception-AssertionFailed.dalf",
"daml-prim/DA-Exception-GeneralError.dalf",
"daml-prim/DA-Exception-PreconditionFailed.dalf",
"daml-prim/DA-Internal-Erased.dalf",
"daml-prim/DA-Internal-NatSyn.dalf",
"daml-prim/DA-Internal-PromotedText.dalf",
"daml-prim/DA-Types.dalf",
"daml-prim/GHC-Prim.dalf",
"daml-prim/GHC-Tuple.dalf",
"daml-prim/GHC-Types.dalf",
"daml-stdlib/DA-Action-State-Type.dalf",
"daml-stdlib/DA-Date-Types.dalf",
"daml-stdlib/DA-Internal-Any.dalf",
"daml-stdlib/DA-Internal-Down.dalf",
"daml-stdlib/DA-Internal-Interface-AnyView-Types.dalf",
"daml-stdlib/DA-Internal-Template.dalf",
"daml-stdlib/DA-Logic-Types.dalf",
"daml-stdlib/DA-Monoid-Types.dalf",
"daml-stdlib/DA-NonEmpty-Types.dalf",
"daml-stdlib/DA-Random-Types.dalf",
"daml-stdlib/DA-Semigroup-Types.dalf",
"daml-stdlib/DA-Set-Types.dalf",
"daml-stdlib/DA-Stack-Types.dalf",
"daml-stdlib/DA-Time-Types.dalf",
"daml-stdlib/DA-Validation-Types.dalf",
],
visibility = ["//visibility:public"],
)
genrule(
name = "stable-packages-list-srcs",
outs = ["DA/Daml/StablePackagesList.hs"],
cmd = """
$(location :generate-stable-package) gen-package-list -o $(location DA/Daml/StablePackagesList.hs)
""",
tools = [":generate-stable-package"],
)
# We generate this as a library rather than depending on :stable-packages-lib
# to avoid a cyclical dependency between the daml-lf-proto and :stable-packages-lib
# and to avoid having to encode the packages at runtime to get their package id.
da_haskell_library(
name = "stable-packages-list",
srcs = ["DA/Daml/StablePackagesList.hs"],
hackage_deps = [
"base",
"containers",
],
visibility = ["//visibility:public"],
deps = [
"//compiler/daml-lf-ast",
],
)