Add a progress bar with a maximum for the rendering phase#208
Open
Amoifr wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #19, and removes the
// TODO: create a proper progress bar for renderinginBuildProgressListener.Today the parsing phase gets a real progress bar, while rendering only prints a static note:
Now it gets a bar that knows where it's going:
How, since the parser has no per-document render event.
Documents::render()loops over the documents without dispatching anything, andDocumentNode::renderDocument()bypassesNode::render(), so there's no "document rendered" signal to hook into. But there is enough to work with:PreBuildRenderEvent→getBuilder()->getDocuments()->getAll(), which is exactly the set of documents about to be rendered;POST_NODE_RENDERby looking at the file each rendered node belongs to, advancing once per file — the same "files already seen" approach the parsing bar already uses inpostParseDocument();POST_BUILD_RENDER.Nodes are also rendered outside the rendering phase, so the listener ignores them until the bar exists.
Tests:
BuildDocsCommandTestnow asserts both bars announce their file count and reach it. Verified the assertions fail without the change (the output only contains the old static note). Full suite green: 68 tests, 157 assertions.Unrelated, but I ran into it while testing this and it seems worth flagging:
bin/docs-builderis currently broken on Symfony 8 —Application::add()was removed in favour ofaddCommand(), so the binary dies immediately:The test suite doesn't catch it because it drives the command through
CommandTesterrather than the binary. Happy to send a separate PR if you'd like.