| Index: packages/code_transformers/lib/messages/build_logger.dart
|
| diff --git a/packages/code_transformers/lib/messages/build_logger.dart b/packages/code_transformers/lib/messages/build_logger.dart
|
| index 0e7ecf83b16180cd168ee16d5150085a72abb9d8..39dfcf83068abe02998112c32b2e0af9566c72ec 100644
|
| --- a/packages/code_transformers/lib/messages/build_logger.dart
|
| +++ b/packages/code_transformers/lib/messages/build_logger.dart
|
| @@ -10,7 +10,7 @@ import 'dart:convert' show JSON;
|
| import 'package:barback/barback.dart';
|
| import 'package:source_span/source_span.dart';
|
|
|
| -import 'messages.dart' show Message, MessageId, BuildLogEntry, LogEntryTable;
|
| +import 'messages.dart' show Message, BuildLogEntry, LogEntryTable;
|
|
|
| /// A [TransformLogger] used to track error and warning messages produced during
|
| /// a build.
|
| @@ -59,7 +59,7 @@ class BuildLogger implements TransformLogger {
|
|
|
| /// Records a message at the fine level. If [msg] is a [Message] it is
|
| /// recorded directly, otherwise it is first converted to a [String].
|
| - void fine(msg, {AssetId asset, SourceSpan span}) {
|
| + void fine(Object msg, {AssetId asset, SourceSpan span}) {
|
| msg = msg is Message ? msg : new Message.unknown('$msg');
|
| _transform.logger.fine(_snippet(msg), asset: asset, span: span);
|
| _logs.add(new BuildLogEntry(msg, span, LogLevel.FINE.name));
|
| @@ -67,7 +67,7 @@ class BuildLogger implements TransformLogger {
|
|
|
| /// Records a message at the info level. If [msg] is a [Message] it is
|
| /// recorded directly, otherwise it is first converted to a [String].
|
| - void info(msg, {AssetId asset, SourceSpan span}) {
|
| + void info(Object msg, {AssetId asset, SourceSpan span}) {
|
| msg = msg is Message ? msg : new Message.unknown('$msg');
|
| _transform.logger.info(_snippet(msg), asset: asset, span: span);
|
| _logs.add(new BuildLogEntry(msg, span, LogLevel.INFO.name));
|
| @@ -75,7 +75,7 @@ class BuildLogger implements TransformLogger {
|
|
|
| /// Records a warning message. If [msg] is a [Message] it is recorded
|
| /// directly, otherwise it is first converted to a [String].
|
| - void warning(msg, {AssetId asset, SourceSpan span}) {
|
| + void warning(Object msg, {AssetId asset, SourceSpan span}) {
|
| msg = msg is Message ? msg : new Message.unknown('$msg');
|
| _transform.logger.warning(_snippet(msg), asset: asset, span: span);
|
| _logs.add(new BuildLogEntry(msg, span, LogLevel.WARNING.name));
|
| @@ -83,7 +83,7 @@ class BuildLogger implements TransformLogger {
|
|
|
| /// Records an error message. If [msg] is a [Message] it is recorded
|
| /// directly, otherwise it is first converted to a [String].
|
| - void error(msg, {AssetId asset, SourceSpan span}) {
|
| + void error(Object msg, {AssetId asset, SourceSpan span}) {
|
| msg = msg is Message ? msg : new Message.unknown('$msg');
|
| if (convertErrorsToWarnings) {
|
| _transform.logger.warning(_snippet(msg), asset: asset, span: span);
|
| @@ -110,12 +110,11 @@ class BuildLogger implements TransformLogger {
|
|
|
| // Each phase outputs a new log file with an incrementing # appended, this
|
| // figures out the next # to use.
|
| - Future<AssetId> _getNextLogAssetId([int nextNumber = 1]) {
|
| + Future<AssetId> _getNextLogAssetId([int nextNumber = 1]) async {
|
| var nextAssetPath = _primaryId.addExtension('${LOG_EXTENSION}.$nextNumber');
|
| - return _transform.hasInput(nextAssetPath).then((exists) {
|
| - if (!exists) return nextAssetPath;
|
| - return _getNextLogAssetId(++nextNumber);
|
| - });
|
| + bool exists = await _transform.hasInput(nextAssetPath);
|
| + if (!exists) return nextAssetPath;
|
| + return _getNextLogAssetId(++nextNumber);
|
| }
|
|
|
| // Reads all log files for an Asset into [logs].
|
| @@ -126,7 +125,8 @@ class BuildLogger implements TransformLogger {
|
| return transform.hasInput(nextAssetPath).then((exists) {
|
| if (!exists) return null;
|
| return transform.readInputAsString(nextAssetPath).then((data) {
|
| - entries.addAll(new LogEntryTable.fromJson(JSON.decode(data)));
|
| + entries.addAll(new LogEntryTable.fromJson(
|
| + JSON.decode(data) as Map<String, Iterable>));
|
| return _readLogFilesForAsset(id, transform, entries, ++nextNumber);
|
| });
|
| });
|
|
|