Skip to content

Commit a69e21e

Browse files
authored
Merge branch 'master' into cg/fix_status_badge
2 parents 7de5b63 + deeaf7f commit a69e21e

20 files changed

+607
-64
lines changed

.bazelrc.common

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ common:ci-common --color=no
5656

5757
common:ci-common --nolegacy_important_outputs
5858
build:ci-common --experimental_remote_cache_compression
59-
59+
build:ci-common --experimental_remote_build_event_upload=minimal
6060
build:ci-common --loading_phase_threads=1
6161
build:ci-common --verbose_failures
6262
# Make sure we don't rely on the names of convenience symlinks because those

.github/workflows/workflow.yaml

+6
Original file line numberDiff line numberDiff line change
@@ -164,11 +164,17 @@ jobs:
164164
ghc:
165165
- 9.2.8
166166
- 9.4.6
167+
- 9.6.2
167168
exclude:
168169
# TODO: in a MODULE.bazel file we declare version specific dependencies, would need to use stack snapshot json
169170
# and stack config per GHC version
170171
- ghc: 9.4.6
171172
bzlmod: true
173+
- ghc: 9.6.2
174+
bzlmod: true
175+
# currently proto-lens-protoc fails with an access violation on Windows
176+
- ghc: 9.6.2
177+
os: windows-latest
172178
env:
173179
# prevent auto-detection of system compilers on Windows
174180
BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN: ${{ matrix.os == 'windows-latest' && 1 || 0 }}

WORKSPACE

+1-1
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ stack_snapshot(
179179
"proto-lens-runtime",
180180
"lens-family",
181181
],
182-
setup_deps = {
182+
setup_deps = {} if GHC_VERSION and GHC_VERSION.startswith("9.6.") else {
183183
# See https://github.com/tweag/rules_haskell/issues/1871
184184
"HUnit": ["@Cabal//:Cabal"],
185185
"bifunctors": ["@Cabal//:Cabal"],

extensions/rules_haskell_dependencies.bzl

+20-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,20 @@ load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
77
load("@rules_haskell//tools:os_info.bzl", "os_info")
88
load("@rules_haskell_ghc_version//:ghc_version.bzl", "GHC_VERSION")
99

10+
def _empty_repo_impl(rctx):
11+
fail(rctx.attr.error_msg)
12+
13+
_empty_repo = repository_rule(
14+
implementation = _empty_repo_impl,
15+
doc = """A dummy repository that can be loaded from the MODULE.bazel file but not fetched.""",
16+
attrs = {
17+
"error_msg": attr.string(
18+
doc = "The error message displayed if the repository is fetched",
19+
mandatory = True,
20+
),
21+
},
22+
)
23+
1024
def repositories(*, bzlmod): # @unused
1125
rules_haskell_dependencies_bzlmod()
1226

@@ -24,7 +38,12 @@ def repositories(*, bzlmod): # @unused
2438

2539
# TODO: Remove when tests are run with a ghc version containing Cabal >= 3.10
2640
# See https://github.com/tweag/rules_haskell/issues/1871
27-
if GHC_VERSION and GHC_VERSION.startswith("9.4."):
41+
if GHC_VERSION and GHC_VERSION.startswith("9.6."):
42+
_empty_repo(
43+
name = "Cabal",
44+
error_msg = "When using GHC >= 9.6, do not depend on @Cabal, as https://github.com/tweag/rules_haskell/issues/1871 is fixed.",
45+
)
46+
elif GHC_VERSION and GHC_VERSION.startswith("9.4."):
2847
http_archive(
2948
name = "Cabal",
3049
build_file_content = """

haskell/private/actions/link.bzl

+29
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,23 @@ def link_binary(
136136
args.add_all(hs.toolchain.ghcopts)
137137
args.add_all(compiler_flags)
138138

139+
# NOTE When linking, GHC < 9.6 ignores -fplugin= arguments.
140+
#
141+
# GHC >= 9.6, however, tries to locate a package providing the given module.
142+
#
143+
# Failing to find a corresponding package it tries to find a source file with
144+
# the given name and .hs, .lhs, .hsig or .lhsig extension.
145+
#
146+
# Passing appropriate -package-db and -plugin-package-id flags for
147+
# the given plugin causes GHC to try building a dynamic library instead of
148+
# an executable which fails in the linking step with:
149+
#
150+
# > error: main2.o: requires unsupported dynamic reloc 11; recompile with -fPIC
151+
#
152+
# Since compilation is already done at this stage, we simply clear all plugins
153+
# here so they do not have any effect.
154+
args.add("-fclear-plugins")
155+
139156
# By default, GHC will produce mostly-static binaries, i.e. in which all
140157
# Haskell code is statically linked and foreign libraries and system
141158
# dependencies are dynamically linked. If linkstatic is false, i.e. the user
@@ -351,6 +368,18 @@ def link_library_dynamic(hs, cc, posix, dep_info, extra_srcs, object_files, my_p
351368
args.add_all(["-shared", "-dynamic"])
352369
args.add_all(hs.toolchain.ghcopts)
353370
args.add_all(compiler_flags)
371+
372+
# NOTE When linking, GHC < 9.6 ignores -fplugin= arguments.
373+
#
374+
# GHC >= 9.6, however, tries to locate a package providing the given module.
375+
#
376+
# Failing to find a corresponding package it tries to find a source file with
377+
# the given name and .hs, .lhs, .hsig or .lhsig extension.
378+
#
379+
# Since compilation is already done at this stage, we simply clear all plugins
380+
# here so they do not have any effect.
381+
args.add("-fclear-plugins")
382+
354383
extra_prefix = empty_lib_prefix
355384

356385
(pkg_info_inputs, pkg_info_args) = pkg_info_to_compile_flags(

rules_haskell_tests/WORKSPACE

+25-21
Original file line numberDiff line numberDiff line change
@@ -273,27 +273,31 @@ stack_snapshot(
273273
"temporary",
274274
],
275275
setup_deps = {
276-
"polysemy": ["cabal-doctest"],
277-
# See https://github.com/tweag/rules_haskell/issues/1871
278-
"HUnit": ["@Cabal//:Cabal"],
279-
"bifunctors": ["@Cabal//:Cabal"],
280-
"c2hs": ["@Cabal//:Cabal"],
281-
"call-stack": ["@Cabal//:Cabal"],
282-
"doctest": ["@Cabal//:Cabal"],
283-
"generic-deriving": ["@Cabal//:Cabal"],
284-
"happy": ["@Cabal//:Cabal"],
285-
"hspec": ["@Cabal//:Cabal"],
286-
"hspec-core": ["@Cabal//:Cabal"],
287-
"hspec-discover": ["@Cabal//:Cabal"],
288-
"hspec-expectations": ["@Cabal//:Cabal"],
289-
"mono-traversable": ["@Cabal//:Cabal"],
290-
"proto-lens-protoc": ["@Cabal//:Cabal"],
291-
"proto-lens-runtime": ["@Cabal//:Cabal"],
292-
"quickcheck-io": ["@Cabal//:Cabal"],
293-
"transformers-compat": ["@Cabal//:Cabal"],
294-
"type-errors": ["@Cabal//:Cabal"],
295-
"typed-process": ["@Cabal//:Cabal"],
296-
"unliftio-core": ["@Cabal//:Cabal"],
276+
name: deps
277+
for name, deps in {
278+
"polysemy": ["cabal-doctest"],
279+
# See https://github.com/tweag/rules_haskell/issues/1871
280+
"HUnit": ["@Cabal//:Cabal"],
281+
"bifunctors": ["@Cabal//:Cabal"],
282+
"c2hs": ["@Cabal//:Cabal"],
283+
"call-stack": ["@Cabal//:Cabal"],
284+
"doctest": ["@Cabal//:Cabal"],
285+
"generic-deriving": ["@Cabal//:Cabal"],
286+
"happy": ["@Cabal//:Cabal"],
287+
"hspec": ["@Cabal//:Cabal"],
288+
"hspec-core": ["@Cabal//:Cabal"],
289+
"hspec-discover": ["@Cabal//:Cabal"],
290+
"hspec-expectations": ["@Cabal//:Cabal"],
291+
"mono-traversable": ["@Cabal//:Cabal"],
292+
"proto-lens-protoc": ["@Cabal//:Cabal"],
293+
"proto-lens-runtime": ["@Cabal//:Cabal"],
294+
"quickcheck-io": ["@Cabal//:Cabal"],
295+
"transformers-compat": ["@Cabal//:Cabal"],
296+
"type-errors": ["@Cabal//:Cabal"],
297+
"typed-process": ["@Cabal//:Cabal"],
298+
"unliftio-core": ["@Cabal//:Cabal"],
299+
}.items()
300+
if [d for d in deps if d != "@Cabal//:Cabal"] or not GHC_VERSION or not GHC_VERSION.startswith("9.6.")
297301
},
298302
stack_snapshot_json = "//:stackage_snapshot{}.json".format(
299303
"_" + str(GHC_VERSION) if GHC_VERSION else "",

0 commit comments

Comments
 (0)