Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for install hls from hackage using ghc 9.0.1 #2322

Merged
merged 11 commits into from Nov 3, 2021
3 changes: 2 additions & 1 deletion .github/workflows/hackage.yml
Expand Up @@ -21,7 +21,7 @@ jobs:
"hls-splice-plugin", "hls-tactics-plugin",
"hls-call-hierarchy-plugin",
"haskell-language-server"]
ghc: ["8.10.7", "8.8.4", "8.6.5"]
ghc: ["9.0.1", "8.10.7", "8.8.4", "8.6.5"]

steps:

Expand Down Expand Up @@ -119,6 +119,7 @@ jobs:
path: ${{ steps.generate-dist-tarball.outputs.path }}

upload-candidate:
if: ${{ !contains(github.head_ref, 'check') }}
needs: check-and-upload-tarballs
runs-on: ubuntu-latest
steps:
Expand Down
4 changes: 2 additions & 2 deletions cabal-ghc901.project
Expand Up @@ -58,8 +58,8 @@ write-ghc-environment-files: never
index-state: 2021-10-04T02:41:06Z

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

allow-newer:
floskell:base,
Expand Down
5 changes: 2 additions & 3 deletions cabal-ghc921.project
Expand Up @@ -54,9 +54,8 @@ write-ghc-environment-files: never
index-state: 2021-09-29T21:38:47Z

constraints:
-- These plugins doesn't work on GHC9 yet
haskell-language-server -brittany -class -fourmolu -splice -stylishhaskell -tactic -refineImports -callhierarchy -retrie

-- These plugins doesn't work on GHC92 yet
haskell-language-server +ignore-plugins-ghc-bounds -brittany -class -fourmolu -splice -stylishhaskell -tactic -refineImports -callhierarchy -retrie

allow-newer:
Cabal,
Expand Down
83 changes: 25 additions & 58 deletions haskell-language-server.cabal
Expand Up @@ -83,18 +83,11 @@ library
default-extensions: DataKinds, TypeOperators

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

flag all-plugins
description: Enable all non formatter plugins
default: False
manual: True

flag all-formatters
description: Enable all fomatters
flag ignore-plugins-ghc-bounds
description: Force the inclusion of plugins even if they are not buildable by default with a specific ghc version
jneira marked this conversation as resolved.
Show resolved Hide resolved
default: False
manual: True

Expand Down Expand Up @@ -196,94 +189,94 @@ common example-plugins
Ide.Plugin.Example2

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

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

common haddockComments
if flag(haddockComments) || flag(all-plugins)
if flag(haddockComments)
build-depends: hls-haddock-comments-plugin ^>=1.0.0.1
cpp-options: -DhaddockComments

common eval
if flag(eval) || flag(all-plugins)
if flag(eval)
build-depends: hls-eval-plugin ^>=1.2.0.0
cpp-options: -Deval

common importLens
if flag(importLens) || flag(all-plugins)
if flag(importLens)
build-depends: hls-explicit-imports-plugin ^>=1.0.0.1
cpp-options: -DimportLens

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

common rename
if flag(rename) || flag(all-plugins)
if flag(rename)
build-depends: hls-rename-plugin ^>= 1.0.0.0
cpp-options: -Drename

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

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

common hlint
if flag(hlint) || flag(all-plugins)
if flag(hlint)
build-depends: hls-hlint-plugin ^>=1.0.0.2
cpp-options: -Dhlint

common moduleName
if flag(moduleName) || flag(all-plugins)
if flag(moduleName)
build-depends: hls-module-name-plugin ^>=1.0.0.0
cpp-options: -DmoduleName

common pragmas
if flag(pragmas) || flag(all-plugins)
if flag(pragmas)
build-depends: hls-pragmas-plugin ^>=1.0.0.0
cpp-options: -Dpragmas

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

-- formatters

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

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

common ormolu
if flag(ormolu) || flag(all-formatters)
if flag(ormolu)
build-depends: hls-ormolu-plugin ^>=1.0.0.0
cpp-options: -Dormolu

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

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

Expand Down Expand Up @@ -443,42 +436,16 @@ test-suite func-test
if flag(pedantic)
ghc-options: -Werror -Wredundant-constraints

if flag(callHierarchy) || flag(all-plugins)
cpp-options: -DcallHierarchy
if flag(class) || flag(all-plugins)
cpp-options: -Dclass
if flag(haddockComments) || flag(all-plugins)
cpp-options: -DhaddockComments
if flag(eval) || flag(all-plugins)
-- Duplicating inclusion plugin conditions until tests are moved to their own packages
if flag(eval)
cpp-options: -Deval
if flag(importLens) || flag(all-plugins)
cpp-options: -DimportLens
if flag(rename) || flag(all-plugins)
cpp-options: -Drename
if flag(retrie) || flag(all-plugins)
cpp-options: -Dretrie
if flag(tactic) || flag(all-plugins)
cpp-options: -Dtactic
if flag(hlint) || flag(all-plugins)
cpp-options: -Dhlint
if flag(moduleName) || flag(all-plugins)
cpp-options: -DmoduleName
if flag(pragmas) || flag(all-plugins)
cpp-options: -Dpragmas
if flag(splice) || flag(all-plugins)
cpp-options: -Dsplice

-- formatters
if flag(floskell) || flag(all-formatters)
if flag(floskell) && (impl(ghc < 9.0.1) || flag(ignore-plugins-ghc-bounds))
cpp-options: -Dfloskell
if flag(fourmolu) || flag(all-formatters)
if flag(fourmolu) && (impl(ghc < 9.2.1) || flag(ignore-plugins-ghc-bounds))
cpp-options: -Dfourmolu
if flag(ormolu) || flag(all-formatters)
if flag(ormolu)
cpp-options: -Dormolu
if flag(stylishHaskell) || flag(all-formatters)
cpp-options: -DstylishHaskell
if (flag(brittany) || flag(all-formatters))
cpp-options: -Dbrittany

test-suite wrapper-test
type: exitcode-stdio-1.0
Expand Down
99 changes: 1 addition & 98 deletions test/utils/Test/Hls/Flags.hs
@@ -1,28 +1,13 @@
{-# LANGUAGE CPP #-}
{-# OPTIONS_GHC -Wno-unused-imports #-}
-- | Module for disabling tests if their plugins are disabled
-- DEPRECATED: To be removed when all plugin tests are in their own packages
module Test.Hls.Flags where

import Test.Hls (TestTree, ignoreTestBecause)

-- * Plugin dependent tests

-- | Disable test unless the class flag is set
requiresClassPlugin :: TestTree -> TestTree
#if class
requiresClassPlugin = id
#else
requiresClassPlugin = ignoreTestBecause "Class plugin disabled"
#endif

-- | Disable test unless the haddockComments flag is set
requiresHaddockCommentsPlugin :: TestTree -> TestTree
#if haddockComments
requiresHaddockCommentsPlugin = id
#else
requiresHaddockCommentsPlugin = ignoreTestBecause "HaddockComments plugin disabled"
#endif

-- | Disable test unless the eval flag is set
requiresEvalPlugin :: TestTree -> TestTree
#if eval
Expand All @@ -31,71 +16,6 @@ requiresEvalPlugin = id
requiresEvalPlugin = ignoreTestBecause "Eval plugin disabled"
#endif

-- | Disable test unless the importLens flag is set
requiresImportLensPlugin :: TestTree -> TestTree
#if importLens
requiresImportLensPlugin = id
#else
requiresImportLensPlugin = ignoreTestBecause "ImportLens plugin disabled"
#endif

-- | Disable test unless the rename flag is set
requiresRenamePlugin :: TestTree -> TestTree
#if rename
requiresRenamePlugin = id
#else
requiresRenamePlugin = ignoreTestBecause "Rename plugin disabled"
#endif

-- | Disable test unless the retrie flag is set
requiresRetriePlugin :: TestTree -> TestTree
#if retrie
requiresRetriePlugin = id
#else
requiresRetriePlugin = ignoreTestBecause "Retrie plugin disabled"
#endif

-- | Disable test unless the tactic flag is set
requiresTacticPlugin :: TestTree -> TestTree
#if tactic
requiresTacticPlugin = id
#else
requiresTacticPlugin = ignoreTestBecause "Tactic plugin disabled"
#endif

-- | Disable test unless the hlint flag is set
requiresHlintPlugin :: TestTree -> TestTree
#if hlint
requiresHlintPlugin = id
#else
requiresHlintPlugin = ignoreTestBecause "Hlint plugin disabled"
#endif

-- | Disable test unless the moduleName flag is set
requiresModuleNamePlugin :: TestTree -> TestTree
#if moduleName
requiresModuleNamePlugin = id
#else
requiresModuleNamePlugin = ignoreTestBecause "ModuleName plugin disabled"
#endif

-- | Disable test unless the pragmas flag is set
requiresPragmasPlugin :: TestTree -> TestTree
#if pragmas
requiresPragmasPlugin = id
#else
requiresPragmasPlugin = ignoreTestBecause "Pragmas plugin disabled"
#endif

-- | Disable test unless the splice flag is set
requiresSplicePlugin :: TestTree -> TestTree
#if splice
requiresSplicePlugin = id
#else
requiresSplicePlugin = ignoreTestBecause "Splice plugin disabled"
#endif


-- * Formatters
-- | Disable test unless the floskell flag is set
requiresFloskellPlugin :: TestTree -> TestTree
Expand All @@ -120,20 +40,3 @@ requiresOrmoluPlugin = id
#else
requiresOrmoluPlugin = ignoreTestBecause "Ormolu plugin disabled"
#endif

-- | Disable test unless the stylishHaskell flag is set
requiresStylishHaskellPlugin :: TestTree -> TestTree
#if stylishHaskell
requiresStylishHaskellPlugin = id
#else
requiresStylishHaskellPlugin = ignoreTestBecause "StylishHaskell plugin disabled"
#endif

-- | Disable test unless the brittany flag is set
requiresBrittanyPlugin :: TestTree -> TestTree
#if brittany
requiresBrittanyPlugin = id
#else
requiresBrittanyPlugin = ignoreTestBecause "Brittany plugin disabled"
#endif