Skip to content

Commit 027fce1

Browse files
authored
Merge branch 'master' into renovate/gazelle-0.x
2 parents 7fb33f5 + a5188b6 commit 027fce1

File tree

34 files changed

+3209
-498
lines changed

34 files changed

+3209
-498
lines changed

.bazelci/presubmit.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ tasks:
99
ubuntu1804:
1010
bazel: ${{ bazel }}
1111
working_directory: ${{ workdir }}
12-
platform: "ubuntu1804"
12+
platform: "ubuntu2204"
1313
environment:
1414
# haskell base uses the environment locale to decode sockets
1515
LANG: "C.UTF-8"

.bcr/presubmit.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
matrix:
22
platform:
33
- debian10
4-
- ubuntu2004
4+
- ubuntu2404
55
- macos
66
- macos_arm64
77
# disable Windows for now, it fails with
@@ -19,7 +19,7 @@ tasks:
1919
- |
2020
if apt --version >/dev/null 2>/dev/null; then
2121
sudo apt update
22-
sudo apt install --no-install-recommends -yy libtinfo5 libgmp-dev
22+
sudo apt install --no-install-recommends -yy libgmp-dev
2323
fi
2424
- |
2525
if xcodebuild -version; then

.github/actions/free_disk_space_on_linux/action.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ runs:
99
run: |-
1010
sudo swapoff -a
1111
sudo rm -rf /swapfile /usr/share/dotnet /usr/local/lib/android /opt/ghc "$ANDROID_HOME" /usr/local/.ghcup /usr/local/share/powershell /opt/az /opt/microsoft /etc/skel
12-
docker rmi $(docker images -q) -f
12+
docker images -q | xargs -r docker rmi -f

.github/extract_from_ghc_bindist.py

+22-14
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,36 @@
11
import json
22
import os
33
import sys
4+
from packaging import version
45

5-
current_dir = os.path.dirname(__file__)
6-
haskell_dir = os.path.join(current_dir, "..", "haskell")
76

7+
def get_latest_versions(version_list):
8+
# Create a dictionary to store the latest version for each major.minor pair
9+
latest_versions = {}
10+
11+
for ver in version_list:
12+
# Split the version into major, minor, and patch
13+
major, minor, patch = map(int, ver.split('.'))
14+
15+
# Create a key for the major.minor pair
16+
key = f"{major}.{minor}"
17+
18+
# If the key is not in the dictionary or the current version is greater than the stored version
19+
if key not in latest_versions or version.parse(ver) > version.parse(latest_versions[key]):
20+
# Update the dictionary with the latest version
21+
latest_versions[key] = ver
822

9-
def unexpected(unexpected, l, error_message):
10-
for a in unexpected:
11-
if a in l:
12-
print(error_message, file=sys.stderr)
13-
list.remove(a)
23+
# Return the latest versions
24+
return list(latest_versions.values())
1425

1526

27+
current_dir = os.path.dirname(__file__)
28+
haskell_dir = os.path.join(current_dir, "..", "haskell")
29+
1630
with open(
1731
os.path.join(haskell_dir, "private", "ghc_bindist_generated.json"), mode="rb"
1832
) as f:
19-
version_numbers = list(json.load(f).keys())
20-
21-
unexpected(
22-
["8.10.1", "8.10.2"],
23-
version_numbers,
24-
"GHC 8.10.1 and 8.10.2 not supported. Upgrade to 8.10.3 or later.",
25-
)
33+
version_numbers = get_latest_versions(json.load(f).keys())
2634

2735
with open(os.environ["GITHUB_OUTPUT"], mode="a", encoding="utf-8") as output:
2836
output.write("ghc-matrix={}\n".format(version_numbers))

.github/workflows/patch-test.yaml

+6-8
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ env:
1313
jobs:
1414
find-ghc-version:
1515
name: Find GHC versions for which a bindist is provided
16-
runs-on: ubuntu-22.04
16+
runs-on: ubuntu-24.04
1717
outputs:
1818
ghc-matrix: ${{ steps.set-ghc-versions.outputs.ghc-matrix }}
1919
steps:
@@ -30,16 +30,10 @@ jobs:
3030
strategy:
3131
fail-fast: false
3232
matrix:
33-
os: [ubuntu-22.04, macos-13, windows-latest]
33+
os: [ubuntu-24.04, macos-13, windows-2022]
3434
ghc-version: ${{ fromJSON(needs.find-ghc-version.outputs.ghc-matrix) }}
3535
runs-on: ${{ matrix.os }}
3636
steps:
37-
- name: Install required packages
38-
run: |
39-
sudo apt-get update
40-
sudo apt-get install --no-install-recommends -yy libtinfo5
41-
sudo apt-get clean
42-
if: ${{ matrix.os == 'ubuntu-22.04' }}
4337
- uses: actions/checkout@v4
4438
- name: Mount Bazel cache
4539
uses: actions/cache@v4
@@ -68,6 +62,10 @@ jobs:
6862
machine api.github.com
6963
password ${{ secrets.GITHUB_TOKEN }}
7064
EOF
65+
- uses: ./.github/actions/install_apt_pkgs
66+
with:
67+
# some old ghc distributions require libnuma, see https://gitlab.haskell.org/ghc/ghc/-/issues/15688
68+
packages: libnuma-dev
7169
- name: Build & test
7270
shell: bash
7371
run: |

.github/workflows/prepare-release.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ permissions:
1515
jobs:
1616
release:
1717
name: Prepare Release
18-
runs-on: ubuntu-22.04
18+
runs-on: ubuntu-24.04
1919
steps:
2020
- name: Check version
2121
run: |

.github/workflows/publish.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88
jobs:
99
webpage:
1010
name: Update webpage
11-
runs-on: ubuntu-22.04
11+
runs-on: ubuntu-24.04
1212
steps:
1313
- name: Checkout
1414
uses: actions/checkout@v4

.github/workflows/update-ghc.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
jobs:
88
update_ghc:
99
name: GHC ${{ matrix.ghc }} Update
10-
runs-on: ubuntu-22.04
10+
runs-on: ubuntu-24.04
1111
strategy:
1212
fail-fast: false
1313
matrix:

.github/workflows/workflow.yaml

+7-13
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ concurrency:
1818
jobs:
1919
lint:
2020
name: Format & Lint
21-
runs-on: ubuntu-22.04
21+
runs-on: ubuntu-24.04
2222
steps:
2323
- uses: actions/checkout@v4
2424
- uses: tweag/configure-bazel-remote-cache-auth@v0
@@ -43,7 +43,7 @@ jobs:
4343
strategy:
4444
fail-fast: false
4545
matrix:
46-
os: [ubuntu-22.04, macos-13]
46+
os: [ubuntu-24.04, macos-13]
4747
module: [rules_haskell, rules_haskell_nix, rules_haskell_tests]
4848
bzlmod: [true, false]
4949
ghc:
@@ -139,7 +139,7 @@ jobs:
139139
strategy:
140140
fail-fast: false
141141
matrix:
142-
os: [ubuntu-22.04, macos-13, windows-latest]
142+
os: [ubuntu-24.04, macos-13, windows-2022]
143143
module: [rules_haskell, rules_haskell_tests]
144144
bzlmod: [true, false]
145145
ghc:
@@ -155,18 +155,15 @@ jobs:
155155
bzlmod: true
156156
# currently proto-lens-protoc (read: protoc-gen-haskell) fails with an access violation on Windows
157157
- ghc: 9.6.5
158-
os: windows-latest
158+
os: windows-2022
159159
- ghc: 9.8.2
160-
os: windows-latest
160+
os: windows-2022
161161
env:
162162
GHC_VERSION: ${{ matrix.ghc }}
163163
runs-on: ${{ matrix.os }}
164164
steps:
165165
- uses: actions/checkout@v4
166166
- uses: ./.github/actions/free_disk_space_on_linux
167-
- uses: ./.github/actions/install_apt_pkgs
168-
with:
169-
packages: libtinfo5
170167
- name: Mount Bazel cache
171168
uses: actions/cache@v4
172169
with:
@@ -257,7 +254,7 @@ jobs:
257254
strategy:
258255
fail-fast: false
259256
matrix:
260-
os: [ubuntu-22.04, macos-13, macos-14, windows-latest]
257+
os: [ubuntu-24.04, macos-13, macos-14, windows-latest]
261258
bzlmod: [true, false]
262259
bazel:
263260
- "6.x"
@@ -272,9 +269,6 @@ jobs:
272269
steps:
273270
- uses: actions/checkout@v4
274271
- uses: ./.github/actions/free_disk_space_on_linux
275-
- uses: ./.github/actions/install_apt_pkgs
276-
with:
277-
packages: libtinfo5
278272
- name: Mount Bazel cache
279273
uses: actions/cache@v4
280274
with:
@@ -332,7 +326,7 @@ jobs:
332326
bazelisk build "//..."
333327
334328
all_ci_tests:
335-
runs-on: ubuntu-22.04
329+
runs-on: ubuntu-24.04
336330
needs:
337331
- lint
338332
- examples-bindist

MODULE.bazel

+5-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,11 @@ haskell_toolchains = use_extension(
7979
"@rules_haskell//extensions:haskell_toolchains.bzl",
8080
"haskell_toolchains",
8181
)
82-
haskell_toolchains.bindists()
82+
haskell_toolchains.bindists(
83+
dist = {
84+
"linux_amd64": "deb10",
85+
},
86+
)
8387
use_repo(
8488
haskell_toolchains,
8589
"all_bindist_toolchains",

WORKSPACE

+6-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,12 @@ load(
6767
)
6868
load("@rules_haskell_ghc_version//:ghc_version.bzl", "GHC_VERSION")
6969

70-
haskell_register_ghc_bindists(version = GHC_VERSION)
70+
haskell_register_ghc_bindists(
71+
dist = {
72+
"linux_amd64": "deb10",
73+
},
74+
version = GHC_VERSION,
75+
)
7176

7277
load("@os_info//:os_info.bzl", "is_nix_shell", "is_windows")
7378
load(

docs/haskell-use-cases.rst

+8
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,17 @@ toolchain resolution based on the target platform)::
5454
)
5555

5656
rules_haskell_toolchains(
57+
dist = {
58+
"<arch>": "abc", # Select a concrete dist available for the <arch>
59+
},
60+
variant = {
61+
"<arch>": "abc", # Select a concrete variant available for the <arch> and <dist>
62+
}
5763
version = "X.Y.Z", # Any GHC version
5864
)
5965

66+
*Note*: if no `dist` attribute is specified, we pick a Debian based binary
67+
distribution on Linux by default.
6068

6169
The compiler can also be pulled from Nixpkgs_, a set of package
6270
definitions for the `Nix package manager`_. Pulling the compiler from

docs/haskell.rst

+6-3
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,17 @@ On a Unix system you will need the following tools installed.
3030
* ``gcc``
3131
* ``libffi``
3232
* ``libgmp``
33-
* ``libtinfo5``
33+
* ``libtinfo6``
3434
* ``make``
35-
* ``python3`` (``python`` also needs to be available in ``$PATH``. Depending on your distribution, this might require installing the ``python`` meta-package, which might use Python 2 or 3, ``rules_haskell`` works with both.)
35+
* ``python3``
3636
* JDK (e.g., OpenJDK 8 or 11)
3737

3838
On Ubuntu you can obtain them by installing the following packages. ::
3939

40-
build-essential libffi-dev libgmp-dev libtinfo5 libtinfo-dev python python3 openjdk-11-jdk
40+
build-essential libffi-dev libgmp-dev libtinfo6 libtinfo-dev python3 openjdk-11-jdk
41+
42+
*Note*: on older Unix systems, with older GHC versions you might need to install
43+
``libtinfo5`` instead of ``libtinfo6`` and ``libnuma-dev`` additionally.
4144

4245
On Windows you will need.
4346

examples/WORKSPACE

+6-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,12 @@ haskell_register_ghc_nixpkgs(
2626

2727
load("@rules_haskell//haskell:toolchain.bzl", "rules_haskell_toolchains")
2828

29-
rules_haskell_toolchains(version = GHC_VERSION)
29+
rules_haskell_toolchains(
30+
dist = {
31+
"linux_amd64": "deb10",
32+
},
33+
version = GHC_VERSION,
34+
)
3035

3136
load("@rules_nixpkgs_cc//:cc.bzl", "nixpkgs_cc_configure")
3237
load("@rules_nixpkgs_python//:python.bzl", "nixpkgs_python_configure")

extensions/haskell_toolchains.bzl

+16
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ _bindists_tag = tag_class(
1414
"version": attr.string(
1515
doc = "[see rules_haskell_toolchains](toolchain.html#rules_haskell_toolchains-version)",
1616
),
17+
"dist": attr.string_dict(
18+
doc = "Select a specific `dist` of a GHC binary tarball (e.g. deb10, alpine312) for a platform",
19+
),
20+
"variant": attr.string_dict(
21+
doc = "Select a specific `variant` of a GHC binary tarball (e.g. dwarf, native_int) for a platform",
22+
),
1723
"ghcopts": attr.string_list(
1824
doc = "[see rules_haskell_toolchains](toolchain.html#rules_haskell_toolchains-ghcopts)",
1925
),
@@ -41,6 +47,12 @@ _bindist_tag = tag_class(
4147
mandatory = True,
4248
doc = "The desired GHC version",
4349
),
50+
"dist": attr.string_dict(
51+
doc = "Select a specific `dist` of a GHC binary tarball (e.g. deb10, alpine312) for a platform",
52+
),
53+
"variant": attr.string_dict(
54+
doc = "Select a specific `variant` of a GHC binary tarball (e.g. dwarf, native_int) for a platform",
55+
),
4456
"target": attr.string(
4557
mandatory = True,
4658
doc = "The desired architecture (See [ghc_bindist_generated.json](https://github.com/tweag/rules_haskell/blob/master/haskell/private/ghc_bindist_generated.json))",
@@ -118,6 +130,8 @@ def _haskell_toolchains_impl(mctx):
118130
bindist_targets.append(bindist_tag.target)
119131
ghc_bindist(
120132
name = name,
133+
dist = bindist_tag.dist,
134+
variant = bindist_tag.variant,
121135
version = bindist_tag.version,
122136
target = bindist_tag.target,
123137
ghcopts = bindist_tag.ghcopts,
@@ -152,6 +166,8 @@ def _haskell_toolchains_impl(mctx):
152166
targets = bindist_info_for_version(mctx, bindists_tag.version).keys()
153167

154168
haskell_register_ghc_bindists(
169+
dist = bindists_tag.dist,
170+
variant = bindists_tag.variant,
155171
version = bindists_tag.version,
156172
ghcopts = bindists_tag.ghcopts,
157173
haddock_flags = bindists_tag.haddock_flags,

0 commit comments

Comments
 (0)