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

Side by Side Diff: lib/src/sdk.dart

Issue 1166623003: Prefer the Dart repo's SDK to DART_SDK. (Closed) Base URL: git@github.com:dart-lang/pub.git@master
Patch Set: Created 5 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 /// Operations relative to the user's installed Dart SDK. 5 /// Operations relative to the user's installed Dart SDK.
6 library pub.sdk; 6 library pub.sdk;
7 7
8 import 'dart:io'; 8 import 'dart:io';
9 9
10 import 'package:path/path.dart' as p; 10 import 'package:path/path.dart' as p;
11 import 'package:pub_semver/pub_semver.dart'; 11 import 'package:pub_semver/pub_semver.dart';
12 12
13 import 'io.dart'; 13 import 'io.dart';
14 14
15 /// The path to the root directory of the SDK. 15 /// The path to the root directory of the SDK.
16 /// 16 ///
17 /// Note that if pub is running from source within the Dart repo (for example 17 /// Note that if pub is running from source within the Dart repo (for example
18 /// when building Observatory), this will be the repo's "sdk/" directory, which 18 /// when building Observatory), this will be the repo's "sdk/" directory, which
19 /// doesn't look exactly like the built SDK. 19 /// doesn't look exactly like the built SDK.
20 final String rootDirectory = (() { 20 final String rootDirectory = (() {
21 if (runningFromDartRepo) return p.join(dartRepoRoot, 'sdk');
22
21 var dartSdk = Platform.environment["DART_SDK"]; 23 var dartSdk = Platform.environment["DART_SDK"];
22 if (dartSdk != null) return dartSdk; 24 if (dartSdk != null) return dartSdk;
23 25
24 if (runningFromDartRepo) return p.join(dartRepoRoot, 'sdk');
25
26 // The Dart exectuable is in "/path/to/sdk/bin/dart", so two levels up is 26 // The Dart exectuable is in "/path/to/sdk/bin/dart", so two levels up is
27 // "/path/to/sdk". 27 // "/path/to/sdk".
28 var aboveExecutable = p.dirname(p.dirname(Platform.executable)); 28 var aboveExecutable = p.dirname(p.dirname(Platform.executable));
29 assert(fileExists(p.join(aboveExecutable, 'version'))); 29 assert(fileExists(p.join(aboveExecutable, 'version')));
30 return aboveExecutable; 30 return aboveExecutable;
31 })(); 31 })();
32 32
33 /// The SDK's revision number formatted to be a semantic version. 33 /// The SDK's revision number formatted to be a semantic version.
34 /// 34 ///
35 /// This can be set so that the version solver tests can artificially select 35 /// This can be set so that the version solver tests can artificially select
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 var version = "$major.$minor.$patch"; 70 var version = "$major.$minor.$patch";
71 if (channel == "be") { 71 if (channel == "be") {
72 // TODO(rnystrom): tools/utils.py includes the svn commit here. Should we? 72 // TODO(rnystrom): tools/utils.py includes the svn commit here. Should we?
73 version += "-edge"; 73 version += "-edge";
74 } else if (channel == "dev") { 74 } else if (channel == "dev") {
75 version += "-dev.$prerelease.$prereleasePatch"; 75 version += "-dev.$prerelease.$prereleasePatch";
76 } 76 }
77 77
78 return new Version.parse(version); 78 return new Version.parse(version);
79 } 79 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698