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

Side by Side Diff: packages/barback/lib/src/build_result.dart

Issue 3015713002: Roll to pickup pool changes
Patch Set: Created 3 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
« no previous file with comments | « packages/barback/lib/src/barback.dart ('k') | packages/barback/lib/src/errors.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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 library barback.build_result; 5 library barback.build_result;
6 6
7 import 'errors.dart'; 7 import 'errors.dart';
8 import 'utils.dart'; 8 import 'utils.dart';
9 9
10 /// An event indicating that the cascade has finished building all assets. 10 /// An event indicating that the cascade has finished building all assets.
(...skipping 11 matching lines...) Expand all
22 22
23 /// `true` if the build succeeded. 23 /// `true` if the build succeeded.
24 bool get succeeded => errors.isEmpty; 24 bool get succeeded => errors.isEmpty;
25 25
26 BuildResult(Iterable<BarbackException> errors) 26 BuildResult(Iterable<BarbackException> errors)
27 : errors = flattenAggregateExceptions(errors).toSet(); 27 : errors = flattenAggregateExceptions(errors).toSet();
28 28
29 /// Creates a build result indicating a successful build. 29 /// Creates a build result indicating a successful build.
30 /// 30 ///
31 /// This equivalent to a build result with no errors. 31 /// This equivalent to a build result with no errors.
32 BuildResult.success() 32 BuildResult.success() : this([]);
33 : this([]);
34 33
35 /// Creates a single [BuildResult] that contains all of the errors of 34 /// Creates a single [BuildResult] that contains all of the errors of
36 /// [results]. 35 /// [results].
37 factory BuildResult.aggregate(Iterable<BuildResult> results) { 36 factory BuildResult.aggregate(Iterable<BuildResult> results) {
38 var errors = unionAll(results.map((result) => result.errors)); 37 var errors = unionAll(results.map((result) => result.errors));
39 return new BuildResult(errors); 38 return new BuildResult(errors);
40 } 39 }
41 40
42 String toString() { 41 String toString() {
43 if (succeeded) return "success"; 42 if (succeeded) return "success";
44 43
45 return "errors:\n" + errors.map((error) { 44 return "errors:\n" +
46 var stackTrace = null; 45 errors.map((error) {
47 if (error is TransformerException) { 46 var stackTrace = null;
48 stackTrace = error.stackTrace.terse; 47 if (error is TransformerException) {
49 } else if (error is AssetLoadException) { 48 stackTrace = error.stackTrace.terse;
50 stackTrace = error.stackTrace.terse; 49 } else if (error is AssetLoadException) {
51 } 50 stackTrace = error.stackTrace.terse;
51 }
52 52
53 var msg = new StringBuffer(); 53 var msg = new StringBuffer();
54 msg.write(prefixLines(error.toString())); 54 msg.write(prefixLines(error.toString()));
55 if (stackTrace != null) { 55 if (stackTrace != null) {
56 msg.write("\n\n"); 56 msg.write("\n\n");
57 msg.write("Stack chain:\n"); 57 msg.write("Stack chain:\n");
58 msg.write(prefixLines(stackTrace.toString())); 58 msg.write(prefixLines(stackTrace.toString()));
59 } 59 }
60 return msg.toString(); 60 return msg.toString();
61 }).join("\n\n"); 61 }).join("\n\n");
62 } 62 }
63 } 63 }
OLDNEW
« no previous file with comments | « packages/barback/lib/src/barback.dart ('k') | packages/barback/lib/src/errors.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698