Skip to content

Commit

Permalink
Make work stack-9.2.1.yaml and enable pedantic (-WError) for cabal (
Browse files Browse the repository at this point in the history
#2606)

* Enable brittany for ghc-9.0.2

* Make works using cabal freeze

* Add stack 9.2.1 to ci

* Use new *molu versions

* Enable rename for stack 9.2.1

* Use last ghc-lib

* Use correct boot pkgs

* Use last ghc-exactprint

* Reorganize and use lens-5.1

* update retrie

* Comment class plugin package

* Handle Nothing case

* Restore ghc-typelits deps

* More non-exhaustive patterns

* More non-exhaustive patterns

* Set pedantic (-WError) true for cabal

* Remove pedantic as we set it out in cabal.project

* Not set pedantic for ghc-9.2.1

* Set pedantic in cabal.project's

* More non-exhaustive patterns

* Not set pedantic for ghc-9.0.1

* More incomplete patterns

* Fix WErrors

* Dodgy import

* Correct CPP conditions

* Not MonadFail in Prelude

* Fix more warnings

* Restore missing fun

* unused imports

* Enable refine imports

* more fixes

* Enable brittany in nix for 9.0.1

* Use newer prettyprinter

* Return to master

* Enable tactics in stack-9.2.1.yaml

* Enable pedantic in ci

* Avoid deprecation warning with CPP �

* Use default prettyprinter

* Update refinery for ghc-9.2.1

* Ignore deprecations

* Use dev version of ghc-source-gen

* disable wingman for 9.2.1

* Enable wingman for 9.0.2

* disable tactic with flag

* yaml grammar

* Use setup-build action

* Correct workflow

* Build flags for al major os's

* The integer twaek is needed for the solver

* Disable tests beforehand

* flags only affect local packages

* Exclude 8.6.5

* Exclude 8.8.4
  • Loading branch information
jneira authored Jan 20, 2022
1 parent 905f8f7 commit 2558035
Show file tree
Hide file tree
Showing 20 changed files with 171 additions and 176 deletions.
6 changes: 6 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,11 @@ jobs:
- STACK_FILE: "stack-9.0.2.yaml"
<<: *defaults

ghc-9.2.1:
environment:
- STACK_FILE: "stack-9.2.1.yaml"
<<: *defaults

ghc-default:
environment:
- STACK_FILE: "stack.yaml"
Expand All @@ -121,4 +126,5 @@ workflows:
- ghc-8.10.7
- ghc-9.0.1
- ghc-9.0.2
- ghc-9.2.1
- ghc-default
12 changes: 10 additions & 2 deletions .github/actions/setup-build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,19 @@ runs:
fi
shell: bash

# some alpines come with integer-simple instead of integer-gmp
- if: inputs.os == 'Linux'
name: Force integer-simple
run: |
if ghc --info | grep -q integer-simple ; then
echo -e 'package blaze-textual\n flags: +integer-simple' >> cabal.project.local
fi
shell: bash

- if: inputs.os == 'Windows' && inputs.ghc == '8.8.4'
name: (Windows,GHC 8.8) Modify `cabal.project` to workaround segfaults
run: |
echo "package floskell" >> cabal.project
echo " ghc-options: -O0" >> cabal.project
echo -e 'package floskell\n ghc-options: -O0' >> cabal.project.local
shell: bash

# Shorten binary names as a workaround for filepath length limits in Windows,
Expand Down
50 changes: 9 additions & 41 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,40 +41,15 @@ jobs:
apk add --no-cache zlib zlib-dev zlib-static gmp gmp-dev ncurses-static
- uses: actions/checkout@v2

- uses: haskell/actions/setup@v1
with:
ghc-version : ${{ matrix.ghc }}
cabal-version: ${{ matrix.cabal }}
enable-stack: false

# some alpines come with integer-simple instead of integer-gmp
- name: Force integer-simple
if: matrix.os == 'ubuntu-18.04'
run: |
if ghc --info | grep -q integer-simple ; then
echo -e 'package blaze-textual\n flags: +integer-simple' >> cabal.project.local
fi
- name: Use modified cabal.project
env:
GHCVER: ${{ matrix.ghc }}
- name: Disable tests and bechmarks
run: |
GHCVER2=${GHCVER//./}
ALT_PROJECT_FILE_MINOR=cabal-ghc${GHCVER2}.project
ALT_PROJECT_FILE_MAJOR=cabal-ghc${GHCVER2:0:2}.project
if [[ -f "$ALT_PROJECT_FILE_MINOR" ]]; then
rm -f -v cabal.project && cp -v "$ALT_PROJECT_FILE_MINOR" cabal.project
elif [[ -f "$ALT_PROJECT_FILE_MAJOR" ]]; then
rm -f -v cabal.project && cp -v "$ALT_PROJECT_FILE_MAJOR" cabal.project
fi
echo -e 'tests: false' >> cabal.project.local
echo -e 'benchmarks: false' >> cabal.project.local
- name: Shorten binary names
run: |
sed -i.bak -e 's/haskell-language-server/hls/g' \
-e 's/haskell_language_server/hls/g' \
haskell-language-server.cabal cabal.project
sed -i.bak -e 's/Paths_haskell_language_server/Paths_hls/g' \
src/**/*.hs exe/*.hs
- uses: ./.github/actions/setup-build
with:
ghc: ${{ matrix.ghc }}
os: ${{ runner.os }}

- name: (Windows) Platform specifics
if: matrix.os == 'windows-latest'
Expand All @@ -99,17 +74,10 @@ jobs:
run: |
echo "GHC_VERSION=$GHC_VER" >> $GITHUB_ENV
- name: (Windows, GHC 8.8.4) Workaround segfaults
if: matrix.ghc == '8.8.4' && matrix.os == 'windows-latest'
run: |
echo "package floskell" >> cabal.project
echo " ghc-options: -O0" >> cabal.project
- name: Build the server
# Try building it twice in case of flakey builds on Windows
run: |
cabal build --disable-tests exe:hls -O2 $LINUX_CABAL_ARGS || \
cabal build --disable-tests exe:hls -O2 $LINUX_CABAL_ARGS -j1
cabal build exe:hls -O2 $LINUX_CABAL_ARGS || cabal build exe:hls -O2 $LINUX_CABAL_ARGS -j1
- name: Compress server binary
id: compress_server_binary
Expand Down Expand Up @@ -148,7 +116,7 @@ jobs:

- name: (GHC 8.10) Build the wrapper
if: matrix.ghc == '8.10.7'
run: cabal build --disable-tests exe:hls-wrapper -O2 $LINUX_CABAL_ARGS
run: cabal build exe:hls-wrapper -O2 $LINUX_CABAL_ARGS

- name: (GHC 8.10) Compress wrapper binary
if: matrix.ghc == '8.10.7'
Expand Down
24 changes: 14 additions & 10 deletions .github/workflows/flags.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,11 @@ jobs:
strategy:
fail-fast: true
matrix:
ghc: [ "8.10.7"
ghc: [ "9.2.1"
, "9.0.2"
, "8.10.7"
, "8.8.4"
, "8.6.5"
]
os: [ "ubuntu-latest"
]
Expand All @@ -57,20 +61,20 @@ jobs:
os: ${{ runner.os }}

- name: Build `hls-graph` with flags
run: cabal v2-build hls-graph --flags="pedantic embed-files stm-stats"
run: cabal v2-build hls-graph --flags="embed-files stm-stats"

- name: Build `hie-compat` with flags
- if: matrix.ghc != '8.6.5' && matrix.ghc != '8.8.4'
name: Build `hie-compat` with flags
run: cabal v2-build hie-compat --flags="ghc-lib"

- name: Build `hls-plugin-api` with flags
run: cabal v2-build hls-plugin-api --flags="pedantic"

- name: Build `hls-test-utils` with flags
run: cabal v2-build hls-test-utils --flags="pedantic"

- name: Build
- name: Build `ghcide` with flags
run: cabal v2-build ghcide --flags="ghc-patched-unboxed-bytecode test-exe executable bench-exe"

# we have to clean up warnings for 9.0 and 9.2 before enable -WAll
- if: matrix.ghc != '9.0.2' && matrix.ghc != '9.2.1'
name: Build with pedantic (-WError)
run: cabal v2-build --flags="pedantic"

flags_post_job:
if: always()
runs-on: ubuntu-latest
Expand Down
19 changes: 0 additions & 19 deletions cabal-ghc921.project
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,6 @@ packages:
./plugins/hls-call-hierarchy-plugin
./plugins/hls-alternate-number-format-plugin

repository head.hackage.ghc.haskell.org
url: https://ghc.gitlab.haskell.org/head.hackage/
secure: True
key-threshold: 3
root-keys:
f76d08be13e9a61a377a85e2fb63f4c5435d40f8feb3e12eb05905edb8cdea89
26021a13b401500c8eb2761ca95c61f2d625bfef951b939a8124ed12ecf07329
7541f32a4ccca4f97aea3b22f5e593ba2c0267546016b992dfadcd2fe944e55d


with-compiler: ghc-9.2.1

tests: true
Expand All @@ -63,17 +53,8 @@ constraints:
-splice
-stylishhaskell
-tactic,
ghc-lib-parser ^>= 9.2,
attoparsec ^>= 0.14.3,
ghc-exactprint >= 1.3,
retrie >= 1.2,
direct-sqlite == 2.3.26,
lens >= 5.0.1,
primitive-unlifted ==0.1.3.1

allow-newer:
-- base,

-- for shake-bench
Chart:lens,
Chart-diagrams:lens,
Expand Down
9 changes: 2 additions & 7 deletions hls-graph/src/Development/IDE/Graph/Internal/Types.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@


{-# LANGUAGE CPP #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DeriveFunctor #-}
Expand All @@ -14,16 +12,13 @@ module Development.IDE.Graph.Internal.Types where

import Control.Applicative
import Control.Monad.Catch
#if __GLASGOW_HASKELL__ < 870
#if __GLASGOW_HASKELL__ < 808
-- Needed in GHC 8.6.5
import Control.Concurrent.STM.Stats (TVar, atomically)
import Control.Monad.Fail
#else
import GHC.Conc (TVar, atomically)
#endif
#if __GLASGOW_HASKELL__ < 880
import Control.Monad.Fail
import Prelude hiding (MonadFail)
#endif
import Control.Monad.IO.Class
import Control.Monad.Trans.Reader
import Data.Aeson (FromJSON, ToJSON)
Expand Down
21 changes: 12 additions & 9 deletions plugins/default/src/Ide/Plugin/Example.hs
Original file line number Diff line number Diff line change
Expand Up @@ -109,15 +109,18 @@ mkDiag file diagSource sev loc msg = (file, D.ShowDiag,)
-- | Generate code actions.
codeAction :: PluginMethodHandler IdeState TextDocumentCodeAction
codeAction state _pid (CodeActionParams _ _ (TextDocumentIdentifier uri) _range CodeActionContext{_diagnostics=List _xs}) = liftIO $ do
let Just nfp = uriToNormalizedFilePath $ toNormalizedUri uri
Just (ParsedModule{},_) <- runIdeAction "example" (shakeExtras state) $ useWithStaleFast GetParsedModule nfp
let
title = "Add TODO Item 1"
tedit = [TextEdit (Range (Position 2 0) (Position 2 0))
"-- TODO1 added by Example Plugin directly\n"]
edit = WorkspaceEdit (Just $ Map.singleton uri $ List tedit) Nothing Nothing
pure $ Right $ List
[ InR $ CodeAction title (Just CodeActionQuickFix) (Just $ List []) Nothing Nothing (Just edit) Nothing Nothing]
let mbnfp = uriToNormalizedFilePath $ toNormalizedUri uri
case mbnfp of
Just nfp -> do
Just (ParsedModule{},_) <- runIdeAction "example" (shakeExtras state) $ useWithStaleFast GetParsedModule nfp
let
title = "Add TODO Item 1"
tedit = [TextEdit (Range (Position 2 0) (Position 2 0))
"-- TODO1 added by Example Plugin directly\n"]
edit = WorkspaceEdit (Just $ Map.singleton uri $ List tedit) Nothing Nothing
pure $ Right $ List
[ InR $ CodeAction title (Just CodeActionQuickFix) (Just $ List []) Nothing Nothing (Just edit) Nothing Nothing]
Nothing -> error $ "Unable to get a normalized file path from the uri: " ++ show uri

-- ---------------------------------------------------------------------

Expand Down
3 changes: 2 additions & 1 deletion plugins/hls-eval-plugin/src/Ide/Plugin/Eval/Rules.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE RecordWildCards #-}

-- To avoid warning "Pattern match has inaccessible right hand side"
{-# OPTIONS_GHC -Wno-overlapping-patterns #-}
module Ide.Plugin.Eval.Rules (GetEvalComments(..), rules,queueForEvaluation) where

import Control.Monad.IO.Class (MonadIO (liftIO))
Expand Down
13 changes: 6 additions & 7 deletions plugins/hls-hlint-plugin/src/Ide/Plugin/Hlint.hs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ import Development.IDE.GHC.Compat (BufSpan,
DynFlags,
extensionFlags,
ms_hspp_opts,
topDir)
topDir,
WarningFlag(Opt_WarnUnrecognisedPragmas),
wopt)
import qualified Development.IDE.GHC.Compat.Util as EnumSet
import "ghc-lib" GHC hiding
(DynFlags (..),
Expand All @@ -85,6 +87,7 @@ import Language.Haskell.GHC.ExactPrint.Delta (deltaOption
import Language.Haskell.GHC.ExactPrint.Parsers (postParseTransform)
import Language.Haskell.GHC.ExactPrint.Types (Rigidity (..))
import Language.Haskell.GhclibParserEx.Fixity as GhclibParserEx (applyFixities)
import GHC.Generics (Associativity (LeftAssociative, NotAssociative, RightAssociative))
#endif

import Ide.Logger
Expand All @@ -105,21 +108,17 @@ import Language.LSP.Types hiding
import qualified Language.LSP.Types as LSP
import qualified Language.LSP.Types.Lens as LSP

import GHC.Generics (Associativity (LeftAssociative, NotAssociative, RightAssociative),
Generic)
import Text.Regex.TDFA.Text ()

import Development.IDE.GHC.Compat (WarningFlag (Opt_WarnUnrecognisedPragmas),
wopt)
import Development.IDE.Spans.Pragmas (LineSplitTextEdits (LineSplitTextEdits),
NextPragmaInfo (NextPragmaInfo),
getNextPragmaInfo,
lineSplitDeleteTextEdit,
lineSplitInsertTextEdit,
lineSplitTextEdits,
nextPragmaLine)
import GHC.Generics (Generic)
import System.Environment (setEnv,
unsetEnv)
import Text.Regex.TDFA.Text ()
-- ---------------------------------------------------------------------

#ifdef HLINT_ON_GHC_LIB
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,10 +160,11 @@ commandProvider RunMetaprogram =


requireGHC88OrHigher :: TacticProvider -> TacticProvider
requireGHC88OrHigher tp tpd =
#if __GLASGOW_HASKELL__ >= 808
requireGHC88OrHigher tp tpd =
tp tpd
#else
requireGHC88OrHigher _ _=
mempty
#endif

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{-# LANGUAGE OverloadedStrings #-}
{-# OPTIONS_GHC -Wno-deprecations #-}

module Wingman.Metaprogramming.Parser.Documentation where

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# OPTIONS_GHC -Wno-deprecations #-}

module Wingman.Metaprogramming.ProofState where

Expand Down
Loading

0 comments on commit 2558035

Please sign in to comment.