daml/bazel_tools/scala_version.bzl
Moritz Kiefer d24ef94f36
Add a Scala 2.13 build pipeline (#8271)
* Add a Scala 2.13 build pipeline

This adds initial support for multiple Scala versions controlled via
the DAML_SCALA_VERSION env var and a CI job to make sure we don’t
regress. For now we only test //libs-scala/ports/... which seemed like
the easiest starting point I could find. We can incrementally expand
that over time.

changelog_begin
changelog_end

* Document pinning

changelog_begin
changelog_end

* Address review comments

changelog_begin
changelog_end
2020-12-14 12:42:26 +01:00

39 lines
1.1 KiB
Python

# Copyright (c) 2020 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 = {},
)