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

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

Issue 11827017: Update remaining usages of Completer.completeException. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tools/html_json_doc/lib/html_to_json.dart ('k') | utils/archive/entry.dart » ('j') | 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 /** 42 /**
43 * 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
44 * 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
45 * from the source control system of the current checkout. 45 * from the source control system of the current checkout.
46 */ 46 */
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.completeError("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().trim(); 57 var line = input.readLine().trim();
58 if (line == null) { 58 if (line == null) {
59 c.completeException( 59 c.completeError(
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.completeError(
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;
68 } 68 }
69 var number = 0; 69 var number = 0;
70 try { 70 try {
71 number = int.parse(values[1]); 71 number = int.parse(values[1]);
72 } catch (e) { 72 } catch (e) {
73 c.completeException("Can't parse version numbers, not an int"); 73 c.completeError("Can't parse version numbers, not an int");
74 return; 74 return;
75 } 75 }
76 switch (values[0]) { 76 switch (values[0]) {
77 case "MAJOR": 77 case "MAJOR":
78 MAJOR = number; 78 MAJOR = number;
79 break; 79 break;
80 case "MINOR": 80 case "MINOR":
81 MINOR = number; 81 MINOR = number;
82 break; 82 break;
83 case "BUILD": 83 case "BUILD":
84 BUILD = number; 84 BUILD = number;
85 break; 85 break;
86 case "PATCH": 86 case "PATCH":
87 PATCH = number; 87 PATCH = number;
88 break; 88 break;
89 default: 89 default:
90 c.completeException("Wrong format in VERSION file, line does not " 90 c.completeError("Wrong format in VERSION file, line does not "
91 "contain one of {MAJOR, MINOR, BUILD, PATCH}"); 91 "contain one of {MAJOR, MINOR, BUILD, PATCH}");
92 return; 92 return;
93 } 93 }
94 }; 94 };
95 input.onClosed = () { 95 input.onClosed = () {
96 // Only complete if we did not already complete with a failure. 96 // Only complete if we did not already complete with a failure.
97 if (!c.future.isComplete) { 97 if (!c.future.isComplete) {
98 getRevision().then((revision) { 98 getRevision().then((revision) {
99 REVISION = revision; 99 REVISION = revision;
100 USERNAME = getUserName(); 100 USERNAME = getUserName();
101 var userNameString = ""; 101 var userNameString = "";
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 static RepositoryType guessType() { 206 static RepositoryType guessType() {
207 if (new Directory(".svn").existsSync()) return RepositoryType.SVN; 207 if (new Directory(".svn").existsSync()) return RepositoryType.SVN;
208 if (new Directory(".git").existsSync()) return RepositoryType.GIT; 208 if (new Directory(".git").existsSync()) return RepositoryType.GIT;
209 return RepositoryType.UNKNOWN; 209 return RepositoryType.UNKNOWN;
210 } 210 }
211 211
212 String toString() => name; 212 String toString() => name;
213 213
214 final String name; 214 final String name;
215 } 215 }
OLDNEW
« no previous file with comments | « tools/html_json_doc/lib/html_to_json.dart ('k') | utils/archive/entry.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698