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

Unified Diff: utils/pub/pubspec.dart

Issue 12433014: Dev dependencies. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated after discussing. Created 7 years, 9 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 | utils/pub/sdk_source.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: utils/pub/pubspec.dart
diff --git a/utils/pub/pubspec.dart b/utils/pub/pubspec.dart
index 81678afc0b039f234c7c1c65bc88141e2b3b54cf..92cf29bbfe488f856fa0f92dcc3aa8e66057d59f 100644
--- a/utils/pub/pubspec.dart
+++ b/utils/pub/pubspec.dart
@@ -25,6 +25,9 @@ class Pubspec {
/// The packages this package depends on.
final List<PackageRef> dependencies;
+ /// The packages this package depends on when it is the root package.
+ final List<PackageRef> devDependencies;
+
/// The environment-related metadata.
final PubspecEnvironment environment;
@@ -55,14 +58,15 @@ class Pubspec {
}
}
- Pubspec(this.name, this.version, this.dependencies, this.environment,
- [Map<String, Object> fields])
+ Pubspec(this.name, this.version, this.dependencies, this.devDependencies,
+ this.environment, [Map<String, Object> fields])
: this.fields = fields == null ? {} : fields;
Pubspec.empty()
: name = null,
version = Version.none,
dependencies = <PackageRef>[],
+ devDependencies = <PackageRef>[],
environment = new PubspecEnvironment(),
fields = {};
@@ -105,6 +109,21 @@ class Pubspec {
var dependencies = _parseDependencies(filePath, sources,
parsedPubspec['dependencies']);
+ var devDependencies = _parseDependencies(filePath, sources,
+ parsedPubspec['dev_dependencies']);
+
+ // Make sure the same package doesn't appear as both a regular and dev
+ // dependency.
+ var dependencyNames = dependencies.map((dep) => dep.name).toSet();
+ var collisions = dependencyNames.intersection(
+ devDependencies.map((dep) => dep.name).toSet());
+
+ if (!collisions.isEmpty) {
+ throw new FormatException(
+ 'Package "${collisions.first}" cannot appear in both "dependencies" '
+ 'and "dev_dependencies".');
nweiz 2013/03/13 18:46:29 Let's list all the collisions so users don't have
Bob Nystrom 2013/03/13 19:42:44 Done.
+ }
+
var environmentYaml = parsedPubspec['environment'];
var sdkConstraint = VersionConstraint.any;
if (environmentYaml != null) {
@@ -169,7 +188,8 @@ class Pubspec {
}
}
- return new Pubspec(name, version, dependencies, environment, parsedPubspec);
+ return new Pubspec(name, version, dependencies, devDependencies,
+ environment, parsedPubspec);
}
}
« no previous file with comments | « no previous file | utils/pub/sdk_source.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698