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

Unified Diff: utils/pub/sdk.dart

Issue 12087008: Handle parsing the "version" file better. (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | utils/tests/pub/command_line_config.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: utils/pub/sdk.dart
diff --git a/utils/pub/sdk.dart b/utils/pub/sdk.dart
index 0e47acd867b5a753eb17c1d87219bb040a828a86..98007b5a40cea7fa6ff2cb2ac2c1cc89711ee5e1 100644
--- a/utils/pub/sdk.dart
+++ b/utils/pub/sdk.dart
@@ -14,7 +14,7 @@ import 'version.dart';
/// Matches an Eclipse-style SDK version number. This is four dotted numbers
/// (major, minor, patch, build) with an optional suffix attached to the build
/// number.
-final _versionPattern = new RegExp(r'^(\d+)\.(\d+)\.(\d+)\.(\d+)(.*)$');
+final _versionPattern = new RegExp(r'^(\d+)\.(\d+)\.(\d+)\.(\d+.*)$');
/// Gets the path to the root directory of the SDK.
String get rootDirectory {
@@ -41,15 +41,15 @@ Version _getVersion() {
var version = new File(revisionPath).readAsStringSync().trim();
// Given a version file like: 0.1.2.0_r17495
- // We create a semver like: 0.1.2+0._r17495
+ // We create a semver like: 0.1.2+0.r17495
var match = _versionPattern.firstMatch(version);
if (match == null) {
throw new FormatException("The Dart SDK's 'version' file was not in a "
"format pub could recognize. Found: $version");
}
- var build = match[4];
- if (match[5].length > 0) build = '$build.${match[5]}';
+ // Semantic versions cannot use "_".
+ var build = match[4].replaceAll('_', '.');
return new Version(
int.parse(match[1]), int.parse(match[2]), int.parse(match[3]),
« no previous file with comments | « no previous file | utils/tests/pub/command_line_config.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698