Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[flutter_tools] fix version tag v stripping #55385

Merged

Conversation

peterlauri
Copy link
Contributor

@peterlauri peterlauri commented Apr 22, 2020

Description

This fixes an incorrect string replacement that is intended to strip the first v, for example:

v1.0.0 => 1.0.0
1.0.0.dev.0 => 1.0.0.dev.0 (actual 1.0.0.de.0)

Related Issues

Fixes #55421 and #55383

Tests

Added test "dev version switch prompt is accepted" that checks that dev versions can be requested in the flutter version command.

Also fixed the test it self, as it had the same defect as the implementation it self.

Checklist

Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes ([x]). This will ensure a smooth and quick review process.

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I signed the CLA.
  • I read and followed the Flutter Style Guide, including Features we expect every widget to implement.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I updated/added relevant documentation (doc comments with ///).
  • All existing and new tests are passing.
  • The analyzer (flutter analyze --flutter-repo) does not report any problems on my PR.
  • I am willing to follow-up on review comments in a timely manner.

Breaking Change

Did any tests fail when you ran them? Please read Handling breaking changes.

  • No, no existing tests failed, so this is not a breaking change.

@fluttergithubbot fluttergithubbot added tool Affects the "flutter" command-line tool. See also t: labels. work in progress; do not review labels Apr 22, 2020
@jonahwilliams
Copy link
Member

@peterlauri this approach seems good, so if you're interested in working on please let us know

@peterlauri
Copy link
Contributor Author

peterlauri commented Apr 23, 2020 via email

@christopherfujino
Copy link
Member

Hi, yes. I just need to figure out my the development environment :) Want to add a test that proves the problem as well...

Sounds great. You will want to add a test to this file: https://github.com/flutter/flutter/blob/master/packages/flutter_tools/test/commands.shard/hermetic/version_test.dart. Let me know if you need any additional help. I was going to try to patch this today, but if you can land this PR today it's all your's :)

@peterlauri
Copy link
Contributor Author

@christopherfujino my biggest problem is to setup VScode to follow the styling guides. Any hint on a settings file or something? :)

@peterlauri peterlauri marked this pull request as ready for review April 23, 2020 20:54
@peterlauri
Copy link
Contributor Author

To be honest, I don't know if I followed the style guides... I'll use Nano and fix the test styling for now, as VScode formatts plenty of things :)

@peterlauri
Copy link
Contributor Author

peterlauri commented Apr 23, 2020

To confirm it was broken in the first place, revert the fix, and run

../../bin/cache/dart-sdk/bin/pub run test test/commands.shard/hermetic/version_test.dart

@christopherfujino
Copy link
Member

@christopherfujino my biggest problem is to setup VScode to follow the styling guides. Any hint on a settings file or something? :)

Sorry I just saw this now. Unfortunately, you cannot use autoformatting to follow our style guide.

@christopherfujino
Copy link
Member

I'm looking at the test now...

@peterlauri
Copy link
Contributor Author

@christopherfujino personally I would have refactored and parameterised the tests... But I gotta learn more about dart tests, coming from python/pytest background where I know exactly how to do it.

@christopherfujino
Copy link
Member

@peterlauri this looks great! Thanks so much for this contribution!

Copy link
Member

@christopherfujino christopherfujino left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@christopherfujino christopherfujino changed the title [flutter_tools] fixes 55383 [flutter_tools] fix version tag v stripping Apr 23, 2020
@christopherfujino christopherfujino merged commit c91a3a7 into flutter:master Apr 24, 2020
jonahwilliams added a commit that referenced this pull request Apr 24, 2020
jonahwilliams added a commit that referenced this pull request Apr 24, 2020
@christopherfujino
Copy link
Member

Shucks, unfortunately this failed testing on post-submit and was reverted. If I have free cycles today I'll investigate...

@peterlauri
Copy link
Contributor Author

@christopherfujino anything I can do to help?

@christopherfujino
Copy link
Member

Sure, you could investigate why this test passed on pre-submit but failed on post: https://cirrus-ci.com/task/6113630626250752?command=main#L336

@peterlauri
Copy link
Contributor Author

@christopherfujino sure, I'm on it. Can confirm after merging master prior to the merge that the test fails...

@peterlauri
Copy link
Contributor Author

peterlauri commented Apr 24, 2020

@christopherfujino Are tags like 1.18.0-dev.5.0 expected to be allowed with 'flutter version'? Or only tags like 1.18.0-6.0.pre?

@christopherfujino
Copy link
Member

@christopherfujino Are tags like 1.18.0-dev.5.0 expected to be allowed with 'flutter version'? Or only tags like 1.18.0-6.0.pre?

The short answer is no, the tags of the form 1.18.0-dev.5.0 are no longer allowed (although that is a recent change with the latest release).

@christopherfujino
Copy link
Member

Ahh, I see, this must have passed on pre-submit because it was branched before the change was made.

@peterlauri
Copy link
Contributor Author

@christopherfujino I know that is changed, but as the old tags exist should flutter version allow them? It is a fairly easy fix to allow both, and I'm happy to do that fix. Your call...

@christopherfujino
Copy link
Member

Another instance that would have been caught by #53366

@christopherfujino
Copy link
Member

Sorry, you're right that flutter version 1.18.0-dev.5.0 should be allowed. But I think the test passed pre-submit because it wasn't rebased off of upstream.

@peterlauri
Copy link
Contributor Author

peterlauri commented Apr 24, 2020 via email

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 31, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
tool Affects the "flutter" command-line tool. See also t: labels.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

flutter version fails to parse the v in new tags correctly
5 participants