daml/rules_daml/daml.bzl

444 lines
13 KiB
Python
Raw Normal View History

# Copyright (c) 2021 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
2019-04-04 11:33:38 +03:00
# SPDX-License-Identifier: Apache-2.0
load("@build_environment//:configuration.bzl", "ghc_version", "sdk_version")
Update Bazel 2.1.0 --> 3.3.1 (#6761) * Upgrade nixpkgs revision * Remove unused minio It used to be used as a gateway to push the Nix cache to GCS, but has since been replaced by nix-store-gcs-proxy. * Update Bazel on Windows changelog_begin changelog_end * Fix hlint warnings The nixpkgs update implied an hlint update which enabled new warnings. * Fix "Error applying patch" Since Bazel 2.2.0 the order of generating `WORKSPACE` and `BUILD` files and applying patches has been reversed. The allows users to define patches to these files that will not be immediately overwritten. However, it also means that patches on another repository's original `WORKSPACE` file will likely become invalid. * https://github.com/bazelbuild/bazel/commit/a948eb7255b8418f0bba1c819a58972066577d6f * https://github.com/bazelbuild/bazel/issues/10681 Hint: If you're generating a patch with `git` then you can use the following command to exclude the `WORKSPACE` file. ``` git diff ':(exclude)WORKSPACE' ``` * Update rules_nixpkgs * nixpkgs location expansion escaping * Drop --noincompatible_windows_native_test_wrapper * client_server_test using sh_inline_test client_server_test used to produce an executable shell script in form of a text file output. However, since the removal of `--noincompatible_windows_native_test_wrapper` this no longer works on Windows since `.sh` files are not directly executable on Windows. This change fixes the issue by producing the script file in a dedicated rule and then wrapping it in a `sh_test` rule which also works on Windows. * daml_test using sh_inline_test * daml_doc_test using sh_inline_test * _daml_validate_test using sh_inline_test * damlc_compile_test using sh_inline_test * client_server_test find .exe on Windows * Bump Windows cache for Bazel update Remove `clean --expunge` after merge. Co-authored-by: Andreas Herrmann <andreas.herrmann@tweag.io>
2020-07-23 10:46:04 +03:00
load("//bazel_tools/sh:sh.bzl", "sh_inline_test")
load("//daml-lf/language:daml-lf.bzl", "COMPILER_LF_VERSIONS")
_damlc = attr.label(
default = Label("//compiler/damlc:damlc-compile-only"),
executable = True,
cfg = "host",
doc = "The DAML compiler.",
)
_zipper = attr.label(
allow_single_file = True,
default = Label("@bazel_tools//tools/zip:zipper"),
executable = True,
cfg = "host",
)
2019-04-04 11:33:38 +03:00
def _daml_configure_impl(ctx):
project_name = ctx.attr.project_name
project_version = ctx.attr.project_version
daml_yaml = ctx.outputs.daml_yaml
target = ctx.attr.target
opts = ["--target={}".format(target)] if target else []
ctx.actions.write(
output = daml_yaml,
content = """
sdk-version: {sdk}
name: {name}
version: {version}
source: .
dependencies: []
build-options: [{opts} ]
""".format(
sdk = sdk_version,
name = project_name,
version = project_version,
opts = ", ".join(opts),
),
2019-04-04 11:33:38 +03:00
)
_daml_configure = rule(
implementation = _daml_configure_impl,
attrs = {
"project_name": attr.string(
mandatory = True,
doc = "Name of the DAML project.",
),
"project_version": attr.string(
mandatory = True,
doc = "Version of the DAML project.",
),
"daml_yaml": attr.output(
mandatory = True,
doc = "The generated daml.yaml config file.",
),
"target": attr.string(
doc = "DAML-LF version to output.",
),
},
)
def file_of_target(k):
[file] = k.files.to_list()
return file
def make_cp_command(src, dest):
return "mkdir -p $(dirname {dest}); cp -f {src} {dest}".format(
src = src,
dest = dest,
)
def _daml_build_impl(ctx):
name = ctx.label.name
daml_yaml = ctx.file.daml_yaml
srcs = ctx.files.srcs
dar_dict = ctx.attr.dar_dict
damlc = ctx.executable.damlc
input_dars = [file_of_target(k) for k in dar_dict.keys()]
output_dar = ctx.outputs.dar
posix = ctx.toolchains["@rules_sh//sh/posix:toolchain_type"]
ghc_opts = ctx.attr.ghc_options
ctx.actions.run_shell(
tools = [damlc],
inputs = [daml_yaml] + srcs + input_dars,
outputs = [output_dar],
progress_message = "Building DAML project %s" % name,
command = """
set -eou pipefail
tmpdir=$(mktemp -d)
trap "rm -rf $tmpdir" EXIT
cp -f {config} $tmpdir/daml.yaml
# Having to produce all the daml.yaml files via a genrule is annoying
# so we allow hardcoded version numbers and patch them here.
{sed} -i 's/^sdk-version:.*$/sdk-version: {sdk_version}/' $tmpdir/daml.yaml
{cp_srcs}
{cp_dars}
{damlc} build --project-root $tmpdir {ghc_opts} -o $PWD/{output_dar}
""".format(
config = daml_yaml.path,
cp_srcs = "\n".join([
make_cp_command(
src = src.path,
dest = "$tmpdir/" + src.path,
)
for src in srcs
]),
cp_dars = "\n".join([
make_cp_command(
src = file_of_target(k).path,
dest = "$tmpdir/" + v,
)
for k, v in dar_dict.items()
]),
sed = posix.commands["sed"],
damlc = damlc.path,
output_dar = output_dar.path,
sdk_version = sdk_version,
ghc_opts = " ".join(ghc_opts),
),
2019-04-04 11:33:38 +03:00
)
_daml_build = rule(
implementation = _daml_build_impl,
2019-04-04 11:33:38 +03:00
attrs = {
"daml_yaml": attr.label(
allow_single_file = True,
2019-04-04 11:33:38 +03:00
mandatory = True,
doc = "The daml.yaml config file.",
2019-04-04 11:33:38 +03:00
),
"srcs": attr.label_list(
allow_files = [".daml"],
mandatory = True,
doc = "DAML files in this DAML project.",
),
"dar_dict": attr.label_keyed_string_dict(
mandatory = True,
allow_files = True,
doc = "Other DAML projects referenced by this DAML project.",
),
"dar": attr.output(
mandatory = True,
doc = "The generated DAR file.",
),
"ghc_options": attr.string_list(
doc = "Options passed to GHC.",
default = ["--ghc-option=-Werror", "--ghc-option=-Wwarn", "--log-level=WARNING"],
),
"damlc": _damlc,
},
toolchains = ["@rules_sh//sh/posix:toolchain_type"],
)
def _extract_main_dalf_impl(ctx):
project_name = ctx.attr.project_name
project_version = ctx.attr.project_version
input_dar = ctx.file.dar
output_dalf = ctx.outputs.dalf
zipper = ctx.file._zipper
posix = ctx.toolchains["@rules_sh//sh/posix:toolchain_type"]
ctx.actions.run_shell(
tools = [zipper],
inputs = [input_dar],
outputs = [output_dalf],
progress_message = "Extract DALF from DAR (%s)" % project_name,
command = """
set -eou pipefail
TMPDIR=$(mktemp -d)
trap "rm -rf $TMPDIR" EXIT
# While zipper has a -d option, it insists on it
# being a relative path so we don't use it.
ZIPPER=$PWD/{zipper}
DAR=$PWD/{input_dar}
(cd $TMPDIR && $ZIPPER x $DAR)
main_dalf=$({find} $TMPDIR/ -name '{project_name}-{project_version}-[a-z0-9]*.dalf')
cp $main_dalf {output_dalf}
""".format(
zipper = zipper.path,
find = posix.commands["find"],
project_name = project_name,
project_version = project_version,
input_dar = input_dar.path,
output_dalf = output_dalf.path,
),
)
_extract_main_dalf = rule(
implementation = _extract_main_dalf_impl,
attrs = {
"project_name": attr.string(
mandatory = True,
doc = "Name of the DAML project.",
),
"project_version": attr.string(
mandatory = True,
doc = "Version of the DAML project.",
),
"dar": attr.label(
allow_single_file = [".dar"],
mandatory = True,
doc = "The DAR from which the DALF will be extracted.",
2019-04-04 11:33:38 +03:00
),
"dalf": attr.output(
mandatory = True,
doc = "The extracted DALF.",
2019-04-04 11:33:38 +03:00
),
"_zipper": _zipper,
2019-04-04 11:33:38 +03:00
},
toolchains = ["@rules_sh//sh/posix:toolchain_type"],
2019-04-04 11:33:38 +03:00
)
Update Bazel 2.1.0 --> 3.3.1 (#6761) * Upgrade nixpkgs revision * Remove unused minio It used to be used as a gateway to push the Nix cache to GCS, but has since been replaced by nix-store-gcs-proxy. * Update Bazel on Windows changelog_begin changelog_end * Fix hlint warnings The nixpkgs update implied an hlint update which enabled new warnings. * Fix "Error applying patch" Since Bazel 2.2.0 the order of generating `WORKSPACE` and `BUILD` files and applying patches has been reversed. The allows users to define patches to these files that will not be immediately overwritten. However, it also means that patches on another repository's original `WORKSPACE` file will likely become invalid. * https://github.com/bazelbuild/bazel/commit/a948eb7255b8418f0bba1c819a58972066577d6f * https://github.com/bazelbuild/bazel/issues/10681 Hint: If you're generating a patch with `git` then you can use the following command to exclude the `WORKSPACE` file. ``` git diff ':(exclude)WORKSPACE' ``` * Update rules_nixpkgs * nixpkgs location expansion escaping * Drop --noincompatible_windows_native_test_wrapper * client_server_test using sh_inline_test client_server_test used to produce an executable shell script in form of a text file output. However, since the removal of `--noincompatible_windows_native_test_wrapper` this no longer works on Windows since `.sh` files are not directly executable on Windows. This change fixes the issue by producing the script file in a dedicated rule and then wrapping it in a `sh_test` rule which also works on Windows. * daml_test using sh_inline_test * daml_doc_test using sh_inline_test * _daml_validate_test using sh_inline_test * damlc_compile_test using sh_inline_test * client_server_test find .exe on Windows * Bump Windows cache for Bazel update Remove `clean --expunge` after merge. Co-authored-by: Andreas Herrmann <andreas.herrmann@tweag.io>
2020-07-23 10:46:04 +03:00
def _daml_validate_test(
name,
dar,
**kwargs):
damlc = "//compiler/damlc:damlc-compile-only"
Update Bazel 2.1.0 --> 3.3.1 (#6761) * Upgrade nixpkgs revision * Remove unused minio It used to be used as a gateway to push the Nix cache to GCS, but has since been replaced by nix-store-gcs-proxy. * Update Bazel on Windows changelog_begin changelog_end * Fix hlint warnings The nixpkgs update implied an hlint update which enabled new warnings. * Fix "Error applying patch" Since Bazel 2.2.0 the order of generating `WORKSPACE` and `BUILD` files and applying patches has been reversed. The allows users to define patches to these files that will not be immediately overwritten. However, it also means that patches on another repository's original `WORKSPACE` file will likely become invalid. * https://github.com/bazelbuild/bazel/commit/a948eb7255b8418f0bba1c819a58972066577d6f * https://github.com/bazelbuild/bazel/issues/10681 Hint: If you're generating a patch with `git` then you can use the following command to exclude the `WORKSPACE` file. ``` git diff ':(exclude)WORKSPACE' ``` * Update rules_nixpkgs * nixpkgs location expansion escaping * Drop --noincompatible_windows_native_test_wrapper * client_server_test using sh_inline_test client_server_test used to produce an executable shell script in form of a text file output. However, since the removal of `--noincompatible_windows_native_test_wrapper` this no longer works on Windows since `.sh` files are not directly executable on Windows. This change fixes the issue by producing the script file in a dedicated rule and then wrapping it in a `sh_test` rule which also works on Windows. * daml_test using sh_inline_test * daml_doc_test using sh_inline_test * _daml_validate_test using sh_inline_test * damlc_compile_test using sh_inline_test * client_server_test find .exe on Windows * Bump Windows cache for Bazel update Remove `clean --expunge` after merge. Co-authored-by: Andreas Herrmann <andreas.herrmann@tweag.io>
2020-07-23 10:46:04 +03:00
sh_inline_test(
name = name,
data = [damlc, dar],
cmd = """\
DAMLC=$$(canonicalize_rlocation $(rootpath {damlc}))
Update Bazel 2.1.0 --> 3.3.1 (#6761) * Upgrade nixpkgs revision * Remove unused minio It used to be used as a gateway to push the Nix cache to GCS, but has since been replaced by nix-store-gcs-proxy. * Update Bazel on Windows changelog_begin changelog_end * Fix hlint warnings The nixpkgs update implied an hlint update which enabled new warnings. * Fix "Error applying patch" Since Bazel 2.2.0 the order of generating `WORKSPACE` and `BUILD` files and applying patches has been reversed. The allows users to define patches to these files that will not be immediately overwritten. However, it also means that patches on another repository's original `WORKSPACE` file will likely become invalid. * https://github.com/bazelbuild/bazel/commit/a948eb7255b8418f0bba1c819a58972066577d6f * https://github.com/bazelbuild/bazel/issues/10681 Hint: If you're generating a patch with `git` then you can use the following command to exclude the `WORKSPACE` file. ``` git diff ':(exclude)WORKSPACE' ``` * Update rules_nixpkgs * nixpkgs location expansion escaping * Drop --noincompatible_windows_native_test_wrapper * client_server_test using sh_inline_test client_server_test used to produce an executable shell script in form of a text file output. However, since the removal of `--noincompatible_windows_native_test_wrapper` this no longer works on Windows since `.sh` files are not directly executable on Windows. This change fixes the issue by producing the script file in a dedicated rule and then wrapping it in a `sh_test` rule which also works on Windows. * daml_test using sh_inline_test * daml_doc_test using sh_inline_test * _daml_validate_test using sh_inline_test * damlc_compile_test using sh_inline_test * client_server_test find .exe on Windows * Bump Windows cache for Bazel update Remove `clean --expunge` after merge. Co-authored-by: Andreas Herrmann <andreas.herrmann@tweag.io>
2020-07-23 10:46:04 +03:00
$$DAMLC validate-dar $$(canonicalize_rlocation $(rootpath {dar}))
""".format(
damlc = damlc,
dar = dar,
),
Update Bazel 2.1.0 --> 3.3.1 (#6761) * Upgrade nixpkgs revision * Remove unused minio It used to be used as a gateway to push the Nix cache to GCS, but has since been replaced by nix-store-gcs-proxy. * Update Bazel on Windows changelog_begin changelog_end * Fix hlint warnings The nixpkgs update implied an hlint update which enabled new warnings. * Fix "Error applying patch" Since Bazel 2.2.0 the order of generating `WORKSPACE` and `BUILD` files and applying patches has been reversed. The allows users to define patches to these files that will not be immediately overwritten. However, it also means that patches on another repository's original `WORKSPACE` file will likely become invalid. * https://github.com/bazelbuild/bazel/commit/a948eb7255b8418f0bba1c819a58972066577d6f * https://github.com/bazelbuild/bazel/issues/10681 Hint: If you're generating a patch with `git` then you can use the following command to exclude the `WORKSPACE` file. ``` git diff ':(exclude)WORKSPACE' ``` * Update rules_nixpkgs * nixpkgs location expansion escaping * Drop --noincompatible_windows_native_test_wrapper * client_server_test using sh_inline_test client_server_test used to produce an executable shell script in form of a text file output. However, since the removal of `--noincompatible_windows_native_test_wrapper` this no longer works on Windows since `.sh` files are not directly executable on Windows. This change fixes the issue by producing the script file in a dedicated rule and then wrapping it in a `sh_test` rule which also works on Windows. * daml_test using sh_inline_test * daml_doc_test using sh_inline_test * _daml_validate_test using sh_inline_test * damlc_compile_test using sh_inline_test * client_server_test find .exe on Windows * Bump Windows cache for Bazel update Remove `clean --expunge` after merge. Co-authored-by: Andreas Herrmann <andreas.herrmann@tweag.io>
2020-07-23 10:46:04 +03:00
**kwargs
)
def _inspect_dar_impl(ctx):
dar = ctx.file.dar
damlc = ctx.executable.damlc
pp = ctx.outputs.pp
ctx.actions.run(
executable = damlc,
inputs = [dar],
outputs = [pp],
arguments = ["inspect", dar.path, "-o", pp.path],
)
_inspect_dar = rule(
implementation = _inspect_dar_impl,
attrs = {
"dar": attr.label(
allow_single_file = True,
mandatory = True,
),
"damlc": _damlc,
"pp": attr.output(mandatory = True),
},
)
_default_project_version = "1.0.0"
default_damlc_opts = ["--ghc-option=-Werror", "--ghc-option=-Wwarn", "--log-level=WARNING"]
def damlc_for_target(target):
if not target or target in COMPILER_LF_VERSIONS:
return "//compiler/damlc:damlc-compile-only"
else:
return "@damlc_legacy//:damlc_legacy"
def daml_compile(
name,
srcs,
version = _default_project_version,
target = None,
project_name = None,
ghc_options = default_damlc_opts,
**kwargs):
"Build a DAML project, with a generated daml.yaml."
if len(srcs) == 0:
fail("daml_compile: Expected `srcs' to be non-empty.")
daml_yaml = name + ".yaml"
_daml_configure(
name = name + ".configure",
project_name = project_name or name,
project_version = version,
daml_yaml = daml_yaml,
target = target,
**kwargs
)
_daml_build(
name = name + ".build",
daml_yaml = daml_yaml,
srcs = srcs,
dar_dict = {},
dar = name + ".dar",
ghc_options = ghc_options,
damlc = damlc_for_target(target),
**kwargs
)
_inspect_dar(
name = "{}-inspect".format(name),
dar = "{}.dar".format(name),
pp = "{}.dar.pp".format(name),
damlc = damlc_for_target(target),
)
def daml_compile_with_dalf(
name,
version = _default_project_version,
**kwargs):
"Build a DAML project, with a generated daml.yaml, and extract the main DALF."
daml_compile(
name = name,
version = version,
**kwargs
)
_extract_main_dalf(
name = name + ".extract",
project_name = name,
project_version = version,
dar = name + ".dar",
dalf = name + ".dalf",
)
def daml_build_test(
name,
project_dir,
daml_config_basename = "daml.yaml",
daml_subdir_basename = "daml",
daml_yaml = None,
dar_dict = {},
ghc_options = default_damlc_opts,
**kwargs):
"Build a DAML project and validate the resulting .dar file."
if not daml_yaml:
daml_yaml = project_dir + "/" + daml_config_basename
srcs = native.glob([project_dir + "/" + daml_subdir_basename + "/**/*.daml"])
_daml_build(
name = name,
daml_yaml = daml_yaml,
srcs = srcs,
dar_dict = dar_dict,
dar = name + ".dar",
ghc_options = ghc_options,
**kwargs
)
_daml_validate_test(
name = name + ".test",
dar = name + ".dar",
)
Update Bazel 2.1.0 --> 3.3.1 (#6761) * Upgrade nixpkgs revision * Remove unused minio It used to be used as a gateway to push the Nix cache to GCS, but has since been replaced by nix-store-gcs-proxy. * Update Bazel on Windows changelog_begin changelog_end * Fix hlint warnings The nixpkgs update implied an hlint update which enabled new warnings. * Fix "Error applying patch" Since Bazel 2.2.0 the order of generating `WORKSPACE` and `BUILD` files and applying patches has been reversed. The allows users to define patches to these files that will not be immediately overwritten. However, it also means that patches on another repository's original `WORKSPACE` file will likely become invalid. * https://github.com/bazelbuild/bazel/commit/a948eb7255b8418f0bba1c819a58972066577d6f * https://github.com/bazelbuild/bazel/issues/10681 Hint: If you're generating a patch with `git` then you can use the following command to exclude the `WORKSPACE` file. ``` git diff ':(exclude)WORKSPACE' ``` * Update rules_nixpkgs * nixpkgs location expansion escaping * Drop --noincompatible_windows_native_test_wrapper * client_server_test using sh_inline_test client_server_test used to produce an executable shell script in form of a text file output. However, since the removal of `--noincompatible_windows_native_test_wrapper` this no longer works on Windows since `.sh` files are not directly executable on Windows. This change fixes the issue by producing the script file in a dedicated rule and then wrapping it in a `sh_test` rule which also works on Windows. * daml_test using sh_inline_test * daml_doc_test using sh_inline_test * _daml_validate_test using sh_inline_test * damlc_compile_test using sh_inline_test * client_server_test find .exe on Windows * Bump Windows cache for Bazel update Remove `clean --expunge` after merge. Co-authored-by: Andreas Herrmann <andreas.herrmann@tweag.io>
2020-07-23 10:46:04 +03:00
def daml_test(
name,
srcs = [],
java-quickstart replace scenarios by DAML Script (#7183) * java-quickstart replace scenarios by DAML Script This replaces the scenarios in the java quickstart project by DAML script test cases. The following changes were required * Replace `getParty` by `allocateParty`. * Replace `create` and `exercise` by `createCmd` and `exerciseCmd`. * Replace the pattern of `submit ... do create ...; exercise ...` by `submit ... do createAndExerciseCmd ... ...`. * Replace instances of `submit ... do fetch ...` by `query ... ...`. To that end I've added the following helper function. ``` queryIou : Party -> ContractId Iou -> Optional Iou ``` changelog_begin changelog_end * Replace queryIou by FetchIou choice changelog_begin changelog_end * Add comment explaining fetch choice Addressing review comment https://github.com/digital-asset/daml/pull/7183#discussion_r478918758 * Support dependencies in daml_test rule Cherry-picked from https://github.com/digital-asset/daml/pull/7264/files Renamed `dependencies` as `deps` to stick to Bazel conventions. * Fix quickstart `daml_test` target * fmt * Quote deps in daml.yaml To avoid issues with `:` in Windows paths. * //docs:quickstart-java - use temp dir This target repeatedly failed to build on Windows with ``` ERROR: D:/a/1/s/docs/BUILD.bazel:538:8: declared output 'docs/quickstart-java.tar.gz' was not created by genrule. This is probably because the genrule actually didn't create this output, or because the output was a directory and the genrule was run remotely (note that only the contents of declared file outputs are copied from genrules run remotely) ``` The genrule was operating in the current working directory and builds on Windows are not sandboxed. Conflicting files in the current working directory could cause this to fail. Co-authored-by: Andreas Herrmann <andreas.herrmann@tweag.io>
2020-08-28 19:19:45 +03:00
deps = [],
data_deps = [],
damlc = "//compiler/damlc:damlc",
target = None,
Update Bazel 2.1.0 --> 3.3.1 (#6761) * Upgrade nixpkgs revision * Remove unused minio It used to be used as a gateway to push the Nix cache to GCS, but has since been replaced by nix-store-gcs-proxy. * Update Bazel on Windows changelog_begin changelog_end * Fix hlint warnings The nixpkgs update implied an hlint update which enabled new warnings. * Fix "Error applying patch" Since Bazel 2.2.0 the order of generating `WORKSPACE` and `BUILD` files and applying patches has been reversed. The allows users to define patches to these files that will not be immediately overwritten. However, it also means that patches on another repository's original `WORKSPACE` file will likely become invalid. * https://github.com/bazelbuild/bazel/commit/a948eb7255b8418f0bba1c819a58972066577d6f * https://github.com/bazelbuild/bazel/issues/10681 Hint: If you're generating a patch with `git` then you can use the following command to exclude the `WORKSPACE` file. ``` git diff ':(exclude)WORKSPACE' ``` * Update rules_nixpkgs * nixpkgs location expansion escaping * Drop --noincompatible_windows_native_test_wrapper * client_server_test using sh_inline_test client_server_test used to produce an executable shell script in form of a text file output. However, since the removal of `--noincompatible_windows_native_test_wrapper` this no longer works on Windows since `.sh` files are not directly executable on Windows. This change fixes the issue by producing the script file in a dedicated rule and then wrapping it in a `sh_test` rule which also works on Windows. * daml_test using sh_inline_test * daml_doc_test using sh_inline_test * _daml_validate_test using sh_inline_test * damlc_compile_test using sh_inline_test * client_server_test find .exe on Windows * Bump Windows cache for Bazel update Remove `clean --expunge` after merge. Co-authored-by: Andreas Herrmann <andreas.herrmann@tweag.io>
2020-07-23 10:46:04 +03:00
**kwargs):
sh_inline_test(
name = name,
data = [damlc] + srcs + deps + data_deps,
Update Bazel 2.1.0 --> 3.3.1 (#6761) * Upgrade nixpkgs revision * Remove unused minio It used to be used as a gateway to push the Nix cache to GCS, but has since been replaced by nix-store-gcs-proxy. * Update Bazel on Windows changelog_begin changelog_end * Fix hlint warnings The nixpkgs update implied an hlint update which enabled new warnings. * Fix "Error applying patch" Since Bazel 2.2.0 the order of generating `WORKSPACE` and `BUILD` files and applying patches has been reversed. The allows users to define patches to these files that will not be immediately overwritten. However, it also means that patches on another repository's original `WORKSPACE` file will likely become invalid. * https://github.com/bazelbuild/bazel/commit/a948eb7255b8418f0bba1c819a58972066577d6f * https://github.com/bazelbuild/bazel/issues/10681 Hint: If you're generating a patch with `git` then you can use the following command to exclude the `WORKSPACE` file. ``` git diff ':(exclude)WORKSPACE' ``` * Update rules_nixpkgs * nixpkgs location expansion escaping * Drop --noincompatible_windows_native_test_wrapper * client_server_test using sh_inline_test client_server_test used to produce an executable shell script in form of a text file output. However, since the removal of `--noincompatible_windows_native_test_wrapper` this no longer works on Windows since `.sh` files are not directly executable on Windows. This change fixes the issue by producing the script file in a dedicated rule and then wrapping it in a `sh_test` rule which also works on Windows. * daml_test using sh_inline_test * daml_doc_test using sh_inline_test * _daml_validate_test using sh_inline_test * damlc_compile_test using sh_inline_test * client_server_test find .exe on Windows * Bump Windows cache for Bazel update Remove `clean --expunge` after merge. Co-authored-by: Andreas Herrmann <andreas.herrmann@tweag.io>
2020-07-23 10:46:04 +03:00
cmd = """\
set -eou pipefail
java-quickstart replace scenarios by DAML Script (#7183) * java-quickstart replace scenarios by DAML Script This replaces the scenarios in the java quickstart project by DAML script test cases. The following changes were required * Replace `getParty` by `allocateParty`. * Replace `create` and `exercise` by `createCmd` and `exerciseCmd`. * Replace the pattern of `submit ... do create ...; exercise ...` by `submit ... do createAndExerciseCmd ... ...`. * Replace instances of `submit ... do fetch ...` by `query ... ...`. To that end I've added the following helper function. ``` queryIou : Party -> ContractId Iou -> Optional Iou ``` changelog_begin changelog_end * Replace queryIou by FetchIou choice changelog_begin changelog_end * Add comment explaining fetch choice Addressing review comment https://github.com/digital-asset/daml/pull/7183#discussion_r478918758 * Support dependencies in daml_test rule Cherry-picked from https://github.com/digital-asset/daml/pull/7264/files Renamed `dependencies` as `deps` to stick to Bazel conventions. * Fix quickstart `daml_test` target * fmt * Quote deps in daml.yaml To avoid issues with `:` in Windows paths. * //docs:quickstart-java - use temp dir This target repeatedly failed to build on Windows with ``` ERROR: D:/a/1/s/docs/BUILD.bazel:538:8: declared output 'docs/quickstart-java.tar.gz' was not created by genrule. This is probably because the genrule actually didn't create this output, or because the output was a directory and the genrule was run remotely (note that only the contents of declared file outputs are copied from genrules run remotely) ``` The genrule was operating in the current working directory and builds on Windows are not sandboxed. Conflicting files in the current working directory could cause this to fail. Co-authored-by: Andreas Herrmann <andreas.herrmann@tweag.io>
2020-08-28 19:19:45 +03:00
tmpdir=$$(mktemp -d)
trap "rm -rf $$tmpdir" EXIT
Update Bazel 2.1.0 --> 3.3.1 (#6761) * Upgrade nixpkgs revision * Remove unused minio It used to be used as a gateway to push the Nix cache to GCS, but has since been replaced by nix-store-gcs-proxy. * Update Bazel on Windows changelog_begin changelog_end * Fix hlint warnings The nixpkgs update implied an hlint update which enabled new warnings. * Fix "Error applying patch" Since Bazel 2.2.0 the order of generating `WORKSPACE` and `BUILD` files and applying patches has been reversed. The allows users to define patches to these files that will not be immediately overwritten. However, it also means that patches on another repository's original `WORKSPACE` file will likely become invalid. * https://github.com/bazelbuild/bazel/commit/a948eb7255b8418f0bba1c819a58972066577d6f * https://github.com/bazelbuild/bazel/issues/10681 Hint: If you're generating a patch with `git` then you can use the following command to exclude the `WORKSPACE` file. ``` git diff ':(exclude)WORKSPACE' ``` * Update rules_nixpkgs * nixpkgs location expansion escaping * Drop --noincompatible_windows_native_test_wrapper * client_server_test using sh_inline_test client_server_test used to produce an executable shell script in form of a text file output. However, since the removal of `--noincompatible_windows_native_test_wrapper` this no longer works on Windows since `.sh` files are not directly executable on Windows. This change fixes the issue by producing the script file in a dedicated rule and then wrapping it in a `sh_test` rule which also works on Windows. * daml_test using sh_inline_test * daml_doc_test using sh_inline_test * _daml_validate_test using sh_inline_test * damlc_compile_test using sh_inline_test * client_server_test find .exe on Windows * Bump Windows cache for Bazel update Remove `clean --expunge` after merge. Co-authored-by: Andreas Herrmann <andreas.herrmann@tweag.io>
2020-07-23 10:46:04 +03:00
DAMLC=$$(canonicalize_rlocation $(rootpath {damlc}))
rlocations () {{ for i in $$@; do echo $$(canonicalize_rlocation $$i); done; }}
java-quickstart replace scenarios by DAML Script (#7183) * java-quickstart replace scenarios by DAML Script This replaces the scenarios in the java quickstart project by DAML script test cases. The following changes were required * Replace `getParty` by `allocateParty`. * Replace `create` and `exercise` by `createCmd` and `exerciseCmd`. * Replace the pattern of `submit ... do create ...; exercise ...` by `submit ... do createAndExerciseCmd ... ...`. * Replace instances of `submit ... do fetch ...` by `query ... ...`. To that end I've added the following helper function. ``` queryIou : Party -> ContractId Iou -> Optional Iou ``` changelog_begin changelog_end * Replace queryIou by FetchIou choice changelog_begin changelog_end * Add comment explaining fetch choice Addressing review comment https://github.com/digital-asset/daml/pull/7183#discussion_r478918758 * Support dependencies in daml_test rule Cherry-picked from https://github.com/digital-asset/daml/pull/7264/files Renamed `dependencies` as `deps` to stick to Bazel conventions. * Fix quickstart `daml_test` target * fmt * Quote deps in daml.yaml To avoid issues with `:` in Windows paths. * //docs:quickstart-java - use temp dir This target repeatedly failed to build on Windows with ``` ERROR: D:/a/1/s/docs/BUILD.bazel:538:8: declared output 'docs/quickstart-java.tar.gz' was not created by genrule. This is probably because the genrule actually didn't create this output, or because the output was a directory and the genrule was run remotely (note that only the contents of declared file outputs are copied from genrules run remotely) ``` The genrule was operating in the current working directory and builds on Windows are not sandboxed. Conflicting files in the current working directory could cause this to fail. Co-authored-by: Andreas Herrmann <andreas.herrmann@tweag.io>
2020-08-28 19:19:45 +03:00
DEPS=($$(rlocations {deps}))
DATA_DEPS=($$(rlocations {data_deps}))
JOINED_DATA_DEPS="$$(printf ',"%s"' $${{DATA_DEPS[@]}})"
echo "$$JOINED_DATA_DEPS"
java-quickstart replace scenarios by DAML Script (#7183) * java-quickstart replace scenarios by DAML Script This replaces the scenarios in the java quickstart project by DAML script test cases. The following changes were required * Replace `getParty` by `allocateParty`. * Replace `create` and `exercise` by `createCmd` and `exerciseCmd`. * Replace the pattern of `submit ... do create ...; exercise ...` by `submit ... do createAndExerciseCmd ... ...`. * Replace instances of `submit ... do fetch ...` by `query ... ...`. To that end I've added the following helper function. ``` queryIou : Party -> ContractId Iou -> Optional Iou ``` changelog_begin changelog_end * Replace queryIou by FetchIou choice changelog_begin changelog_end * Add comment explaining fetch choice Addressing review comment https://github.com/digital-asset/daml/pull/7183#discussion_r478918758 * Support dependencies in daml_test rule Cherry-picked from https://github.com/digital-asset/daml/pull/7264/files Renamed `dependencies` as `deps` to stick to Bazel conventions. * Fix quickstart `daml_test` target * fmt * Quote deps in daml.yaml To avoid issues with `:` in Windows paths. * //docs:quickstart-java - use temp dir This target repeatedly failed to build on Windows with ``` ERROR: D:/a/1/s/docs/BUILD.bazel:538:8: declared output 'docs/quickstart-java.tar.gz' was not created by genrule. This is probably because the genrule actually didn't create this output, or because the output was a directory and the genrule was run remotely (note that only the contents of declared file outputs are copied from genrules run remotely) ``` The genrule was operating in the current working directory and builds on Windows are not sandboxed. Conflicting files in the current working directory could cause this to fail. Co-authored-by: Andreas Herrmann <andreas.herrmann@tweag.io>
2020-08-28 19:19:45 +03:00
cat << EOF > $$tmpdir/daml.yaml
build-options: [{target}]
java-quickstart replace scenarios by DAML Script (#7183) * java-quickstart replace scenarios by DAML Script This replaces the scenarios in the java quickstart project by DAML script test cases. The following changes were required * Replace `getParty` by `allocateParty`. * Replace `create` and `exercise` by `createCmd` and `exerciseCmd`. * Replace the pattern of `submit ... do create ...; exercise ...` by `submit ... do createAndExerciseCmd ... ...`. * Replace instances of `submit ... do fetch ...` by `query ... ...`. To that end I've added the following helper function. ``` queryIou : Party -> ContractId Iou -> Optional Iou ``` changelog_begin changelog_end * Replace queryIou by FetchIou choice changelog_begin changelog_end * Add comment explaining fetch choice Addressing review comment https://github.com/digital-asset/daml/pull/7183#discussion_r478918758 * Support dependencies in daml_test rule Cherry-picked from https://github.com/digital-asset/daml/pull/7264/files Renamed `dependencies` as `deps` to stick to Bazel conventions. * Fix quickstart `daml_test` target * fmt * Quote deps in daml.yaml To avoid issues with `:` in Windows paths. * //docs:quickstart-java - use temp dir This target repeatedly failed to build on Windows with ``` ERROR: D:/a/1/s/docs/BUILD.bazel:538:8: declared output 'docs/quickstart-java.tar.gz' was not created by genrule. This is probably because the genrule actually didn't create this output, or because the output was a directory and the genrule was run remotely (note that only the contents of declared file outputs are copied from genrules run remotely) ``` The genrule was operating in the current working directory and builds on Windows are not sandboxed. Conflicting files in the current working directory could cause this to fail. Co-authored-by: Andreas Herrmann <andreas.herrmann@tweag.io>
2020-08-28 19:19:45 +03:00
sdk-version: {sdk_version}
name: test
version: 0.0.1
source: .
dependencies: [daml-stdlib, daml-prim $$([ $${{#DEPS[@]}} -gt 0 ] && printf ',"%s"' $${{DEPS[@]}})]
data-dependencies: [$$([ $${{#DATA_DEPS[@]}} -gt 0 ] && printf '%s' $${{JOINED_DATA_DEPS:1}})]
java-quickstart replace scenarios by DAML Script (#7183) * java-quickstart replace scenarios by DAML Script This replaces the scenarios in the java quickstart project by DAML script test cases. The following changes were required * Replace `getParty` by `allocateParty`. * Replace `create` and `exercise` by `createCmd` and `exerciseCmd`. * Replace the pattern of `submit ... do create ...; exercise ...` by `submit ... do createAndExerciseCmd ... ...`. * Replace instances of `submit ... do fetch ...` by `query ... ...`. To that end I've added the following helper function. ``` queryIou : Party -> ContractId Iou -> Optional Iou ``` changelog_begin changelog_end * Replace queryIou by FetchIou choice changelog_begin changelog_end * Add comment explaining fetch choice Addressing review comment https://github.com/digital-asset/daml/pull/7183#discussion_r478918758 * Support dependencies in daml_test rule Cherry-picked from https://github.com/digital-asset/daml/pull/7264/files Renamed `dependencies` as `deps` to stick to Bazel conventions. * Fix quickstart `daml_test` target * fmt * Quote deps in daml.yaml To avoid issues with `:` in Windows paths. * //docs:quickstart-java - use temp dir This target repeatedly failed to build on Windows with ``` ERROR: D:/a/1/s/docs/BUILD.bazel:538:8: declared output 'docs/quickstart-java.tar.gz' was not created by genrule. This is probably because the genrule actually didn't create this output, or because the output was a directory and the genrule was run remotely (note that only the contents of declared file outputs are copied from genrules run remotely) ``` The genrule was operating in the current working directory and builds on Windows are not sandboxed. Conflicting files in the current working directory could cause this to fail. Co-authored-by: Andreas Herrmann <andreas.herrmann@tweag.io>
2020-08-28 19:19:45 +03:00
EOF
cat $$tmpdir/daml.yaml
java-quickstart replace scenarios by DAML Script (#7183) * java-quickstart replace scenarios by DAML Script This replaces the scenarios in the java quickstart project by DAML script test cases. The following changes were required * Replace `getParty` by `allocateParty`. * Replace `create` and `exercise` by `createCmd` and `exerciseCmd`. * Replace the pattern of `submit ... do create ...; exercise ...` by `submit ... do createAndExerciseCmd ... ...`. * Replace instances of `submit ... do fetch ...` by `query ... ...`. To that end I've added the following helper function. ``` queryIou : Party -> ContractId Iou -> Optional Iou ``` changelog_begin changelog_end * Replace queryIou by FetchIou choice changelog_begin changelog_end * Add comment explaining fetch choice Addressing review comment https://github.com/digital-asset/daml/pull/7183#discussion_r478918758 * Support dependencies in daml_test rule Cherry-picked from https://github.com/digital-asset/daml/pull/7264/files Renamed `dependencies` as `deps` to stick to Bazel conventions. * Fix quickstart `daml_test` target * fmt * Quote deps in daml.yaml To avoid issues with `:` in Windows paths. * //docs:quickstart-java - use temp dir This target repeatedly failed to build on Windows with ``` ERROR: D:/a/1/s/docs/BUILD.bazel:538:8: declared output 'docs/quickstart-java.tar.gz' was not created by genrule. This is probably because the genrule actually didn't create this output, or because the output was a directory and the genrule was run remotely (note that only the contents of declared file outputs are copied from genrules run remotely) ``` The genrule was operating in the current working directory and builds on Windows are not sandboxed. Conflicting files in the current working directory could cause this to fail. Co-authored-by: Andreas Herrmann <andreas.herrmann@tweag.io>
2020-08-28 19:19:45 +03:00
{cp_srcs}
cd $$tmpdir
$$DAMLC test --files {files}
Update Bazel 2.1.0 --> 3.3.1 (#6761) * Upgrade nixpkgs revision * Remove unused minio It used to be used as a gateway to push the Nix cache to GCS, but has since been replaced by nix-store-gcs-proxy. * Update Bazel on Windows changelog_begin changelog_end * Fix hlint warnings The nixpkgs update implied an hlint update which enabled new warnings. * Fix "Error applying patch" Since Bazel 2.2.0 the order of generating `WORKSPACE` and `BUILD` files and applying patches has been reversed. The allows users to define patches to these files that will not be immediately overwritten. However, it also means that patches on another repository's original `WORKSPACE` file will likely become invalid. * https://github.com/bazelbuild/bazel/commit/a948eb7255b8418f0bba1c819a58972066577d6f * https://github.com/bazelbuild/bazel/issues/10681 Hint: If you're generating a patch with `git` then you can use the following command to exclude the `WORKSPACE` file. ``` git diff ':(exclude)WORKSPACE' ``` * Update rules_nixpkgs * nixpkgs location expansion escaping * Drop --noincompatible_windows_native_test_wrapper * client_server_test using sh_inline_test client_server_test used to produce an executable shell script in form of a text file output. However, since the removal of `--noincompatible_windows_native_test_wrapper` this no longer works on Windows since `.sh` files are not directly executable on Windows. This change fixes the issue by producing the script file in a dedicated rule and then wrapping it in a `sh_test` rule which also works on Windows. * daml_test using sh_inline_test * daml_doc_test using sh_inline_test * _daml_validate_test using sh_inline_test * damlc_compile_test using sh_inline_test * client_server_test find .exe on Windows * Bump Windows cache for Bazel update Remove `clean --expunge` after merge. Co-authored-by: Andreas Herrmann <andreas.herrmann@tweag.io>
2020-07-23 10:46:04 +03:00
""".format(
damlc = damlc,
files = " ".join(["$(rootpaths %s)" % src for src in srcs]),
java-quickstart replace scenarios by DAML Script (#7183) * java-quickstart replace scenarios by DAML Script This replaces the scenarios in the java quickstart project by DAML script test cases. The following changes were required * Replace `getParty` by `allocateParty`. * Replace `create` and `exercise` by `createCmd` and `exerciseCmd`. * Replace the pattern of `submit ... do create ...; exercise ...` by `submit ... do createAndExerciseCmd ... ...`. * Replace instances of `submit ... do fetch ...` by `query ... ...`. To that end I've added the following helper function. ``` queryIou : Party -> ContractId Iou -> Optional Iou ``` changelog_begin changelog_end * Replace queryIou by FetchIou choice changelog_begin changelog_end * Add comment explaining fetch choice Addressing review comment https://github.com/digital-asset/daml/pull/7183#discussion_r478918758 * Support dependencies in daml_test rule Cherry-picked from https://github.com/digital-asset/daml/pull/7264/files Renamed `dependencies` as `deps` to stick to Bazel conventions. * Fix quickstart `daml_test` target * fmt * Quote deps in daml.yaml To avoid issues with `:` in Windows paths. * //docs:quickstart-java - use temp dir This target repeatedly failed to build on Windows with ``` ERROR: D:/a/1/s/docs/BUILD.bazel:538:8: declared output 'docs/quickstart-java.tar.gz' was not created by genrule. This is probably because the genrule actually didn't create this output, or because the output was a directory and the genrule was run remotely (note that only the contents of declared file outputs are copied from genrules run remotely) ``` The genrule was operating in the current working directory and builds on Windows are not sandboxed. Conflicting files in the current working directory could cause this to fail. Co-authored-by: Andreas Herrmann <andreas.herrmann@tweag.io>
2020-08-28 19:19:45 +03:00
sdk_version = sdk_version,
deps = " ".join(["$(rootpaths %s)" % dep for dep in deps]),
data_deps = " ".join(["$(rootpaths %s)" % dep for dep in data_deps]),
java-quickstart replace scenarios by DAML Script (#7183) * java-quickstart replace scenarios by DAML Script This replaces the scenarios in the java quickstart project by DAML script test cases. The following changes were required * Replace `getParty` by `allocateParty`. * Replace `create` and `exercise` by `createCmd` and `exerciseCmd`. * Replace the pattern of `submit ... do create ...; exercise ...` by `submit ... do createAndExerciseCmd ... ...`. * Replace instances of `submit ... do fetch ...` by `query ... ...`. To that end I've added the following helper function. ``` queryIou : Party -> ContractId Iou -> Optional Iou ``` changelog_begin changelog_end * Replace queryIou by FetchIou choice changelog_begin changelog_end * Add comment explaining fetch choice Addressing review comment https://github.com/digital-asset/daml/pull/7183#discussion_r478918758 * Support dependencies in daml_test rule Cherry-picked from https://github.com/digital-asset/daml/pull/7264/files Renamed `dependencies` as `deps` to stick to Bazel conventions. * Fix quickstart `daml_test` target * fmt * Quote deps in daml.yaml To avoid issues with `:` in Windows paths. * //docs:quickstart-java - use temp dir This target repeatedly failed to build on Windows with ``` ERROR: D:/a/1/s/docs/BUILD.bazel:538:8: declared output 'docs/quickstart-java.tar.gz' was not created by genrule. This is probably because the genrule actually didn't create this output, or because the output was a directory and the genrule was run remotely (note that only the contents of declared file outputs are copied from genrules run remotely) ``` The genrule was operating in the current working directory and builds on Windows are not sandboxed. Conflicting files in the current working directory could cause this to fail. Co-authored-by: Andreas Herrmann <andreas.herrmann@tweag.io>
2020-08-28 19:19:45 +03:00
cp_srcs = "\n".join([
"mkdir -p $$(dirname {dest}); cp -f {src} {dest}".format(
src = "$$(canonicalize_rlocation $(rootpath {}))".format(src),
dest = "$$tmpdir/$(rootpath {})".format(src),
)
for src in srcs
]),
target = "--target=" + target if (target) else "",
Update Bazel 2.1.0 --> 3.3.1 (#6761) * Upgrade nixpkgs revision * Remove unused minio It used to be used as a gateway to push the Nix cache to GCS, but has since been replaced by nix-store-gcs-proxy. * Update Bazel on Windows changelog_begin changelog_end * Fix hlint warnings The nixpkgs update implied an hlint update which enabled new warnings. * Fix "Error applying patch" Since Bazel 2.2.0 the order of generating `WORKSPACE` and `BUILD` files and applying patches has been reversed. The allows users to define patches to these files that will not be immediately overwritten. However, it also means that patches on another repository's original `WORKSPACE` file will likely become invalid. * https://github.com/bazelbuild/bazel/commit/a948eb7255b8418f0bba1c819a58972066577d6f * https://github.com/bazelbuild/bazel/issues/10681 Hint: If you're generating a patch with `git` then you can use the following command to exclude the `WORKSPACE` file. ``` git diff ':(exclude)WORKSPACE' ``` * Update rules_nixpkgs * nixpkgs location expansion escaping * Drop --noincompatible_windows_native_test_wrapper * client_server_test using sh_inline_test client_server_test used to produce an executable shell script in form of a text file output. However, since the removal of `--noincompatible_windows_native_test_wrapper` this no longer works on Windows since `.sh` files are not directly executable on Windows. This change fixes the issue by producing the script file in a dedicated rule and then wrapping it in a `sh_test` rule which also works on Windows. * daml_test using sh_inline_test * daml_doc_test using sh_inline_test * _daml_validate_test using sh_inline_test * damlc_compile_test using sh_inline_test * client_server_test find .exe on Windows * Bump Windows cache for Bazel update Remove `clean --expunge` after merge. Co-authored-by: Andreas Herrmann <andreas.herrmann@tweag.io>
2020-07-23 10:46:04 +03:00
),
**kwargs
)
2019-04-04 11:33:38 +03:00
Update Bazel 2.1.0 --> 3.3.1 (#6761) * Upgrade nixpkgs revision * Remove unused minio It used to be used as a gateway to push the Nix cache to GCS, but has since been replaced by nix-store-gcs-proxy. * Update Bazel on Windows changelog_begin changelog_end * Fix hlint warnings The nixpkgs update implied an hlint update which enabled new warnings. * Fix "Error applying patch" Since Bazel 2.2.0 the order of generating `WORKSPACE` and `BUILD` files and applying patches has been reversed. The allows users to define patches to these files that will not be immediately overwritten. However, it also means that patches on another repository's original `WORKSPACE` file will likely become invalid. * https://github.com/bazelbuild/bazel/commit/a948eb7255b8418f0bba1c819a58972066577d6f * https://github.com/bazelbuild/bazel/issues/10681 Hint: If you're generating a patch with `git` then you can use the following command to exclude the `WORKSPACE` file. ``` git diff ':(exclude)WORKSPACE' ``` * Update rules_nixpkgs * nixpkgs location expansion escaping * Drop --noincompatible_windows_native_test_wrapper * client_server_test using sh_inline_test client_server_test used to produce an executable shell script in form of a text file output. However, since the removal of `--noincompatible_windows_native_test_wrapper` this no longer works on Windows since `.sh` files are not directly executable on Windows. This change fixes the issue by producing the script file in a dedicated rule and then wrapping it in a `sh_test` rule which also works on Windows. * daml_test using sh_inline_test * daml_doc_test using sh_inline_test * _daml_validate_test using sh_inline_test * damlc_compile_test using sh_inline_test * client_server_test find .exe on Windows * Bump Windows cache for Bazel update Remove `clean --expunge` after merge. Co-authored-by: Andreas Herrmann <andreas.herrmann@tweag.io>
2020-07-23 10:46:04 +03:00
def daml_doc_test(
name,
package_name,
srcs = [],
ignored_srcs = [],
flags = [],
cpp = "@stackage-exe//hpp",
damlc = "//compiler/damlc:damlc",
Update Bazel 2.1.0 --> 3.3.1 (#6761) * Upgrade nixpkgs revision * Remove unused minio It used to be used as a gateway to push the Nix cache to GCS, but has since been replaced by nix-store-gcs-proxy. * Update Bazel on Windows changelog_begin changelog_end * Fix hlint warnings The nixpkgs update implied an hlint update which enabled new warnings. * Fix "Error applying patch" Since Bazel 2.2.0 the order of generating `WORKSPACE` and `BUILD` files and applying patches has been reversed. The allows users to define patches to these files that will not be immediately overwritten. However, it also means that patches on another repository's original `WORKSPACE` file will likely become invalid. * https://github.com/bazelbuild/bazel/commit/a948eb7255b8418f0bba1c819a58972066577d6f * https://github.com/bazelbuild/bazel/issues/10681 Hint: If you're generating a patch with `git` then you can use the following command to exclude the `WORKSPACE` file. ``` git diff ':(exclude)WORKSPACE' ``` * Update rules_nixpkgs * nixpkgs location expansion escaping * Drop --noincompatible_windows_native_test_wrapper * client_server_test using sh_inline_test client_server_test used to produce an executable shell script in form of a text file output. However, since the removal of `--noincompatible_windows_native_test_wrapper` this no longer works on Windows since `.sh` files are not directly executable on Windows. This change fixes the issue by producing the script file in a dedicated rule and then wrapping it in a `sh_test` rule which also works on Windows. * daml_test using sh_inline_test * daml_doc_test using sh_inline_test * _daml_validate_test using sh_inline_test * damlc_compile_test using sh_inline_test * client_server_test find .exe on Windows * Bump Windows cache for Bazel update Remove `clean --expunge` after merge. Co-authored-by: Andreas Herrmann <andreas.herrmann@tweag.io>
2020-07-23 10:46:04 +03:00
**kwargs):
sh_inline_test(
name = name,
data = [cpp, damlc] + srcs,
cmd = """\
set -eou pipefail
Update Bazel 2.1.0 --> 3.3.1 (#6761) * Upgrade nixpkgs revision * Remove unused minio It used to be used as a gateway to push the Nix cache to GCS, but has since been replaced by nix-store-gcs-proxy. * Update Bazel on Windows changelog_begin changelog_end * Fix hlint warnings The nixpkgs update implied an hlint update which enabled new warnings. * Fix "Error applying patch" Since Bazel 2.2.0 the order of generating `WORKSPACE` and `BUILD` files and applying patches has been reversed. The allows users to define patches to these files that will not be immediately overwritten. However, it also means that patches on another repository's original `WORKSPACE` file will likely become invalid. * https://github.com/bazelbuild/bazel/commit/a948eb7255b8418f0bba1c819a58972066577d6f * https://github.com/bazelbuild/bazel/issues/10681 Hint: If you're generating a patch with `git` then you can use the following command to exclude the `WORKSPACE` file. ``` git diff ':(exclude)WORKSPACE' ``` * Update rules_nixpkgs * nixpkgs location expansion escaping * Drop --noincompatible_windows_native_test_wrapper * client_server_test using sh_inline_test client_server_test used to produce an executable shell script in form of a text file output. However, since the removal of `--noincompatible_windows_native_test_wrapper` this no longer works on Windows since `.sh` files are not directly executable on Windows. This change fixes the issue by producing the script file in a dedicated rule and then wrapping it in a `sh_test` rule which also works on Windows. * daml_test using sh_inline_test * daml_doc_test using sh_inline_test * _daml_validate_test using sh_inline_test * damlc_compile_test using sh_inline_test * client_server_test find .exe on Windows * Bump Windows cache for Bazel update Remove `clean --expunge` after merge. Co-authored-by: Andreas Herrmann <andreas.herrmann@tweag.io>
2020-07-23 10:46:04 +03:00
CPP=$$(canonicalize_rlocation $(rootpath {cpp}))
DAMLC=$$(canonicalize_rlocation $(rootpath {damlc}))
FILES=($$(
for file in {files}; do
IGNORED=false
Update Bazel 2.1.0 --> 3.3.1 (#6761) * Upgrade nixpkgs revision * Remove unused minio It used to be used as a gateway to push the Nix cache to GCS, but has since been replaced by nix-store-gcs-proxy. * Update Bazel on Windows changelog_begin changelog_end * Fix hlint warnings The nixpkgs update implied an hlint update which enabled new warnings. * Fix "Error applying patch" Since Bazel 2.2.0 the order of generating `WORKSPACE` and `BUILD` files and applying patches has been reversed. The allows users to define patches to these files that will not be immediately overwritten. However, it also means that patches on another repository's original `WORKSPACE` file will likely become invalid. * https://github.com/bazelbuild/bazel/commit/a948eb7255b8418f0bba1c819a58972066577d6f * https://github.com/bazelbuild/bazel/issues/10681 Hint: If you're generating a patch with `git` then you can use the following command to exclude the `WORKSPACE` file. ``` git diff ':(exclude)WORKSPACE' ``` * Update rules_nixpkgs * nixpkgs location expansion escaping * Drop --noincompatible_windows_native_test_wrapper * client_server_test using sh_inline_test client_server_test used to produce an executable shell script in form of a text file output. However, since the removal of `--noincompatible_windows_native_test_wrapper` this no longer works on Windows since `.sh` files are not directly executable on Windows. This change fixes the issue by producing the script file in a dedicated rule and then wrapping it in a `sh_test` rule which also works on Windows. * daml_test using sh_inline_test * daml_doc_test using sh_inline_test * _daml_validate_test using sh_inline_test * damlc_compile_test using sh_inline_test * client_server_test find .exe on Windows * Bump Windows cache for Bazel update Remove `clean --expunge` after merge. Co-authored-by: Andreas Herrmann <andreas.herrmann@tweag.io>
2020-07-23 10:46:04 +03:00
for pattern in {ignored}; do
if [[ $$file = *$$pattern ]]; then
IGNORED=true
Update Bazel 2.1.0 --> 3.3.1 (#6761) * Upgrade nixpkgs revision * Remove unused minio It used to be used as a gateway to push the Nix cache to GCS, but has since been replaced by nix-store-gcs-proxy. * Update Bazel on Windows changelog_begin changelog_end * Fix hlint warnings The nixpkgs update implied an hlint update which enabled new warnings. * Fix "Error applying patch" Since Bazel 2.2.0 the order of generating `WORKSPACE` and `BUILD` files and applying patches has been reversed. The allows users to define patches to these files that will not be immediately overwritten. However, it also means that patches on another repository's original `WORKSPACE` file will likely become invalid. * https://github.com/bazelbuild/bazel/commit/a948eb7255b8418f0bba1c819a58972066577d6f * https://github.com/bazelbuild/bazel/issues/10681 Hint: If you're generating a patch with `git` then you can use the following command to exclude the `WORKSPACE` file. ``` git diff ':(exclude)WORKSPACE' ``` * Update rules_nixpkgs * nixpkgs location expansion escaping * Drop --noincompatible_windows_native_test_wrapper * client_server_test using sh_inline_test client_server_test used to produce an executable shell script in form of a text file output. However, since the removal of `--noincompatible_windows_native_test_wrapper` this no longer works on Windows since `.sh` files are not directly executable on Windows. This change fixes the issue by producing the script file in a dedicated rule and then wrapping it in a `sh_test` rule which also works on Windows. * daml_test using sh_inline_test * daml_doc_test using sh_inline_test * _daml_validate_test using sh_inline_test * damlc_compile_test using sh_inline_test * client_server_test find .exe on Windows * Bump Windows cache for Bazel update Remove `clean --expunge` after merge. Co-authored-by: Andreas Herrmann <andreas.herrmann@tweag.io>
2020-07-23 10:46:04 +03:00
continue
fi
done
if [[ $$IGNORED == "false" ]]; then
echo $$(canonicalize_rlocation $$file)
fi
Update Bazel 2.1.0 --> 3.3.1 (#6761) * Upgrade nixpkgs revision * Remove unused minio It used to be used as a gateway to push the Nix cache to GCS, but has since been replaced by nix-store-gcs-proxy. * Update Bazel on Windows changelog_begin changelog_end * Fix hlint warnings The nixpkgs update implied an hlint update which enabled new warnings. * Fix "Error applying patch" Since Bazel 2.2.0 the order of generating `WORKSPACE` and `BUILD` files and applying patches has been reversed. The allows users to define patches to these files that will not be immediately overwritten. However, it also means that patches on another repository's original `WORKSPACE` file will likely become invalid. * https://github.com/bazelbuild/bazel/commit/a948eb7255b8418f0bba1c819a58972066577d6f * https://github.com/bazelbuild/bazel/issues/10681 Hint: If you're generating a patch with `git` then you can use the following command to exclude the `WORKSPACE` file. ``` git diff ':(exclude)WORKSPACE' ``` * Update rules_nixpkgs * nixpkgs location expansion escaping * Drop --noincompatible_windows_native_test_wrapper * client_server_test using sh_inline_test client_server_test used to produce an executable shell script in form of a text file output. However, since the removal of `--noincompatible_windows_native_test_wrapper` this no longer works on Windows since `.sh` files are not directly executable on Windows. This change fixes the issue by producing the script file in a dedicated rule and then wrapping it in a `sh_test` rule which also works on Windows. * daml_test using sh_inline_test * daml_doc_test using sh_inline_test * _daml_validate_test using sh_inline_test * damlc_compile_test using sh_inline_test * client_server_test find .exe on Windows * Bump Windows cache for Bazel update Remove `clean --expunge` after merge. Co-authored-by: Andreas Herrmann <andreas.herrmann@tweag.io>
2020-07-23 10:46:04 +03:00
done
))
2019-04-04 11:33:38 +03:00
Update Bazel 2.1.0 --> 3.3.1 (#6761) * Upgrade nixpkgs revision * Remove unused minio It used to be used as a gateway to push the Nix cache to GCS, but has since been replaced by nix-store-gcs-proxy. * Update Bazel on Windows changelog_begin changelog_end * Fix hlint warnings The nixpkgs update implied an hlint update which enabled new warnings. * Fix "Error applying patch" Since Bazel 2.2.0 the order of generating `WORKSPACE` and `BUILD` files and applying patches has been reversed. The allows users to define patches to these files that will not be immediately overwritten. However, it also means that patches on another repository's original `WORKSPACE` file will likely become invalid. * https://github.com/bazelbuild/bazel/commit/a948eb7255b8418f0bba1c819a58972066577d6f * https://github.com/bazelbuild/bazel/issues/10681 Hint: If you're generating a patch with `git` then you can use the following command to exclude the `WORKSPACE` file. ``` git diff ':(exclude)WORKSPACE' ``` * Update rules_nixpkgs * nixpkgs location expansion escaping * Drop --noincompatible_windows_native_test_wrapper * client_server_test using sh_inline_test client_server_test used to produce an executable shell script in form of a text file output. However, since the removal of `--noincompatible_windows_native_test_wrapper` this no longer works on Windows since `.sh` files are not directly executable on Windows. This change fixes the issue by producing the script file in a dedicated rule and then wrapping it in a `sh_test` rule which also works on Windows. * daml_test using sh_inline_test * daml_doc_test using sh_inline_test * _daml_validate_test using sh_inline_test * damlc_compile_test using sh_inline_test * client_server_test find .exe on Windows * Bump Windows cache for Bazel update Remove `clean --expunge` after merge. Co-authored-by: Andreas Herrmann <andreas.herrmann@tweag.io>
2020-07-23 10:46:04 +03:00
$$DAMLC doctest {flags} --cpp $$CPP --package-name {package_name}-{version} "$${{FILES[@]}}"
""".format(
cpp = cpp,
damlc = damlc,
package_name = package_name,
flags = " ".join(flags),
version = ghc_version,
files = " ".join(["$(rootpaths %s)" % src for src in srcs]),
ignored = " ".join(ignored_srcs),
),
Update Bazel 2.1.0 --> 3.3.1 (#6761) * Upgrade nixpkgs revision * Remove unused minio It used to be used as a gateway to push the Nix cache to GCS, but has since been replaced by nix-store-gcs-proxy. * Update Bazel on Windows changelog_begin changelog_end * Fix hlint warnings The nixpkgs update implied an hlint update which enabled new warnings. * Fix "Error applying patch" Since Bazel 2.2.0 the order of generating `WORKSPACE` and `BUILD` files and applying patches has been reversed. The allows users to define patches to these files that will not be immediately overwritten. However, it also means that patches on another repository's original `WORKSPACE` file will likely become invalid. * https://github.com/bazelbuild/bazel/commit/a948eb7255b8418f0bba1c819a58972066577d6f * https://github.com/bazelbuild/bazel/issues/10681 Hint: If you're generating a patch with `git` then you can use the following command to exclude the `WORKSPACE` file. ``` git diff ':(exclude)WORKSPACE' ``` * Update rules_nixpkgs * nixpkgs location expansion escaping * Drop --noincompatible_windows_native_test_wrapper * client_server_test using sh_inline_test client_server_test used to produce an executable shell script in form of a text file output. However, since the removal of `--noincompatible_windows_native_test_wrapper` this no longer works on Windows since `.sh` files are not directly executable on Windows. This change fixes the issue by producing the script file in a dedicated rule and then wrapping it in a `sh_test` rule which also works on Windows. * daml_test using sh_inline_test * daml_doc_test using sh_inline_test * _daml_validate_test using sh_inline_test * damlc_compile_test using sh_inline_test * client_server_test find .exe on Windows * Bump Windows cache for Bazel update Remove `clean --expunge` after merge. Co-authored-by: Andreas Herrmann <andreas.herrmann@tweag.io>
2020-07-23 10:46:04 +03:00
**kwargs
)