Sdk: package:analyzer has too many dependencies

Created on 29 Jan 2019  路  10Comments  路  Source: dart-lang/sdk

Flutter sometimes finds it wants to depend on a package that depends on package:analyzer, and that forces all Flutter apps to take on a dependency on a ton of other packages like csslib. There's no reason why Flutter needs to depend on csslib. Unfortunately, since Flutter has to pin every dependency, we end up pinning csslib, which means that if any customer depends on csslib, they are forced to use the version we want to use, even if they want to use another version.

So far we've managed to avoid this by finding ever-more-creative ways to avoid depending on package:analyzer, but it would be good if this wasn't an issue in the first place.

P2 analyzer-package area-analyzer type-enhancement

Most helpful comment

Why is the analyzer checking Android manifests XML files at all?

... much less with an HTML parsing package? I realize we want to offer an awesome Android/Flutter experience, but there is a certain point (perhaps already reached) where we need a functional plugin model and not inlining the knowledge of 50 platforms into the analysis server/SDK.

All 10 comments

Flutter has to pin every dependency

"Flutter has decided to pin every dependency" 鈥撀爁or reasons that have trade-offs. Not pinning transitive dependencies eliminates this issue, but it's possible for users to get versions of packages that have not been validated.

FYI: after https://dart-review.googlesource.com/c/sdk/+/91701 and removing the task model it seems all dependencies on pkg:html go away. And along with it pkg:css, pkg:logging and pkg:utf!

Nice!

(We have to pin every dependency because we're an SDK. If any of our dependencies change in a way that breaks us, it can result in our users being permanently unable to use Flutter, including upgrading. That's existential, so while it's technically a tradeoff, it's not really one we have any choice about.)

Screen Shot 2019-03-15 at 3 47 58 PM

With analyzer 0.35.4 just released @Hixie !

Hmm, I saw the recent change and I was hoping to see more of a discussion on how this issue resulted in the dropping of html and plugin packages from analyzer. The complaint was about csslib, which is a dependency of html.

It seems, from a quick glance at the changes, that logic was altogether dropped instead of leverage either the native Dart SDK or some other existing dependency.

I can't tell if the logic that was dropped was deemed no longer useful or if it's somehow handled elsewhere, which is possible as I haven't gone through all the changes yet. I just need some human logic.

The pkg:html dependency was there to support parsing Dart code embedded in an HTML document in a