| OLD | NEW |
| 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.transform_node; | 5 library barback.transform_node; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'asset.dart'; | 9 import 'asset.dart'; |
| 10 import 'asset_id.dart'; | 10 import 'asset_id.dart'; |
| (...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 404 var invalidIds = newOutputs | 404 var invalidIds = newOutputs |
| 405 .map((asset) => asset.id) | 405 .map((asset) => asset.id) |
| 406 .where((id) => id.package != phase.cascade.package) | 406 .where((id) => id.package != phase.cascade.package) |
| 407 .toSet(); | 407 .toSet(); |
| 408 for (var id in invalidIds) { | 408 for (var id in invalidIds) { |
| 409 newOutputs.removeId(id); | 409 newOutputs.removeId(id); |
| 410 // TODO(nweiz): report this as a warning rather than a failing error. | 410 // TODO(nweiz): report this as a warning rather than a failing error. |
| 411 phase.cascade.reportError(new InvalidOutputException(info, id)); | 411 phase.cascade.reportError(new InvalidOutputException(info, id)); |
| 412 } | 412 } |
| 413 | 413 |
| 414 if (_declaredOutputs != null) { | |
| 415 var missingOutputs = _declaredOutputs.difference( | |
| 416 newOutputs.map((asset) => asset.id).toSet()); | |
| 417 if (missingOutputs.isNotEmpty) { | |
| 418 _warn("This transformer didn't emit declared " | |
| 419 "${pluralize('output asset', missingOutputs.length)} " | |
| 420 "${toSentence(missingOutputs)}."); | |
| 421 } | |
| 422 } | |
| 423 | |
| 424 // Remove outputs that used to exist but don't anymore. | 414 // Remove outputs that used to exist but don't anymore. |
| 425 for (var id in _outputControllers.keys.toList()) { | 415 for (var id in _outputControllers.keys.toList()) { |
| 426 if (newOutputs.containsId(id)) continue; | 416 if (newOutputs.containsId(id)) continue; |
| 427 _outputControllers.remove(id).setRemoved(); | 417 _outputControllers.remove(id).setRemoved(); |
| 428 } | 418 } |
| 429 | 419 |
| 430 // Emit or stop emitting the pass-through asset between removing and | 420 // Emit or stop emitting the pass-through asset between removing and |
| 431 // adding outputs to ensure there are no collisions. | 421 // adding outputs to ensure there are no collisions. |
| 432 if (!_consumePrimary && !newOutputs.containsId(primary.id)) { | 422 if (!_consumePrimary && !newOutputs.containsId(primary.id)) { |
| 433 _emitPassThrough(); | 423 _emitPassThrough(); |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 556 /// | 546 /// |
| 557 /// This will never transition to another state. | 547 /// This will never transition to another state. |
| 558 static final NOT_PRIMARY = const _State._("not primary"); | 548 static final NOT_PRIMARY = const _State._("not primary"); |
| 559 | 549 |
| 560 final String name; | 550 final String name; |
| 561 | 551 |
| 562 const _State._(this.name); | 552 const _State._(this.name); |
| 563 | 553 |
| 564 String toString() => name; | 554 String toString() => name; |
| 565 } | 555 } |
| OLD | NEW |