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

Side by Side Diff: utils/pub/sdk.dart

Issue 12047096: Get rid of RootSource. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 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 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 '../../pkg/path/lib/path.dart' as path; 10 import '../../pkg/path/lib/path.dart' as path;
(...skipping 27 matching lines...) Expand all
38 /// Determine the SDK's version number. 38 /// Determine the SDK's version number.
39 Version _getVersion() { 39 Version _getVersion() {
40 var revisionPath = path.join(rootDirectory, "version"); 40 var revisionPath = path.join(rootDirectory, "version");
41 var version = new File(revisionPath).readAsStringSync().trim(); 41 var version = new File(revisionPath).readAsStringSync().trim();
42 42
43 // Given a version file like: 0.1.2.0_r17495 43 // Given a version file like: 0.1.2.0_r17495
44 // We create a semver like: 0.1.2+0._r17495 44 // We create a semver like: 0.1.2+0._r17495
45 var match = _versionPattern.firstMatch(version); 45 var match = _versionPattern.firstMatch(version);
46 if (match == null) { 46 if (match == null) {
47 throw new FormatException("The Dart SDK's 'version' file was not in a " 47 throw new FormatException("The Dart SDK's 'version' file was not in a "
48 "format pub could recognize. Found: $revision"); 48 "format pub could recognize. Found: $version");
49 } 49 }
50 50
51 var build = match[4]; 51 var build = match[4];
52 if (match[5].length > 0) build = '$build.${match[5]}'; 52 if (match[5].length > 0) build = '$build.${match[5]}';
53 53
54 return new Version( 54 return new Version(
55 int.parse(match[1]), int.parse(match[2]), int.parse(match[3]), 55 int.parse(match[1]), int.parse(match[2]), int.parse(match[3]),
56 build: build); 56 build: build);
57 } 57 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698