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

Side by Side Diff: reflectable/lib/transformer.dart

Issue 1722653002: Enables globbing for entry points. (Closed) Base URL: https://github.com/dart-lang/reflectable.git@master
Patch Set: Created 4 years, 10 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 | « reflectable/lib/src/transformer_implementation.dart ('k') | reflectable/pubspec.yaml » ('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) 2016, the Dart Team. All rights reserved. Use of this 1 // Copyright (c) 2016, the Dart Team. All rights reserved. Use of this
2 // source code is governed by a BSD-style license that can be found in 2 // source code is governed by a BSD-style license that can be found in
3 // the LICENSE file. 3 // the LICENSE file.
4 4
5 library reflectable.transformer; 5 library reflectable.transformer;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:io'; 8 import 'dart:io';
9 import 'package:barback/barback.dart'; 9 import 'package:barback/barback.dart';
10 import 'package:glob/glob.dart';
10 import 'package:logging/logging.dart'; 11 import 'package:logging/logging.dart';
11 import 'src/transformer_implementation.dart' as implementation; 12 import 'src/transformer_implementation.dart' as implementation;
12 13
13 class ReflectableTransformer extends Transformer 14 class ReflectableTransformer extends Transformer
14 implements DeclaringTransformer { 15 implements DeclaringTransformer {
15 BarbackSettings _settings; 16 BarbackSettings _settings;
16 List<String> _entryPoints = <String>[]; 17 List<String> _entryPoints = <String>[];
17 bool _formatted; 18 bool _formatted;
18 List<implementation.WarningKind> _suppressWarnings = 19 List<implementation.WarningKind> _suppressWarnings =
19 <implementation.WarningKind>[]; 20 <implementation.WarningKind>[];
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 @override 137 @override
137 Future apply(Transform transform) { 138 Future apply(Transform transform) {
138 return new implementation.TransformerImplementation() 139 return new implementation.TransformerImplementation()
139 .apply(transform, _entryPoints, _formatted, _suppressWarnings); 140 .apply(transform, _entryPoints, _formatted, _suppressWarnings);
140 } 141 }
141 142
142 @override 143 @override
143 declareOutputs(DeclaringTransform transform) async { 144 declareOutputs(DeclaringTransform transform) async {
144 AssetId id = await transform.primaryId; 145 AssetId id = await transform.primaryId;
145 _entryPoints.forEach((String entryPoint) { 146 _entryPoints.forEach((String entryPoint) {
146 if (id.path.endsWith(entryPoint)) { 147 Glob glob = new Glob(entryPoint);
148 if (glob.matches(id.path)) {
147 transform.declareOutput(id); 149 transform.declareOutput(id);
148 AssetId dataId = id.changeExtension("_reflectable_original_main.dart"); 150 AssetId dataId = id.changeExtension("_reflectable_original_main.dart");
149 transform.declareOutput(dataId); 151 transform.declareOutput(dataId);
150 } 152 }
151 // Otherwise there is no such entry point; however, we do not need to 153 // Otherwise there is no such entry point; however, we do not need to
152 // emit any diagnostic messages, this is done by `apply` in 154 // emit any diagnostic messages, this is done by `apply` in
153 // `TransformerImplementation`. 155 // `TransformerImplementation`.
154 }); 156 });
155 } 157 }
156 } 158 }
OLDNEW
« no previous file with comments | « reflectable/lib/src/transformer_implementation.dart ('k') | reflectable/pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698