Skip to content

Commit

Permalink
Make heavy use of common sections
Browse files Browse the repository at this point in the history
  • Loading branch information
fendor committed Dec 7, 2021
1 parent 85b51c4 commit 6ed287e
Showing 1 changed file with 25 additions and 18 deletions.
43 changes: 25 additions & 18 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
-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,20 @@ 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
, hls-test-utils
, extra

hs-source-dirs: test/wrapper
main-is: Main.hs
ghc-options: -Wall

0 comments on commit 6ed287e

Please sign in to comment.