Skip to content

Commit 2bd9ab4

Browse files
authored
simplify hlint plugin Cabal descriptor (haskell#2867)
1 parent e52cffe commit 2bd9ab4

File tree

10 files changed

+20
-68
lines changed

10 files changed

+20
-68
lines changed

.github/workflows/flags.yml

-4
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,6 @@ jobs:
6464
- name: Build `hls-graph` with flags
6565
run: cabal v2-build hls-graph --flags="embed-files stm-stats"
6666

67-
- if: matrix.ghc != '8.6.5' && matrix.ghc != '8.8.4'
68-
name: Build `hie-compat` with flags
69-
run: cabal v2-build hie-compat --flags="ghc-lib"
70-
7167
- name: Build `ghcide` with flags
7268
run: cabal v2-build ghcide --flags="ghc-patched-unboxed-bytecode test-exe executable bench-exe"
7369

cabal-ghc90.project

-1
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

-2
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,6 @@ constraints:
5050
-retrie
5151
-splice
5252
-tactic,
53-
hls-hlint-plugin +ghc-lib,
54-
-- # Use ghc-lib force instead of ghc itself
5553
ghc-lib-parser-ex -auto,
5654
hlint +ghc-lib,
5755
stylish-haskell +ghc-lib

cabal.project

+7-3
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,19 @@ optional-packages: vendored/*/*.cabal
3737
tests: true
3838

3939
package *
40-
ghc-options: -haddock
40+
-- ghc 8.10 cannot build ghc-lib 9.2 with --haddock
41+
-- ghc-options: -haddock
4142
test-show-details: direct
4243

4344
write-ghc-environment-files: never
4445

45-
index-state: 2022-03-08T10:53:01Z
46+
index-state: 2022-04-27T09:22:49Z
4647

4748
constraints:
48-
hyphenation +embed
49+
hyphenation +embed,
50+
-- remove this when hlint sets ghc-lib to true by default
51+
-- https://github.com/ndmitchell/hlint/issues/1376
52+
hlint +ghc-lib
4953

5054
allow-newer:
5155
-- for shake-bench

hie-compat/hie-compat.cabal

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ library
2525
build-depends:
2626
base < 4.17, array, bytestring, containers, directory, filepath, transformers
2727
if flag(ghc-lib)
28-
build-depends: ghc-lib
28+
build-depends: ghc-lib < 9.0
2929
else
3030
build-depends: ghc, ghc-boot
3131
if (impl(ghc >= 9.0) && impl(ghc < 9.1))

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

+7-45
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,9 @@ flag pedantic
2626
manual: True
2727

2828
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
29+
default: True
30+
manual: True
31+
description: Use ghc-lib types (requires hlint to be built with ghc-lib)
4032

4133
library
4234
exposed-modules: Ide.Plugin.Hlint
@@ -56,7 +48,7 @@ library
5648
, ghc-exactprint >=0.6.3.4
5749
, ghcide ^>=1.7
5850
, hashable
59-
, hlint
51+
, hlint < 3.5
6052
, hls-plugin-api ^>=1.4
6153
, hslogger
6254
, lens
@@ -69,41 +61,11 @@ library
6961
, transformers
7062
, unordered-containers
7163
, 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
64+
, ghc-lib
65+
, ghc-lib-parser
7566
, ghc-lib-parser-ex
7667

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-
68+
cpp-options: -DHLINT_ON_GHC_LIB
10769
ghc-options:
10870
-Wall -Wredundant-constraints -Wno-name-shadowing
10971
-Wno-unticked-promoted-constructors

plugins/hls-hlint-plugin/test/Main.hs

+1-1
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ disableHlint = sendConfigurationChanged $ toJSON $ def { Plugin.plugins = Map.fr
371371
-- Although a given hlint version supports one direct ghc, we could use several versions of hlint
372372
-- each one supporting a different ghc version. It should be a temporary situation though.
373373
knownBrokenForHlintOnGhcLib :: String -> TestTree -> TestTree
374-
knownBrokenForHlintOnGhcLib = knownBrokenForGhcVersions [GHC86, GHC88, GHC90, GHC92]
374+
knownBrokenForHlintOnGhcLib = expectFailBecause
375375

376376
-- 1's based
377377
data Point = Point {

stack-lts16.yaml

+2-4
Original file line numberDiff line numberDiff line change
@@ -103,12 +103,10 @@ flags:
103103
pedantic: true
104104
retrie:
105105
BuildExecutable: false
106-
# Stack doesn't support automatic flags.
107-
# Until the formatters support ghc-lib-9, we need this flag disabled
108-
hls-hlint-plugin:
109-
hlint34: false
110106
hyphenation:
111107
embed: true
108+
hlint:
109+
ghc-lib: true
112110

113111
nix:
114112
packages: [icu libcxx zlib]

stack-lts19.yaml

+2-4
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,10 @@ flags:
6767
retrie:
6868
BuildExecutable: false
6969
# Stack doesn't support automatic flags.
70-
# Until the formatters support ghc-lib-9, we need this flag disabled
71-
hls-hlint-plugin:
72-
hlint34: true
73-
ghc-lib: true
7470
hyphenation:
7571
embed: true
72+
hlint:
73+
ghc-lib: true
7674

7775
nix:
7876
packages: [ icu libcxx zlib ]

stack.yaml

-3
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,6 @@ flags:
8282
retrie:
8383
BuildExecutable: false
8484
# Stack doesn't support automatic flags.
85-
hls-hlint-plugin:
86-
hlint34: true
87-
ghc-lib: true
8885
# Use ghc-lib force instead of ghc itself
8986
ghc-lib-parser-ex:
9087
auto: false

0 commit comments

Comments
 (0)