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

Unified Diff: utils/pub/source.dart

Issue 10540151: First pass at version constraint solver. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 6 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
Index: utils/pub/source.dart
diff --git a/utils/pub/source.dart b/utils/pub/source.dart
index 974f677f31dd626a90a69ca326e70a27ed583cf7..9647d3907137797b435fbddf62c7e640cf0bdcf7 100644
--- a/utils/pub/source.dart
+++ b/utils/pub/source.dart
@@ -30,6 +30,29 @@ class Source {
abstract bool get shouldCache();
/**
+ * Finds the best known version of package [name] that meets [constraint].
+ *
+ * Note that this does *not* require the packages to be installed, which is
+ * the point. This is used during version resolution to determine which
+ * package versions are available to be installed (or already installed).
+ */
+ Future<Version> findVersion(String name,
nweiz 2012/06/18 18:29:19 Shouldn't "name" be "description" instead?
Bob Nystrom 2012/06/20 01:40:04 Yeah. Right now, this giant patch punts on how dif
nweiz 2012/06/20 21:08:48 Sure, it's reasonable to put this off.
+ VersionConstraint constraint) {
nweiz 2012/06/18 18:29:19 This puts a lot of burden onto the sources for und
Bob Nystrom 2012/06/20 01:40:04 Maybe I'm being premature, but I worry that that c
nweiz 2012/06/20 21:08:48 If we do pass VersionConstraints to sources, we sh
Bob Nystrom 2012/06/20 22:29:54 My intent is that that caching would live outside
nweiz 2012/06/20 23:47:45 My point is that if the source receives findVersio
Bob Nystrom 2012/06/21 00:12:18 Ah, sorry. I see what you're getting at. I forgot
+ // TODO(rnystrom): Do something better here.
+ throw "Source $name doesn't support versioning.";
+ }
+
+ /**
+ * Loads the (possibly remote) pubspec for the desired [version] of the named
+ * [package]. This will be called for packages that have not yet been
+ * installed during the version resolution process.
+ */
+ Future<Pubspec> describe(String package, Version version) {
+ // TODO(rnystrom): Figure out how non-default sources should handle this.
+ throw "Source $name doesn't support versioning.";
+ }
+
+ /**
* Installs the package identified by [id] to [path]. Returns a [Future] that
* completes when the installation was finished. The [Future] should resolve
* to true if the package was found in the source and false if it wasn't. For

Powered by Google App Engine
This is Rietveld 408576698