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

Unified Diff: utils/pub/package.dart

Issue 12171002: Tweak SDK constraint checking a bit. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Clean up Package and Pubspec a bit. Created 7 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
« no previous file with comments | « utils/pub/git_source.dart ('k') | utils/pub/pubspec.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: utils/pub/package.dart
diff --git a/utils/pub/package.dart b/utils/pub/package.dart
index ac9cc39703353a377d922bc8d4dbcf6a23772981..5485b65e78b33eb9228f5343a6183b93f4d861d9 100644
--- a/utils/pub/package.dart
+++ b/utils/pub/package.dart
@@ -58,26 +58,9 @@ class Package {
/// Loads the package whose root directory is [packageDir]. [name] is the
/// expected name of that package (e.g. the name given in the dependency), or
/// `null` if the package being loaded is the entrypoint package.
- factory Package(String name, String packageDir, SourceRegistry sources) {
- var pubspecPath = join(packageDir, 'pubspec.yaml');
- if (!fileExists(pubspecPath)) throw new PubspecNotFoundException(name);
-
- try {
- var pubspec = new Pubspec.parse(readTextFile(pubspecPath), sources);
-
- if (pubspec.name == null) {
- throw new PubspecHasNoNameException(name);
- }
-
- if (name != null && pubspec.name != name) {
- throw new PubspecNameMismatchException(name, pubspec.name);
- }
-
- return new Package._(packageDir, pubspec);
- } on FormatException catch (ex) {
- throw 'Could not parse $pubspecPath:\n${ex.message}';
- }
- }
+ Package.load(String name, String packageDir, SourceRegistry sources)
+ : dir = packageDir,
+ pubspec = new Pubspec.load(name, packageDir, sources);
/// Constructs a package with the given pubspec. The package will have no
/// directory associated with it.
« no previous file with comments | « utils/pub/git_source.dart ('k') | utils/pub/pubspec.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698