daml/bazel_tools/build_environment.bzl
Gerolf Seitz 329320bad9
Organize maven coordinates (#5272)
* Use com.daml as groupId for all artifacts

CHANGELOG_BEGIN
[SDK] Changed the groupId for Maven artifacts to ``com.daml``.
CHANGELOG_END

* Add 2 additional maven related checks to the release binary

1. Check that all maven upload artifacts use com.daml as the groupId
2. Check that all maven upload artifacts have a unique artifactId

* Address @cocreature's comments in https://github.com/digital-asset/daml/pull/5272#pullrequestreview-385026181
2020-04-01 11:41:18 +02:00

43 lines
1.3 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 = "",
executable = False,
)
# Generates a simple Bazel file that just sets a bunch of Bazel variables,
# so they can be used in our main Bazel BUILD files.
semver = ctx.os.environ.get("DAML_SDK_RELEASE_VERSION", default = "0.0.0")
if semver.find("-snapshot.") > 0:
ghc = semver[:-9].replace("-snapshot.", ".")
else:
ghc = semver
ctx.file(
"configuration.bzl",
content =
"""
npm_version = "{NPM_VERSION}"
mvn_version = "{MVN_VERSION}"
ghc_version = "{GHC_VERSION}"
sdk_version = "{SDK_VERSION}"
""".format(
SDK_VERSION = semver,
NPM_VERSION = semver,
MVN_VERSION = semver,
GHC_VERSION = ghc,
),
executable = False,
)
build_environment = repository_rule(
# Tell Bazel that this rule will produce different results if any of the
# env vars in the list has changed.
environ = ["DAML_SDK_RELEASE_VERSION"],
implementation = _impl,
attrs = {},
)