Skip to content

Commit

Permalink
Merge pull request #3353 from Matthew-Mosior/clean-does-not-remove-ge…
Browse files Browse the repository at this point in the history
…nerated-docs

Clean removes generated docs
  • Loading branch information
andrevidela authored Aug 5, 2024
2 parents 4d46c18 + 77d4780 commit d9049e8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
3 changes: 2 additions & 1 deletion CHANGELOG_NEXT.md
Original file line number Diff line number Diff line change
Expand Up @@ -256,4 +256,5 @@ This CHANGELOG describes the merged but unreleased changes. Please see [CHANGELO

#### Documentation

* Module docstrings are now displayed for namespace indexes when documentation is built via --mkdoc.
* Module docstrings are now displayed for namespace indexes when documentation is built via `--mkdoc`.
* Generated documentation are now removed via `--clean`.
12 changes: 12 additions & 0 deletions src/Idris/Package.idr
Original file line number Diff line number Diff line change
Expand Up @@ -843,6 +843,10 @@ clean pkg opts -- `opts` is not used but might be in the future
deleteFolder builddir []
maybe (pure ()) (\e => delete (outputdir </> e))
(executable pkg)
-- clean out the generated docs
let build = build_dir (dirs (options defs))
deleteDocsFolder $ build </> "docs" </> "docs"
deleteDocsFolder $ build </> "docs"
runScript (postclean pkg)
where
delete : String -> Core ()
Expand All @@ -859,6 +863,14 @@ clean pkg opts -- `opts` is not used but might be in the future
delete $ ttFile <.> "ttc"
delete $ ttFile <.> "ttm"

deleteDocsFolder : String -> Core ()
deleteDocsFolder dir
= do Right docbasefiles <- coreLift $ listDir dir
| Left err => pure ()
traverse_ (\x => delete $ dir </> x)
docbasefiles
deleteFolder dir []

-- Just load the given module, if it exists, which will involve building
-- it if necessary
runRepl : {auto c : Ref Ctxt Defs} ->
Expand Down

0 comments on commit d9049e8

Please sign in to comment.