Skip to content
Snippets Groups Projects
  • nweiz@google.com's avatar
    Lazily throw pubspec parsing exceptions. · 84ee8ed9
    nweiz@google.com authored
    The user-visible effect of this is to make operations that only look at part of
    a pubspec work if other parts of the pubspec are somehow invalid. This is
    particularly important for the following scenario:
    
    1. We release a version of pub in SDK 1.0.0 that parses pubspec field "foo" as
       an integer.
    
    2. Sally uploads version 0.1.0 of her package, libsally.
    
    3. We release a new version of pub in SDK 1.1.0 that supports strings in "foo".
    
    4. Sally uploads libsally 0.2.0, which uses a string in "foo". The new version
       of libsally has an SDK constraint of ">= 1.1.0", since it uses the new "foo"
       feature.
    
    5. Tom is using SDK 1.0.0 and runs "pub install" in a package that depends on
       libsally.
    
    Everyone's done everything right here; we made a backwards-compatible pubspec
    change, Sally chose the correct SDK constraint, and Tom has a dependency on a
    package that has a compatible version available.
    
    However, prior to this change, Tom's "pub install" would crash. His outdated
    version of pub would try and fail to parse libsally 0.2.0's "foo" field, and his
    version resolution would crash. With this change, it will only attempt to parse
    the SDK constraint portion of Sally's pubspec, and ignore anything else it
    doesn't understand.
    
    R=rnystrom@google.com
    BUG=
    
    Review URL: https://codereview.chromium.org//24246002
    
    git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge@27784 260f80e4-7a28-3924-810f-c04153c831b5
    84ee8ed9