Skip to content

Commit

Permalink
Merge pull request #1909 from tweag/ylecornec/incompatible_disable_st…
Browse files Browse the repository at this point in the history
…arlark_host_transitions

Support for --incompatible_disable_starlark_host_transitions
  • Loading branch information
mergify[bot] authored Jun 23, 2023
2 parents 6a0686f + 39659ca commit c6b996b
Show file tree
Hide file tree
Showing 11 changed files with 40 additions and 27 deletions.
2 changes: 1 addition & 1 deletion haskell/c2hs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ _c2hs_toolchain = rule(
mandatory = True,
allow_single_file = True,
executable = True,
cfg = "host",
cfg = "exec",
),
},
)
Expand Down
12 changes: 6 additions & 6 deletions haskell/cabal.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -701,7 +701,7 @@ haskell_cabal_library = rule(
Flags to pass to Haskell compiler, in addition to those defined the cabal file. Subject to Make variable substitution.""",
),
"tools": attr.label_list(
cfg = "host",
cfg = "exec",
allow_files = True,
doc = """Tool dependencies. They are built using the host configuration, since
the tools are executed as part of the build.""",
Expand All @@ -719,12 +719,12 @@ haskell_cabal_library = rule(
),
"_cabal_wrapper": attr.label(
executable = True,
cfg = "host",
cfg = "exec",
default = Label("@rules_haskell//haskell:cabal_wrapper"),
),
"_runghc": attr.label(
executable = True,
cfg = "host",
cfg = "exec",
default = Label("@rules_haskell//haskell:runghc"),
),
"_cc_toolchain": attr.label(
Expand Down Expand Up @@ -940,7 +940,7 @@ haskell_cabal_binary = rule(
Flags to pass to Haskell compiler, in addition to those defined the cabal file. Subject to Make variable substitution.""",
),
"tools": attr.label_list(
cfg = "host",
cfg = "exec",
allow_files = True,
doc = """Tool dependencies. They are built using the host configuration, since
the tools are executed as part of the build.""",
Expand All @@ -958,12 +958,12 @@ haskell_cabal_binary = rule(
),
"_cabal_wrapper": attr.label(
executable = True,
cfg = "host",
cfg = "exec",
default = Label("@rules_haskell//haskell:cabal_wrapper"),
),
"_runghc": attr.label(
executable = True,
cfg = "host",
cfg = "exec",
default = Label("@rules_haskell//haskell:runghc"),
),
"_cc_toolchain": attr.label(
Expand Down
10 changes: 5 additions & 5 deletions haskell/defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ _haskell_common_attrs = {
aspects = [haskell_cc_libraries_aspect],
),
"tools": attr.label_list(
cfg = "host",
cfg = "exec",
allow_files = True,
),
"_ghci_script": attr.label(
Expand All @@ -89,21 +89,21 @@ _haskell_common_attrs = {
),
"_version_macros": attr.label(
executable = True,
cfg = "host",
cfg = "exec",
default = Label("@rules_haskell//haskell:version_macros"),
),
"_cc_toolchain": attr.label(
default = Label("@rules_cc//cc:current_cc_toolchain"),
),
"_ghc_wrapper": attr.label(
executable = True,
cfg = "host",
cfg = "exec",
default = Label("@rules_haskell//haskell:ghc_wrapper"),
),
"worker": attr.label(
default = None,
executable = True,
cfg = "host",
cfg = "exec",
),
}

Expand Down Expand Up @@ -686,7 +686,7 @@ haskell_import = rule(
"haddock_html": attr.label(allow_single_file = True),
"_version_macros": attr.label(
executable = True,
cfg = "host",
cfg = "exec",
default = Label("@rules_haskell//haskell:version_macros"),
),
},
Expand Down
2 changes: 1 addition & 1 deletion haskell/doctest.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ _doctest_toolchain = rule(
attrs = {
"doctest": attr.label(
doc = "Doctest executable",
cfg = "host",
cfg = "exec",
executable = True,
allow_single_file = True,
mandatory = True,
Expand Down
4 changes: 2 additions & 2 deletions haskell/experimental/defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@ _haskell_module = rule(
aspects = [haskell_cc_libraries_aspect],
),
"tools": attr.label_list(
cfg = "host",
cfg = "exec",
allow_files = True,
),
"_cc_toolchain": attr.label(
default = Label("@rules_cc//cc:current_cc_toolchain"),
),
"_ghc_wrapper": attr.label(
executable = True,
cfg = "host",
cfg = "exec",
default = Label("@rules_haskell//haskell:ghc_wrapper"),
),
# TODO[AH] Suppport worker
Expand Down
2 changes: 1 addition & 1 deletion haskell/plugins.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ ghc_plugin = rule(
doc = "Plugin options.",
),
"tools": attr.label_list(
cfg = "host",
cfg = "exec",
doc = "Tools needed by the plugin when enabled.",
),
},
Expand Down
6 changes: 3 additions & 3 deletions haskell/protobuf.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ _haskell_proto_aspect = aspect(
),
"_ghc_wrapper": attr.label(
executable = True,
cfg = "host",
cfg = "exec",
default = Label("@rules_haskell//haskell:ghc_wrapper"),
),
},
Expand Down Expand Up @@ -367,13 +367,13 @@ _protobuf_toolchain = rule(
attrs = {
"protoc": attr.label(
executable = True,
cfg = "host",
cfg = "exec",
allow_single_file = True,
mandatory = True,
),
"plugin": attr.label(
executable = True,
cfg = "host",
cfg = "exec",
allow_single_file = True,
mandatory = True,
),
Expand Down
13 changes: 13 additions & 0 deletions haskell/repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,19 @@ def rules_haskell_dependencies():

rules_haskell_dependencies_bzlmod()

# For --incompatible_disable_starlark_host_transitions support (default in bazel 7)
# Temporarily overrides the rules_licence that comes with bazel to workaround
# https://github.com/bazelbuild/bazel/issues/17032#issuecomment-1548459728
maybe(
http_archive,
name = "rules_license",
sha256 = "4531deccb913639c30e5c7512a054d5d875698daeb75d8cf90f284375fe7c360",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/rules_license/releases/download/0.0.7/rules_license-0.0.7.tar.gz",
"https://github.com/bazelbuild/rules_license/releases/download/0.0.7/rules_license-0.0.7.tar.gz",
],
)

def haskell_repositories():
"""Alias for rules_haskell_dependencies
Expand Down
4 changes: 2 additions & 2 deletions haskell/toolchain.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -370,13 +370,13 @@ common_attrs = {
),
"asterius_binaries": attr.label(),
"_cc_wrapper": attr.label(
cfg = "host",
cfg = "exec",
default = Label("@rules_haskell//haskell:cc_wrapper"),
executable = True,
),
"_protoc": attr.label(
executable = True,
cfg = "host",
cfg = "exec",
default = Label("@com_google_protobuf//:protoc"),
),
"_rule_info_proto": attr.label(
Expand Down
6 changes: 3 additions & 3 deletions non_module_dev_deps.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,9 @@ haskell_cabal_library(
# no modules are provided at the moment for buildifier
http_archive(
name = "com_github_bazelbuild_buildtools",
sha256 = "614c84128ddb86aab4e1f25ba2e027d32fd5c6da302ae30685b9d7973b13da1b",
strip_prefix = "buildtools-4.2.3",
urls = ["https://github.com/bazelbuild/buildtools/archive/4.2.3.tar.gz"],
sha256 = "977a0bd4593c8d4c8f45e056d181c35e48aa01ad4f8090bdb84f78dca42f47dc",
strip_prefix = "buildtools-6.1.2",
urls = ["https://github.com/bazelbuild/buildtools/archive/v6.1.2.tar.gz"],
)

nixpkgs_local_repository(
Expand Down
6 changes: 3 additions & 3 deletions rules_haskell_tests/non_module_deps.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ def repositories(*, bzlmod):
# no modules are provided at the moment for buildifier
http_archive(
name = "com_github_bazelbuild_buildtools",
sha256 = "614c84128ddb86aab4e1f25ba2e027d32fd5c6da302ae30685b9d7973b13da1b",
strip_prefix = "buildtools-4.2.3",
urls = ["https://github.com/bazelbuild/buildtools/archive/4.2.3.tar.gz"],
sha256 = "977a0bd4593c8d4c8f45e056d181c35e48aa01ad4f8090bdb84f78dca42f47dc",
strip_prefix = "buildtools-6.1.2",
urls = ["https://github.com/bazelbuild/buildtools/archive/v6.1.2.tar.gz"],
)

http_archive(
Expand Down

0 comments on commit c6b996b

Please sign in to comment.