Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 20 additions & 4 deletions script/tool/lib/src/version_check_command.dart
Original file line number Diff line number Diff line change
Expand Up @@ -547,20 +547,22 @@ ${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'
'from version changes according to repository policy.\n'
'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');
}
}

Expand All @@ -569,18 +571,32 @@ ${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'
'comment in the PR to explain why the PR is exempt, and add (or '
'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;
}
}
6 changes: 4 additions & 2 deletions script/tool/test/version_check_command_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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');

Expand Down Expand Up @@ -819,6 +819,8 @@ packages/plugin/lib/plugin.dart
output,
containsAllInOrder(<Matcher>[
contains('No version change found'),
contains('No CHANGELOG change found.'),
contains('"update-release-info" command'),
contains('plugin:\n'
' Missing version change'),
]),
Expand Down