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

Unified Diff: sdk/lib/_internal/pub/lib/src/pubspec.dart

Issue 22825024: Don't allow packages to depend on themselves. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 4 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
« no previous file with comments | « no previous file | sdk/lib/_internal/pub/lib/src/validator/dependency.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/pub/lib/src/pubspec.dart
diff --git a/sdk/lib/_internal/pub/lib/src/pubspec.dart b/sdk/lib/_internal/pub/lib/src/pubspec.dart
index 6da96ba621cc6f2456a9a5bc41e00cc99bd0ac71..049857754de00f3999f1e7e5cf8e6b19e4ab9e6a 100644
--- a/sdk/lib/_internal/pub/lib/src/pubspec.dart
+++ b/sdk/lib/_internal/pub/lib/src/pubspec.dart
@@ -135,10 +135,10 @@ Pubspec _parseMap(String filePath, Map map, SourceRegistry sources) {
version = new Version.parse(map['version']);
}
- var dependencies = _parseDependencies(filePath, sources,
+ var dependencies = _parseDependencies(name, filePath, sources,
map['dependencies']);
- var devDependencies = _parseDependencies(filePath, sources,
+ var devDependencies = _parseDependencies(name, filePath, sources,
map['dev_dependencies']);
// Make sure the same package doesn't appear as both a regular and dev
@@ -241,8 +241,8 @@ Pubspec _parseMap(String filePath, Map map, SourceRegistry sources) {
environment, map);
}
-List<PackageDep> _parseDependencies(String pubspecPath, SourceRegistry sources,
- yaml) {
+List<PackageDep> _parseDependencies(String packageName, String pubspecPath,
+ SourceRegistry sources, yaml) {
var dependencies = <PackageDep>[];
// Allow an empty dependencies key.
@@ -255,6 +255,10 @@ List<PackageDep> _parseDependencies(String pubspecPath, SourceRegistry sources,
}
yaml.forEach((name, spec) {
+ if (name == packageName) {
+ throw new FormatException("Package '$name' cannot depend on itself.");
nweiz 2013/08/22 00:18:21 Rather than specifically including the package nam
Bob Nystrom 2013/08/22 18:09:30 When one of these exceptions is thrown, the output
+ }
+
var description;
var sourceName;
« no previous file with comments | « no previous file | sdk/lib/_internal/pub/lib/src/validator/dependency.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698