Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean removes generated docs #3353

Merged
3 changes: 2 additions & 1 deletion CHANGELOG_NEXT.md
Original file line number Diff line number Diff line change
Expand Up @@ -254,4 +254,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
Loading