mirror of
https://github.com/digital-asset/daml.git
synced 2024-09-20 17:28:46 +03:00
ba6ba9019f
* Release Scala 2.13 artifacts changelog_begin changelog_end * Dedup default scala version changelog_begin changelog_end
43 lines
1.2 KiB
Python
43 lines
1.2 KiB
Python
# Copyright (c) 2021 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
default_scala_version = "2.12.12"
|
|
|
|
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 = default_scala_version)
|
|
if version == "":
|
|
version = default_scala_version
|
|
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 = {},
|
|
)
|