[ci] updates update-release-info to support batch release#10958
[ci] updates update-release-info to support batch release#10958chunhtai wants to merge 4 commits intoflutter:mainfrom
update-release-info to support batch release#10958Conversation
| await for (final PackageEnumerationEntry entry in getPackagesToProcess()) { | ||
| if ((entry.package.parseCIConfig()?.isBatchRelease ?? false) && | ||
| (entry.package.parsePubspec().version?.isPreRelease ?? false)) { | ||
| throw UsageException( |
There was a problem hiding this comment.
note to myself, will need to add checks in #10859 to enforce this
There was a problem hiding this comment.
Code Review
This pull request modifies the update-release-info command to support batch releases. For packages configured for batch release, the command now creates a pending changelog YAML file in a pending_changelogs directory instead of directly updating the pubspec.yaml and CHANGELOG.md files. The implementation separates the logic for direct updates and batch release updates into distinct methods. A check has been added to prevent running the command on batch release packages with pre-release versions. New tests have been added to verify the batch release functionality. I have one suggestion to improve code readability.
update-release-info to support batch release
| throw UnimplementedError('Unimplemented version change type'); | ||
| } | ||
|
|
||
| await for (final PackageEnumerationEntry entry in getPackagesToProcess()) { |
There was a problem hiding this comment.
Why is this being done here instead of runForPackage? The whole idea of the package-looping-command structure is that things that are evaluated per package are done there.
| final Version? version = entry.package.parsePubspec().version; | ||
| if ((entry.package.parseCIConfig()?.isBatchRelease ?? false) && | ||
| (version?.isPreRelease ?? false)) { | ||
| throw UsageException( |
There was a problem hiding this comment.
And then it can fail an individual package instead of throwing and canceling the entire command.
| nextVersionString = 'NEXT'; | ||
| final CIConfig? ciConfig = package.parseCIConfig(); | ||
| if (ciConfig?.isBatchRelease ?? false) { | ||
| return _createPendingChangelog(package, versionChange: versionChange); |
There was a problem hiding this comment.
_createPendingBatchChangelog
A pending changelog in general could refer to either this, or to a NEXT in a changelog file.
| } | ||
|
|
||
| return PackageResult.success(); | ||
| return _updateReleaseDirectly(package, versionChange: versionChange); |
There was a problem hiding this comment.
_updatePubspecAndChangelog
| } | ||
| } | ||
|
|
||
| Future<PackageResult> _updateReleaseDirectly( |
There was a problem hiding this comment.
These new helpers should have declaration comments explaining what they do; it's not necessarily obvious from the name.
| type = VersionChange.patch; | ||
| case _VersionIncrementType.build: | ||
| throw UnimplementedError( | ||
| 'Build version changes should not happen in batch mode. Please file an issue if you see this.', |
There was a problem hiding this comment.
It's not clear to me what this instruction means. If it's not supposed to happen, why should the person file an issue? What would that issue say/request?
If you mean that it's not supported, then it should say that it's not currently supported and that if that's an issue they should file an issue requesting support for build versions in batch changes.
There was a problem hiding this comment.
It can't logically happen because otherwise the tool should have throw UsageError in the earlier stage. If this line is reached, that mean something is wrong with the code
| final content = | ||
| ''' | ||
| changelog: | | ||
| ${changelogEntry.split('\n').map((line) => ' - $line').join('\n')} |
There was a problem hiding this comment.
Doesn't $line need to be quoted in case it has characters that have special meaning in YAML?
There was a problem hiding this comment.
this is text block after a |, a quick search shows the there is no need to escape yaml special character
| '''; | ||
|
|
||
| final Directory pendingDirectory = package.pendingChangelogsDirectory; | ||
| if (!pendingDirectory.existsSync()) { |
There was a problem hiding this comment.
Isn't this a CI failure in the repo metadata validator? If so, why does this command need to handle it?
There was a problem hiding this comment.
you are right, will change it to just throw
As title
Pre-Review Checklist
[shared_preferences]pubspec.yamlwith an appropriate new version according to the pub versioning philosophy, or I have commented below to indicate which version change exemption this PR falls under1.CHANGELOG.mdto add a description of the change, following repository CHANGELOG style, or I have commented below to indicate which CHANGELOG exemption this PR falls under1.///).If you need help, consider asking for advice on the #hackers-new channel on Discord.
Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the
gemini-code-assistbot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.Footnotes
Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling. ↩ ↩2 ↩3