Skip to content

Commit ccf9d04

Browse files
fendorjneira
andauthored
Make heavy use of common sections (#2447)
Co-authored-by: Javier Neira <atreyu.bbb@gmail.com>
1 parent dcd2163 commit ccf9d04

File tree

1 file changed

+26
-21
lines changed

1 file changed

+26
-21
lines changed

haskell-language-server.cabal

Lines changed: 26 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,20 @@ common common-deps
4040
, filepath
4141
, text
4242

43+
-- Default warnings in HLS
44+
common warnings
45+
ghc-options: -Wall -Wredundant-constraints -Wno-name-shadowing -Wno-unticked-promoted-constructors
46+
47+
-- Allow compiling in pedantic mode
48+
common pedantic
49+
if flag(pedantic)
50+
ghc-options: -Werror
51+
4352
library
4453
import: common-deps
54+
-- configuration
55+
, warnings
56+
, pedantic
4557
exposed-modules:
4658
Ide.Arguments
4759
Ide.Main
@@ -74,11 +86,6 @@ library
7486
, unordered-containers
7587
, aeson-pretty
7688

77-
ghc-options: -Wall -Wredundant-constraints -Wno-name-shadowing -Wno-unticked-promoted-constructors
78-
79-
if flag(pedantic)
80-
ghc-options: -Werror
81-
8289
default-language: Haskell2010
8390
default-extensions: DataKinds, TypeOperators
8491

@@ -302,6 +309,9 @@ common brittany
302309

303310
executable haskell-language-server
304311
import: common-deps
312+
-- configuration
313+
, warnings
314+
, pedantic
305315
-- plugins
306316
, example-plugins
307317
, callHierarchy
@@ -330,15 +340,12 @@ executable haskell-language-server
330340
other-modules: Plugins
331341

332342
ghc-options:
333-
-threaded -Wall -Wno-name-shadowing -Wredundant-constraints
343+
-threaded
334344
-- allow user RTS overrides
335345
-rtsopts
336346
-- disable idle GC
337347
-- increase nursery size
338348
"-with-rtsopts=-I0 -A128M"
339-
-Wno-unticked-promoted-constructors
340-
if flag(pedantic)
341-
ghc-options: -Werror
342349

343350
build-depends:
344351
, aeson
@@ -378,19 +385,19 @@ executable haskell-language-server
378385

379386
executable haskell-language-server-wrapper
380387
import: common-deps
388+
, warnings
389+
, pedantic
381390
main-is: Wrapper.hs
382391
hs-source-dirs: exe
383392
other-modules: Paths_haskell_language_server
384393
autogen-modules: Paths_haskell_language_server
385394
ghc-options:
386-
-threaded -Wall -Wno-name-shadowing -Wredundant-constraints
395+
-threaded
387396
-- allow user RTS overrides
388397
-rtsopts
389398
-- disable idle GC
390399
-- increase nursery size
391400
"-with-rtsopts=-I0 -A128M"
392-
if flag(pedantic)
393-
ghc-options: -Werror
394401

395402
build-depends:
396403
, data-default
@@ -409,6 +416,8 @@ executable haskell-language-server-wrapper
409416

410417
test-suite func-test
411418
import: common-deps
419+
, warnings
420+
, pedantic
412421
type: exitcode-stdio-1.0
413422
default-language: Haskell2010
414423
build-tool-depends:
@@ -454,10 +463,7 @@ test-suite func-test
454463

455464
default-extensions: OverloadedStrings
456465
ghc-options:
457-
-Wall -Wno-name-shadowing -threaded -rtsopts -with-rtsopts=-N -Wno-unticked-promoted-constructors
458-
459-
if flag(pedantic)
460-
ghc-options: -Werror -Wredundant-constraints
466+
-threaded -rtsopts -with-rtsopts=-N
461467

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

473479
test-suite wrapper-test
480+
import: common-deps
481+
, warnings
482+
, pedantic
474483
type: exitcode-stdio-1.0
475484
build-tool-depends:
476485
haskell-language-server:haskell-language-server-wrapper -any,
477486
haskell-language-server:haskell-language-server -any
478487

479488
default-language: Haskell2010
480489
build-depends:
481-
, base
482-
, directory
483-
, process
490+
process
484491
, hls-test-utils
485-
, extra
486492

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

0 commit comments

Comments
 (0)