diff options
author | Matthew Pickering <matthewtpickering@gmail.com> | 2022-06-27 16:32:25 +0100 |
---|---|---|
committer | Matthew Pickering <matthewtpickering@gmail.com> | 2022-07-05 11:15:56 +0100 |
commit | 7ade0cdda7c75272868e0c816c86c0e734562caa (patch) | |
tree | 8b765a0bc3e96bc36acad8c01aee9b37b4c32aba | |
parent | 550e8e1718f95d81150d28d43643e6c4e85733e8 (diff) | |
download | haskell-7ade0cdda7c75272868e0c816c86c0e734562caa.tar.gz |
Add docs:<pkg> command to hadrian to build docs for just one package
(cherry picked from commit 74f3867dbc77cad216444ed1e12d095feb1ced92)
-rw-r--r-- | hadrian/README.md | 3 | ||||
-rw-r--r-- | hadrian/src/Rules/SimpleTargets.hs | 5 |
2 files changed, 8 insertions, 0 deletions
diff --git a/hadrian/README.md b/hadrian/README.md index a815039e7f..5378ee973b 100644 --- a/hadrian/README.md +++ b/hadrian/README.md @@ -256,6 +256,9 @@ To build all GHC documentation, run `build docs`. This includes In order to only build haddock document there is the `build docs-haddock` target. +In order to build the haddock documentation for just one package use the `docs:<pkg>` command, +for example `docs:base` will just build the documentation for `base`. + Alternatively, you can use the `--docs` CLI flag to selectively disable some or all of the documentation targets: diff --git a/hadrian/src/Rules/SimpleTargets.hs b/hadrian/src/Rules/SimpleTargets.hs index f89575fccb..4e461dc946 100644 --- a/hadrian/src/Rules/SimpleTargets.hs +++ b/hadrian/src/Rules/SimpleTargets.hs @@ -39,6 +39,11 @@ simpleTarget (stage, target) = do if target == Packages.ghc then need [ root -/- ("ghc-" <> stagestr) ] else pure () + when (stage == Stage1 && isLibrary target && target /= rts) $ do + let doc_tgt = intercalate ":" ["docs", pkgname] + doc_tgt ~> do + need . (:[]) =<< (pkgHaddockFile $ vanillaContext Stage1 target) + where typ = if isLibrary target then "lib" else "exe" stagestr = stageString stage |