Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(134)

Issue 12092080: Validate packages against their SDK constraints. (Closed)

Created:
7 years, 10 months ago by Bob Nystrom
Modified:
7 years, 10 months ago
Reviewers:
nweiz
CC:
reviews_dartlang.org
Visibility:
Public.

Description

Validate packages against their SDK constraints. After running pub install or update, it will look at all of the selected packages and see if their SDK constraints match the current SDK. If not, it will show a (hopefully) helpful error message. BUG=dartbug.com/6285 Committed: https://code.google.com/p/dart/source/detail?r=18014

Patch Set 1 #

Patch Set 2 : Clean up a bit. #

Total comments: 22

Patch Set 3 : Revise. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+332 lines, -52 lines) Patch
M utils/pub/command_install.dart View 1 chunk +4 lines, -4 lines 0 comments Download
M utils/pub/command_update.dart View 2 chunks +4 lines, -2 lines 0 comments Download
M utils/pub/entrypoint.dart View 1 2 2 chunks +58 lines, -0 lines 0 comments Download
M utils/pub/git_source.dart View 1 chunk +2 lines, -0 lines 0 comments Download
M utils/pub/hosted_source.dart View 1 2 1 chunk +4 lines, -2 lines 0 comments Download
M utils/pub/io.dart View 1 2 4 chunks +24 lines, -0 lines 0 comments Download
M utils/pub/package.dart View 1 2 2 chunks +5 lines, -1 line 0 comments Download
M utils/pub/pubspec.dart View 2 chunks +3 lines, -1 line 0 comments Download
M utils/pub/source.dart View 2 chunks +12 lines, -12 lines 0 comments Download
M utils/pub/system_cache.dart View 1 2 2 chunks +21 lines, -0 lines 0 comments Download
M utils/pub/utils.dart View 1 2 1 chunk +41 lines, -0 lines 0 comments Download
M utils/tests/pub/install/git/check_out_transitive_test.dart View 1 chunk +1 line, -1 line 0 comments Download
M utils/tests/pub/install/pub_install_test.dart View 1 chunk +0 lines, -1 line 0 comments Download
M utils/tests/pub/install/sdk/check_out_test.dart View 1 chunk +0 lines, -1 line 0 comments Download
M utils/tests/pub/install/sdk/check_out_transitive_test.dart View 1 chunk +1 line, -2 lines 0 comments Download
M utils/tests/pub/pub_test.dart View 2 chunks +0 lines, -8 lines 0 comments Download
A utils/tests/pub/sdk_constraint_test.dart View 1 2 1 chunk +121 lines, -0 lines 0 comments Download
M utils/tests/pub/test_pub.dart View 1 2 2 chunks +18 lines, -3 lines 0 comments Download
M utils/tests/pub/update/git/do_not_update_if_unneeded_test.dart View 2 chunks +2 lines, -2 lines 0 comments Download
M utils/tests/pub/update/pub_update_test.dart View 1 chunk +0 lines, -1 line 0 comments Download
M utils/tests/pub/validator_test.dart View 1 2 11 chunks +11 lines, -11 lines 0 comments Download

Messages

Total messages: 5 (0 generated)
Bob Nystrom
This will throw output at you like: Some packages are not compatible with SDK version ...
7 years, 10 months ago (2013-01-31 00:50:26 UTC) #1
nweiz
https://codereview.chromium.org/12092080/diff/1022/utils/pub/entrypoint.dart File utils/pub/entrypoint.dart (right): https://codereview.chromium.org/12092080/diff/1022/utils/pub/entrypoint.dart#newcode146 utils/pub/entrypoint.dart:146: Future<List<Package>> walkDependencies() { Maybe this and validateSdkConstraints should be ...
7 years, 10 months ago (2013-01-31 22:38:53 UTC) #2
Bob Nystrom
Dang, forgot to send this out yesterday. :( https://codereview.chromium.org/12092080/diff/1022/utils/pub/entrypoint.dart File utils/pub/entrypoint.dart (right): https://codereview.chromium.org/12092080/diff/1022/utils/pub/entrypoint.dart#newcode146 utils/pub/entrypoint.dart:146: Future<List<Package>> ...
7 years, 10 months ago (2013-02-01 16:53:29 UTC) #3
nweiz
lgtm https://codereview.chromium.org/12092080/diff/1022/utils/pub/entrypoint.dart File utils/pub/entrypoint.dart (right): https://codereview.chromium.org/12092080/diff/1022/utils/pub/entrypoint.dart#newcode146 utils/pub/entrypoint.dart:146: Future<List<Package>> walkDependencies() { On 2013/02/01 16:53:29, Bob Nystrom ...
7 years, 10 months ago (2013-02-01 22:24:54 UTC) #4
Bob Nystrom
7 years, 10 months ago (2013-02-02 00:02:31 UTC) #5
Message was sent while issue was closed.
Accidentally submitted this so I've made your suggestions here:
https://codereview.chromium.org/12171002

https://codereview.chromium.org/12092080/diff/1022/utils/pub/entrypoint.dart
File utils/pub/entrypoint.dart (right):

https://codereview.chromium.org/12092080/diff/1022/utils/pub/entrypoint.dart#...
utils/pub/entrypoint.dart:146: Future<List<Package>> walkDependencies() {
On 2013/02/01 22:24:54, nweiz wrote:
> On 2013/02/01 16:53:29, Bob Nystrom wrote:
> > On 2013/01/31 22:38:53, nweiz wrote:
> > > Maybe this and validateSdkConstraints should be methods on LockFile?
> > 
> > I put it here because walking the locked transitive deps is really only
> > meaningful for the root package. Seemed like it made sense here. LockFile is
> > really just the state for the file itself and not the root package that owns
> it.
> > 
> > > It weirds me out that they have this weird "should only be called"
> > requirement.
> > 
> > Yeah, I'm not crazy about that either. Before when this was a separate
> command,
> > it would throw an error if an entry wasn't in the lock file. For now, I
think
> > the comment is enough?
> 
> I'd like to at least get an exception if this is called incorrectly. Right now
> it'll just use an empty lockfile and return [].

It should fail if called with an out of date lockfile. It will try to look up a
dependency in it and get null back and then barf on that.

https://codereview.chromium.org/12092080/diff/1022/utils/pub/git_source.dart
File utils/pub/git_source.dart (right):

https://codereview.chromium.org/12092080/diff/1022/utils/pub/git_source.dart#...
utils/pub/git_source.dart:63: Future<String> systemCacheDirectory(PackageId id)
=> _revisionCachePath(id);
On 2013/02/01 22:24:54, nweiz wrote:
> On 2013/02/01 16:53:29, Bob Nystrom wrote:
> > On 2013/01/31 22:38:53, nweiz wrote:
> > > Why not just rename "_revisionCachePath" to "systemCacheDirectory"?
> > 
> > I kept it because I like that it helps clarify the git-specific semantics of
> > that path.
> 
> I don't like having two differently-named functions that do identical things.
> I'd rather just document on this method that it's the part for the specific
> revision.

Done.

https://codereview.chromium.org/12092080/diff/1022/utils/pub/system_cache.dart
File utils/pub/system_cache.dart (right):

https://codereview.chromium.org/12092080/diff/1022/utils/pub/system_cache.dar...
utils/pub/system_cache.dart:65: Future<Package> describe(PackageId id) {
On 2013/02/01 22:24:54, nweiz wrote:
> On 2013/02/01 16:53:29, Bob Nystrom wrote:
> > On 2013/01/31 22:38:53, nweiz wrote:
> > > I don't like that this returns a Package whereas other describe() methods
> > return
> > > Pubspecs. It looks to me like you could make walkDependencies work with
> > Pubspecs
> > > rather than Packages, so I'd do that.
> > 
> > I had that originally, but Pubspec doesn't know how to find and read the
file.
> > It's constructor just takes the contents of a pubspec file. So I had code
here
> > that would locate the pubspec file, read it, and then create the pubspec.
> > 
> > That's exactly what Package's constructor does. So it seemed like Package
was
> a
> > better object to use.
> 
> I think it's fine to use Package internally to load the pubspec, but I don't
> think it makes sense to return it. It's not useful for the known use-case, and
> it's inconsistent with other methods called "describe".
> 
> If you really feel like this should return a package, at least rename it
load()
> or something like that.

Done.

Powered by Google App Engine
This is Rietveld 408576698