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

Make heavy use of common sections #2447

Merged
merged 2 commits into from
Dec 8, 2021
Merged
Changes from 1 commit
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
47 changes: 26 additions & 21 deletions haskell-language-server.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,20 @@ common common-deps
, filepath
, text

-- Default warnings in HLS
common warnings
ghc-options: -Wall -Wredundant-constraints -Wno-name-shadowing -Wno-unticked-promoted-constructors

-- Allow compiling in pedantic mode
common pedantic
if flag(pedantic)
ghc-options: -Werror

library
import: common-deps
-- configuration
, warnings
, pedantic
exposed-modules:
Ide.Arguments
Ide.Main
Expand Down Expand Up @@ -74,11 +86,6 @@ library
, unordered-containers
, aeson-pretty

ghc-options: -Wall -Wredundant-constraints -Wno-name-shadowing -Wno-unticked-promoted-constructors

if flag(pedantic)
ghc-options: -Werror

default-language: Haskell2010
default-extensions: DataKinds, TypeOperators

Expand Down Expand Up @@ -302,6 +309,9 @@ common brittany

executable haskell-language-server
import: common-deps
-- configuration
, warnings
, pedantic
-- plugins
, example-plugins
, callHierarchy
Expand Down Expand Up @@ -330,15 +340,12 @@ executable haskell-language-server
other-modules: Plugins

ghc-options:
-threaded -Wall -Wno-name-shadowing -Wredundant-constraints
-threaded
-- allow user RTS overrides
-rtsopts
-- disable idle GC
-- increase nursery size
"-with-rtsopts=-I0 -A128M"
-Wno-unticked-promoted-constructors
if flag(pedantic)
ghc-options: -Werror

build-depends:
, aeson
Expand Down Expand Up @@ -378,19 +385,19 @@ executable haskell-language-server

executable haskell-language-server-wrapper
import: common-deps
, warnings
, pedantic
main-is: Wrapper.hs
hs-source-dirs: exe
other-modules: Paths_haskell_language_server
autogen-modules: Paths_haskell_language_server
ghc-options:
-threaded -Wall -Wno-name-shadowing -Wredundant-constraints
-threaded
-- allow user RTS overrides
-rtsopts
-- disable idle GC
-- increase nursery size
"-with-rtsopts=-I0 -A128M"
if flag(pedantic)
ghc-options: -Werror

build-depends:
, data-default
Expand All @@ -409,6 +416,8 @@ executable haskell-language-server-wrapper

test-suite func-test
import: common-deps
, warnings
, pedantic
type: exitcode-stdio-1.0
default-language: Haskell2010
build-tool-depends:
Expand Down Expand Up @@ -454,10 +463,7 @@ test-suite func-test

default-extensions: OverloadedStrings
ghc-options:
-Wall -Wno-name-shadowing -threaded -rtsopts -with-rtsopts=-N -Wno-unticked-promoted-constructors

if flag(pedantic)
ghc-options: -Werror -Wredundant-constraints
Comment on lines -457 to -460
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This configuration changes compared to before. E.g. -Wredundant-constraints is always added to the list of warnings.

-threaded -rtsopts -with-rtsopts=-N

-- Duplicating inclusion plugin conditions until tests are moved to their own packages
if flag(eval)
Expand All @@ -471,19 +477,18 @@ test-suite func-test
cpp-options: -Dormolu

test-suite wrapper-test
import: common-deps
, warnings
, pedantic
type: exitcode-stdio-1.0
build-tool-depends:
haskell-language-server:haskell-language-server-wrapper -any,
haskell-language-server:haskell-language-server -any

default-language: Haskell2010
build-depends:
, base
, directory
, process
process
, hls-test-utils
, extra

hs-source-dirs: test/wrapper
main-is: Main.hs
ghc-options: -Wall
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We add more warnings than just -Wall