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

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`.
14 changes: 14 additions & 0 deletions src/Idris/Package.idr
Original file line number Diff line number Diff line change
Expand Up @@ -843,6 +843,20 @@ 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))
let docBase = build </> "docs"
let docDir = docBase </> "docs"
() <- do Right docfiles' <- coreLift $ listDir docDir
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Can we refactor the two do-blocks in their own auxiliary function?

Copy link
Contributor Author

@Matthew-Mosior Matthew-Mosior Jul 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! That sounds good, should be resolved via ccff608.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry that's not quite what I meant, the two functions you put in auxiliary definitions are essentially the same, except for the file path, it would be nice to remove this redundancy.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah I see! I think I've addressed this with d788e07.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure why this test is failing ...

| Left err => pure ()
traverse_ (\x => delete $ docDir </> x)
docfiles'
deleteFolder docDir []
() <- do Right docfiles'' <- coreLift $ listDir docBase
| Left err => pure ()
traverse_ (\x => delete $ docBase </> x)
docfiles''
deleteFolder docBase []
runScript (postclean pkg)
where
delete : String -> Core ()
Expand Down
Loading