-
Notifications
You must be signed in to change notification settings - Fork 9.8k
Fix and update version checks #3792
Fix and update version checks #3792
Conversation
I imagine that now that this works, we'll run into things we need to relax or tweak over time, but getting it actually working is a good first step to getting it working the way we want :) |
} | ||
final Pubspec pubspec = Pubspec.parse(pubspecFile.readAsStringSync()); | ||
if (pubspec.publishTo == 'none') { | ||
print(' Found "publish_to: none"; skipping.'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the indentation intended? I imagine you wanted the output look more organized?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this is instead of doing the ----------
between each section like the CHANGELOG check; it's more compact, and I think it's more readable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated to use an indentation
variable to make it clearer and ensure consistency.
} on io.ProcessException { | ||
print('Unable to find pubspec in master for $pubspecPath.' | ||
' Safe to ignore if the project is new.'); | ||
print(' Unable to find pubspec in master. ' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now looking at this code again. I think we should handle it in getPackageVersion
. Then getPackageVersion
would just return null
if a version is not available. WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that makes way more sense; the type of exception here is entirely dependent on the implementation details of that method, which is odd. Fixed.
|
||
// Skip validation for the special NEXT version that's used to accumulate | ||
// changes that don't warrant publishing on their own. | ||
if (versionString == 'NEXT') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We also need to make sure that the version in pubspec equals to the next version after NEXT
in CHANGELOG.
This is to prevent someone updated the version in pubspec but forgot to change the "NEXT"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we only cares about presubmit, which looks like so in the current code (base-sha not configurable), we can easily do
if (versionString == 'NEXT' && pubspecVersion not changed)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call, added validation for that and added a test.
// CHANGELOG. That means the next version entry in the CHANGELOG pass the | ||
// normal validation. | ||
while (iterator.moveNext()) { | ||
if (iterator.current.trim().startsWith('## ')) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some of our CHANGELOG.md files do no follow the standard format, see: https://github.com/flutter/plugins/blob/master/packages/url_launcher/url_launcher_web/CHANGELOG.md
This would fail. :(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm fine with a model where trying to use NEXT won't work until the format has been fixed to follow our standard format.
We can also do a one-time sweep if that becomes annoying.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, but there's a small typo that slipped through?
packages/path_provider/path_provider_macos/example/pubspec.yaml
Outdated
Show resolved
Hide resolved
Co-authored-by: David Iglesias <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
format
CI check is taking issue, a pass of dartfmt -w .
should fix it!
* master: (397 commits) [in_app_purchase] Implementation of platform interface (flutter#3781) [google_sign_in] Add todo WRT correctly setting X-Goog-AuthUser header (flutter#3819) [tools] fix version check command not working for new packages (flutter#3818) [camera] android-rework part 1: Base classes to support Android Camera features (flutter#3795) fix MD (flutter#3815) Path provider windows crash fix (flutter#3814) [local_auth] docs update (flutter#3103) Update PULL_REQUEST_TEMPLATE.md (flutter#3801) [quick_actions] handle cold start on iOS correctly (flutter#3811) Replace path_provider_linux widget tests with simple unit tests (flutter#3812) [sensors] format dart code based on the new dart formatter (flutter#3809) [google_sign_in] Fix "pick account" on iOS (flutter#3805) [image_picker_platform_interface] Added pickMultiImage (flutter#3782) [in_app_purchase] Added currency code and numerical price to product detail model. (flutter#3794) [local_auth] Fix iOS crash when no localizedReason (flutter#3780) Fix and update version checks (flutter#3792) [in_app_purchase] Configured example app to use StoreKit Testing on iOS 14 (flutter#3772) [local_auth] Unnecessary reassignment in example removed (flutter#2983) [flutter_webview] Fix `allowsInlineMediaPlayback` ignored on iOS (flutter#3791) Switch script/tools over to the new analysis options (flutter#3777) ...
Currently our version update checks aren't actually working; the script doesn't work correctly if no explicit --base-sha is passed, but that's always how CI is calling it. Fixes flutter/flutter#79823 (and version checks in general) This makes a number of changes: - Fixes it to work without --base-sha - Adds tests that it works in that mode - And tightens existing tests to require ToolExit, not just any error, to reduce false-positive test success - Adds verbose logging of the checks being done, to make it easier to debug this kind of issue in the future - Tightens the exception handling for missing previous versions to just the line that's expected to fail in that case - Only allows missing versions when "publish_to: none" is set - Adds that everywhere it's missing - Standardize the format in the repo to "none" (instead of also having "'none'"). - Allows the use of NEXT in CHANGELOG as a way of gathering changes that are worth noting, but not doing a publish cycle for. (Replaces the plan of using -dev versions, since that's actually harder to implement, and more confusing.) - Ensures that we don't forget to clean up NEXT entries when bumping versions
Currently our version update checks aren't actually working; the script doesn't work correctly if no explicit --base-sha is passed, but that's always how CI is calling it.
Fixes flutter/flutter#79823 (and version checks in general)
This makes a number of changes:
doing a publish cycle for. (Replaces the plan of using -dev versions, since that's actually harder to implement,
and more confusing.)
Pre-launch Checklist
[shared_preferences]
///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.