diff --git a/script/tool/lib/src/version_check_command.dart b/script/tool/lib/src/version_check_command.dart index 71fb489d8b32..4d147cb92baa 100644 --- a/script/tool/lib/src/version_check_command.dart +++ b/script/tool/lib/src/version_check_command.dart @@ -547,11 +547,14 @@ ${indentation}The first version listed in CHANGELOG.md is $fromChangeLog. return null; } + bool missingVersionChange = false; + bool missingChangelogChange = false; if (state.needsVersionChange) { if (_prLabels.contains(_missingVersionChangeOverrideLabel)) { logWarning('Ignoring lack of version change due to the ' '"$_missingVersionChangeOverrideLabel" label.'); } else { + missingVersionChange = true; printError( 'No version change found, but the change to this package could ' 'not be verified to be exempt\n' @@ -559,8 +562,7 @@ ${indentation}The first version listed in CHANGELOG.md is $fromChangeLog. 'If this is a false positive, please comment in ' 'the PR to explain why the PR\n' 'is exempt, and add (or ask your reviewer to add) the ' - '"$_missingVersionChangeOverrideLabel" label.'); - return 'Missing version change'; + '"$_missingVersionChangeOverrideLabel" label.\n'); } } @@ -569,6 +571,7 @@ ${indentation}The first version listed in CHANGELOG.md is $fromChangeLog. logWarning('Ignoring lack of CHANGELOG update due to the ' '"$_missingChangelogChangeOverrideLabel" label.'); } else { + missingChangelogChange = true; printError('No CHANGELOG change found.\n' 'If this PR needs an exemption from the standard policy of listing ' 'all changes in the CHANGELOG,\n' @@ -576,11 +579,24 @@ ${indentation}The first version listed in CHANGELOG.md is $fromChangeLog. 'ask your reviewer to add) the\n' '"$_missingChangelogChangeOverrideLabel" label.\n' 'Otherwise, please add a NEXT entry in the CHANGELOG as described in ' - 'the contributing guide.'); - return 'Missing CHANGELOG change'; + 'the contributing guide.\n'); } } + if (missingVersionChange && missingChangelogChange) { + printError('If this PR is not exempt, you can update version and ' + 'CHANGELOG with the "update-release-info" command.\\\n' + 'See here for an example: ' + 'https://github.com/flutter/packages/blob/main/script/tool/README.md#update-changelog-and-version\\\n' + 'For more details on versioning, check the contributing guide.'); + } + if (missingVersionChange) { + return 'Missing version change'; + } + if (missingChangelogChange) { + return 'Missing CHANGELOG change'; + } + return null; } } diff --git a/script/tool/test/version_check_command_test.dart b/script/tool/test/version_check_command_test.dart index cba573d00fb8..4c852bb110d4 100644 --- a/script/tool/test/version_check_command_test.dart +++ b/script/tool/test/version_check_command_test.dart @@ -787,8 +787,8 @@ void main() { }); test( - 'fails if a version change is missing from a change that does not ' - 'pass the exemption check', () async { + 'fails if a version and CHANGELOG change is missing from a change ' + 'that does not pass the exemption check', () async { final RepositoryPackage plugin = createFakePlugin('plugin', packagesDir, version: '1.0.0'); @@ -819,6 +819,8 @@ packages/plugin/lib/plugin.dart output, containsAllInOrder([ contains('No version change found'), + contains('No CHANGELOG change found.'), + contains('"update-release-info" command'), contains('plugin:\n' ' Missing version change'), ]),