mirror of
https://github.com/digital-asset/daml.git
synced 2024-11-04 00:36:58 +03:00
aa70c7f64e
* Add buildifier targets. The tool allows to check and format BUILD files in the repo. To check if files are well formatted, run: bazel run //:buildifier To fix badly-formatted files run: bazel run //:buildifier-fix * Cleanup dade-copyright-headers formatting. * Fix dade-copyright-headers on files with just the copyright. * Run buildifier automatically on CI via 'fmt.sh'. * Reformat all BUILD files with buildifier. Excludes autogenerated Bazel files.
32 lines
1.2 KiB
Python
32 lines
1.2 KiB
Python
# Copyright (c) 2019 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
# Build rule for a DA Documentation Package.
|
|
def da_doc_package(**args):
|
|
src_name = args["name"] + "-srcs"
|
|
native.filegroup(
|
|
name = src_name,
|
|
srcs = native.glob(["source/**"]),
|
|
)
|
|
prepare = args.get("prepare", "")
|
|
extra_srcs = args.get("extra_srcs", [])
|
|
native.genrule(
|
|
name = args["name"],
|
|
outs = ["sources.tar.gz"],
|
|
srcs = [src_name, "@tar_dev_env//:tar", "@gzip_dev_env//:gzip"] + extra_srcs,
|
|
cmd = """
|
|
export PATH=$$(dirname $(location {gzip})):$$PATH
|
|
# Bazel makes it fairly hard to get the directory in a robust way so
|
|
# we take the first file and strip everything after source.
|
|
SRCS=($(locations {srcs}))
|
|
BASEDIR=$${{SRCS[0]%%source*}}
|
|
{prepare}
|
|
$(location {tar}) czhf $(location sources.tar.gz) -C $$BASEDIR source
|
|
""".format(
|
|
srcs = ":" + src_name,
|
|
prepare = prepare,
|
|
tar = "@tar_dev_env//:tar",
|
|
gzip = "@gzip_dev_env//:gzip",
|
|
),
|
|
)
|