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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 Future<String> getVersion() { | 47 Future<String> getVersion() { |
48 File f = new File(_versionFileName); | 48 File f = new File(_versionFileName); |
49 Completer c = new Completer(); | 49 Completer c = new Completer(); |
50 f.exists().then((existed) { | 50 f.exists().then((existed) { |
51 if (!existed) { | 51 if (!existed) { |
52 c.completeException("No VERSION file"); | 52 c.completeException("No VERSION file"); |
53 return; | 53 return; |
54 } | 54 } |
55 StringInputStream input = new StringInputStream(f.openInputStream()); | 55 StringInputStream input = new StringInputStream(f.openInputStream()); |
56 input.onLine = () { | 56 input.onLine = () { |
57 var line = input.readLine(); | 57 var line = input.readLine().trim(); |
58 if (line == null) { | 58 if (line == null) { |
59 c.completeException( | 59 c.completeException( |
60 "VERSION input file seems to be in the wrong format"); | 60 "VERSION input file seems to be in the wrong format"); |
61 return; | 61 return; |
62 } | 62 } |
63 var values = line.split(" "); | 63 var values = line.split(" "); |
64 if (values.length != 2) { | 64 if (values.length != 2) { |
65 c.completeException( | 65 c.completeException( |
66 "VERSION input file seems to be in the wrong format"); | 66 "VERSION input file seems to be in the wrong format"); |
67 return; | 67 return; |
(...skipping 127 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 |