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

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

Issue 22265002: Support cross-package transforms in barback. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Remove a duplicated test. Created 7 years, 4 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
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 library barback.build_result;
6
7 import 'dart:async';
8
9 import 'package:stack_trace/stack_trace.dart';
10
11 import 'utils.dart';
12
13 /// An event indicating that the cascade has finished building all assets.
14 ///
15 /// A build can end either in success or failure. If there were no errors during
16 /// the build, it's considered to be a success; any errors render it a failure,
17 /// although individual assets may still have built successfully.
18 class BuildResult {
19 /// All errors that occurred during the build.
20 final List errors;
21
22 /// `true` if the build succeeded.
23 bool get succeeded => errors.isEmpty;
24
25 BuildResult(Iterable errors)
26 : errors = errors.toList();
27
28 /// Creates a build result indicating a successful build.
29 ///
30 /// This equivalent to a build result with no errors.
31 BuildResult.success()
32 : this([]);
33
34 String toString() {
35 if (succeeded) return "success";
36
37 return "errors:\n" + errors.map((error) {
38 var stackTrace = getAttachedStackTrace(error);
39 if (stackTrace != null) stackTrace = new Trace.from(stackTrace);
40
41 var msg = new StringBuffer();
42 msg.write(prefixLines(error.toString()));
43 if (stackTrace != null) {
44 msg.write("\n\n");
45 msg.write("Stack trace:\n");
46 msg.write(prefixLines(stackTrace.toString()));
47 }
48 return msg.toString();
49 }).join("\n\n");
50 }
51 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698