-
Notifications
You must be signed in to change notification settings - Fork 28.5k
Flutter "version" file in repo root is missing and being created then deleted by the tool on branches named master/main #142521
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
Comments
This is very odd... I can repro running from source and added some
And nothing in the I'll try to debug a bit more shortly... This could be a big issue if widespread, because VS Code uses this version to switch quite a bit of Dart-Code functionality. |
@christopherfujino here is the issue:
The files are being deleted by:
Stack trace is like:
It's created here on line 311 and then deleted because of the call on line 338: Doesn't seem to affect beta, but I haven't yet figured out why, since most of the code seems the same. |
Ok, the reason this doesn't happen on beta is because of this early exit, which prevents the constructor running that deletes the file: flutter/packages/flutter_tools/lib/src/version.dart Lines 172 to 174 in ccb2b44
So the issue is isolated to branches named |
Thanks for the detailed report and analysis. Labeling this for tracking. |
@christopherfujino leaving to you for prioritizing |
Not sure if it's the same thing, but I just noticed that the GitHub actions are often failing the coverage step because the Flutter version is reported as 0.0.0-unknown: Example: https://github.com/flutter/flutter/actions/runs/8999603670/job/24722091985 |
TIL we try to upload coverage from actions |
This came up again in Dart-Code/Dart-Code#5226, where we were using old versions of DevTools page IDs because we thought we were on an old version of the Flutter SDK. @christopherfujino @andrewkolos does anyone know why we have a difference in this path for master/main? If we remove the |
We have a difference on master/main because what we report as the version changes as new tags are added upstream. If we removed the if statement, once we cache the version, this would remain as long as you're on the same commit, even if we publish a beta from an OLDER commit, and our version should now reflect that it is AFTER the beta. |
Ah, gotcha. Should there be an |
Some additional info I just noticed:
Seems like Dart-Code is triggering this sometimes when you have a Flutter SDK with no Dart SDK because we force it to initialize by calling |
… the version file This may help avoid flutter/flutter#142521 until there's a better fix. Also fixes #5226.
Let me carve out some time today to dig in a little bit. I'll take me a while to get back up to speed on all the convoluted logic here (I remember thinking I could implement this in a few days, but it actually took me weeks, I've already had to fix a bad bug, and clearly there's another one). |
Thanks! I implemented a few tweaks in Dart-Code (such as calling |
@DanTup Ahh, as I read this issue carefully, am I correct in understanding that dart-code is parsing I (mistakenly) thought that the only tool that was reading this was pub, which was migrated here: dart-lang/pub#4113. Does devtools also parse this file @kenzieschmoll ? |
Ah, that sounds reasonable. Currently we're just reading the version the same way for Dart and Flutter (Dart also has a |
I've switched Dart-Code to reading the new JSON file first and just using the legacy As such, I/Dart-Code doesn't care so much about this behaviour now - if this version file is considered legacy and shouldn't be used, this issue could be closed. (although it may also be worth checking with @helin24 / @jwren whether IntelliJ uses the original file) |
Today I noticed that this file is also not present in my Flutter checkout. Combined with the If I run an invalid command like So it seems that migrating to the new version file hasn't actually solved the problem. |
Late on the response here... but this is the only other place I am aware of. It looks like it is using the correct file path: |
I'm assuming this is still an issue @DanTup? |
@bkonyi it is. Here you can see both the legacy flutterversion.mp4 |
Nope, I haven't had a chance to look into this and probably won't for a while. I'm the only one on the tools team at the moment so I don't have cycles to investigate, I just didn't want this triaged issue to disappear into the void by leaving it unassigned. |
I had some time to look into this, and it looks like we're deleting the version files when we [create a // if we are fetching tags, ignore cached versionFile
if (fetchTags && versionFile.existsSync()) {
versionFile.deleteSync();
final File legacyVersionFile = fs.file(fs.path.join(flutterRoot, 'version'));
if (legacyVersionFile.existsSync()) {
legacyVersionFile.deleteSync();
}
} AFAICT, there's not a follow up call to |
Steps to reproduce
I'm on the latest
master
(commit ccb2b44) and I noticed a number of things not working as expected in VS Code. It turns out, Dart-Code thinks I'm on Flutter version 0.0.0 and is therefore disabling all functionality that requires a specific Flutter version. This seems to be because I don't have theversion
file in the repo root.I found #133097 while searching which seems to describe the same issue, however I'm on a much newer version than that (cc @christopherfujino )
Expected results
There should be a file named
version
in the root of the repository.Actual results
There is no file.
Code sample
N/A
Screenshots or Video
Logs
No response
Flutter Doctor output
The text was updated successfully, but these errors were encountered: