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

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

Issue 657673002: Regenerate pub sources. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 2 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 | Annotate | Revision Log
OLDNEW
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 /// Operations relative to the user's installed Dart SDK.
1 library pub.sdk; 6 library pub.sdk;
7
2 import 'dart:io'; 8 import 'dart:io';
9
3 import 'package:path/path.dart' as path; 10 import 'package:path/path.dart' as path;
4 import 'package:pub_semver/pub_semver.dart'; 11 import 'package:pub_semver/pub_semver.dart';
12
5 import 'io.dart'; 13 import 'io.dart';
14
15 /// Gets the path to the root directory of the SDK.
16 ///
17 /// When running from the actual built SDK, this will be the SDK that contains
18 /// the running Dart executable. When running from the repo, it will be the
19 /// "sdk" directory in the Dart repository itself.
6 final String rootDirectory = 20 final String rootDirectory =
7 runningFromSdk ? _rootDirectory : path.join(repoRoot, "sdk"); 21 runningFromSdk ? _rootDirectory : path.join(repoRoot, "sdk");
22
23 /// Gets the path to the root directory of the SDK, assuming that the currently
24 /// running Dart executable is within it.
8 final String _rootDirectory = path.dirname(path.dirname(Platform.executable)); 25 final String _rootDirectory = path.dirname(path.dirname(Platform.executable));
26
27 /// The SDK's revision number formatted to be a semantic version.
28 ///
29 /// This can be set so that the version solver tests can artificially select
30 /// different SDK versions.
9 Version version = _getVersion(); 31 Version version = _getVersion();
32
33 /// Determine the SDK's version number.
10 Version _getVersion() { 34 Version _getVersion() {
35 // Some of the pub integration tests require an SDK version number, but the
36 // tests on the bots are not run from a built SDK so this lets us avoid
37 // parsing the missing version file.
11 var sdkVersion = Platform.environment["_PUB_TEST_SDK_VERSION"]; 38 var sdkVersion = Platform.environment["_PUB_TEST_SDK_VERSION"];
12 if (sdkVersion != null) return new Version.parse(sdkVersion); 39 if (sdkVersion != null) return new Version.parse(sdkVersion);
40
13 if (runningFromSdk) { 41 if (runningFromSdk) {
42 // Read the "version" file.
14 var version = readTextFile(path.join(_rootDirectory, "version")).trim(); 43 var version = readTextFile(path.join(_rootDirectory, "version")).trim();
15 return new Version.parse(version); 44 return new Version.parse(version);
16 } 45 }
46
47 // When running from the repo, read the canonical VERSION file in tools/.
48 // This makes it possible to run pub without having built the SDK first.
17 var contents = readTextFile(path.join(repoRoot, "tools/VERSION")); 49 var contents = readTextFile(path.join(repoRoot, "tools/VERSION"));
50
18 parseField(name) { 51 parseField(name) {
19 var pattern = new RegExp("^$name ([a-z0-9]+)", multiLine: true); 52 var pattern = new RegExp("^$name ([a-z0-9]+)", multiLine: true);
20 var match = pattern.firstMatch(contents); 53 var match = pattern.firstMatch(contents);
21 return match[1]; 54 return match[1];
22 } 55 }
56
23 var channel = parseField("CHANNEL"); 57 var channel = parseField("CHANNEL");
24 var major = parseField("MAJOR"); 58 var major = parseField("MAJOR");
25 var minor = parseField("MINOR"); 59 var minor = parseField("MINOR");
26 var patch = parseField("PATCH"); 60 var patch = parseField("PATCH");
27 var prerelease = parseField("PRERELEASE"); 61 var prerelease = parseField("PRERELEASE");
28 var prereleasePatch = parseField("PRERELEASE_PATCH"); 62 var prereleasePatch = parseField("PRERELEASE_PATCH");
63
29 var version = "$major.$minor.$patch"; 64 var version = "$major.$minor.$patch";
30 if (channel == "be") { 65 if (channel == "be") {
66 // TODO(rnystrom): tools/utils.py includes the svn commit here. Should we?
31 version += "-edge"; 67 version += "-edge";
32 } else if (channel == "dev") { 68 } else if (channel == "dev") {
33 version += "-dev.$prerelease.$prereleasePatch"; 69 version += "-dev.$prerelease.$prereleasePatch";
34 } 70 }
71
35 return new Version.parse(version); 72 return new Version.parse(version);
36 } 73 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698