@@ -139,6 +139,7 @@ Future<TestBuilderResult> testBuilder(
139139 TestReaderWriter ? readerWriter,
140140 bool verbose = false ,
141141 bool enableLowResourceMode = false ,
142+ bool flattenOutput = false ,
142143}) async {
143144 return testBuilders (
144145 [builder],
@@ -154,6 +155,7 @@ Future<TestBuilderResult> testBuilder(
154155 readerWriter: readerWriter,
155156 verbose: verbose,
156157 enableLowResourceMode: enableLowResourceMode,
158+ flattenOutput: flattenOutput,
157159 );
158160}
159161
@@ -186,6 +188,7 @@ Future<TestBuilderResult> testBuilders(
186188 TestReaderWriter ? readerWriter,
187189 bool verbose = false ,
188190 bool enableLowResourceMode = false ,
191+ bool flattenOutput = false ,
189192}) {
190193 final builderFactories = < BuilderFactory > [];
191194 final optionalBuilderFactories = Set <BuilderFactory >.identity ();
@@ -227,6 +230,7 @@ Future<TestBuilderResult> testBuilders(
227230 readerWriter: readerWriter,
228231 verbose: verbose,
229232 enableLowResourceMode: enableLowResourceMode,
233+ flattenOutput: flattenOutput,
230234 );
231235}
232236
@@ -293,6 +297,11 @@ Future<TestBuilderResult> testBuilders(
293297/// Optionally pass [enableLowResourceMode] , which acts like the command
294298/// line flag; in particular it disables file caching.
295299///
300+ /// By default generated outputs are written to the `TestReaderWriter` where
301+ /// they would be written in a real `build_runner` build, which means "hidden"
302+ /// outputs go in the `.dart_tool/build/generated` folder in the root package.
303+ /// Pass [flattenOutput] to instead output next to each package source.
304+ ///
296305/// Returns a [TestBuilderResult] with the [BuildResult] and the
297306/// [TestReaderWriter] used for the build, which can be used for further
298307/// checks.
@@ -315,6 +324,7 @@ Future<TestBuilderResult> testBuilderFactories(
315324 TestReaderWriter ? readerWriter,
316325 bool verbose = false ,
317326 bool enableLowResourceMode = false ,
327+ bool flattenOutput = false ,
318328}) async {
319329 onLog ?? = _printOnFailureOrWrite;
320330
@@ -412,14 +422,14 @@ Future<TestBuilderResult> testBuilderFactories(
412422 ),
413423 );
414424 }
415- for (final postProcessBuiderFactory in postProcessBuilderFactories) {
425+ for (final postProcessBuilderFactory in postProcessBuilderFactories) {
416426 String name;
417427 try {
418- name = builderName (postProcessBuiderFactory (const BuilderOptions ({})));
428+ name = builderName (postProcessBuilderFactory (const BuilderOptions ({})));
419429 } catch (e) {
420430 name = e.toString ();
421431 }
422- builderApplications.add (applyPostProcess (name, postProcessBuiderFactory ));
432+ builderApplications.add (applyPostProcess (name, postProcessBuilderFactory ));
423433 }
424434
425435 final testingOverrides = TestingOverrides (
@@ -461,6 +471,7 @@ Future<TestBuilderResult> testBuilderFactories(
461471 }.build ()
462472 : null ,
463473 reportUnusedAssetsForInput: reportUnusedAssetsForInput,
474+ flattenOutput: flattenOutput,
464475 );
465476
466477 final buildPlan = await BuildPlan .load (
0 commit comments