| 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 library sdk; | 6 library sdk; |
| 7 | 7 |
| 8 import 'dart:io'; | 8 import 'dart:io'; |
| 9 | 9 |
| 10 import 'package:pathos/path.dart' as path; | 10 import 'package:pathos/path.dart' as path; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 String get rootDirectory { | 22 String get rootDirectory { |
| 23 // If the environment variable was provided, use it. This is mainly used for | 23 // If the environment variable was provided, use it. This is mainly used for |
| 24 // the pub tests. | 24 // the pub tests. |
| 25 var dir = Platform.environment["DART_SDK"]; | 25 var dir = Platform.environment["DART_SDK"]; |
| 26 if (dir != null) { | 26 if (dir != null) { |
| 27 log.fine("Using DART_SDK to find SDK at $dir"); | 27 log.fine("Using DART_SDK to find SDK at $dir"); |
| 28 return dir; | 28 return dir; |
| 29 } | 29 } |
| 30 | 30 |
| 31 // Assume the Dart executable is always coming from the SDK. | 31 // Assume the Dart executable is always coming from the SDK. |
| 32 return path.dirname(path.dirname(new Options().executable)); | 32 return path.dirname(path.dirname(Platform.executable)); |
| 33 } | 33 } |
| 34 | 34 |
| 35 /// Gets the SDK's revision number formatted to be a semantic version. | 35 /// Gets the SDK's revision number formatted to be a semantic version. |
| 36 Version version = _getVersion(); | 36 Version version = _getVersion(); |
| 37 | 37 |
| 38 /// Is `true` if the current SDK is an unreleased bleeding edge version. | 38 /// Is `true` if the current SDK is an unreleased bleeding edge version. |
| 39 bool get isBleedingEdge { | 39 bool get isBleedingEdge { |
| 40 // The live build is locked to the magical old number "0.1.2+<stuff>". | 40 // The live build is locked to the magical old number "0.1.2+<stuff>". |
| 41 return version.major == 0 && version.minor == 1 && version.patch == 2; | 41 return version.major == 0 && version.minor == 1 && version.patch == 2; |
| 42 } | 42 } |
| (...skipping 11 matching lines...) Expand all Loading... |
| 54 "format pub could recognize. Found: $version"); | 54 "format pub could recognize. Found: $version"); |
| 55 } | 55 } |
| 56 | 56 |
| 57 // Semantic versions cannot use "_". | 57 // Semantic versions cannot use "_". |
| 58 var build = match[4].replaceAll('_', '.'); | 58 var build = match[4].replaceAll('_', '.'); |
| 59 | 59 |
| 60 return new Version( | 60 return new Version( |
| 61 int.parse(match[1]), int.parse(match[2]), int.parse(match[3]), | 61 int.parse(match[1]), int.parse(match[2]), int.parse(match[3]), |
| 62 build: build); | 62 build: build); |
| 63 } | 63 } |
| OLD | NEW |