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

Unified Diff: utils/pub/sdk_source.dart

Issue 10689169: Use environment variables to find the Dart SDK and the Pub cache directory. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Code review changes Created 8 years, 5 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/pub.dart ('k') | utils/tests/pub/pub_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: utils/pub/sdk_source.dart
diff --git a/utils/pub/sdk_source.dart b/utils/pub/sdk_source.dart
index 3662f853fa4530280307cbfe9e5b2369fb43aa6c..53a4664b846b7f775ef5804a8a4692c8f384126d 100644
--- a/utils/pub/sdk_source.dart
+++ b/utils/pub/sdk_source.dart
@@ -13,8 +13,6 @@
*
* This currently uses the "sdkdir" command-line argument to find the SDK.
*/
-// TODO(nweiz): This should read the SDK directory from an environment variable
-// once we can set those for tests.
class SdkSource extends Source {
final String name = "sdk";
final bool shouldCache = false;
@@ -22,9 +20,15 @@ class SdkSource extends Source {
/**
* The root directory of the Dart SDK.
*/
- final String rootDir;
+ final String _rootDir;
- SdkSource(this.rootDir);
+ String get rootDir() {
+ if (_rootDir != null) return _rootDir;
+ throw "Pub can't find the Dart SDK. Please set the DART_SDK environment "
+ "variable to the Dart SDK directory.";
+ }
+
+ SdkSource(this._rootDir);
/**
* An SDK package has no dependencies. Its version number is inferred from the
« no previous file with comments | « utils/pub/pub.dart ('k') | utils/tests/pub/pub_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698