From ba282f75a1960248c0d49cb83daa09fdb2771036 Mon Sep 17 00:00:00 2001 From: Jenn Magder Date: Fri, 15 Aug 2025 15:28:44 -0700 Subject: [PATCH 1/4] [ci] Add update-release-info command suggestion when version check fails --- .../tool/lib/src/version_check_command.dart | 25 ++++++++++++++++--- .../tool/test/version_check_command_test.dart | 6 +++-- 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/script/tool/lib/src/version_check_command.dart b/script/tool/lib/src/version_check_command.dart index c3e36bb70872..298bdb746e68 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,25 @@ ${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 may update the version and ' + 'CHANGELOG with the "update-release-info" command. Example:\n' + '\$ dart run script/tool/bin/flutter_plugin_tools.dart update-release-info \\\n' + '\t--version=minimal \\\n' + '\t--base-branch=upstream/main \\\n' + '\t--changelog="Description of the change."'); + } + 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 a2e04bd710e8..aedd8686c7b2 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'), ]), From eb0173082587bd55514e4fe4321a1dd8706f1bf2 Mon Sep 17 00:00:00 2001 From: Jenn Magder Date: Fri, 15 Aug 2025 15:30:42 -0700 Subject: [PATCH 2/4] Change plugin to see this working --- packages/camera/camera/lib/camera.dart | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/camera/camera/lib/camera.dart b/packages/camera/camera/lib/camera.dart index 1400be8d7642..674d0b13a688 100644 --- a/packages/camera/camera/lib/camera.dart +++ b/packages/camera/camera/lib/camera.dart @@ -15,6 +15,8 @@ export 'package:camera_platform_interface/camera_platform_interface.dart' ResolutionPreset, XFile; + + export 'src/camera_controller.dart'; export 'src/camera_image.dart'; export 'src/camera_preview.dart'; From 1f977e74d20e0d37f7f1908949ff6a67498216e0 Mon Sep 17 00:00:00 2001 From: Jenn Magder Date: Fri, 15 Aug 2025 15:58:13 -0700 Subject: [PATCH 3/4] Revert "Change plugin to see this working" This reverts commit eb0173082587bd55514e4fe4321a1dd8706f1bf2. --- packages/camera/camera/lib/camera.dart | 2 -- 1 file changed, 2 deletions(-) diff --git a/packages/camera/camera/lib/camera.dart b/packages/camera/camera/lib/camera.dart index 674d0b13a688..1400be8d7642 100644 --- a/packages/camera/camera/lib/camera.dart +++ b/packages/camera/camera/lib/camera.dart @@ -15,8 +15,6 @@ export 'package:camera_platform_interface/camera_platform_interface.dart' ResolutionPreset, XFile; - - export 'src/camera_controller.dart'; export 'src/camera_image.dart'; export 'src/camera_preview.dart'; From 29167f596440be890571645665b178f78206d159 Mon Sep 17 00:00:00 2001 From: Jenn Magder Date: Fri, 12 Sep 2025 15:05:40 -0700 Subject: [PATCH 4/4] Add link instead --- script/tool/lib/src/version_check_command.dart | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/script/tool/lib/src/version_check_command.dart b/script/tool/lib/src/version_check_command.dart index 298bdb746e68..9c9c3f6c6820 100644 --- a/script/tool/lib/src/version_check_command.dart +++ b/script/tool/lib/src/version_check_command.dart @@ -584,12 +584,11 @@ ${indentation}The first version listed in CHANGELOG.md is $fromChangeLog. } if (missingVersionChange && missingChangelogChange) { - printError('If this PR is not exempt, you may update the version and ' - 'CHANGELOG with the "update-release-info" command. Example:\n' - '\$ dart run script/tool/bin/flutter_plugin_tools.dart update-release-info \\\n' - '\t--version=minimal \\\n' - '\t--base-branch=upstream/main \\\n' - '\t--changelog="Description of the change."'); + 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';