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

Side by Side Diff: sdk/lib/_internal/pub_generated/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: Created 5 years, 10 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library pub.source.path; 5 library pub.source.path;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:path/path.dart' as p; 9 import 'package:path/path.dart' as p;
10 10
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 return description; 90 return description;
91 } 91 }
92 92
93 if (description is! String) { 93 if (description is! String) {
94 throw new FormatException("The description must be a path string."); 94 throw new FormatException("The description must be a path string.");
95 } 95 }
96 96
97 // Resolve the path relative to the containing file path, and remember 97 // Resolve the path relative to the containing file path, and remember
98 // whether the original path was relative or absolute. 98 // whether the original path was relative or absolute.
99 var isRelative = p.isRelative(description); 99 var isRelative = p.isRelative(description);
100 if (p.isRelative(description)) { 100 if (isRelative) {
101 // Can't handle relative paths coming from pubspecs that are not on the 101 // Relative paths coming from pubspecs that are not on the local file
102 // local file system. 102 // system aren't allowed. This can happen if a hosted or git dependency
103 assert(containingPath != null); 103 // has a path dependency.
104 if (containingPath == null) {
105 throw new FormatException(
106 '"$description" is a relative path, but this ' 'isn\'t a local pubsp ec.');
107 }
104 108
105 description = p.normalize(p.join(p.dirname(containingPath), description)); 109 description = p.normalize(p.join(p.dirname(containingPath), description));
106 } 110 }
107 111
108 return { 112 return {
109 "path": description, 113 "path": description,
110 "relative": isRelative 114 "relative": isRelative
111 }; 115 };
112 } 116 }
113 117
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 if (fileExists(dir)) { 153 if (fileExists(dir)) {
150 fail( 154 fail(
151 'Path dependency for package $name must refer to a directory, ' 155 'Path dependency for package $name must refer to a directory, '
152 'not a file. Was "$dir".'); 156 'not a file. Was "$dir".');
153 } 157 }
154 158
155 throw new PackageNotFoundException( 159 throw new PackageNotFoundException(
156 'Could not find package $name at "$dir".'); 160 'Could not find package $name at "$dir".');
157 } 161 }
158 } 162 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698