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

simplify hlint plugin Cabal descriptor #2867

Merged
merged 14 commits into from
May 1, 2022
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions .github/workflows/flags.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,6 @@ jobs:
- name: Build `hls-graph` with flags
run: cabal v2-build hls-graph --flags="embed-files stm-stats"

- 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 `ghcide` with flags
run: cabal v2-build ghcide --flags="ghc-patched-unboxed-bytecode test-exe executable bench-exe"

Expand Down
1 change: 0 additions & 1 deletion cabal-ghc90.project
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ write-ghc-environment-files: never
index-state: 2022-04-27T09:22:49Z

constraints:
hls-hlint-plugin +ghc-lib

-- although we are not building all plugins cabal solver phase is run for all packages
-- this way we track explicitly all transitive dependencies which need support for ghc-9
Expand Down
2 changes: 0 additions & 2 deletions cabal-ghc92.project
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ constraints:
-retrie
-splice
-tactic,
hls-hlint-plugin +ghc-lib,
-- # Use ghc-lib force instead of ghc itself
ghc-lib-parser-ex -auto,
hlint +ghc-lib,
stylish-haskell +ghc-lib
Expand Down
8 changes: 5 additions & 3 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,17 @@ optional-packages: vendored/*/*.cabal
tests: true

package *
ghc-options: -haddock
-- ghc 8.10 cannot build ghc-lib 9.2 with --haddock
pepeiborra marked this conversation as resolved.
Show resolved Hide resolved
-- ghc-options: -haddock
test-show-details: direct

write-ghc-environment-files: never

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

constraints:
hyphenation +embed
hyphenation +embed,
hlint +ghc-lib
pepeiborra marked this conversation as resolved.
Show resolved Hide resolved

allow-newer:
-- for shake-bench
Expand Down
2 changes: 1 addition & 1 deletion hie-compat/hie-compat.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ library
build-depends:
base < 4.17, array, bytestring, containers, directory, filepath, transformers
if flag(ghc-lib)
build-depends: ghc-lib
build-depends: ghc-lib < 9.0
else
build-depends: ghc, ghc-boot
if (impl(ghc >= 9.0) && impl(ghc < 9.1))
Expand Down
51 changes: 4 additions & 47 deletions plugins/hls-hlint-plugin/hls-hlint-plugin.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,6 @@ flag pedantic
default: False
manual: True

flag ghc-lib
default: False
manual: True
description:
Force dependency on ghc-lib-parser even if GHC API in the ghc package is supported

flag hlint34
default: True
manual: False
description:
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
This flag can be removed when all dependencies support ghc-lib-9.0.* and we drop support for ghc-8.6

library
exposed-modules: Ide.Plugin.Hlint
hs-source-dirs: src
Expand All @@ -56,7 +43,7 @@ library
, ghc-exactprint >=0.6.3.4
, ghcide ^>=1.7
, hashable
, hlint
, hlint < 3.5
, hls-plugin-api ^>=1.4
, hslogger
, lens
Expand All @@ -69,41 +56,11 @@ library
, transformers
, unordered-containers
, apply-refact >=0.9.0.0
-- can be removed if https://github.com/ndmitchell/hlint/pull/1325#issue-1077062712 is merged
pepeiborra marked this conversation as resolved.
Show resolved Hide resolved
-- and https://github.com/haskell/haskell-language-server/pull/2464#issue-1077133441 is updated
-- accordingly
, ghc-lib
, ghc-lib-parser
, ghc-lib-parser-ex

if (flag(hlint34))
-- This mirrors the logic in hlint.cabal for hlint-3.3
-- https://github.com/ndmitchell/hlint/blob/d3576de4529d8df6cca5a345f5b7e04474ff7bff/hlint.cabal#L79-L88
-- so we can make sure that we do the same thing as hlint
build-depends: hlint ^>=3.4

if (!flag(ghc-lib) && impl(ghc >=9.0.1) && impl(ghc <9.1.0))
build-depends: ghc ==9.0.*
else
build-depends:
, ghc-lib ^>=9.2
, ghc-lib-parser-ex ^>=9.2
, ghc-lib-parser ^>=9.2

cpp-options: -DHLINT_ON_GHC_LIB
pepeiborra marked this conversation as resolved.
Show resolved Hide resolved

else
-- This mirrors the logic in hlint.cabal for hlint-3.2
-- https://github.com/ndmitchell/hlint/blob/c7354e473c7d09213c8adc3dc94bf50a6eb4a42d/hlint.cabal#L79-L88
build-depends: hlint ^>=3.2
if (!flag(ghc-lib) && impl(ghc >=8.10.1) && impl(ghc < 8.11.0))
build-depends: ghc >=8.10 && <9.0
else
build-depends:
, ghc
, ghc-lib ^>=8.10.7.20210828
, ghc-lib-parser-ex ^>=8.10

cpp-options: -DHLINT_ON_GHC_LIB

cpp-options: -DHLINT_ON_GHC_LIB
pepeiborra marked this conversation as resolved.
Show resolved Hide resolved
ghc-options:
-Wall -Wredundant-constraints -Wno-name-shadowing
-Wno-unticked-promoted-constructors
Expand Down
2 changes: 1 addition & 1 deletion plugins/hls-hlint-plugin/test/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ disableHlint = sendConfigurationChanged $ toJSON $ def { Plugin.plugins = Map.fr
-- Although a given hlint version supports one direct ghc, we could use several versions of hlint
-- each one supporting a different ghc version. It should be a temporary situation though.
knownBrokenForHlintOnGhcLib :: String -> TestTree -> TestTree
knownBrokenForHlintOnGhcLib = knownBrokenForGhcVersions [GHC86, GHC88, GHC90, GHC92]
knownBrokenForHlintOnGhcLib = expectFailBecause
pepeiborra marked this conversation as resolved.
Show resolved Hide resolved

-- 1's based
data Point = Point {
Expand Down
6 changes: 2 additions & 4 deletions stack-lts16.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,10 @@ flags:
pedantic: true
retrie:
BuildExecutable: false
# Stack doesn't support automatic flags.
# Until the formatters support ghc-lib-9, we need this flag disabled
hls-hlint-plugin:
hlint34: false
hyphenation:
embed: true
hlint:
ghc-lib: true

nix:
packages: [icu libcxx zlib]
Expand Down
6 changes: 2 additions & 4 deletions stack-lts19.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,10 @@ flags:
retrie:
BuildExecutable: false
# Stack doesn't support automatic flags.
# Until the formatters support ghc-lib-9, we need this flag disabled
hls-hlint-plugin:
hlint34: true
ghc-lib: true
hyphenation:
embed: true
hlint:
ghc-lib: true

nix:
packages: [ icu libcxx zlib ]
Expand Down
3 changes: 0 additions & 3 deletions stack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,6 @@ flags:
retrie:
BuildExecutable: false
# Stack doesn't support automatic flags.
hls-hlint-plugin:
hlint34: true
ghc-lib: true
# Use ghc-lib force instead of ghc itself
ghc-lib-parser-ex:
auto: false
Expand Down