2020-01-02 23:21:13 +03:00
|
|
|
# Copyright (c) 2020 The DAML Authors. All rights reserved.
|
2019-08-13 21:00:14 +03:00
|
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
|
|
|
|
# This repository rule exists so that we can switch the GHC attribute
|
|
|
|
# name in `WORKSPACE` as we cannot use `select` theer.
|
|
|
|
|
|
|
|
_ghc_dwarf_bzl_template = """
|
|
|
|
enable_ghc_dwarf = {GHC_DWARF}
|
|
|
|
"""
|
|
|
|
|
|
|
|
def _ghc_dwarf_impl(repository_ctx):
|
|
|
|
enable_dwarf = repository_ctx.os.environ.get("GHC_DWARF", "") != ""
|
|
|
|
substitutions = {
|
|
|
|
"GHC_DWARF": enable_dwarf,
|
|
|
|
}
|
|
|
|
repository_ctx.file(
|
|
|
|
"ghc_dwarf.bzl",
|
|
|
|
_ghc_dwarf_bzl_template.format(**substitutions),
|
|
|
|
False,
|
|
|
|
)
|
|
|
|
repository_ctx.file(
|
|
|
|
"BUILD",
|
|
|
|
"",
|
|
|
|
False,
|
|
|
|
)
|
|
|
|
|
|
|
|
ghc_dwarf = repository_rule(
|
|
|
|
implementation = _ghc_dwarf_impl,
|
|
|
|
local = True,
|
|
|
|
)
|