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

Add some progress bars for time-intensive tasks #3579

Merged
merged 4 commits into from
Nov 15, 2023

Conversation

srawlins
Copy link
Member

It's a lot of code to get this to display nicely but here goes:

  • Refactor logging.html into a class structure to store a few fields; the basic behavior is kept in-tact.
  • Privatize progressLevel.
  • Add top-level functions for setting up, completing, and making progress on a progress bar.
  • Remove usage of cli_util, which provides it's own Logger class; we were only using it to detect ANSI support, and that can be done inline.
  • Add a deterministic progress bar for when elements are being discovered and linked. Also for when docs are being precached. The precaching is necessary so that we can do global discovery of {@template}s. 😦 .
  • Change _allModelElements from a late final field with a self-executing closure to a function. I realized this "field" was only being used once, and it can take minutes and minutes to initialize this "field" when documenting Flutter. 😛 . So... call it a function.
  • The ProgressBar class comes from package:nnbd_migration.
  • The task code is really awkwardly complex. But I think I added comments to help. I tried to simplify the commands to document a package, and then added a "To re-run this..." output line because all of the pre-work that the task does can take minutes. The awkwardness is mostly from the --json flag which is needed when doing things like comparing warnings, but cannot be used when you're trying to watch progress.

  • I’ve reviewed the contributor guide and applied the relevant portions to this PR.
Contribution guidelines:

Note that many Dart repos have a weekly cadence for reviewing PRs - please allow for some latency before initial review feedback.


import 'package:logging/logging.dart';

const Level progressBarUpdate = Level('PROGRESS_BAR', 502);
Copy link
Member

Choose a reason for hiding this comment

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

Can we add a comment here? For also why it's set to 502?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good catch. Added. The number, is not important; it's just a unique Level for the logging code.

tool/task.dart Show resolved Hide resolved
@srawlins srawlins merged commit 8f966f6 into dart-lang:main Nov 15, 2023
9 checks passed
@srawlins srawlins deleted the more-stats branch November 15, 2023 04:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants