Closed DartBot closed 9 years ago
Comment by amouravski
Perhaps a dependency constraint like "any compatible" or "latest compatible" would help.
Comment by munificent
I'm wondering why pub update isn't smart enough to forego a package update when it knows it won't work
It is because pub's constraint solver literally isn't smart enough to solve that. The current implementation is very simple and doesn't do any backtracking when exploring the solution space. In order to correctly select the right version of a package while taking SDK constraints into account, it will need to backtrack in order to find a solution to even just-barely-more-complex-than-trivial dependency graphs.
Perhaps a dependency constraint like "any compatible" or "latest compatible" would help.
Packages can and do specify the SDK constraints. It's just that pub can't currently solve them.
We do expect to implement a more complex solver at some point (other package managers always seem to eventually end up adding backtracking), so I'll leave this bug open for that.
We know the current behavior isn't ideal, but it was the best we could get implemented in a short timeframe. We felt the warnings were better than nothing given that every release of the SDK right now is a breaking one.
Set owner to @munificent. Removed Type-Defect label. Added Type-Enhancement label.
Issue by rbishop-bah Originally opened as dart-lang/sdk#9216
For projects with builds that always update to the latest packages, it'd be nice if staggered releases of packages and the SDK did not cause build failures. We currently have a situation where a number of pub packages have been updated for the impending release of 0.4.2.x, but the SDK itself has not been released. I'm wondering why pub update isn't smart enough to forego a package update when it knows it won't work (i.e., package, such as web_ui declares in its pubspec.yaml:
environment: sdk: ">=0.4.2+0.r20084"
but pub update grabs it anyway, even though it knows I'm using SDK 19045... see output below).
What steps will reproduce the problem?
What is the expected output? What do you see instead? I expect pub not to download packages that are incompatible with the current SDK (or at least that should be the default with an option to force). I see build carnage instead.
What version of the product are you using? On what operating system? Windows64 and Linux64
Please provide any additional information below. Sample message: Resolving dependencies... Dependencies updated! Some packages that were installed are not compatible with your SDK version 0.4.1+0.r19425 and may not work:
You may be able to resolve this by upgrading to the latest Dart SDK or adding a version constraint to use an older version of a package.