daml/bazel_tools/scala_version.bzl
Gary Verhaegen a925f0174c
update copyright notices for 2021 (#8257)
* update copyright notices for 2021

To be merged on 2021-01-01.

CHANGELOG_BEGIN
CHANGELOG_END

* patch-bazel-windows & da-ghc-lib
2021-01-01 19:49:51 +01:00

39 lines
1.1 KiB
Python

# Copyright (c) 2021 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
def _impl(ctx):
# Generates an empty BUILD file, because we do not need to build anything.
ctx.file(
"BUILD",
content = """exports_files(["index.bzl"])""",
executable = False,
)
version = ctx.os.environ.get("DAML_SCALA_VERSION", default = "2.12.12")
suffix = version.replace(".", "_")
major = version[:version.rfind(".")]
major_suffix = major.replace(".", "_")
ctx.file(
"index.bzl",
content =
"""
scala_version = "{version}"
scala_major_version = "{major}"
scala_version_suffix = "{suffix}"
scala_major_version_suffix = "{major_suffix}"
""".format(
version = version,
major = major,
suffix = suffix,
major_suffix = major_suffix,
),
executable = False,
)
scala_version = repository_rule(
environ = ["DAML_SCALA_VERSION"],
implementation = _impl,
attrs = {},
)