Lazily throw pubspec parsing exceptions.
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
Showing
- lib/src/barback.dart 2 additions, 3 deletionslib/src/barback.dart
- lib/src/command.dart 3 additions, 11 deletionslib/src/command.dart
- lib/src/package.dart 1 addition, 29 deletionslib/src/package.dart
- lib/src/pubspec.dart 391 additions, 288 deletionslib/src/pubspec.dart
- lib/src/solver/version_solver.dart 1 addition, 1 deletionlib/src/solver/version_solver.dart
- lib/src/source.dart 2 additions, 1 deletionlib/src/source.dart
- lib/src/source/hosted.dart 2 additions, 1 deletionlib/src/source/hosted.dart
- lib/src/source/path.dart 2 additions, 2 deletionslib/src/source/path.dart
- lib/src/utils.dart 24 additions, 10 deletionslib/src/utils.dart
- lib/src/validator/pubspec_field.dart 73 additions, 26 deletionslib/src/validator/pubspec_field.dart
- test/install/git/dependency_name_match_pubspec_test.dart 2 additions, 3 deletionstest/install/git/dependency_name_match_pubspec_test.dart
- test/install/git/require_pubspec_name_test.dart 2 additions, 5 deletionstest/install/git/require_pubspec_name_test.dart
- test/install/git/require_pubspec_test.dart 2 additions, 3 deletionstest/install/git/require_pubspec_test.dart
- test/install/path/no_pubspec_test.dart 2 additions, 1 deletiontest/install/path/no_pubspec_test.dart
- test/pub_install_and_update_test.dart 8 additions, 9 deletionstest/pub_install_and_update_test.dart
- test/pubspec_test.dart 65 additions, 103 deletionstest/pubspec_test.dart
- test/serve/fails_to_load_a_pubspec_with_reserved_transformer_config_test.dart 5 additions, 4 deletions...load_a_pubspec_with_reserved_transformer_config_test.dart
- test/serve/fails_to_load_a_transform_from_a_non_dependency_test.dart 2 additions, 2 deletions...fails_to_load_a_transform_from_a_non_dependency_test.dart
- test/update/git/update_to_incompatible_pubspec_test.dart 2 additions, 2 deletionstest/update/git/update_to_incompatible_pubspec_test.dart
- test/update/git/update_to_nonexistent_pubspec_test.dart 2 additions, 1 deletiontest/update/git/update_to_nonexistent_pubspec_test.dart
Loading
Please register or sign in to comment