Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions haskell/tests/mingw_cc/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
load("@bazel_skylib//rules:build_test.bzl", "build_test")

# Keep these loads in sync with _MINGW_CC_LOADS in haskell/toolchain/repos.bzl.
# Only the Windows GHC repo uses them, so this package loads them on every host.
load("@rules_cc//cc/toolchains:cc_toolchain.bzl", "cc_toolchain")
load("@rules_dx//quality:fixtures.bzl", "real_source_target")
load("@rules_haskell//haskell:cc_toolchain_config.bzl", "cc_toolchain_config")

filegroup(name = "empty")

cc_toolchain_config(
name = "config",
is_clang = True,
)

cc_toolchain(
name = "toolchain",
all_files = ":empty",
ar_files = ":empty",
as_files = ":empty",
compiler_files = ":empty",
dwp_files = ":empty",
linker_files = ":empty",
objcopy_files = ":empty",
strip_files = ":empty",
supports_param_files = 0,
toolchain_config = ":config",
toolchain_identifier = "mingw_cc_test",
)

build_test(
name = "mingw_cc_test",
targets = [
":config",
":toolchain",
],
)

real_source_target(
name = "corpus_starlark",
testonly = True,
starlark_srcs = ["BUILD.bazel"],
tags = ["corpus"],
)
3 changes: 2 additions & 1 deletion haskell/toolchain/repos.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ filegroup(

# The bundled mingw clang as a C toolchain. Only the hub's gated toolchain()
# entries select it. Loads sit at the top of the generated file.
_MINGW_CC_LOADS = """load("@rules_cc//cc:cc_toolchain.bzl", "cc_toolchain")
_MINGW_CC_LOADS = """load("@rules_cc//cc/toolchains:cc_toolchain.bzl", "cc_toolchain")
load("@rules_haskell//haskell:cc_toolchain_config.bzl", "cc_toolchain_config")
"""

Expand Down Expand Up @@ -606,6 +606,7 @@ def _haskell_impl(mctx):
Label("//patches/rules_haskell:hermetic_haskell.patch"),
Label("//patches/rules_haskell:cabal_rules.patch"),
Label("//patches/rules_haskell:toolchain_type_alias.patch"),
Label("//patches/rules_haskell:cc_toolchain_config_info.patch"),
],
sha256 = RULES_HASKELL_SHA256,
strip_prefix = "rules_haskell-" + RULES_HASKELL_COMMIT,
Expand Down
1 change: 1 addition & 0 deletions patches/rules_haskell/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ load("@rules_dx//quality:fixtures.bzl", "real_source_target")

exports_files([
"cabal_rules.patch",
"cc_toolchain_config_info.patch",
"coverage_wrapper_no_report.patch",
"hermetic_haskell.patch",
"toolchain_type_alias.patch",
Expand Down
13 changes: 13 additions & 0 deletions patches/rules_haskell/cc_toolchain_config_info.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Load CcToolchainConfigInfo from rules_cc; the native global is None under Bazel 9.
Upstream: https://github.com/tweag/rules_haskell/issues/2483, https://github.com/tweag/rules_haskell/pull/2484

--- a/haskell/cc_toolchain_config.bzl
+++ b/haskell/cc_toolchain_config.bzl
@@ -11,6 +11,7 @@
"tool_path",
)
load("@rules_cc//cc:defs.bzl", "cc_common")
+load("@rules_cc//cc/toolchains:cc_toolchain_config_info.bzl", "CcToolchainConfigInfo")

def _impl(ctx):
tool_paths = [
Loading