|
1 | 1 | """ External repositories for the CI that need to be shared between WORKSPACE and MODULE.bazel files """ |
2 | 2 |
|
3 | 3 | load("@rules_haskell//haskell:cabal.bzl", "stack_snapshot") |
| 4 | +load("@rules_haskell//haskell:private/versions.bzl", "is_at_least") |
4 | 5 | load("@os_info//:os_info.bzl", "is_linux", "is_windows") |
5 | 6 | load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") |
6 | 7 | load("@toolchains_libraries//:toolchain_libraries.bzl", "toolchain_libraries") |
@@ -88,7 +89,7 @@ def repositories(*, bzlmod): # @unused |
88 | 89 | "unliftio-core": ["@ghcide//:Cabal"], |
89 | 90 | "yaml": ["@ghcide//:Cabal"], |
90 | 91 | }.items() |
91 | | - if [d for d in deps if d != "@Cabal//:Cabal"] or not GHC_VERSION or not GHC_VERSION.startswith("9.6.") |
| 92 | + if [d for d in deps if d != "@Cabal//:Cabal"] or not GHC_VERSION or not is_at_least("9.6", GHC_VERSION) |
92 | 93 | }, |
93 | 94 | stack_snapshot_json = ("//:ghcide-snapshot{}.json".format( |
94 | 95 | "_" + str(GHC_VERSION) if GHC_VERSION else "", |
@@ -119,15 +120,15 @@ haskell_cabal_binary( |
119 | 120 | verbose = False, |
120 | 121 | visibility = ["//visibility:public"], |
121 | 122 | ) |
122 | | - """.format(setup_deps = "" if GHC_VERSION and GHC_VERSION.startswith("9.6.") else """setup_deps = ["@Cabal//:Cabal"],"""), |
| 123 | + """.format(setup_deps = "" if GHC_VERSION and is_at_least("9.6", GHC_VERSION) else """setup_deps = ["@Cabal//:Cabal"],"""), |
123 | 124 | sha256 = "9bd2f1a27e8f1b2ffdb5b2fbd3ed82b6f0e85191459a1b24ffcbef4e68a81bec", |
124 | 125 | strip_prefix = "alex-3.2.7.1", |
125 | 126 | urls = ["http://hackage.haskell.org/package/alex-3.2.7.1/alex-3.2.7.1.tar.gz"], |
126 | 127 | ) |
127 | 128 |
|
128 | 129 | # TODO: Remove when tests are run with a ghc version containing Cabal >= 3.10 |
129 | 130 | # See https://github.com/tweag/rules_haskell/issues/1871 |
130 | | - if GHC_VERSION and GHC_VERSION.startswith("9.6."): |
| 131 | + if GHC_VERSION and is_at_least("9.6", GHC_VERSION): |
131 | 132 | _empty_repo( |
132 | 133 | name = "Cabal", |
133 | 134 | error_msg = "When using GHC >= 9.6, do not depend on @Cabal, as https://github.com/tweag/rules_haskell/issues/1871 is fixed.", |
@@ -200,7 +201,7 @@ haskell_cabal_library( |
200 | 201 | "hspec-expectations": ["@Cabal//:Cabal"], |
201 | 202 | "quickcheck-io": ["@Cabal//:Cabal"], |
202 | 203 | }.items() |
203 | | - if [d for d in deps if d != "@Cabal//:Cabal"] or not GHC_VERSION or not GHC_VERSION.startswith("9.6.") |
| 204 | + if [d for d in deps if d != "@Cabal//:Cabal"] or not GHC_VERSION or not is_at_least("9.6", GHC_VERSION) |
204 | 205 | }, |
205 | 206 | stack_snapshot_json = ("//:stackage-pinning-test_snapshot{}.json".format( |
206 | 207 | "_" + str(GHC_VERSION) if GHC_VERSION else "", |
|
0 commit comments