Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC
Commits:
-
35826d8b
by Matthew Pickering at 2025-06-08T22:00:41+01:00
9 changed files:
- hadrian/doc/flavours.md
- hadrian/doc/user-settings.md
- hadrian/src/Context.hs
- hadrian/src/Context/Path.hs
- hadrian/src/Flavour.hs
- hadrian/src/Flavour/Type.hs
- hadrian/src/Settings/Builders/Ghc.hs
- hadrian/src/Settings/Default.hs
- hadrian/src/Settings/Flavours/Release.hs
Changes:
... | ... | @@ -334,6 +334,8 @@ The supported transformers are listed below: |
334 | 334 | <td>Disable including self-recompilation information in interface files via <code>-fno-write-if-self-recomp</code>. If you are building a distribution you can enable this flag to produce more deterministic interface files.</td>
|
335 | 335 | <td><code>hash_unit_ids</code></td>
|
336 | 336 | <td>Include a package hash in the unit id of built packages</td>
|
337 | + <td><code>hie_files</code></td>
|
|
338 | + <td>Produce hie files for stage1 libraries</td>
|
|
337 | 339 | </tr>
|
338 | 340 | </table>
|
339 | 341 |
... | ... | @@ -47,7 +47,10 @@ data Flavour = Flavour { |
47 | 47 | -> Bool,
|
48 | 48 | -- | Whether to build docs and which ones
|
49 | 49 | -- (haddocks, user manual, haddock manual)
|
50 | - ghcDocs :: Action DocTargets }
|
|
50 | + ghcDocs :: Action DocTargets,
|
|
51 | + -- | Whether to generate .hie files
|
|
52 | + ghcHieFiles :: Stage -> Bool
|
|
53 | + }
|
|
51 | 54 | ```
|
52 | 55 | Hadrian provides several built-in flavours (`default`, `quick`, and a few
|
53 | 56 | others; see `hadrian/doc/flavours.md`), which can be activated from the command line,
|
... | ... | @@ -364,6 +367,13 @@ all of the documentation targets: |
364 | 367 | You can pass several `--docs=...` flags, Hadrian will combine
|
365 | 368 | their effects.
|
366 | 369 | |
370 | +### HIE files
|
|
371 | + |
|
372 | +The `ghcHieFiles` field controls whether `.hie` files are generated
|
|
373 | +for source files built with the stage1 compiler.
|
|
374 | + |
|
375 | +For most flavours `.hie` files wil be generated by default.
|
|
376 | + |
|
367 | 377 | ### Split sections
|
368 | 378 | |
369 | 379 | You can build all or just a few packages with
|
... | ... | @@ -3,7 +3,7 @@ module Context ( |
3 | 3 | Context (..), vanillaContext, stageContext,
|
4 | 4 | |
5 | 5 | -- * Expressions
|
6 | - getStage, getPackage, getWay, getBuildPath, getPackageDbLoc, getStagedTarget,
|
|
6 | + getStage, getPackage, getWay, getBuildPath, getHieBuildPath, getPackageDbLoc, getStagedTarget,
|
|
7 | 7 | |
8 | 8 | -- * Paths
|
9 | 9 | contextDir, buildPath, buildDir, pkgInplaceConfig, pkgSetupConfigFile, pkgSetupConfigDir,
|
... | ... | @@ -42,6 +42,10 @@ buildPath context = buildRoot <&> (-/- buildDir context) |
42 | 42 | getBuildPath :: Expr Context b FilePath
|
43 | 43 | getBuildPath = expr . buildPath =<< getContext
|
44 | 44 | |
45 | +-- | The output directory for hie files
|
|
46 | +getHieBuildPath :: Expr Context b FilePath
|
|
47 | +getHieBuildPath = (-/- "extra-compilation-artifacts" -/- "hie") <$> getBuildPath
|
|
48 | + |
|
45 | 49 | -- | Path to the directory containing haddock timing files, used by
|
46 | 50 | -- the haddock perf tests.
|
47 | 51 | haddockStatsFilesDir :: Action FilePath
|
... | ... | @@ -21,6 +21,7 @@ module Flavour |
21 | 21 | , enableHiCore
|
22 | 22 | , useNativeBignum
|
23 | 23 | , enableTextWithSIMDUTF
|
24 | + , enableHieFiles
|
|
24 | 25 | , omitPragmas
|
25 | 26 | |
26 | 27 | , completeSetting
|
... | ... | @@ -75,6 +76,7 @@ flavourTransformers = M.fromList |
75 | 76 | , "boot_nonmoving_gc" =: enableBootNonmovingGc
|
76 | 77 | , "dump_stg" =: enableDumpStg
|
77 | 78 | , "hash_unit_ids" =: enableHashUnitIds
|
79 | + , "hie_files" =: enableHieFiles
|
|
78 | 80 | ]
|
79 | 81 | where (=:) = (,)
|
80 | 82 | |
... | ... | @@ -324,6 +326,9 @@ enableTextWithSIMDUTF flavour = flavour { |
324 | 326 | enableHashUnitIds :: Flavour -> Flavour
|
325 | 327 | enableHashUnitIds flavour = flavour { hashUnitIds = True }
|
326 | 328 | |
329 | +enableHieFiles :: Flavour -> Flavour
|
|
330 | +enableHieFiles flavour = flavour { ghcHieFiles = (>= Stage1) }
|
|
331 | + |
|
327 | 332 | -- | Build stage2 compiler with -fomit-interface-pragmas to reduce
|
328 | 333 | -- recompilation.
|
329 | 334 | omitPragmas :: Flavour -> Flavour
|
... | ... | @@ -51,7 +51,10 @@ data Flavour = Flavour { |
51 | 51 | ghcDocs :: Action DocTargets,
|
52 | 52 | |
53 | 53 | -- | Whether to uses hashes or inplace for unit ids
|
54 | - hashUnitIds :: Bool
|
|
54 | + hashUnitIds :: Bool,
|
|
55 | + |
|
56 | + -- | Whether to generate .hie files
|
|
57 | + ghcHieFiles :: Stage -> Bool
|
|
55 | 58 | |
56 | 59 | }
|
57 | 60 |
... | ... | @@ -35,6 +35,9 @@ compileAndLinkHs = (builder (Ghc CompileHs) ||^ builder (Ghc LinkHs)) ? do |
35 | 35 | useColor <- shakeColor <$> expr getShakeOptions
|
36 | 36 | let hasVanilla = elem vanilla ways
|
37 | 37 | hasDynamic = elem dynamic ways
|
38 | + hieFiles <- ghcHieFiles <$> expr flavour
|
|
39 | + stage <- getStage
|
|
40 | + hie_path <- getHieBuildPath
|
|
38 | 41 | mconcat [ arg "-Wall"
|
39 | 42 | , arg "-Wcompat"
|
40 | 43 | , not useColor ? builder (Ghc CompileHs) ?
|
... | ... | @@ -49,6 +52,10 @@ compileAndLinkHs = (builder (Ghc CompileHs) ||^ builder (Ghc LinkHs)) ? do |
49 | 52 | , ghcLinkArgs
|
50 | 53 | , defaultGhcWarningsArgs
|
51 | 54 | , builder (Ghc CompileHs) ? arg "-c"
|
55 | + , hieFiles stage ? builder (Ghc CompileHs) ? mconcat
|
|
56 | + [ arg "-fwrite-ide-info"
|
|
57 | + , arg "-hiedir", arg hie_path
|
|
58 | + ]
|
|
52 | 59 | , getInputs
|
53 | 60 | , arg "-o", arg =<< getOutput ]
|
54 | 61 |
... | ... | @@ -283,6 +283,7 @@ defaultFlavour = Flavour |
283 | 283 | , ghcDebugAssertions = const False
|
284 | 284 | , ghcSplitSections = False
|
285 | 285 | , ghcDocs = cmdDocsArgs
|
286 | + , ghcHieFiles = const False
|
|
286 | 287 | , hashUnitIds = False }
|
287 | 288 | |
288 | 289 | -- | Default logic for determining whether to build
|
... | ... | @@ -11,4 +11,6 @@ releaseFlavour = |
11 | 11 | $ enableHaddock
|
12 | 12 | -- 3. Include unit id hashes
|
13 | 13 | $ enableHashUnitIds
|
14 | + -- 4. Include hie files (#16901)
|
|
15 | + -- $ enableHieFiles
|
|
14 | 16 | $ performanceFlavour { name = "release" } |