Skip to content

Commit 8d1ec79

Browse files
authored
Merge pull request #2370 from tweag/automation/update-ghc-9.14
* add GHC 9.14 and configure stack snapshots per supported version in start script * fix problem with newer clang cc toolchain of 9.14.1 on Windows * use new cabal_flags to toggle haddock generation per cabal (sub-)library
2 parents 727b417 + eb57d95 commit 8d1ec79

File tree

10 files changed

+195
-22
lines changed

10 files changed

+195
-22
lines changed

.github/actions/install_apt_pkgs/action.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ description: Install packages via apt-get install.
33

44
inputs:
55
packages:
6-
type: string
76
description: A space-separated list of apt packages to install.
7+
required: true
88

99
runs:
1010
using: composite

.github/actions/set_tcp_keepalive_time/action.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ description: Avoids deadline exceeded errors on Linux.
66

77
inputs:
88
tcp_keepalive_time:
9-
type: number
109
description: The value to be set for the TCP keep-alive time.
1110
default: 60
1211

.github/workflows/patch-test.yaml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,14 @@ jobs:
3232
matrix:
3333
os: [ubuntu-24.04, macos-14, windows-2022]
3434
ghc-version: ${{ fromJSON(needs.find-ghc-version.outputs.ghc-matrix) }}
35+
exclude:
36+
# older GHC versions require the LLVM backend on darwin-arm64,
37+
# which does not work out of the box
38+
- ghc-version: 8.10.7
39+
os: macos-14
40+
- ghc-version: 9.0.2
41+
os: macos-14
42+
3543
runs-on: ${{ matrix.os }}
3644
steps:
3745
- uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1
@@ -68,7 +76,7 @@ jobs:
6876
packages: libnuma-dev
6977
- name: Build & test
7078
shell: bash
71-
run: |
72-
export GHC_VERSION=${{ matrix.ghc-version }}
73-
cd rules_haskell_tests
74-
./tests/run-start-script.sh --use-bindists
79+
env:
80+
GHC_VERSION: ${{ matrix.ghc-version }}
81+
working-directory: rules_haskell_tests
82+
run: ./tests/run-start-script.sh --use-bindists

haskell/cabal.bzl

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -431,10 +431,12 @@ def _haskell_cabal_args_impl(ctx):
431431
is_empty = ctx.attr.is_empty
432432
ignore_setup = ctx.attr.ignore_setup
433433
static_binary = ctx.attr.static_binary
434+
with_haddock = ctx.attr.with_haddock
434435
cabal_args = HaskellCabalArgsInfo(
435436
is_empty = is_empty,
436437
ignore_setup = ignore_setup,
437438
static_binary = static_binary,
439+
with_haddock = with_haddock,
438440
)
439441
return [cabal_args]
440442

@@ -456,6 +458,11 @@ haskell_cabal_args = rule(
456458
defaults to True. Some programs (like haskell-language-server) require dynamic linking
457459
for certain functionality.""",
458460
),
461+
"with_haddock": attr.bool(
462+
default = True,
463+
doc = """Whether to build haddock docs for Haskell modules. Some components do not contain
464+
Haskell code and no haddock output will be generated.""",
465+
),
459466
},
460467
provides = [HaskellCabalArgsInfo],
461468
)
@@ -472,9 +479,13 @@ def _haskell_cabal_library_impl(ctx):
472479

473480
is_empty = False
474481
ignore_setup = False
482+
with_haddock = hs.tools_config.supports_haddock
475483
if ctx.attr.cabal_args:
476-
is_empty = ctx.attr.cabal_args[HaskellCabalArgsInfo].is_empty
477-
ignore_setup = ctx.attr.cabal_args[HaskellCabalArgsInfo].ignore_setup
484+
cabal_args = ctx.attr.cabal_args[HaskellCabalArgsInfo]
485+
486+
is_empty = cabal_args.is_empty
487+
ignore_setup = cabal_args.ignore_setup
488+
with_haddock = with_haddock and not is_empty and cabal_args.with_haddock
478489

479490
# All C and Haskell library dependencies.
480491
cc_info = cc_common.merge_cc_infos(
@@ -516,7 +527,6 @@ def _haskell_cabal_library_impl(ctx):
516527
"_install/{}_data".format(package_id),
517528
sibling = cabal,
518529
)
519-
with_haddock = ctx.attr.haddock and hs.tools_config.supports_haddock and not is_empty
520530
if with_haddock:
521531
haddock_file = hs.actions.declare_file(
522532
"_install/{}_haddock/{}.haddock".format(package_id, package_name),
@@ -1195,8 +1205,10 @@ _default_components_args = {
11951205
"fail:lib:fail": "@rules_haskell//haskell/cabal:empty_library",
11961206
"ghc-byteorder:lib:ghc-byteorder": "@rules_haskell//haskell/cabal:empty_library",
11971207
"haskell-gi-overloading:lib:haskell-gi-overloading": "@rules_haskell//haskell/cabal:empty_library",
1208+
"libyaml-clib:lib:libyaml-clib": "@rules_haskell//haskell/cabal:without_haddock",
11981209
"mtl-compat:lib:mtl-compat": "@rules_haskell//haskell/cabal:empty_library",
11991210
"nats:lib:nats": "@rules_haskell//haskell/cabal:empty_library",
1211+
"zlib-clib:lib:zlib-clib": "@rules_haskell//haskell/cabal:without_haddock",
12001212
}
12011213

12021214
def _get_components(components, package):

haskell/cabal/BUILD.bazel

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,9 @@ haskell_cabal_args(
1717
static_binary = False,
1818
visibility = ["//visibility:public"],
1919
)
20+
21+
haskell_cabal_args(
22+
name = "without_haddock",
23+
visibility = ["//visibility:public"],
24+
with_haddock = False,
25+
)

haskell/cc_toolchain_config.bzl

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,25 @@ def _impl(ctx):
8585
),
8686
],
8787
)
88+
no_canonical_paths_feature = feature(
89+
name = "no_canonical_flags",
90+
enabled = True,
91+
flag_sets = [
92+
flag_set(
93+
actions = [
94+
ACTION_NAMES.c_compile,
95+
ACTION_NAMES.cpp_compile,
96+
],
97+
flag_groups = [
98+
flag_group(
99+
flags = [
100+
"-no-canonical-prefixes",
101+
] + ([] if ctx.attr.is_clang else ["-fno-canonical-system-headers"]),
102+
),
103+
],
104+
),
105+
],
106+
)
88107
return cc_common.create_cc_toolchain_config_info(
89108
ctx = ctx,
90109
toolchain_identifier = "ghc_windows_mingw64",
@@ -97,7 +116,7 @@ def _impl(ctx):
97116
abi_libc_version = "local",
98117
tool_paths = tool_paths,
99118
artifact_name_patterns = artifact_name_patterns,
100-
features = [default_link_flags_feature],
119+
features = [default_link_flags_feature, no_canonical_paths_feature],
101120
)
102121

103122
cc_toolchain_config = rule(

haskell/private/ghc_bindist_generated.json

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3421,5 +3421,137 @@
34213421
"variant": "int_native"
34223422
}
34233423
]
3424+
},
3425+
"9.14.1": {
3426+
"darwin_amd64": [
3427+
{
3428+
"dist": "apple",
3429+
"sha256": "404b2ceacb2b2092a2f1d9e8f551a72d0bf34d897c0c7baf3e79ffec837a0b72",
3430+
"url": "https://downloads.haskell.org/~ghc/9.14.1/ghc-9.14.1-x86_64-apple-darwin.tar.xz"
3431+
}
3432+
],
3433+
"darwin_arm64": [
3434+
{
3435+
"dist": "apple",
3436+
"sha256": "841591f152085be605616682779341847d24fd56bd6d22ca61bb37ee32b50681",
3437+
"url": "https://downloads.haskell.org/~ghc/9.14.1/ghc-9.14.1-aarch64-apple-darwin.tar.xz"
3438+
}
3439+
],
3440+
"linux_amd64": [
3441+
{
3442+
"dist": "alpine3_12",
3443+
"sha256": "238ff218098949b9c6be2315b4a288fbdd2edd4cd29a1b6e27117b784c23802f",
3444+
"url": "https://downloads.haskell.org/~ghc/9.14.1/ghc-9.14.1-x86_64-alpine3_12-linux-static.tar.xz",
3445+
"variant": "static"
3446+
},
3447+
{
3448+
"dist": "alpine3_12",
3449+
"sha256": "bb3055242ffb4187851fcfd3483eec14336093fe319cff9cbc435c24397cad35",
3450+
"url": "https://downloads.haskell.org/~ghc/9.14.1/ghc-9.14.1-x86_64-alpine3_12-linux-static-int_native.tar.xz",
3451+
"variant": "static-int_native"
3452+
},
3453+
{
3454+
"dist": "alpine3_22",
3455+
"sha256": "7f082fede580b3c19d6571483993a97ab78c0a121e2200b4247881bb1389dbbe",
3456+
"url": "https://downloads.haskell.org/~ghc/9.14.1/ghc-9.14.1-x86_64-alpine3_22-linux.tar.xz"
3457+
},
3458+
{
3459+
"dist": "deb10",
3460+
"sha256": "c812cbadc685eba6e92778f9de1ebd0f1ea513cdea42db2d487fbd17e88ca3d1",
3461+
"url": "https://downloads.haskell.org/~ghc/9.14.1/ghc-9.14.1-x86_64-deb10-linux.tar.xz"
3462+
},
3463+
{
3464+
"dist": "deb10",
3465+
"sha256": "5909ada8e19bf7320fd5b6d4be63fe2d12acc4d1cbfd3eea7bb3c1e83a117825",
3466+
"url": "https://downloads.haskell.org/~ghc/9.14.1/ghc-9.14.1-x86_64-deb10-linux-dwarf.tar.xz",
3467+
"variant": "dwarf"
3468+
},
3469+
{
3470+
"dist": "deb11",
3471+
"sha256": "98f42ba5b44e50d680434b9d3c7ad51b257678899cf7f806a0c85cf63b6d1095",
3472+
"url": "https://downloads.haskell.org/~ghc/9.14.1/ghc-9.14.1-x86_64-deb11-linux.tar.xz"
3473+
},
3474+
{
3475+
"dist": "deb12",
3476+
"sha256": "60f7ab75f28df892729fbaff3a54f58ee3ad7e731929f1b2f3eb0208f73de841",
3477+
"url": "https://downloads.haskell.org/~ghc/9.14.1/ghc-9.14.1-x86_64-deb12-linux.tar.xz"
3478+
},
3479+
{
3480+
"dist": "deb9",
3481+
"sha256": "4b3afbf7979349efc48ea26810ae747f14b1ea2af954122fc4df0a406a09c68e",
3482+
"url": "https://downloads.haskell.org/~ghc/9.14.1/ghc-9.14.1-x86_64-deb9-linux.tar.xz"
3483+
},
3484+
{
3485+
"dist": "fedora33",
3486+
"sha256": "b92cd3a35d8b5b83d36ddaf99d7a21907b1e18b32d73bc9457bd2a1029e5c66c",
3487+
"url": "https://downloads.haskell.org/~ghc/9.14.1/ghc-9.14.1-x86_64-fedora33-linux.tar.xz"
3488+
},
3489+
{
3490+
"dist": "fedora33",
3491+
"sha256": "d8818120db7fad7e07b578854a139de5a67b149c9588db92c4e49a912e9874a8",
3492+
"url": "https://downloads.haskell.org/~ghc/9.14.1/ghc-9.14.1-x86_64-fedora33-linux-dwarf.tar.xz",
3493+
"variant": "dwarf"
3494+
},
3495+
{
3496+
"dist": "fedora38",
3497+
"sha256": "cd73823eb6747b16393d802bfb7feacfb0e789a4a6f10b7b5a62c6cdbe806e9e",
3498+
"url": "https://downloads.haskell.org/~ghc/9.14.1/ghc-9.14.1-x86_64-fedora38-linux.tar.xz"
3499+
},
3500+
{
3501+
"dist": "rocky8",
3502+
"sha256": "f796b25efc1c02f15ab716d69c655b38faab8b398a8d408ba5ff97f41ff2831a",
3503+
"url": "https://downloads.haskell.org/~ghc/9.14.1/ghc-9.14.1-x86_64-rocky8-linux.tar.xz"
3504+
},
3505+
{
3506+
"dist": "ubuntu18_04",
3507+
"sha256": "0d0897cb7ac4c2502265e44803fc74fb11b0dbfeb6668fc532ddaff304a651a0",
3508+
"url": "https://downloads.haskell.org/~ghc/9.14.1/ghc-9.14.1-x86_64-ubuntu18_04-linux.tar.xz"
3509+
},
3510+
{
3511+
"dist": "ubuntu20_04",
3512+
"sha256": "b75c349730142b345db459423456fe1e5380ae34211ec49ee86182b8908d6423",
3513+
"url": "https://downloads.haskell.org/~ghc/9.14.1/ghc-9.14.1-x86_64-ubuntu20_04-linux.tar.xz"
3514+
},
3515+
{
3516+
"dist": "ubuntu22_04",
3517+
"sha256": "29410b9856dcb47fe5038e69478fbcf96137166ced8a789e566440747c2b9393",
3518+
"url": "https://downloads.haskell.org/~ghc/9.14.1/ghc-9.14.1-x86_64-ubuntu22_04-linux.tar.xz"
3519+
},
3520+
{
3521+
"dist": "ubuntu24_04",
3522+
"sha256": "530f0861d1d7b45476c158a9e68aa89987687aaf9939df7a15995c45726e2344",
3523+
"url": "https://downloads.haskell.org/~ghc/9.14.1/ghc-9.14.1-x86_64-ubuntu24_04-linux.tar.xz"
3524+
}
3525+
],
3526+
"linux_arm64": [
3527+
{
3528+
"dist": "alpine3_22",
3529+
"sha256": "2bdad0992bad9c37cdba8ee8a5a14690b24c325be507b1ae7464510e5be37818",
3530+
"url": "https://downloads.haskell.org/~ghc/9.14.1/ghc-9.14.1-aarch64-alpine3_22-linux.tar.xz"
3531+
},
3532+
{
3533+
"dist": "deb10",
3534+
"sha256": "526c352cceddbf6c580e17ade7e782e3b21b4182d328b2d454c9f13ca7c08992",
3535+
"url": "https://downloads.haskell.org/~ghc/9.14.1/ghc-9.14.1-aarch64-deb10-linux.tar.xz"
3536+
},
3537+
{
3538+
"dist": "deb12",
3539+
"sha256": "6aa27a377451851c851eefdd869e8f5a9217b02ce66c6ca9b418b72efee28427",
3540+
"url": "https://downloads.haskell.org/~ghc/9.14.1/ghc-9.14.1-aarch64-deb12-linux.tar.xz"
3541+
}
3542+
],
3543+
"windows_amd64": [
3544+
{
3545+
"dist": "unknown",
3546+
"sha256": "4914e262a91a9cb65807ec33b3a2adc884894b1dcc33691d820bb9456f2794ba",
3547+
"url": "https://downloads.haskell.org/~ghc/9.14.1/ghc-9.14.1-x86_64-unknown-mingw32.tar.xz"
3548+
},
3549+
{
3550+
"dist": "unknown",
3551+
"sha256": "d0c5a0f8b7ab7c07b0ebdc1a1fa1cd141113cf93680a2fc8c5d6cd2b3f4e263c",
3552+
"url": "https://downloads.haskell.org/~ghc/9.14.1/ghc-9.14.1-x86_64-unknown-mingw32-int_native.tar.xz",
3553+
"variant": "int_native"
3554+
}
3555+
]
34243556
}
34253557
}

haskell/providers.bzl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ HaskellCabalArgsInfo = provider(
4040
"is_empty": "True if this (sub) library is empty, with only re-exports, and no source files of its own.",
4141
"ignore_setup": "True if this package contains a \"Setup.hs\" that isn't a cabal Setup module.",
4242
"static_binary": "True if this package should build a (haskell) static binary. Default is True.",
43+
"with_haddock": "True if haddock docs should be generated.",
4344
},
4445
)
4546

rules_haskell_tests/tests/haskell_cabal_empty_library/BUILD.bazel

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
load("@rules_cc//cc:defs.bzl", "cc_library")
21
load("@rules_haskell//haskell:cabal.bzl",
32
"haskell_cabal_args",
43
"haskell_cabal_library",

start

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -219,8 +219,6 @@ case "${MODE}" in
219219
;;
220220
esac > "${ZLIB_BUILD_FILE}"
221221

222-
WITH_HADDOCK=True
223-
224222
case "$GHC_VERSION" in
225223
8.10.*)
226224
SNAPSHOT=lts-18.28
@@ -235,16 +233,16 @@ case "$GHC_VERSION" in
235233
SNAPSHOT=lts-21.5
236234
;;
237235
9.6.*)
238-
SNAPSHOT=lts-22.22
236+
SNAPSHOT=lts-22.44
237+
;;
238+
9.8.*)
239+
SNAPSHOT=lts-23.28
240+
;;
241+
9.10.*)
242+
SNAPSHOT=lts-24.28
239243
;;
240244
*)
241-
# zlib >= 0.7.1.0 depends on zlib-clib on Windows (unless using pkg-config), since zlib-clib is
242-
# a C only cabal library that does not produce any haddock this results in an error.
243-
# See https://github.com/tweag/rules_haskell/issues/2200
244-
case "$( uname )" in
245-
WindowsNT | MINGW* | MSYS* ) WITH_HADDOCK=False ;;
246-
esac
247-
SNAPSHOT=nightly-2024-05-24
245+
SNAPSHOT=nightly-2026-01-16
248246
stderr "warning: unsupported GHC version: ${GHC_VERSION}, using stack resolver ${SNAPSHOT}"
249247
esac
250248

@@ -299,7 +297,6 @@ stack_snapshot(
299297
300298
# disable calling pkg-config
301299
flags = {"zlib": ["-pkg-config"]},
302-
haddock = $WITH_HADDOCK,
303300
304301
# LTS snapshot published for ghc-${GHC_VERSION} (default version used by rules_haskell)
305302
snapshot = "$SNAPSHOT",

0 commit comments

Comments
 (0)