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

Unified Diff: utils/pub/package.dart

Issue 10091014: Start implementing pub object model. Rudimentary package cache class, and a simple pub command to l… (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Platform is static now. Created 8 years, 8 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/io.dart ('k') | utils/pub/pub.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
new file mode 100644
index 0000000000000000000000000000000000000000..2942a92c67c1c4ec2af1a8a65d3b9b276d722f72
--- /dev/null
+++ b/utils/pub/package.dart
@@ -0,0 +1,39 @@
+// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+/**
+ * A named, versioned, unit of code and resource reuse.
+ */
+class Package {
+ /**
+ * The name of the package.
+ */
+ final String name;
+
+ /**
+ * The names of the packages that this package depends on. This is what is
+ * specified in the pubspec when this package depends on another.
+ */
+ // TODO(rnystrom): When packages are versioned and sourced, this will likely
+ // be something more than just a string.
+ final Collection<String> dependencies;
+
+ /**
+ * The cache where this package is contained.
+ */
+ final PackageCache _cache;
+
+ /**
+ * Constructs a package. This should not be called directly. Instead, acquire
+ * packages from [PackageCache].
+ */
+ Package._(this._cache, this.name, this.dependencies);
+
+ /**
+ * Reads and returns all of the packages this package depends on.
+ */
+ Future<Collection<Package>> readDependencies() {
+ return Futures.wait(dependencies.map((name) => _cache.find(name)));
+ }
+}
« no previous file with comments | « utils/pub/io.dart ('k') | utils/pub/pub.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698