-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
[Analyzer plugin] Only the latest version of the plugin is installed, despite the version in pubspec #50209
Comments
Same here. It generates very non-obvious bugs 🥲 |
@bwilkerson @scheglov could you please take a look? |
I'm not completely familiar with the plugin support but I had a quick look at this and was able to reproduce the issue above where a different version of the plugin compared to the pubspec was being used: I had a look through the code for that version and found that in dependencies:
dart_code_metrics: ^4.18.2 I found some docs about this package here, which say:
So it seems like the analyzer uses this file to set the plugin up, and that file allows for newer versions to be fetched. What I'm not sure about is whether:
This is probably a question for @bwilkerson / @scheglov (and whatever the answer is, it probably makes sense to capture in those docs). |
@DanTup thanks for looking into that! Yes, the version is set with But I agree that probably Brian or Konstantin could add more about this behaviour being expected or not. |
Which dependency constraints do you mean? Do you mean the |
Yeah, that's how it has been working before. If a package lists dart_code_metrics with a ^ and a version and upgrading to an upper version is blocked ( Edit: actually, the plugin was just always used from the installed package. |
My understanding of version constraints is that
I'm a bit confused. Which package are you referring to here? (See https://github.com/dart-lang/sdk/blob/main/pkg/analyzer_plugin/doc/tutorial/package_structure.md for a description of the four possible meanings of "package" in this context.) If the below doesn't clear things up for you, you might need to restate the problem in more precise terms.
The analysis server never constrains the versions of the packages used by plugins, and that's intentional. If we shipped a version of the analysis server that was built on analyzer version 6.0.0, then any plugins that had not yet been upgraded to run on version 6.0.0 would not be able to be loaded and run. In other words, every new version of the analyzer would potentially disable some or all of the plugins being used by a given user. I think that would significantly hurt the user's experience. Even if we did something to coordinate with plugin authors so that their plugins would all be updated before we shipped, it would mean that plugin authors couldn't provide version-specific support for their packages. (Remember that the original use case was not for a stand-alone plugin like DCM, but was for a very package-specific plugin like the one for Angular Dart, where a different version of the plugin might be needed for each new version of the host package.) If a user is using an older version of the host package, then a newer version of the plugin package might not be able to correctly support the user's code. We therefore deemed it essential that the versions on packages used by a given plugin had to be independent of either the versions of those packages used by the analysis server or the versions used by other plugins. We achieved that goal by running each plugin in a separate isolate, making the running code completely independent of what code was being run by any other isolate. Plugins do need to update to newer versions of the |
I always treated plugin and the host package as one and from this perspective update to the 4.21.2 wouldn't be possible in the target package that has DCM listed in pubspec, since the closest resolvable version is 4.18.2. Otherwise it creates a problem with the CLI and the plugin running different code.
Sorry for that, by the package I meant a target package (like a flutter app), that has DCM listed in its pubspec. If the package is unable to have 4.21.2 as a resolved dependency, but somehow has a plugin from 4.21.2 - that was not expected.
Thanks for the explanation! Then I'll release the fix removing the ^ and this should be it.
Thats a very good point, any chance I can find a release date for new features, like patterns, records, etc. anywhere, in order to support them before they are live? Or at least an approximate date. |
I don't believe that we have a firm release date. It will depend on a lot of factors including how long it takes the sub-teams (analyzer, dart2js, vm, etc.) to implement the feature. We won't ship the feature until it's solid, so we don't set a date. I can tell you that the analyzer team has started working on records and patterns in the I can also tell you that the server portion of the records work has started. We have basic support mostly finished, but are still evaluating whether there are any new fixes, assists, lints, etc. that we think should be part of the initial launch. (We often wait to see how the community will use a feature before adding stylistic lints.) The server work for patterns hasn't really started yet because the |
Thank you so much, sounds amazing, actually. I think I've seen some references to the records, but that they're very close to be competed is great.
Fair point, especially taking the amount of work for other features 🙂 If you have any kind of notification for the external (or internal) package maintainers, like "you can now prepare your code for the feature X", I'd be happy to receive it too 🙂 I'm closing this, thanks again for the detailed explanation. |
So, long story short: somehow always the last plugin version from pub is installed no matter what version is listed in the pubspec and it installs even if dependency constraints block the update to the latest version.
Initially, I reported this issue here flutter/flutter#95092 (comment)
but now we were able to reproduce it after I've added the version to the plugin name.
Note: the latest version in pub is exactly 4.21.2
Screenshot 1:
Screenshot 2:
Screenshot 3:
Could you please take a look? Looks like it's the last broken part from the new plugins api. Also, all the reports we received were from VS Code, so I'm not sure, that it affects IDEA.
The text was updated successfully, but these errors were encountered: