| 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 17 matching lines...) Expand all Loading... |
| 28 */ | 28 */ |
| 29 class Version { | 29 class Version { |
| 30 String _versionFileName; | 30 String _versionFileName; |
| 31 String USERNAME; | 31 String USERNAME; |
| 32 int REVISION; | 32 int REVISION; |
| 33 int MAJOR; | 33 int MAJOR; |
| 34 int MINOR; | 34 int MINOR; |
| 35 int BUILD; | 35 int BUILD; |
| 36 int PATCH; | 36 int PATCH; |
| 37 | 37 |
| 38 Version(String this._versionFileName); | 38 Version(Path versionFile) { |
| 39 _versionFileName = versionFile.toNativePath(); |
| 40 } |
| 39 | 41 |
| 40 /** | 42 /** |
| 41 * Get the version number for this specific build using the version info | 43 * Get the version number for this specific build using the version info |
| 42 * from the VERSION file in the root directory and the revision info | 44 * from the VERSION file in the root directory and the revision info |
| 43 * from the source control system of the current checkout. | 45 * from the source control system of the current checkout. |
| 44 */ | 46 */ |
| 45 Future<String> getVersion() { | 47 Future<String> getVersion() { |
| 46 File f = new File(_versionFileName); | 48 File f = new File(_versionFileName); |
| 47 Completer c = new Completer(); | 49 Completer c = new Completer(); |
| 48 f.exists().then((existed) { | 50 f.exists().then((existed) { |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 static RepositoryType guessType() { | 170 static RepositoryType guessType() { |
| 169 if (new Directory(".svn").existsSync()) return RepositoryType.SVN; | 171 if (new Directory(".svn").existsSync()) return RepositoryType.SVN; |
| 170 if (new Directory(".git").existsSync()) return RepositoryType.GIT; | 172 if (new Directory(".git").existsSync()) return RepositoryType.GIT; |
| 171 return RepositoryType.UNKNOWN; | 173 return RepositoryType.UNKNOWN; |
| 172 } | 174 } |
| 173 | 175 |
| 174 String toString() => name; | 176 String toString() => name; |
| 175 | 177 |
| 176 final String name; | 178 final String name; |
| 177 } | 179 } |
| OLD | NEW |