SDK version constraints in packages

43 views
Skip to first unread message

Bob Nystrom

unread,
Jan 17, 2013, 2:45:15 PM1/17/13
to General Dart Discussion
I'm going to start adding support for SDK version constraints to pub. If you talk to the web-ui folks or follow the mailing list, you'll know this has been a huge source of pain since we started making breaking changes to the core library. Here's my rough plan, in case you're curious:

1. Packages will be able to specify the range of SDK versions that they work with. This will use a normal semantic version constraint. We'll massage Dart's SDK version to fit that format.

2. When resolving dependencies, pub will take into account the current SDK version (specifically, the version of the SDK that pub itself is running from). When requesting packages, it will pass in the SDK version and only packages whose SDK constraint match will be allowed.

The end result is that you won't erroneously get a version of some package that's too new for your version of the SDK, which is where the pain is coming from.

This means the SDK is handled a bit specially by pub, which I'm not crazy about, but it seems like the SDK is a little special so that's probably a worthwhile trade-off.

This is what Siggy initially suggested when we discussed this, I'm just sold on the idea now and ready to start coding. Holler if you have any thoughts.

Cheers!

- bob

Matthew Butler

unread,
Jan 17, 2013, 2:55:52 PM1/17/13
to mi...@dartlang.org


On Thursday, January 17, 2013 3:45:15 PM UTC-4, Bob Nystrom wrote:
I'm going to start adding support for SDK version constraints to pub. If you talk to the web-ui folks or follow the mailing list, you'll know this has been a huge source of pain since we started making breaking changes to the core library. Here's my rough plan, in case you're curious:

1. Packages will be able to specify the range of SDK versions that they work with. This will use a normal semantic version constraint. We'll massage Dart's SDK version to fit that format.

Does that mean it will be option to have SDK constraints on a package?
 
2. When resolving dependencies, pub will take into account the current SDK version (specifically, the version of the SDK that pub itself is running from). When requesting packages, it will pass in the SDK version and only packages whose SDK constraint match will be allowed.

The end result is that you won't erroneously get a version of some package that's too new for your version of the SDK, which is where the pain is coming from.

Will it only prevent you from downloading a newer version of the library than what the currently running SDK? Or will this also prevent you from using an older, non-updated package with a newer SDK ie. Say package Awesome has version constraints 0.0.2 - 0.1.4, I just downloaded SDK 0.1.6 but the Awesome maintainer hasn't updated to the newest SDK yet. If I 'pub install' am I going to get a broken dependency?

Matt

Bob Nystrom

unread,
Jan 17, 2013, 3:52:47 PM1/17/13
to General Dart Discussion
On Thu, Jan 17, 2013 at 11:55 AM, Matthew Butler <butler....@gmail.com> wrote:
Does that mean it will be option to have SDK constraints on a package?

Yes, exactly right. I'm still figuring things out so I don't have any details on the syntax yet.
 
 
2. When resolving dependencies, pub will take into account the current SDK version (specifically, the version of the SDK that pub itself is running from). When requesting packages, it will pass in the SDK version and only packages whose SDK constraint match will be allowed.

The end result is that you won't erroneously get a version of some package that's too new for your version of the SDK, which is where the pain is coming from.

Will it only prevent you from downloading a newer version of the library than what the currently running SDK? Or will this also prevent you from using an older, non-updated package with a newer SDK ie.

Both. My current plan (subject to change of course) is that any normal version constraint syntax will be supported, so you can do >, <, etc.
 
Say package Awesome has version constraints 0.0.2 - 0.1.4, I just downloaded SDK 0.1.6 but the Awesome maintainer hasn't updated to the newest SDK yet. If I 'pub install' am I going to get a broken dependency?

You'll get an error saying it couldn't find an appropriate version of Awesome.

- bob

Reply all
Reply to author
Forward
0 new messages