Skip to content

Commit 7279faf

Browse files
committed
simplify hlint plugin Cabal descriptor
- the ghc-lib flag is unnecessary, we want to use ghc-lib always for maximum compatibility - the hlint34 flag is unnecessary, we can trust cabal to use the right version
1 parent c14cbdb commit 7279faf

File tree

3 files changed

+6
-51
lines changed

3 files changed

+6
-51
lines changed

cabal-ghc90.project

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ write-ghc-environment-files: never
4040
index-state: 2022-04-27T09:22:49Z
4141

4242
constraints:
43-
hls-hlint-plugin +ghc-lib
4443

4544
-- although we are not building all plugins cabal solver phase is run for all packages
4645
-- this way we track explicitly all transitive dependencies which need support for ghc-9

cabal-ghc92.project

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ with-compiler: ghc-9.2.2
3434
tests: true
3535

3636
package *
37-
ghc-options: -haddock
37+
-- ghc 8.10 cannot build ghc-lib 9.2 with --haddock
38+
-- ghc-options: -haddock
3839
test-show-details: direct
3940

4041
write-ghc-environment-files: never
@@ -50,8 +51,6 @@ constraints:
5051
-retrie
5152
-splice
5253
-tactic,
53-
hls-hlint-plugin +ghc-lib,
54-
-- # Use ghc-lib force instead of ghc itself
5554
ghc-lib-parser-ex -auto,
5655
hlint +ghc-lib,
5756
stylish-haskell +ghc-lib

plugins/hls-hlint-plugin/hls-hlint-plugin.cabal

Lines changed: 4 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -25,19 +25,6 @@ flag pedantic
2525
default: False
2626
manual: True
2727

28-
flag ghc-lib
29-
default: False
30-
manual: True
31-
description:
32-
Force dependency on ghc-lib-parser even if GHC API in the ghc package is supported
33-
34-
flag hlint34
35-
default: True
36-
manual: False
37-
description:
38-
Hlint-3.4 doesn't support versions ghc-lib < 9.0.1 nor ghc <= 8.6, so we can use hlint-3.2 for backwards compat
39-
This flag can be removed when all dependencies support ghc-lib-9.0.* and we drop support for ghc-8.6
40-
4128
library
4229
exposed-modules: Ide.Plugin.Hlint
4330
hs-source-dirs: src
@@ -56,7 +43,7 @@ library
5643
, ghc-exactprint >=0.6.3.4
5744
, ghcide ^>=1.7
5845
, hashable
59-
, hlint
46+
, hlint < 3.5
6047
, hls-plugin-api ^>=1.4
6148
, hslogger
6249
, lens
@@ -69,41 +56,11 @@ library
6956
, transformers
7057
, unordered-containers
7158
, apply-refact >=0.9.0.0
72-
-- can be removed if https://github.com/ndmitchell/hlint/pull/1325#issue-1077062712 is merged
73-
-- and https://github.com/haskell/haskell-language-server/pull/2464#issue-1077133441 is updated
74-
-- accordingly
59+
, ghc-lib
60+
, ghc-lib-parser
7561
, ghc-lib-parser-ex
7662

77-
if (flag(hlint34))
78-
-- This mirrors the logic in hlint.cabal for hlint-3.3
79-
-- https://github.com/ndmitchell/hlint/blob/d3576de4529d8df6cca5a345f5b7e04474ff7bff/hlint.cabal#L79-L88
80-
-- so we can make sure that we do the same thing as hlint
81-
build-depends: hlint ^>=3.4
82-
83-
if (!flag(ghc-lib) && impl(ghc >=9.0.1) && impl(ghc <9.1.0))
84-
build-depends: ghc ==9.0.*
85-
else
86-
build-depends:
87-
, ghc-lib ^>=9.2
88-
, ghc-lib-parser-ex ^>=9.2
89-
, ghc-lib-parser ^>=9.2
90-
91-
cpp-options: -DHLINT_ON_GHC_LIB
92-
93-
else
94-
-- This mirrors the logic in hlint.cabal for hlint-3.2
95-
-- https://github.com/ndmitchell/hlint/blob/c7354e473c7d09213c8adc3dc94bf50a6eb4a42d/hlint.cabal#L79-L88
96-
build-depends: hlint ^>=3.2
97-
if (!flag(ghc-lib) && impl(ghc >=8.10.1) && impl(ghc < 8.11.0))
98-
build-depends: ghc >=8.10 && <9.0
99-
else
100-
build-depends:
101-
, ghc
102-
, ghc-lib ^>=8.10.7.20210828
103-
, ghc-lib-parser-ex ^>=8.10
104-
105-
cpp-options: -DHLINT_ON_GHC_LIB
106-
63+
cpp-options: -DHLINT_ON_GHC_LIB
10764
ghc-options:
10865
-Wall -Wredundant-constraints -Wno-name-shadowing
10966
-Wno-unticked-promoted-constructors

0 commit comments

Comments
 (0)