diff --git a/modules_dart/transform/lib/src/transform/bind_generator/transformer.dart b/modules_dart/transform/lib/src/transform/bind_generator/transformer.dart index 75e79870d4..7853ee93a2 100644 --- a/modules_dart/transform/lib/src/transform/bind_generator/transformer.dart +++ b/modules_dart/transform/lib/src/transform/bind_generator/transformer.dart @@ -16,7 +16,7 @@ import 'generator.dart'; /// /// These setters are registered in the same `setupReflection` function with /// the `registerType` calls. -class BindGenerator extends Transformer implements DeclaringTransformer { +class BindGenerator extends Transformer { final TransformerOptions options; BindGenerator(this.options); @@ -24,19 +24,12 @@ class BindGenerator extends Transformer implements DeclaringTransformer { @override bool isPrimary(AssetId id) => id.path.endsWith(DEPS_EXTENSION); - @override - declareOutputs(DeclaringTransform transform) { - transform.consumePrimary(); - transform.declareOutput(transform.primaryId); - } - @override Future apply(Transform transform) async { await log.initZoned(transform, () async { var primaryId = transform.primaryInput.id; var reader = new AssetReader.fromTransform(transform); var transformedCode = await createNgSettersAndGetters(reader, primaryId); - transform.consumePrimary(); transform.addOutput(new Asset.fromString( primaryId, formatter.format(transformedCode, uri: primaryId.path))); }); diff --git a/modules_dart/transform/lib/src/transform/deferred_rewriter/transformer.dart b/modules_dart/transform/lib/src/transform/deferred_rewriter/transformer.dart index 5350948660..399b9e054a 100644 --- a/modules_dart/transform/lib/src/transform/deferred_rewriter/transformer.dart +++ b/modules_dart/transform/lib/src/transform/deferred_rewriter/transformer.dart @@ -13,7 +13,7 @@ import 'rewriter.dart'; /// Transformer responsible for rewriting deferred library loads to enable /// initializing the reflector in a deferred way to keep the code with the /// deferred library. -class DeferredRewriter extends Transformer implements DeclaringTransformer { +class DeferredRewriter extends Transformer { final TransformerOptions options; DeferredRewriter(this.options); @@ -22,23 +22,14 @@ class DeferredRewriter extends Transformer implements DeclaringTransformer { bool isPrimary(AssetId id) => id.extension.endsWith('dart') && !id.path.endsWith(DEPS_EXTENSION); - @override - declareOutputs(DeclaringTransform transform) { - transform.consumePrimary(); - transform.declareOutput(transform.primaryId); - } - @override Future apply(Transform transform) async { await log.initZoned(transform, () async { var asset = transform.primaryInput; var reader = new AssetReader.fromTransform(transform); var transformedCode = await rewriteDeferredLibraries(reader, asset.id); - transform.consumePrimary(); if (transformedCode != null) { transform.addOutput(new Asset.fromString(asset.id, transformedCode)); - } else { - transform.addOutput(asset); } }); } diff --git a/modules_dart/transform/lib/src/transform/directive_metadata_linker/transformer.dart b/modules_dart/transform/lib/src/transform/directive_metadata_linker/transformer.dart index 59e680ac91..2b0092aeff 100644 --- a/modules_dart/transform/lib/src/transform/directive_metadata_linker/transformer.dart +++ b/modules_dart/transform/lib/src/transform/directive_metadata_linker/transformer.dart @@ -20,22 +20,12 @@ import 'ng_meta_linker.dart'; /// /// See `common/ng_meta.dart` for the JSON format of these files are serialized /// to. -class DirectiveMetadataLinker extends Transformer - implements DeclaringTransformer { +class DirectiveMetadataLinker extends Transformer { final _encoder = const JsonEncoder.withIndent(' '); @override bool isPrimary(AssetId id) => id.path.endsWith(META_EXTENSION); - @override - declareOutputs(DeclaringTransform transform) { - // TODO(kegluenq): We should consume this, but doing so causes barback to - // incorrectly determine what assets are available in this phase. - // transform.consumePrimary(); - transform.declareOutput(transform.primaryId); - transform.declareOutput(_depsAssetId(transform.primaryId)); - } - @override Future apply(Transform transform) { return log.initZoned(transform, () { @@ -43,8 +33,6 @@ class DirectiveMetadataLinker extends Transformer return linkDirectiveMetadata( new AssetReader.fromTransform(transform), primaryId).then((ngMeta) { - // See above - // transform.consumePrimary(); if (ngMeta != null) { if (!ngMeta.types.isEmpty || !ngMeta.aliases.isEmpty) { transform.addOutput(new Asset.fromString( diff --git a/modules_dart/transform/lib/src/transform/directive_processor/transformer.dart b/modules_dart/transform/lib/src/transform/directive_processor/transformer.dart index c14e8a6bfc..1fcfde8677 100644 --- a/modules_dart/transform/lib/src/transform/directive_processor/transformer.dart +++ b/modules_dart/transform/lib/src/transform/directive_processor/transformer.dart @@ -21,7 +21,7 @@ import 'rewriter.dart'; /// /// This transformer is the first phase in a two-phase transform. It should /// be followed by {@link DirectiveLinker}. -class DirectiveProcessor extends Transformer implements DeclaringTransformer { +class DirectiveProcessor extends Transformer { final TransformerOptions options; final _encoder = const JsonEncoder.withIndent(' '); @@ -30,14 +30,6 @@ class DirectiveProcessor extends Transformer implements DeclaringTransformer { @override bool isPrimary(AssetId id) => id.extension.endsWith('dart'); - /// We don't always output these, but providing a superset of our outputs - /// should be safe. Barback will just have to wait until `apply` finishes to - /// determine that one or the other will not be emitted. - @override - declareOutputs(DeclaringTransform transform) { - transform.declareOutput(_ngMetaAssetId(transform.primaryId)); - } - @override Future apply(Transform transform) async { Html5LibDomAdapter.makeCurrent(); diff --git a/modules_dart/transform/lib/src/transform/inliner_for_test/transformer.dart b/modules_dart/transform/lib/src/transform/inliner_for_test/transformer.dart index 546e177b39..1f3e67cf63 100644 --- a/modules_dart/transform/lib/src/transform/inliner_for_test/transformer.dart +++ b/modules_dart/transform/lib/src/transform/inliner_for_test/transformer.dart @@ -17,7 +17,7 @@ import 'package:barback/barback.dart'; import 'package:dart_style/dart_style.dart'; /// Processes .dart files and inlines `templateUrl` and styleUrls` values. -class InlinerForTest extends Transformer implements DeclaringTransformer { +class InlinerForTest extends Transformer { final DartFormatter _formatter; final AnnotationMatcher _annotationMatcher; @@ -28,17 +28,10 @@ class InlinerForTest extends Transformer implements DeclaringTransformer { @override bool isPrimary(AssetId id) => id.extension.endsWith('dart'); - @override - declareOutputs(DeclaringTransform transform) { - transform.consumePrimary(); - transform.declareOutput(transform.primaryId); - } - @override Future apply(Transform transform) async { return initZoned(transform, () async { var primaryId = transform.primaryInput.id; - transform.consumePrimary(); var inlinedCode = await inline(new AssetReader.fromTransform(transform), primaryId, _annotationMatcher); if (inlinedCode == null || inlinedCode.isEmpty) { diff --git a/modules_dart/transform/lib/src/transform/reflection_remover/transformer.dart b/modules_dart/transform/lib/src/transform/reflection_remover/transformer.dart index de0fe8a672..506e2160c8 100644 --- a/modules_dart/transform/lib/src/transform/reflection_remover/transformer.dart +++ b/modules_dart/transform/lib/src/transform/reflection_remover/transformer.dart @@ -19,7 +19,7 @@ import 'remove_reflection_capabilities.dart'; /// have already been run and that a .ng_deps.dart file has been generated for /// {@link options.entryPoint}. The instantiation of {@link ReflectionCapabilities} is /// replaced by calling `setupReflection` in that .ng_deps.dart file. -class ReflectionRemover extends Transformer implements DeclaringTransformer { +class ReflectionRemover extends Transformer { final TransformerOptions options; ReflectionRemover(this.options); @@ -28,12 +28,6 @@ class ReflectionRemover extends Transformer implements DeclaringTransformer { bool isPrimary(AssetId id) => options.entryPointGlobs != null && options.entryPointGlobs.any((g) => g.matches(id.path)); - @override - declareOutputs(DeclaringTransform transform) { - transform.consumePrimary(); - transform.declareOutput(transform.primaryId); - } - @override Future apply(Transform transform) async { await log.initZoned(transform, () async { @@ -51,7 +45,6 @@ class ReflectionRemover extends Transformer implements DeclaringTransformer { var transformedCode = await removeReflectionCapabilities( new AssetReader.fromTransform(transform), primaryId, mirrorMode: mirrorMode, writeStaticInit: writeStaticInit); - transform.consumePrimary(); transform.addOutput(new Asset.fromString(primaryId, transformedCode)); }); } diff --git a/modules_dart/transform/lib/src/transform/stylesheet_compiler/transformer.dart b/modules_dart/transform/lib/src/transform/stylesheet_compiler/transformer.dart index 4ed0663e03..4517308663 100644 --- a/modules_dart/transform/lib/src/transform/stylesheet_compiler/transformer.dart +++ b/modules_dart/transform/lib/src/transform/stylesheet_compiler/transformer.dart @@ -12,7 +12,7 @@ import 'package:barback/barback.dart'; import 'processor.dart'; /// Pre-compiles CSS stylesheet files to Dart code for Angular 2. -class StylesheetCompiler extends Transformer implements DeclaringTransformer { +class StylesheetCompiler extends Transformer { StylesheetCompiler(); @override @@ -20,12 +20,6 @@ class StylesheetCompiler extends Transformer implements DeclaringTransformer { return id.path.endsWith(CSS_EXTENSION); } - @override - declareOutputs(DeclaringTransform transform) { - transform.declareOutput(nonShimmedStylesheetAssetId(transform.primaryId)); - transform.declareOutput(shimmedStylesheetAssetId(transform.primaryId)); - } - @override Future apply(Transform transform) async { await log.initZoned(transform, () async { diff --git a/modules_dart/transform/lib/src/transform/template_compiler/transformer.dart b/modules_dart/transform/lib/src/transform/template_compiler/transformer.dart index 158a4758b4..101e39fc41 100644 --- a/modules_dart/transform/lib/src/transform/template_compiler/transformer.dart +++ b/modules_dart/transform/lib/src/transform/template_compiler/transformer.dart @@ -18,7 +18,7 @@ import 'generator.dart'; /// extracting information about what reflection is necessary to render and /// use that template. It then generates code in place of those reflective /// accesses. -class TemplateCompiler extends Transformer implements DeclaringTransformer { +class TemplateCompiler extends Transformer { final TransformerOptions options; TemplateCompiler(this.options); @@ -26,13 +26,6 @@ class TemplateCompiler extends Transformer implements DeclaringTransformer { @override bool isPrimary(AssetId id) => id.path.endsWith(DEPS_EXTENSION); - @override - declareOutputs(DeclaringTransform transform) { - transform.consumePrimary(); - transform.declareOutput(transform.primaryId); - transform.declareOutput(templatesAssetId(transform.primaryId)); - } - @override Future apply(Transform transform) async { await log.initZoned(transform, () async { @@ -41,7 +34,6 @@ class TemplateCompiler extends Transformer implements DeclaringTransformer { var reader = new AssetReader.fromTransform(transform); var outputs = await processTemplates(reader, primaryId, reflectPropertiesAsAttributes: options.reflectPropertiesAsAttributes); - transform.consumePrimary(); var ngDepsCode = ''; var templatesCode = ''; if (outputs != null) { diff --git a/modules_dart/transform/test/transform/stylesheet_compiler/all_tests.dart b/modules_dart/transform/test/transform/stylesheet_compiler/all_tests.dart index 6ed9ec218d..7986f34ee8 100644 --- a/modules_dart/transform/test/transform/stylesheet_compiler/all_tests.dart +++ b/modules_dart/transform/test/transform/stylesheet_compiler/all_tests.dart @@ -41,17 +41,6 @@ allTests() { .toBe(false); }); - it('should declare outputs', () { - var transform = new FakeDeclaringTransform() - ..primaryId = new AssetId('somepackage', 'lib/style.css'); - subject.declareOutputs(transform); - expect(transform.outputs.length).toBe(2); - expect(transform.outputs[0].toString()) - .toEqual('somepackage|lib/style.css.dart'); - expect(transform.outputs[1].toString()) - .toEqual('somepackage|lib/style.css.shim.dart'); - }); - it('should compile stylesheets', () async { var cssFile = new Asset.fromString( new AssetId('somepackage', 'lib/style.css'), SIMPLE_CSS);