@@ -189,4 +189,42 @@ void main() {
189
189
);
190
190
});
191
191
});
192
+
193
+ // Builder input set grows between builds.
194
+ group ('a.1 <== [a.2], b.3 <== b.4' , () {
195
+ late TestBuilderBuilder bBuilder;
196
+
197
+ setUp (() {
198
+ tester.sources (['a.1' , 'b.3' ]);
199
+ tester.builder (from: '.1' , to: '.2' , isOptional: true )
200
+ ..reads ('.1' )
201
+ ..writes ('.2' );
202
+ bBuilder =
203
+ tester.builder (from: '.3' , to: '.4' )
204
+ ..reads ('.3' )
205
+ ..writes ('.4' );
206
+ });
207
+
208
+ test ('only b.4 is built' , () async {
209
+ expect (await tester.build (), Result (written: ['b.4' ]));
210
+ });
211
+
212
+ test ('changes to b.3+(a.2) <== b.4, a.2 is built' , () async {
213
+ expect (await tester.build (), Result (written: ['b.4' ]));
214
+
215
+ // Builder for 'b.4' reads additional input 'a.2' in the next build.
216
+ //
217
+ // Normally a builder's inputs can only change if the contents of its
218
+ // inputs change to trigger additional reads. Simulate this by telling the
219
+ // builder to read 'a.2' on the next run then changing its input so it
220
+ // will rerun.
221
+ bBuilder.readsOther ('a.2' );
222
+
223
+ // Now the optional 'a.2' is needed so it's built, and 'b.4 is rebuilt.
224
+ expect (
225
+ await tester.build (change: 'b.3' ),
226
+ Result (written: ['a.2' , 'b.4' ]),
227
+ );
228
+ });
229
+ });
192
230
}
0 commit comments