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

Add skipping version mismatch handling when using force or running with a custom fvm version. #654

Merged
merged 6 commits into from
Feb 27, 2024

Conversation

Bassiuz
Copy link
Contributor

@Bassiuz Bassiuz commented Feb 26, 2024

When running fvm use with a custom Flutter version or running with the force command, FVM still tries to correctly handle version mismatching. However, it is expected that the installed version should be used as this is the custom installed folder or is forced by adding the force command.

This should fix issue #653

Copy link

vercel bot commented Feb 26, 2024

@Bassiuz is attempting to deploy a commit to the FlutterTools Team on Vercel.

A member of the Team first needs to authorize it.

@leoafarias
Copy link
Owner

@Bassiuz I requested a change, also make sure you run dcm fix . and dcm analyze . in case there are changes needed.

@Bassiuz
Copy link
Contributor Author

Bassiuz commented Feb 27, 2024

@leoafarias Thank you for the review; the warnings make a lot of sense so I added them. Also fixed a warning shown bij DCM

Copy link
Owner

@leoafarias leoafarias left a comment

Choose a reason for hiding this comment

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

LGTM

@leoafarias leoafarias merged commit 8ad0027 into leoafarias:main Feb 27, 2024
2 of 4 checks passed
@AndreasMattsson
Copy link

Would it not be useful to have a way to ignore the version mismatch prompt in all fvm commands?

My current CI is dependent on using a custom flutter version to build, and while this PR fixed the install part of the equation my build script still gets stuck on the question to resolve the version mismatch on the fvm flutter build ... step.

Is there already a command I'm missing to skip this step, or would it require another patch @Bassiuz @leoafarias ?

@AndreasMattsson
Copy link

Nevermind, I just remembered I could just call .fvm/flutter_sdk/bin/flutter build instead!

@Bassiuz
Copy link
Contributor Author

Bassiuz commented Feb 28, 2024

Would it not be useful to have a way to ignore the version mismatch prompt in all fvm commands?

My current CI is dependent on using a custom flutter version to build, and while this PR fixed the install part of the equation my build script still gets stuck on the question to resolve the version mismatch on the fvm flutter build ... step.

Is there already a command I'm missing to skip this step, or would it require another patch @Bassiuz @leoafarias ?

It should never check for a version mismatch if you prepend your custom flutter name with custom_. Is there another thing prompted instead of the version mismatch that shouldn't when using a custom version?

@AndreasMattsson
Copy link

AndreasMattsson commented Feb 28, 2024

Sorry I realize now my case actually isn't related to "custom flutter versions" at all, I was actually not aware of the feature of prepending "custom_" to a version name and this PR just happened to solve my other issue by chance.

In my case it was actually a project where we have a portion of an app using Flutter, but a very old version. The parts of the app in Flutter aren't really worked on actively (so we haven't bothered to upgrade) but are still built to a native framework by CI and later included into a (otherwise native) app.

It was this build that suddenly stopped working with newer versions of fvm installed via brew (it was being halted by the cached version prompt).

Your PR helped circumvent this issue, but I see now it wasn't necessarily to do with "custom fvm" versions, but rather the mismatch warning seems to be always shown for any non-numeric version number (regardless if custom or not). E.g...

fvm use v1.15.17
...
fvm flutter --version
⚠ Version mismatch detected: cache version is 1.15.17, but expected v1.15.17.

fvm use 1.17.0-dev.3.1
...
fvm flutter --version
⚠ Version mismatch detected: cache version is 1.17.0, but expected 1.17.0-dev.3.1.

fvm use 1.17.0
...
fvm flutter --version
{ all good, no error warning! }

Flutter stopped prepending their version names with v between v1.15.17 and 1.17.0, and I'm guessing not many fvm users beside us are still using versions with those old names.

@leoafarias
Copy link
Owner

@AndreasMattsson can you open a new issue with the item above?

@AndreasMattsson
Copy link

@leoafarias Sure thing: here.

@quyenvsp
Copy link
Contributor

@Bassiuz Do you know about this issue: when using prefix custom_ then fvm dart will not working.
Only happen with custom_ and dart (flutter working fine).

Please check below log

name@PC MINGW64 /d/Projects/flutter (master)
$ fvm install 3.19.3
✓ Flutter SDK: SDK Version : 3.19.3 installed! (6.7s)


name@PC MINGW64 /d/Projects/flutter (master)
$ fvm use 3.19.3
Setting up Flutter SDK: 3.19.3

Checking Dart SDK version... 
Downloading Dart SDK from Flutter engine ...
Expanding downloaded archive with PowerShell...
Building flutter tool... 
Running pub upgrade...
Resolving dependencies... (3.4s)
Got dependencies.
Flutter 3.19.3 • channel stable • https://github.com/flutter/flutter.git
Framework • revision ba39319843 (11 days ago) • 2024-03-07 15:22:21 -0600
Engine • revision 2e4ba9c6fb
Tools • Dart 3.3.1 • DevTools 2.31.1

✓ Flutter SDK: SDK Version : 3.19.3 is setup
[WARN] You are using VSCode, but fvm is not managing VSCode settings for this project.Please remove "updateVscodeSettings: false" from .fvmrc
✓ Project now uses Flutter SDK : SDK Version : 3.19.3
┌────────────────────────────────────────────────────────────────────┐
│ ✓ Running on VsCode, please restart the terminal to apply changes. │
└────────────────────────────────────────────────────────────────────┘
You can then use "flutter" command within the VsCode terminal.


name@PC MINGW64 /d/Projects/flutter (master)
$ fvm flutter --version
Flutter 3.19.3 • channel stable • https://github.com/flutter/flutter.git
Framework • revision ba39319843 (11 days ago) • 2024-03-07 15:22:21 -0600
Engine • revision 2e4ba9c6fb
Tools • Dart 3.3.1 • DevTools 2.31.1


name@PC MINGW64 /d/Projects/flutter (master)
$ fvm dart --version
Dart SDK version: 3.3.1 (stable) (Wed Mar 6 13:09:19 2024 +0000) on "windows_x64"


name@PC MINGW64 /d/Projects/flutter (master)
$ fvm use custom_3.19
[WARN] Not checking for version mismatch as custom version is being used.
[WARN] You are using VSCode, but fvm is not managing VSCode settings for this project.Please remove "updateVscodeSettings: false" from .fvmrc
✓ Project now uses Flutter SDK : SDK Version : custom_3.19
┌────────────────────────────────────────────────────────────────────┐
│ ✓ Running on VsCode, please restart the terminal to apply changes. │
└────────────────────────────────────────────────────────────────────┘
You can then use "flutter" command within the VsCode terminal.


name@PC MINGW64 /d/Projects/flutter (master)
$ fvm flutter --version
[WARN] Not checking for version mismatch as custom version is being used.
[WARN] Version custom_3.19 is not a valid semver
Flutter 3.19.3 • channel stable • https://github.com/flutter/flutter.git
Framework • revision ba39319843 (11 days ago) • 2024-03-07 15:22:21 -0600
Engine • revision 2e4ba9c6fb
Tools • Dart 3.3.1 • DevTools 2.31.1


name@PC MINGW64 /d/Projects/flutter (master)
$ fvm dart --version
[WARN] Not checking for version mismatch as custom version is being used.
[WARN] Version custom_3.19 is not a valid semver
[WARN] Version custom_3.19 is not a valid semver
'C:\Development\fvm\versions\custom_3.19\bin\cache\dart-sdk\bin\dart.bat' is not recognized as an internal or external command,
operable program or batch file.

@Bassiuz
Copy link
Contributor Author

Bassiuz commented Mar 26, 2024

@quyenvsp I cannot reproduce this on my custom flutter version. What happens when you run C:\Development\fvm\versions\custom_3.19\bin\dart --version for example? Since that is just the pointer that fvm uses to locate dart.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants