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

Side by Side Diff: tools/testing/dart/version.dart

Issue 11090067: Version fixed for Windows. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 /** 5 /**
6 * This file contains functionality for getting dart version numbers using 6 * This file contains functionality for getting dart version numbers using
7 * our standard version construction method. Systems that does not include this 7 * our standard version construction method. Systems that does not include this
8 * file should emulate the structure for revision numbers that we have here. 8 * file should emulate the structure for revision numbers that we have here.
9 * 9 *
10 * The version number of a dart build is constructed as follows: 10 * The version number of a dart build is constructed as follows:
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 return; 105 return;
106 }); 106 });
107 } 107 }
108 }; 108 };
109 }); 109 });
110 return c.future; 110 return c.future;
111 } 111 }
112 112
113 String getExecutableSuffix() { 113 String getExecutableSuffix() {
114 if (Platform.operatingSystem == 'windows') { 114 if (Platform.operatingSystem == 'windows') {
115 return '.exe'; 115 return '.bat';
116 } 116 }
117 return ''; 117 return '';
118 } 118 }
119 119
120 Future<int> getRevision() { 120 Future<int> getRevision() {
121 if (repositoryType == RepositoryType.UNKNOWN) { 121 if (repositoryType == RepositoryType.UNKNOWN) {
122 return new Future.immediate(0); 122 return new Future.immediate(0);
123 } 123 }
124 var isSvn = repositoryType == RepositoryType.SVN; 124 var isSvn = repositoryType == RepositoryType.SVN;
125 var command = isSvn ? "svn" : "git"; 125 var command = isSvn ? "svn" : "git";
(...skipping 10 matching lines...) Expand all
136 String revisionString = result.stdout.split("\n")[8].substring(18); 136 String revisionString = result.stdout.split("\n")[8].substring(18);
137 return int.parse(revisionString); 137 return int.parse(revisionString);
138 } catch (e) { 138 } catch (e) {
139 return 0; 139 return 0;
140 } 140 }
141 }); 141 });
142 } 142 }
143 143
144 String getUserName() { 144 String getUserName() {
145 // TODO(ricow): Don't add this on the buildbot. 145 // TODO(ricow): Don't add this on the buildbot.
146 if (!Platform.environment.containsKey("USER")) return ""; 146 var key = "USER";
147 return Platform.environment["USER"]; 147 if (Platform.operatingSystem == 'windows') {
148 key = "USERNAME";
149 }
150 if (!Platform.environment.containsKey(key)) return "";
151 return Platform.environment[key];
148 } 152 }
149 153
150 RepositoryType get repositoryType { 154 RepositoryType get repositoryType {
151 if (new Directory(".svn").existsSync()) return RepositoryType.SVN; 155 if (new Directory(".svn").existsSync()) return RepositoryType.SVN;
152 if (new Directory(".git").existsSync()) return RepositoryType.GIT; 156 if (new Directory(".git").existsSync()) return RepositoryType.GIT;
153 return RepositoryType.UNKNOWN; 157 return RepositoryType.UNKNOWN;
154 } 158 }
155 } 159 }
156 160
157 class RepositoryType { 161 class RepositoryType {
158 static final RepositoryType SVN = const RepositoryType("SVN"); 162 static final RepositoryType SVN = const RepositoryType("SVN");
159 static final RepositoryType GIT = const RepositoryType("GIT"); 163 static final RepositoryType GIT = const RepositoryType("GIT");
160 static final RepositoryType UNKNOWN = const RepositoryType("UNKNOWN"); 164 static final RepositoryType UNKNOWN = const RepositoryType("UNKNOWN");
161 165
162 const RepositoryType(String this.name); 166 const RepositoryType(String this.name);
163 167
164 static RepositoryType guessType() { 168 static RepositoryType guessType() {
165 if (new Directory(".svn").existsSync()) return RepositoryType.SVN; 169 if (new Directory(".svn").existsSync()) return RepositoryType.SVN;
166 if (new Directory(".git").existsSync()) return RepositoryType.GIT; 170 if (new Directory(".git").existsSync()) return RepositoryType.GIT;
167 return RepositoryType.UNKNOWN; 171 return RepositoryType.UNKNOWN;
168 } 172 }
169 173
170 String toString() => name; 174 String toString() => name;
171 175
172 final String name; 176 final String name;
173 } 177 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698