[flutter_plugin_tools] Restructure version-check (#4111)

Combines the two different aspects of version-checking into a single looping structure based on plugins, using the new base command, rather than one operating on plugins as controlled by the usual flags and the other operating on a git list of changed files.

Also simplifies the determination of the new version by simply checking the file, rather than querying git for the HEAD state of the file. Tests setup is simplified since we no longer need to set up nearly as much fake `git` output.

Minor changes to base commands:
- Move indentation up to PackageLoopingCommand so that it is consistent across commands
- Add a new post-loop command for any cleanup, which is needed by version-check
- Change the way the GitDir instance is managed by the base PluginCommand, so that it's always cached even when not overridden, to reduce duplicate work and code.

Part of https://github.com/flutter/flutter/issues/83413
This commit is contained in:
stuartmorgan
2021-06-28 13:25:06 -07:00
committed by GitHub
parent 40162caa65
commit 23c3f5794a
7 changed files with 287 additions and 385 deletions

View File

@ -58,6 +58,16 @@ void printSuccess(String successMessage) {
print(Colorize(successMessage)..green());
}
/// Prints `warningMessage` in yellow.
///
/// Warnings are not surfaced in CI summaries, so this is only useful for
/// highlighting something when someone is already looking though the log
/// messages. DO NOT RELY on someone noticing a warning; instead, use it for
/// things that might be useful to someone debugging an unexpected result.
void printWarning(String warningMessage) {
print(Colorize(warningMessage)..yellow());
}
/// Prints `errorMessage` in red.
void printError(String errorMessage) {
print(Colorize(errorMessage)..red());