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

Unified Diff: sdk/lib/_internal/pub/lib/src/source/path.dart

Issue 887483002: Don't crash 'pub get' if a dev dependency is broken. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Code review changes Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: sdk/lib/_internal/pub/lib/src/source/path.dart
diff --git a/sdk/lib/_internal/pub/lib/src/source/path.dart b/sdk/lib/_internal/pub/lib/src/source/path.dart
index c1fbd52f75815a8db7cd007aa4469a1341298f5f..8786968a81df58f3662b0724855cad6ce15f9694 100644
--- a/sdk/lib/_internal/pub/lib/src/source/path.dart
+++ b/sdk/lib/_internal/pub/lib/src/source/path.dart
@@ -95,10 +95,14 @@ class PathSource extends Source {
// Resolve the path relative to the containing file path, and remember
// whether the original path was relative or absolute.
var isRelative = p.isRelative(description);
- if (p.isRelative(description)) {
- // Can't handle relative paths coming from pubspecs that are not on the
- // local file system.
- assert(containingPath != null);
+ if (isRelative) {
+ // Relative paths coming from pubspecs that are not on the local file
+ // system aren't allowed. This can happen if a hosted or git dependency
+ // has a path dependency.
+ if (containingPath == null) {
+ throw new FormatException('"$description" is a relative path, but this '
+ 'isn\'t a local pubspec.');
+ }
description = p.normalize(
p.join(p.dirname(containingPath), description));

Powered by Google App Engine
This is Rietveld 408576698