44
55import 'dart:async' ;
66
7+ import 'package:build/build.dart' ;
78import 'package:build_runner_core/build_runner_core.dart' ;
89import 'package:logging/logging.dart' ;
910
@@ -16,7 +17,7 @@ import 'common.dart';
1617/// To handle prompts you must first set `nextPromptResponse` . Alternatively
1718/// you can set `throwOnPrompt` to `true` to emulate a
1819/// [NonInteractiveBuildException] .
19- class TestBuildEnvironment extends BuildEnvironment {
20+ class TestBuildEnvironment implements BuildEnvironment {
2021 final TestReaderWriter _readerWriter;
2122
2223 TestReaderWriter get readerWriter => _readerWriter;
@@ -64,4 +65,21 @@ class TestBuildEnvironment extends BuildEnvironment {
6465 assert (_nextPromptResponse != null );
6566 return Future .value (_nextPromptResponse);
6667 }
68+
69+ @override
70+ BuildEnvironment copyWith ({
71+ void Function (LogRecord )? onLogOverride,
72+ RunnerAssetWriter ? writer,
73+ }) => TestBuildEnvironment (
74+ readerWriter: (writer as TestReaderWriter ? ) ?? _readerWriter,
75+ throwOnPrompt: throwOnPrompt,
76+ );
77+
78+ @override
79+ Future <BuildResult > finalizeBuild (
80+ BuildResult buildResult,
81+ FinalizedAssetsView finalizedAssetsView,
82+ AssetReader reader,
83+ Set <BuildDirectory > buildDirs,
84+ ) => Future .value (buildResult);
6785}
0 commit comments