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 /** | 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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 String getExecutableSuffix() { | 115 String getExecutableSuffix() { |
116 if (Platform.operatingSystem == 'windows') { | 116 if (Platform.operatingSystem == 'windows') { |
117 return '.bat'; | 117 return '.bat'; |
118 } | 118 } |
119 return ''; | 119 return ''; |
120 } | 120 } |
121 | 121 |
122 int getRevisionFromSvnInfo(String info) { | 122 int getRevisionFromSvnInfo(String info) { |
123 if (info == null || info == '') return 0; | 123 if (info == null || info == '') return 0; |
124 var lines = info.split("\n"); | 124 var lines = info.split("\n"); |
125 RegExp exp = new RegExp(r"Last Changed Rev: (\d*)"); | 125 RegExp exp = const RegExp(r"Last Changed Rev: (\d*)"); |
126 for (var line in lines) { | 126 for (var line in lines) { |
127 if (exp.hasMatch(line)) { | 127 if (exp.hasMatch(line)) { |
128 String revisionString = (exp.firstMatch(line).group(1)); | 128 String revisionString = (exp.firstMatch(line).group(1)); |
129 try { | 129 try { |
130 return int.parse(revisionString); | 130 return int.parse(revisionString); |
131 } catch(e) { | 131 } catch(e) { |
132 return 0; | 132 return 0; |
133 } | 133 } |
134 } | 134 } |
135 } | 135 } |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 static RepositoryType guessType() { | 195 static RepositoryType guessType() { |
196 if (new Directory(".svn").existsSync()) return RepositoryType.SVN; | 196 if (new Directory(".svn").existsSync()) return RepositoryType.SVN; |
197 if (new Directory(".git").existsSync()) return RepositoryType.GIT; | 197 if (new Directory(".git").existsSync()) return RepositoryType.GIT; |
198 return RepositoryType.UNKNOWN; | 198 return RepositoryType.UNKNOWN; |
199 } | 199 } |
200 | 200 |
201 String toString() => name; | 201 String toString() => name; |
202 | 202 |
203 final String name; | 203 final String name; |
204 } | 204 } |
OLD | NEW |