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 11## 9.0.1-wip
22
33- Don't log stack traces for subclasses of ` Exception ` .
4+ - Bug fix: don't run builders with multiple outputs once per output.
45
56## 9.0.0
67
Original file line number Diff line number Diff line change @@ -310,7 +310,6 @@ class Build {
310310 // If `primaryInputs` is empty, the phase will only run lazily,
311311 // and might not run at all; so don't log it to start with.
312312 if (primaryInputs.isNotEmpty) {
313- primaryInputs.sort ();
314313 primaryInputsByPhase[phase] = primaryInputs;
315314 primaryInputCountsByPhase[phase] = primaryInputs.length;
316315 }
@@ -382,7 +381,8 @@ class Build {
382381 String package,
383382 int phaseNumber,
384383 ) async {
385- var ids = < AssetId > [];
384+ // Accumulate in a `Set` because inputs are found once per output.
385+ var ids = < AssetId > {};
386386 var phase = buildPhases[phaseNumber];
387387 var packageNode = options.packageGraph[package]! ;
388388
@@ -406,7 +406,7 @@ class Build {
406406
407407 ids.add (node.generatedNodeConfiguration! .primaryInput);
408408 }
409- return ids;
409+ return ids. toList ().. sort () ;
410410 }
411411
412412 /// 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() {
210210 );
211211 });
212212
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+
213232 test ('with a PostProcessBuilder' , () async {
214233 await testPhases (
215234 [requiresPostProcessBuilderApplication, postCopyABuilderApplication],
You can’t perform that action at this time.
0 commit comments