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. |