OLD | NEW |
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 import 'dart:io'; | 6 import 'dart:io'; |
7 | 7 |
8 import 'package:path/path.dart' as p; | 8 import 'package:path/path.dart' as p; |
9 import 'package:pub_semver/pub_semver.dart'; | 9 import 'package:pub_semver/pub_semver.dart'; |
10 | 10 |
(...skipping 11 matching lines...) Expand all Loading... |
22 // "/path/to/sdk". | 22 // "/path/to/sdk". |
23 var aboveExecutable = p.dirname(p.dirname(Platform.resolvedExecutable)); | 23 var aboveExecutable = p.dirname(p.dirname(Platform.resolvedExecutable)); |
24 assert(fileExists(p.join(aboveExecutable, 'version'))); | 24 assert(fileExists(p.join(aboveExecutable, 'version'))); |
25 return aboveExecutable; | 25 return aboveExecutable; |
26 })(); | 26 })(); |
27 | 27 |
28 /// The SDK's revision number formatted to be a semantic version. | 28 /// The SDK's revision number formatted to be a semantic version. |
29 /// | 29 /// |
30 /// This can be set so that the version solver tests can artificially select | 30 /// This can be set so that the version solver tests can artificially select |
31 /// different SDK versions. | 31 /// different SDK versions. |
32 Version version = _getVersion(); | 32 final version = _getVersion(); |
33 | 33 |
34 /// Determine the SDK's version number. | 34 /// Determine the SDK's version number. |
35 Version _getVersion() { | 35 Version _getVersion() { |
36 // Some of the pub integration tests require an SDK version number, but the | 36 // Some of the pub integration tests require an SDK version number, but the |
37 // tests on the bots are not run from a built SDK so this lets us avoid | 37 // tests on the bots are not run from a built SDK so this lets us avoid |
38 // parsing the missing version file. | 38 // parsing the missing version file. |
39 var sdkVersion = Platform.environment["_PUB_TEST_SDK_VERSION"]; | 39 var sdkVersion = Platform.environment["_PUB_TEST_SDK_VERSION"]; |
40 if (sdkVersion != null) return new Version.parse(sdkVersion); | 40 if (sdkVersion != null) return new Version.parse(sdkVersion); |
41 | 41 |
42 if (!runningFromDartRepo) { | 42 if (!runningFromDartRepo) { |
(...skipping 22 matching lines...) Expand all Loading... |
65 var version = "$major.$minor.$patch"; | 65 var version = "$major.$minor.$patch"; |
66 if (channel == "be") { | 66 if (channel == "be") { |
67 // TODO(rnystrom): tools/utils.py includes the svn commit here. Should we? | 67 // TODO(rnystrom): tools/utils.py includes the svn commit here. Should we? |
68 version += "-edge"; | 68 version += "-edge"; |
69 } else if (channel == "dev") { | 69 } else if (channel == "dev") { |
70 version += "-dev.$prerelease.$prereleasePatch"; | 70 version += "-dev.$prerelease.$prereleasePatch"; |
71 } | 71 } |
72 | 72 |
73 return new Version.parse(version); | 73 return new Version.parse(version); |
74 } | 74 } |
OLD | NEW |