Skip to content

Commit 6e297c5

Browse files
authored
Add support for install hls from hackage using ghc 9.0.1 (#2322)
* First temporal changes * Clean up tests plugin inclusion Deprecate them as they will be removed when all tests are moved to their own plugin packages * Use force-plugins in project files * Add ghc-9.0.1 to hackage release workflow Diabling actual upload if the branch contains 'check' * Improve force-plugins explanation * Correct deprecated pragma location * Dont use deprecated pragma * Correct yaml config error * Change flag name * Use new flag name in project files
1 parent 7565798 commit 6e297c5

File tree

5 files changed

+32
-162
lines changed

5 files changed

+32
-162
lines changed

.github/workflows/hackage.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
"hls-splice-plugin", "hls-tactics-plugin",
2222
"hls-call-hierarchy-plugin",
2323
"haskell-language-server"]
24-
ghc: ["8.10.7", "8.8.4", "8.6.5"]
24+
ghc: ["9.0.1", "8.10.7", "8.8.4", "8.6.5"]
2525

2626
steps:
2727

@@ -119,6 +119,7 @@ jobs:
119119
path: ${{ steps.generate-dist-tarball.outputs.path }}
120120

121121
upload-candidate:
122+
if: ${{ !contains(github.head_ref, 'check') }}
122123
needs: check-and-upload-tarballs
123124
runs-on: ubuntu-latest
124125
steps:

cabal-ghc901.project

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ write-ghc-environment-files: never
5858
index-state: 2021-10-04T02:41:06Z
5959

6060
constraints:
61-
-- These plugins don't work on GHC9 yet
62-
haskell-language-server -brittany -class -stylishhaskell -tactic
61+
-- These plugins don't work on GHC9 yet
62+
haskell-language-server +ignore-plugins-ghc-bounds -brittany -class -stylishhaskell -tactic
6363

6464
allow-newer:
6565
floskell:base,

cabal-ghc921.project

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,8 @@ write-ghc-environment-files: never
5454
index-state: 2021-09-29T21:38:47Z
5555

5656
constraints:
57-
-- These plugins doesn't work on GHC9 yet
58-
haskell-language-server -brittany -class -fourmolu -splice -stylishhaskell -tactic -refineImports -callhierarchy -retrie
59-
57+
-- These plugins doesn't work on GHC92 yet
58+
haskell-language-server +ignore-plugins-ghc-bounds -brittany -class -fourmolu -splice -stylishhaskell -tactic -refineImports -callhierarchy -retrie
6059

6160
allow-newer:
6261
Cabal,

haskell-language-server.cabal

Lines changed: 25 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -83,18 +83,11 @@ library
8383
default-extensions: DataKinds, TypeOperators
8484

8585
-- Plugin flags are designed for 'cabal install haskell-language-server':
86-
-- - Packaged plugins should be manual:False
87-
-- - Non packaged plugins and bulk flags should be manual:True
8886
-- - Bulk flags should be default:False
8987
-- - Individual flags should be default:True
9088

91-
flag all-plugins
92-
description: Enable all non formatter plugins
93-
default: False
94-
manual: True
95-
96-
flag all-formatters
97-
description: Enable all fomatters
89+
flag ignore-plugins-ghc-bounds
90+
description: Force the inclusion of plugins even if they are not buildable by default with a specific ghc version
9891
default: False
9992
manual: True
10093

@@ -196,94 +189,94 @@ common example-plugins
196189
Ide.Plugin.Example2
197190

198191
common class
199-
if flag(class) || flag(all-plugins)
192+
if flag(class) && (impl(ghc < 9.0.1) || flag(ignore-plugins-ghc-bounds))
200193
build-depends: hls-class-plugin ^>=1.0.0.1
201194
cpp-options: -Dclass
202195

203196
common callHierarchy
204-
if flag(callHierarchy) || flag(all-plugins)
197+
if flag(callHierarchy) && (impl(ghc < 9.2.1) || flag(ignore-plugins-ghc-bounds))
205198
build-depends: hls-call-hierarchy-plugin ^>=1.0.0.0
206199
cpp-options: -DcallHierarchy
207200

208201
common haddockComments
209-
if flag(haddockComments) || flag(all-plugins)
202+
if flag(haddockComments)
210203
build-depends: hls-haddock-comments-plugin ^>=1.0.0.1
211204
cpp-options: -DhaddockComments
212205

213206
common eval
214-
if flag(eval) || flag(all-plugins)
207+
if flag(eval)
215208
build-depends: hls-eval-plugin ^>=1.2.0.0
216209
cpp-options: -Deval
217210

218211
common importLens
219-
if flag(importLens) || flag(all-plugins)
212+
if flag(importLens)
220213
build-depends: hls-explicit-imports-plugin ^>=1.0.0.1
221214
cpp-options: -DimportLens
222215

223216
common refineImports
224-
if flag(refineImports) || flag(all-plugins)
217+
if flag(refineImports) && (impl(ghc < 9.2.1) || flag(ignore-plugins-ghc-bounds))
225218
build-depends: hls-refine-imports-plugin ^>=1.0.0.0
226219
cpp-options: -DrefineImports
227220

228221
common rename
229-
if flag(rename) || flag(all-plugins)
222+
if flag(rename)
230223
build-depends: hls-rename-plugin ^>= 1.0.0.0
231224
cpp-options: -Drename
232225

233226
common retrie
234-
if flag(retrie) || flag(all-plugins)
227+
if flag(retrie) && (impl(ghc < 9.2.1) || flag(ignore-plugins-ghc-bounds))
235228
build-depends: hls-retrie-plugin ^>=1.0.0.1
236229
cpp-options: -Dretrie
237230

238231
common tactic
239-
if flag(tactic) || flag(all-plugins)
232+
if flag(tactic) && (impl(ghc < 9.0.1) || flag(ignore-plugins-ghc-bounds))
240233
build-depends: hls-tactics-plugin >=1.2.0.0 && <1.5
241234
cpp-options: -Dtactic
242235

243236
common hlint
244-
if flag(hlint) || flag(all-plugins)
237+
if flag(hlint)
245238
build-depends: hls-hlint-plugin ^>=1.0.0.2
246239
cpp-options: -Dhlint
247240

248241
common moduleName
249-
if flag(moduleName) || flag(all-plugins)
242+
if flag(moduleName)
250243
build-depends: hls-module-name-plugin ^>=1.0.0.0
251244
cpp-options: -DmoduleName
252245

253246
common pragmas
254-
if flag(pragmas) || flag(all-plugins)
247+
if flag(pragmas)
255248
build-depends: hls-pragmas-plugin ^>=1.0.0.0
256249
cpp-options: -Dpragmas
257250

258251
common splice
259-
if flag(splice) || flag(all-plugins)
252+
if flag(splice) && (impl(ghc < 9.2.1) || flag(ignore-plugins-ghc-bounds))
260253
build-depends: hls-splice-plugin ^>=1.0.0.1
261254
cpp-options: -Dsplice
262255

263256
-- formatters
264257

265258
common floskell
266-
if flag(floskell) || flag(all-formatters)
259+
if flag(floskell) && (impl(ghc < 9.0.1) || flag(ignore-plugins-ghc-bounds))
267260
build-depends: hls-floskell-plugin ^>=1.0.0.0
268261
cpp-options: -Dfloskell
269262

270263
common fourmolu
271-
if flag(fourmolu) || flag(all-formatters)
264+
if flag(fourmolu) && (impl(ghc < 9.2.1) || flag(ignore-plugins-ghc-bounds))
272265
build-depends: hls-fourmolu-plugin ^>=1.0.0.0
273266
cpp-options: -Dfourmolu
274267

275268
common ormolu
276-
if flag(ormolu) || flag(all-formatters)
269+
if flag(ormolu)
277270
build-depends: hls-ormolu-plugin ^>=1.0.0.0
278271
cpp-options: -Dormolu
279272

280273
common stylishHaskell
281-
if flag(stylishHaskell) || flag(all-formatters)
274+
if flag(stylishHaskell) && (impl(ghc < 9.0.1) || flag(ignore-plugins-ghc-bounds))
282275
build-depends: hls-stylish-haskell-plugin ^>=1.0.0.0
283276
cpp-options: -DstylishHaskell
284277

285278
common brittany
286-
if (flag(brittany) || flag(all-formatters))
279+
if flag(brittany) && (impl(ghc < 9.0.1) || flag(ignore-plugins-ghc-bounds))
287280
build-depends: hls-brittany-plugin ^>=1.0.0.1
288281
cpp-options: -Dbrittany
289282

@@ -443,42 +436,16 @@ test-suite func-test
443436
if flag(pedantic)
444437
ghc-options: -Werror -Wredundant-constraints
445438

446-
if flag(callHierarchy) || flag(all-plugins)
447-
cpp-options: -DcallHierarchy
448-
if flag(class) || flag(all-plugins)
449-
cpp-options: -Dclass
450-
if flag(haddockComments) || flag(all-plugins)
451-
cpp-options: -DhaddockComments
452-
if flag(eval) || flag(all-plugins)
439+
-- Duplicating inclusion plugin conditions until tests are moved to their own packages
440+
if flag(eval)
453441
cpp-options: -Deval
454-
if flag(importLens) || flag(all-plugins)
455-
cpp-options: -DimportLens
456-
if flag(rename) || flag(all-plugins)
457-
cpp-options: -Drename
458-
if flag(retrie) || flag(all-plugins)
459-
cpp-options: -Dretrie
460-
if flag(tactic) || flag(all-plugins)
461-
cpp-options: -Dtactic
462-
if flag(hlint) || flag(all-plugins)
463-
cpp-options: -Dhlint
464-
if flag(moduleName) || flag(all-plugins)
465-
cpp-options: -DmoduleName
466-
if flag(pragmas) || flag(all-plugins)
467-
cpp-options: -Dpragmas
468-
if flag(splice) || flag(all-plugins)
469-
cpp-options: -Dsplice
470-
471442
-- formatters
472-
if flag(floskell) || flag(all-formatters)
443+
if flag(floskell) && (impl(ghc < 9.0.1) || flag(ignore-plugins-ghc-bounds))
473444
cpp-options: -Dfloskell
474-
if flag(fourmolu) || flag(all-formatters)
445+
if flag(fourmolu) && (impl(ghc < 9.2.1) || flag(ignore-plugins-ghc-bounds))
475446
cpp-options: -Dfourmolu
476-
if flag(ormolu) || flag(all-formatters)
447+
if flag(ormolu)
477448
cpp-options: -Dormolu
478-
if flag(stylishHaskell) || flag(all-formatters)
479-
cpp-options: -DstylishHaskell
480-
if (flag(brittany) || flag(all-formatters))
481-
cpp-options: -Dbrittany
482449

483450
test-suite wrapper-test
484451
type: exitcode-stdio-1.0

test/utils/Test/Hls/Flags.hs

Lines changed: 1 addition & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,13 @@
11
{-# LANGUAGE CPP #-}
22
{-# OPTIONS_GHC -Wno-unused-imports #-}
33
-- | Module for disabling tests if their plugins are disabled
4+
-- DEPRECATED: To be removed when all plugin tests are in their own packages
45
module Test.Hls.Flags where
56

67
import Test.Hls (TestTree, ignoreTestBecause)
78

89
-- * Plugin dependent tests
910

10-
-- | Disable test unless the class flag is set
11-
requiresClassPlugin :: TestTree -> TestTree
12-
#if class
13-
requiresClassPlugin = id
14-
#else
15-
requiresClassPlugin = ignoreTestBecause "Class plugin disabled"
16-
#endif
17-
18-
-- | Disable test unless the haddockComments flag is set
19-
requiresHaddockCommentsPlugin :: TestTree -> TestTree
20-
#if haddockComments
21-
requiresHaddockCommentsPlugin = id
22-
#else
23-
requiresHaddockCommentsPlugin = ignoreTestBecause "HaddockComments plugin disabled"
24-
#endif
25-
2611
-- | Disable test unless the eval flag is set
2712
requiresEvalPlugin :: TestTree -> TestTree
2813
#if eval
@@ -31,71 +16,6 @@ requiresEvalPlugin = id
3116
requiresEvalPlugin = ignoreTestBecause "Eval plugin disabled"
3217
#endif
3318

34-
-- | Disable test unless the importLens flag is set
35-
requiresImportLensPlugin :: TestTree -> TestTree
36-
#if importLens
37-
requiresImportLensPlugin = id
38-
#else
39-
requiresImportLensPlugin = ignoreTestBecause "ImportLens plugin disabled"
40-
#endif
41-
42-
-- | Disable test unless the rename flag is set
43-
requiresRenamePlugin :: TestTree -> TestTree
44-
#if rename
45-
requiresRenamePlugin = id
46-
#else
47-
requiresRenamePlugin = ignoreTestBecause "Rename plugin disabled"
48-
#endif
49-
50-
-- | Disable test unless the retrie flag is set
51-
requiresRetriePlugin :: TestTree -> TestTree
52-
#if retrie
53-
requiresRetriePlugin = id
54-
#else
55-
requiresRetriePlugin = ignoreTestBecause "Retrie plugin disabled"
56-
#endif
57-
58-
-- | Disable test unless the tactic flag is set
59-
requiresTacticPlugin :: TestTree -> TestTree
60-
#if tactic
61-
requiresTacticPlugin = id
62-
#else
63-
requiresTacticPlugin = ignoreTestBecause "Tactic plugin disabled"
64-
#endif
65-
66-
-- | Disable test unless the hlint flag is set
67-
requiresHlintPlugin :: TestTree -> TestTree
68-
#if hlint
69-
requiresHlintPlugin = id
70-
#else
71-
requiresHlintPlugin = ignoreTestBecause "Hlint plugin disabled"
72-
#endif
73-
74-
-- | Disable test unless the moduleName flag is set
75-
requiresModuleNamePlugin :: TestTree -> TestTree
76-
#if moduleName
77-
requiresModuleNamePlugin = id
78-
#else
79-
requiresModuleNamePlugin = ignoreTestBecause "ModuleName plugin disabled"
80-
#endif
81-
82-
-- | Disable test unless the pragmas flag is set
83-
requiresPragmasPlugin :: TestTree -> TestTree
84-
#if pragmas
85-
requiresPragmasPlugin = id
86-
#else
87-
requiresPragmasPlugin = ignoreTestBecause "Pragmas plugin disabled"
88-
#endif
89-
90-
-- | Disable test unless the splice flag is set
91-
requiresSplicePlugin :: TestTree -> TestTree
92-
#if splice
93-
requiresSplicePlugin = id
94-
#else
95-
requiresSplicePlugin = ignoreTestBecause "Splice plugin disabled"
96-
#endif
97-
98-
9919
-- * Formatters
10020
-- | Disable test unless the floskell flag is set
10121
requiresFloskellPlugin :: TestTree -> TestTree
@@ -120,20 +40,3 @@ requiresOrmoluPlugin = id
12040
#else
12141
requiresOrmoluPlugin = ignoreTestBecause "Ormolu plugin disabled"
12242
#endif
123-
124-
-- | Disable test unless the stylishHaskell flag is set
125-
requiresStylishHaskellPlugin :: TestTree -> TestTree
126-
#if stylishHaskell
127-
requiresStylishHaskellPlugin = id
128-
#else
129-
requiresStylishHaskellPlugin = ignoreTestBecause "StylishHaskell plugin disabled"
130-
#endif
131-
132-
-- | Disable test unless the brittany flag is set
133-
requiresBrittanyPlugin :: TestTree -> TestTree
134-
#if brittany
135-
requiresBrittanyPlugin = id
136-
#else
137-
requiresBrittanyPlugin = ignoreTestBecause "Brittany plugin disabled"
138-
#endif
139-

0 commit comments

Comments
 (0)