From 9e3317d4acb62b34ebfbb93fd9cf08f242efd4c9 Mon Sep 17 00:00:00 2001 From: Veronika Romashkina Date: Sat, 8 Aug 2020 18:48:59 +0100 Subject: [PATCH] [#482] Add GHC options to generate the HIE files (#494) Resolves #482 --- .gitignore | 1 + CHANGELOG.md | 4 ++++ README.md | 2 ++ summoner-cli/examples/cabal-full/.gitignore | 1 + summoner-cli/examples/cabal-full/cabal-full.cabal | 2 ++ summoner-cli/examples/cabal-minimal/cabal-minimal.cabal | 2 ++ summoner-cli/examples/full-batteries/.gitignore | 1 + summoner-cli/examples/stack-full/.gitignore | 1 + summoner-cli/examples/stack-full/stack-full.cabal | 2 ++ summoner-cli/src/Summoner/Template/Cabal.hs | 2 ++ summoner-cli/src/Summoner/Template/GitHub.hs | 1 + summoner-cli/summoner.cabal | 2 ++ summoner-tui/summoner-tui.cabal | 2 ++ 13 files changed, 23 insertions(+) diff --git a/.gitignore b/.gitignore index 22f32a54..595cba76 100644 --- a/.gitignore +++ b/.gitignore @@ -21,6 +21,7 @@ cabal.config cabal.project.local .ghc.environment.* .HTF/ +.hie/ # Stack .stack-work/ stack.yaml.lock diff --git a/CHANGELOG.md b/CHANGELOG.md index b9ecee7a..af184f09 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,10 @@ The changelog is available [on GitHub][2]. Add README link in the `.cabal` file's description field. * [#453](https://github.com/kowainik/summoner/issues/453): Drop support of `GHC-7.10` in the generated projects. +* [#482](https://github.com/kowainik/summoner/issues/482): + Include `.hie` related GHC options to the generated files: + `-fwrite-ide-info` and `-hiedir=.hie` for GHC >= 8.8. + Also add `.hie` folder in the `.gitignore`. * [#484](https://github.com/kowainik/summoner/issues/484): Improve generated files content. diff --git a/README.md b/README.md index 11095910..41f2fdea 100644 --- a/README.md +++ b/README.md @@ -139,6 +139,8 @@ Features related to the structure and content of the generated projects. -Wmissing-export-lists (GHC ⩾ 8.4) -Wpartial-fields (GHC ⩾ 8.4) -Wmissing-deriving-strategies (GHC ⩾ 8.8) + -fwrite-ide-info (GHC ⩾ 8.8) + -hiedir=.hie (GHC ⩾ 8.8) -Wunused-packages (GHC ⩾ 8.10) ``` diff --git a/summoner-cli/examples/cabal-full/.gitignore b/summoner-cli/examples/cabal-full/.gitignore index 80bd4acd..6fe0ed9f 100644 --- a/summoner-cli/examples/cabal-full/.gitignore +++ b/summoner-cli/examples/cabal-full/.gitignore @@ -21,6 +21,7 @@ cabal.config cabal.project.local .ghc.environment.* .HTF/ +.hie/ # Stack .stack-work/ stack.yaml.lock diff --git a/summoner-cli/examples/cabal-full/cabal-full.cabal b/summoner-cli/examples/cabal-full/cabal-full.cabal index 317911ab..3065a484 100644 --- a/summoner-cli/examples/cabal-full/cabal-full.cabal +++ b/summoner-cli/examples/cabal-full/cabal-full.cabal @@ -45,6 +45,8 @@ common common-options -Wpartial-fields if impl(ghc >= 8.8) ghc-options: -Wmissing-deriving-strategies + -fwrite-ide-info + -hiedir=.hie if impl(ghc >= 8.10) ghc-options: -Wunused-packages diff --git a/summoner-cli/examples/cabal-minimal/cabal-minimal.cabal b/summoner-cli/examples/cabal-minimal/cabal-minimal.cabal index 60609768..70c29a60 100644 --- a/summoner-cli/examples/cabal-minimal/cabal-minimal.cabal +++ b/summoner-cli/examples/cabal-minimal/cabal-minimal.cabal @@ -30,6 +30,8 @@ common common-options -Wpartial-fields if impl(ghc >= 8.8) ghc-options: -Wmissing-deriving-strategies + -fwrite-ide-info + -hiedir=.hie if impl(ghc >= 8.10) ghc-options: -Wunused-packages diff --git a/summoner-cli/examples/full-batteries/.gitignore b/summoner-cli/examples/full-batteries/.gitignore index 09ebad36..389cb4ba 100644 --- a/summoner-cli/examples/full-batteries/.gitignore +++ b/summoner-cli/examples/full-batteries/.gitignore @@ -21,6 +21,7 @@ cabal.config cabal.project.local .ghc.environment.* .HTF/ +.hie/ # Stack .stack-work/ stack.yaml.lock diff --git a/summoner-cli/examples/stack-full/.gitignore b/summoner-cli/examples/stack-full/.gitignore index 80bd4acd..6fe0ed9f 100644 --- a/summoner-cli/examples/stack-full/.gitignore +++ b/summoner-cli/examples/stack-full/.gitignore @@ -21,6 +21,7 @@ cabal.config cabal.project.local .ghc.environment.* .HTF/ +.hie/ # Stack .stack-work/ stack.yaml.lock diff --git a/summoner-cli/examples/stack-full/stack-full.cabal b/summoner-cli/examples/stack-full/stack-full.cabal index 6868824f..f626463f 100644 --- a/summoner-cli/examples/stack-full/stack-full.cabal +++ b/summoner-cli/examples/stack-full/stack-full.cabal @@ -45,6 +45,8 @@ common common-options -Wpartial-fields if impl(ghc >= 8.8) ghc-options: -Wmissing-deriving-strategies + -fwrite-ide-info + -hiedir=.hie if impl(ghc >= 8.10) ghc-options: -Wunused-packages diff --git a/summoner-cli/src/Summoner/Template/Cabal.hs b/summoner-cli/src/Summoner/Template/Cabal.hs index c1416cae..92b76f23 100644 --- a/summoner-cli/src/Summoner/Template/Cabal.hs +++ b/summoner-cli/src/Summoner/Template/Cabal.hs @@ -139,6 +139,8 @@ cabalFile Settings{..} = File (toString settingsRepo ++ ".cabal") cabalFileConte , " -Wpartial-fields" , " if impl(ghc >= 8.8)" , " ghc-options: -Wmissing-deriving-strategies" + , " -fwrite-ide-info" + , " -hiedir=.hie" , " if impl(ghc >= 8.10)" , " ghc-options: -Wunused-packages" ] diff --git a/summoner-cli/src/Summoner/Template/GitHub.hs b/summoner-cli/src/Summoner/Template/GitHub.hs index 63ac3df0..41b3a01b 100644 --- a/summoner-cli/src/Summoner/Template/GitHub.hs +++ b/summoner-cli/src/Summoner/Template/GitHub.hs @@ -70,6 +70,7 @@ gitHubFiles Settings{..} = concat , "cabal.project.local" , ".ghc.environment.*" , ".HTF/" + , ".hie/" , "# Stack" , ".stack-work/" , "stack.yaml.lock" diff --git a/summoner-cli/summoner.cabal b/summoner-cli/summoner.cabal index 56f51777..d1080962 100644 --- a/summoner-cli/summoner.cabal +++ b/summoner-cli/summoner.cabal @@ -95,6 +95,8 @@ common common-options if impl(ghc >= 8.8) ghc-options: -Wmissing-deriving-strategies -Werror=missing-deriving-strategies + -fwrite-ide-info + -hiedir=../.hie if impl(ghc >= 8.10) ghc-options: -Wunused-packages diff --git a/summoner-tui/summoner-tui.cabal b/summoner-tui/summoner-tui.cabal index 4ce758af..49ad3078 100644 --- a/summoner-tui/summoner-tui.cabal +++ b/summoner-tui/summoner-tui.cabal @@ -48,6 +48,8 @@ common common-options if impl(ghc >= 8.8) ghc-options: -Wmissing-deriving-strategies -Werror=missing-deriving-strategies + -fwrite-ide-info + -hiedir=../.hie if impl(ghc >= 8.10) ghc-options: -Wunused-packages