on iko/ghcjs-patch-master help sign in
Add writeHieFiles (#1022)

* Bump nix-tools to latest master revision * Add writeHieFiles * Update modules/plan.nix Co-authored-by: Michael Peyton Jones <me@michaelpj.com> * Move where the hie flags are specified Co-authored-by: Michael Peyton Jones <me@michaelpj.com>

commit37b9ce167098441561c325152f65ac0eb5ad2076 authorOllie Charles <ollie@ocharles.org.uk> dateFri 18 Jun 2021, 09:25 (5 years ago) parent6ee69f4
2 files changed+18−2
builder/comp-builder.nix+12−2 modules/plan.nix+6
builder/comp-builder.nix+12−2
@@ -47,6 +47,7 @@ let self =
4747 # ghc's internal linker seems to be broken on x86.
4848 && !(stdenv.hostPlatform.isMusl && !stdenv.hostPlatform.isx86)
4949, enableDeadCodeElimination ? component.enableDeadCodeElimination
50+, writeHieFiles ? component.writeHieFiles
5051
5152, ghcOptions ? component.ghcOptions
5253
@@ -143,7 +144,15 @@ let
143144
144145 finalConfigureFlags = lib.concatStringsSep " " (
145146 [ "--prefix=$out"
146− ] ++ (
147+ ] ++
148+ # We don't specify this in 'commonConfigureFlags', as these are also
149+ # used by haddock-builder.nix. If we do specify these options in
150+ # commonConfigureFlags, then the haddock-builder will fail, because it
151+ # sets its own outputs which *don't* include $hie
152+ lib.optionals writeHieFiles [
153+ "--ghc-option=-fwrite-ide-info" "--ghc-option=-hiedir$hie"
154+ ] ++
155+ (
147156 # If configureAllComponents is set we should not specify the component
148157 # and Setup will attempt to configure them all.
149158 if configureAllComponents
@@ -345,7 +354,8 @@ let
345354
346355 outputs = ["out" ]
347356 ++ (lib.optional enableSeparateDataOutput "data")
348− ++ (lib.optional keepSource "source");
357+ ++ (lib.optional keepSource "source")
358+ ++ (lib.optional writeHieFiles "hie");
349359
350360 prePatch =
351361 # emcc is very slow if it cannot cache stuff in $HOME
modules/plan.nix+6
@@ -173,6 +173,12 @@ let
173173 default = (def.keepSource or false);
174174 description = "Keep component source in the store in a `source` output";
175175 };
176+
177+ writeHieFiles = mkOption {
178+ type = bool;
179+ default = (def.writeHieFiles or false);
180+ description = "Write component `.hie` files in the store in a `hie` output";
181+ };
176182 };
177183 packageOptions = def: componentOptions def // {
178184 preUnpack = mkOption {