From b7e8a2850378cefd0481e90b12b85546e82031a6 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 18 Nov 2024 07:33:41 +0000 Subject: [PATCH 1/8] Update dependency bazel to v7 --- .bazelversion | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.bazelversion b/.bazelversion index f22d756da..815da58b7 100644 --- a/.bazelversion +++ b/.bazelversion @@ -1 +1 @@ -6.5.0 +7.4.1 From 910641c2478c9e9cebee04ea1b175096c7f7a747 Mon Sep 17 00:00:00 2001 From: Claudio Bley Date: Mon, 18 Nov 2024 08:39:19 +0100 Subject: [PATCH 2/8] Use Bazel version 7.1.0 by default (this version is currently available in nixpkgs) --- .bazelversion | 2 +- rules_haskell_tests/shell.nix | 2 +- shell.nix | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.bazelversion b/.bazelversion index 815da58b7..a3fcc7121 100644 --- a/.bazelversion +++ b/.bazelversion @@ -1 +1 @@ -7.4.1 +7.1.0 diff --git a/rules_haskell_tests/shell.nix b/rules_haskell_tests/shell.nix index 2bbf21c73..bcfa20b40 100644 --- a/rules_haskell_tests/shell.nix +++ b/rules_haskell_tests/shell.nix @@ -33,7 +33,7 @@ mkShell { file ] ++ lib.optionals docTools [ graphviz python3Packages.sphinx zip unzip ]; - packages = [ bazel_6 ]; + packages = [ bazel_7 ]; shellHook = '' # Add nix config flags to .bazelrc.local. diff --git a/shell.nix b/shell.nix index 1a44395fe..ad9cd863e 100644 --- a/shell.nix +++ b/shell.nix @@ -42,7 +42,7 @@ mkShell { ++ lib.optionals docTools [ graphviz python3Packages.sphinx zip unzip ] ++ lib.optional stdenv.isDarwin macOS-security; - packages = [ bazel_6 ]; + packages = [ bazel_7 ]; shellHook = '' # Add nix config flags to .bazelrc.local. From cc946f5ea06bf2842248c9780f7dd0a4f25bf606 Mon Sep 17 00:00:00 2001 From: Claudio Bley Date: Tue, 19 Nov 2024 15:19:04 +0100 Subject: [PATCH 3/8] Disable sandboxed exclusive tests This Bazel flag's value was flipped to `true` in Bazel 7 and causes some integration tests to fail: //tests/ghcWithPackages_2097:ghc_with_packages_test_nixpkgs_bazel_7 //tests/haskell_module/repl:haskell_module_repl_cross_library_deps_test_nixpkgs_bazel_7 //tests/recompilation:recompilation_test_nixpkgs_bazel_7 //tests/repl-targets:hs_bin_repl_test_nixpkgs_bazel_7 //tests/repl-targets:hs_lib_repl_test_nixpkgs_bazel_6 //tests/repl-targets:hs_lib_repl_test_nixpkgs_bazel_7 //tests/ghcWithPackages_2097:ghc_with_packages_test_bindist_7_1_0 //tests/haskell_module/repl:haskell_module_repl_cross_library_deps_test_bindist_7_1_0 //tests/recompilation:recompilation_test_bindist_7_1_0 //tests/repl-targets:hs_bin_repl_test_bindist_7_1_0 //tests/repl-targets:hs_lib_repl_test_bindist_6_0_0 //tests/repl-targets:hs_lib_repl_test_bindist_6_3_2 //tests/repl-targets:hs_lib_repl_test_bindist_6_5_0 //tests/repl-targets:hs_lib_repl_test_bindist_7_1_0 --- .bazelrc.common | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.bazelrc.common b/.bazelrc.common index 96e8793f2..1fe555b99 100644 --- a/.bazelrc.common +++ b/.bazelrc.common @@ -18,6 +18,10 @@ common --incompatible_require_linker_input_cc_api common --incompatible_disallow_empty_glob=true common --experimental_cc_shared_library +# explicitly disable sandboxing exclusive tests (it was false in Bazel 6, but is true in Bazel 7+) +# (otherise this causes some integration tests to fail) +common --noincompatible_exclusive_test_sandboxed + # test environment does not propagate locales by default some tests reads files # written in UTF8, we need to propagate the correct environment variables, such # as LOCALE_ARCHIVE We also need to setup an utf8 locale From c1919f994a5bc2f96afe4e5776bd171178216cd0 Mon Sep 17 00:00:00 2001 From: Claudio Bley Date: Tue, 19 Nov 2024 15:26:01 +0100 Subject: [PATCH 4/8] Allow passing environment variables to `rules_haskell_integration_test` --- .../integration_testing/rules_haskell_integration_test.bzl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/rules_haskell_tests/tests/integration_testing/rules_haskell_integration_test.bzl b/rules_haskell_tests/tests/integration_testing/rules_haskell_integration_test.bzl index ff07ac97b..e6de61735 100644 --- a/rules_haskell_tests/tests/integration_testing/rules_haskell_integration_test.bzl +++ b/rules_haskell_tests/tests/integration_testing/rules_haskell_integration_test.bzl @@ -16,6 +16,7 @@ def rules_haskell_integration_test( workspace_path, srcs, deps = [], + env = {}, bindist_bazel_versions = SUPPORTED_BAZEL_VERSIONS, nixpkgs_bazel_packages = SUPPORTED_NIXPKGS_BAZEL_PACKAGES, target_compatible_with = [], @@ -34,7 +35,7 @@ def rules_haskell_integration_test( name = "%s_nixpkgs" % name, srcs = srcs, deps = deps, - env = { + env = env | { "NIXPKGS": "1", }, bazel_binaries = nixpkgs_bazel_binaries, @@ -51,6 +52,7 @@ def rules_haskell_integration_test( name = "%s_bindist" % name, srcs = srcs, deps = deps, + env = env, bazel_binaries = bindist_bazel_binaries, workspace_path = workspace_path, rule_files = ["@rules_haskell//:distribution"], From a7f59e536a62314556d48587dbe47a4f426b88ac Mon Sep 17 00:00:00 2001 From: Claudio Bley Date: Tue, 19 Nov 2024 15:26:53 +0100 Subject: [PATCH 5/8] Pass `BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1` to ghc_with_packages_test --- rules_haskell_tests/tests/ghcWithPackages_2097/BUILD.bazel | 3 +++ 1 file changed, 3 insertions(+) diff --git a/rules_haskell_tests/tests/ghcWithPackages_2097/BUILD.bazel b/rules_haskell_tests/tests/ghcWithPackages_2097/BUILD.bazel index 2af31061e..9e4bf1de8 100644 --- a/rules_haskell_tests/tests/ghcWithPackages_2097/BUILD.bazel +++ b/rules_haskell_tests/tests/ghcWithPackages_2097/BUILD.bazel @@ -5,6 +5,9 @@ rules_haskell_integration_test( srcs = ["Test.hs"], # this test is only useful with a nixpkgs based ghc toolchain target_compatible_with = ["@rules_nixpkgs_core//constraints:support_nix"], + env = { + "BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN": "1", + }, workspace_path = "test", ) From 3ead091e3dd5b4f6ff9c47747b83f7c0313447a4 Mon Sep 17 00:00:00 2001 From: Claudio Bley Date: Tue, 19 Nov 2024 16:22:10 +0100 Subject: [PATCH 6/8] Make .ghcide script compatible with Bazel 7 The `--experimental_show_artifacts` flag was removed, so we do not rely on it anymore. --- rules_haskell_tests/.ghcide | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/rules_haskell_tests/.ghcide b/rules_haskell_tests/.ghcide index ceb0cd3de..c40d70560 100755 --- a/rules_haskell_tests/.ghcide +++ b/rules_haskell_tests/.ghcide @@ -1,13 +1,9 @@ #!/usr/bin/env bash set -euo pipefail build_ghcide() { - bazel build //tests/ghcide \ - --experimental_show_artifacts \ - 2>&1 \ - | awk ' - /^>>>/ { print substr($1, 4); next } - { print $0 > "/dev/stderr" } - ' + bazel build //tests/ghcide + outfile=$( bazel cquery --output=files //tests/ghcide ) + echo "$( bazel info execution_root)/${outfile}" } ghcide="$(build_ghcide)" "$ghcide" "$@" From b4d15268785d232b545136b4f8b1abc4af604fa0 Mon Sep 17 00:00:00 2001 From: Claudio Bley Date: Fri, 27 Feb 2026 13:27:06 +0100 Subject: [PATCH 7/8] Also show stdout if command failed Maybe the command output valuable information to it. --- haskell/private/workspace_utils.bzl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/haskell/private/workspace_utils.bzl b/haskell/private/workspace_utils.bzl index 663e98147..7f1df95f4 100644 --- a/haskell/private/workspace_utils.bzl +++ b/haskell/private/workspace_utils.bzl @@ -25,7 +25,7 @@ def execute_or_fail_loudly( ) if exec_result.return_code != 0: arguments = [_as_string(x) for x in arguments] - fail("\n".join(["Command failed: " + " ".join(arguments), exec_result.stderr])) + fail("\n".join(["Command failed: " + " ".join(arguments), "-- STDOUT --", exec_result.stdout, "-- STDERR --", exec_result.stderr])) return exec_result def _as_string(v): From 968db0ce2ccf6d0e5ee434939116a012dc5b8b9b Mon Sep 17 00:00:00 2001 From: Claudio Bley Date: Thu, 11 Jun 2026 10:33:03 +0200 Subject: [PATCH 8/8] Update rules_java to 7.3.1 This is the last version which still supports Bazel 6.x. In bzlmod mode with Bazel 7.1.0 you will actually get rules_java 7.4.0. In workspace mode, we need to upgrade in order to fix "invalid registered toolchain" errors. --- MODULE.bazel | 2 +- haskell/repositories.bzl | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/MODULE.bazel b/MODULE.bazel index 1c5882959..0fa180063 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -9,7 +9,7 @@ bazel_dep( ) bazel_dep( name = "rules_java", - version = "6.1.0", + version = "7.3.1", ) bazel_dep( name = "rules_license", diff --git a/haskell/repositories.bzl b/haskell/repositories.bzl index 55c0858c0..d378bd194 100644 --- a/haskell/repositories.bzl +++ b/haskell/repositories.bzl @@ -76,10 +76,10 @@ def rules_haskell_dependencies(): maybe( http_archive, name = "rules_java", - sha256 = "29ba147c583aaf5d211686029842c5278e12aaea86f66bd4a9eb5e525b7f2701", urls = [ - "https://github.com/bazelbuild/rules_java/releases/download/6.3.0/rules_java-6.3.0.tar.gz", + "https://github.com/bazelbuild/rules_java/releases/download/7.3.1/rules_java-7.3.1.tar.gz", ], + integrity = "sha256-QBjpfJP5doDxZQ/9KnUwJFuGSsVD/ST66MArpEfLKGQ=", ) maybe(