File tree Expand file tree Collapse file tree 3 files changed +23
-3
lines changed Expand file tree Collapse file tree 3 files changed +23
-3
lines changed Original file line number Diff line number Diff line change 1
1
## 9.0.1-wip
2
2
3
3
- Don't log stack traces for subclasses of ` Exception ` .
4
+ - Bug fix: don't run builders with multiple outputs once per output.
4
5
5
6
## 9.0.0
6
7
Original file line number Diff line number Diff line change @@ -310,7 +310,6 @@ class Build {
310
310
// If `primaryInputs` is empty, the phase will only run lazily,
311
311
// and might not run at all; so don't log it to start with.
312
312
if (primaryInputs.isNotEmpty) {
313
- primaryInputs.sort ();
314
313
primaryInputsByPhase[phase] = primaryInputs;
315
314
primaryInputCountsByPhase[phase] = primaryInputs.length;
316
315
}
@@ -382,7 +381,8 @@ class Build {
382
381
String package,
383
382
int phaseNumber,
384
383
) async {
385
- var ids = < AssetId > [];
384
+ // Accumulate in a `Set` because inputs are found once per output.
385
+ var ids = < AssetId > {};
386
386
var phase = buildPhases[phaseNumber];
387
387
var packageNode = options.packageGraph[package]! ;
388
388
@@ -406,7 +406,7 @@ class Build {
406
406
407
407
ids.add (node.generatedNodeConfiguration! .primaryInput);
408
408
}
409
- return ids;
409
+ return ids. toList ().. sort () ;
410
410
}
411
411
412
412
/// If [id] is a generated asset, ensures that it has been built.
Original file line number Diff line number Diff line change @@ -210,6 +210,25 @@ void main() {
210
210
);
211
211
});
212
212
213
+ test ('runs once per input not once per output' , () async {
214
+ var runs = 0 ;
215
+ final testBuilder = TestBuilder (
216
+ buildExtensions: {
217
+ '.txt' : ['.txt.1' , '.txt.2' ],
218
+ },
219
+ extraWork: (_, _) {
220
+ ++ runs;
221
+ },
222
+ );
223
+
224
+ await testPhases (
225
+ [applyToRoot (testBuilder)],
226
+ {'a|web/a.txt' : '' },
227
+ outputs: {'a|web/a.txt.1' : '' , 'a|web/a.txt.2' : '' },
228
+ );
229
+ expect (runs, 1 );
230
+ });
231
+
213
232
test ('with a PostProcessBuilder' , () async {
214
233
await testPhases (
215
234
[requiresPostProcessBuilderApplication, postCopyABuilderApplication],
You can’t perform that action at this time.
0 commit comments