Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[update] GHC 9.10 #2198

Merged
merged 9 commits into from
May 29, 2024
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
1 change: 0 additions & 1 deletion .github/workflows/patch-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ jobs:
- name: Build & test
shell: bash
run: |
export PATH=$HOME/bazel:$PATH
export GHC_VERSION=${{ matrix.ghc-version }}
cd rules_haskell_tests
./tests/run-start-script.sh --use-bindists
4 changes: 2 additions & 2 deletions haskell/ghc_bindist.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -226,9 +226,9 @@ rm -f
libdir = "lib"
if GHC_BINDIST_LIBDIR.get(version) != None and GHC_BINDIST_LIBDIR[version].get(target) != None:
libdir = GHC_BINDIST_LIBDIR[version][target]
elif os == "darwin" and version_tuple >= (9, 0, 2):
elif os == "darwin" and version_tuple >= (9, 0, 2) and version_tuple < (9, 10, 1):
libdir = "lib/lib"
elif os == "linux" and version_tuple >= (9, 4, 1):
elif os == "linux" and version_tuple >= (9, 4, 1) and version_tuple < (9, 10, 1):
libdir = "lib/lib"

docdir = "doc"
Expand Down
22 changes: 22 additions & 0 deletions haskell/private/ghc_bindist_generated.json
Original file line number Diff line number Diff line change
Expand Up @@ -444,5 +444,27 @@
"https://downloads.haskell.org/~ghc/9.8.2/ghc-9.8.2-x86_64-unknown-mingw32.tar.xz",
"f7d496b850686ea5fbfcecc722ec399ec7acb8d06ebec23bb4dcb9338f430764"
]
},
"9.10.1": {
"linux_amd64": [
"https://downloads.haskell.org/~ghc/9.10.1/ghc-9.10.1-x86_64-deb9-linux.tar.xz",
"5c4fb1c2185320afd6b1efaa155f97e956fa782004ce829fb41879ad0fd1cd14"
],
"linux_arm64": [
"https://downloads.haskell.org/~ghc/9.10.1/ghc-9.10.1-aarch64-deb10-linux.tar.xz",
"e6df50e62b696e3a8b759670fc79207ccc26e88a79a047561ca1ccb8846157dd"
],
"darwin_amd64": [
"https://downloads.haskell.org/~ghc/9.10.1/ghc-9.10.1-x86_64-apple-darwin.tar.xz",
"8cf22188930e10d7ac5270d425e21a3dab606af73a655493639345200c650be9"
],
"darwin_arm64": [
"https://downloads.haskell.org/~ghc/9.10.1/ghc-9.10.1-aarch64-apple-darwin.tar.xz",
"ffaf83b5d7a8b2c04920c6e3909c0be21dde27baf380d095fa27e840a3a2e804"
],
"windows_amd64": [
"https://downloads.haskell.org/~ghc/9.10.1/ghc-9.10.1-x86_64-unknown-mingw32.tar.xz",
"8bac01906ec2fa5c10c730b5ee5b8165654d654dbaf25ba9d3c42f8e26484c6a"
]
}
}
6 changes: 3 additions & 3 deletions haskell/repl.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -486,10 +486,10 @@ def _haskell_repl_impl(ctx):
is_executable = True,
substitutions = {
"%{ENV}": render_env(env),
"%{TOOL}": hs.tools.ghci.path,
"%{TOOL}": hs.tools.ghc.path,
"%{OUTPUT}": paths.dirname(output.path),
"%{ARGS}": "(" + " ".join(
args + [
["--interactive"] + args + [
shell.quote(a)
for a in quote_args
],
Expand All @@ -500,7 +500,7 @@ def _haskell_repl_impl(ctx):
runfiles = [
ctx.runfiles(
files = [
hs.tools.ghci,
hs.tools.ghc,
ghci_repl_script,
],
transitive_files = inputs,
Expand Down
16 changes: 14 additions & 2 deletions haskell/toolchain.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ load(
"HaskellLibraryInfo",
)

_GHC_BINARIES = ["ghc", "ghc-pkg", "hsc2hs", "haddock", "ghci", "runghc", "hpc"]
_GHC_BINARIES = ["ghc", "ghc-pkg", "hsc2hs", "haddock", "runghc", "hpc"]

def _toolchain_library_symlink(dynamic_library):
prefix = dynamic_library.owner.workspace_root.replace("_", "_U").replace("/", "_S")
Expand Down Expand Up @@ -331,7 +331,19 @@ def _haskell_toolchain_impl(ctx):
for tool, asterius_binary in ahc_binaries.items():
tools_struct_args[ASTERIUS_BINARIES[tool]] = asterius_binary
else:
ghc_binaries = _lookup_binaries(_GHC_BINARIES, ctx.files.tools, ctx.attr.version)
ghc_tools = _GHC_BINARIES

# GHC > 9.10 does not install ghci with relocatable = true, add the tool if it is available
if any([file.basename.startswith("ghci") for file in ctx.files.tools]):
ghc_tools = ghc_tools + ["ghci"]
else:
print(
"WARN: ghci binary is not available for {}, `tools.ghci` will not exist on its haskell toolchain".format(
ctx.label.repo_name,
),
)

ghc_binaries = _lookup_binaries(ghc_tools, ctx.files.tools, ctx.attr.version)
tools_struct_args = {
name.replace("-", "_"): file
for name, file in ghc_binaries.items()
Expand Down
2 changes: 2 additions & 0 deletions rules_haskell_tests/non_module_deps_2.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ def repositories(*, bzlmod): # @unused
local_snapshot = "//:stackage_snapshot{}.yaml".format(
"_" + str(GHC_VERSION) if GHC_VERSION else "",
),
# disable calling pkg-config
flags = {"zlib": ["-pkg-config"]},
packages = ["zlib"],
stack_snapshot_json = ("//:stackage-zlib-snapshot{}.json".format(
"_" + str(GHC_VERSION) if GHC_VERSION else "",
Expand Down
5 changes: 5 additions & 0 deletions rules_haskell_tests/tests/run-start-script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ rm -rf $workdir
mkdir $workdir
cd $workdir
cp "$rules_haskell_dir/.bazelversion" .

# specify version for bazelisk via `USE_BAZEL_VERSION`, since it does not read the .bazelversion when there is no WORKSPACE file
USE_BAZEL_VERSION=$( cat .bazelversion )
export USE_BAZEL_VERSION

# arguments are passed on to the start script
"$rules_haskell_dir/start" "$@"

Expand Down
18 changes: 16 additions & 2 deletions start
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ readonly MIN_BAZEL_MAJOR=6
readonly MIN_BAZEL_MINOR=0

readonly MAX_BAZEL_MAJOR=6
readonly MAX_BAZEL_MINOR=4
readonly MAX_BAZEL_MINOR=5

stderr () {
>&2 echo "$*"
Expand Down Expand Up @@ -201,7 +201,7 @@ case "${MODE}" in
;;
esac > "${ZLIB_BUILD_FILE}"

SNAPSHOT=lts-20.3
WITH_HADDOCK=True

case "$GHC_VERSION" in
8.10.*)
Expand All @@ -216,7 +216,17 @@ case "$GHC_VERSION" in
9.4.*)
SNAPSHOT=lts-21.5
;;
9.6.*)
SNAPSHOT=lts-22.22
;;
*)
# zlib >= 0.7.1.0 depends on zlib-clib on Windows (unless using pkg-config), since zlib-clib is
# a C only cabal library that does not produce any haddock this results in an error.
# See https://github.com/tweag/rules_haskell/issues/2200
case "$( uname )" in
WindowsNT | MINGW* | MSYS* ) WITH_HADDOCK=False ;;
esac
SNAPSHOT=nightly-2024-05-24
stderr "warning: unsupported GHC version: ${GHC_VERSION}, using stack resolver ${SNAPSHOT}"
esac

Expand Down Expand Up @@ -269,6 +279,10 @@ stack_snapshot(
extra_deps = {"zlib": ["@zlib.dev//:zlib"]},
packages = ["zlib"],

# disable calling pkg-config
flags = {"zlib": ["-pkg-config"]},
haddock = $WITH_HADDOCK,

# LTS snapshot published for ghc-${GHC_VERSION} (default version used by rules_haskell)
snapshot = "$SNAPSHOT",

Expand Down