tool: DRY up DepfileService (#125922)

This commit is contained in:
Kevin Moore
2023-05-03 13:54:51 -07:00
committed by GitHub
parent f704c68924
commit 4bd9bcd7cb
16 changed files with 38 additions and 120 deletions

View File

@@ -67,11 +67,7 @@ flutter:
expect(depfile, exists);
final DepfileService depfileService = DepfileService(
logger: BufferLogger.test(),
fileSystem: fileSystem,
);
final Depfile dependencies = depfileService.parse(depfile);
final Depfile dependencies = environment.depFileService.parse(depfile);
expect(
dependencies.inputs.firstWhereOrNull((File file) => file.path == '/bar/LICENSE'),

View File

@@ -39,7 +39,6 @@ void main() {
operatingSystem: 'windows',
environment: <String, String>{},
);
late DepfileService depfileService;
setUp(() {
testbed = Testbed(setup: () {
@@ -61,10 +60,6 @@ void main() {
logger: globals.logger,
fileSystem: globals.fs,
);
depfileService = DepfileService(
fileSystem: globals.fs,
logger: globals.logger,
);
environment.buildDir.createSync(recursive: true);
}, overrides: <Type, Generator>{
Platform: () => linux,
@@ -573,7 +568,7 @@ void main() {
await Dart2JSTarget(WebRendererMode.auto).build(environment);
expect(environment.buildDir.childFile('dart2js.d'), exists);
final Depfile depfile = depfileService.parse(environment.buildDir.childFile('dart2js.d'));
final Depfile depfile = environment.depFileService.parse(environment.buildDir.childFile('dart2js.d'));
expect(depfile.inputs.single.path, globals.fs.path.absolute('a.dart'));
expect(depfile.outputs.single.path,

View File

@@ -9,7 +9,6 @@ import 'package:flutter_tools/src/base/file_system.dart';
import 'package:flutter_tools/src/base/logger.dart';
import 'package:flutter_tools/src/build_info.dart';
import 'package:flutter_tools/src/build_system/build_system.dart';
import 'package:flutter_tools/src/build_system/depfile.dart';
import 'package:flutter_tools/src/build_system/targets/common.dart';
import 'package:flutter_tools/src/build_system/targets/windows.dart';
import 'package:flutter_tools/src/convert.dart';
@@ -31,10 +30,6 @@ void main() {
kBuildMode: 'debug',
},
);
final DepfileService depfileService = DepfileService(
logger: BufferLogger.test(),
fileSystem: fileSystem,
);
environment.buildDir.createSync(recursive: true);
final String windowsDesktopPath = artifacts.getArtifactPath(Artifact.windowsDesktopPath, platform: TargetPlatform.windows_x64, mode: BuildMode.debug);
@@ -83,9 +78,9 @@ void main() {
// Depfile is created correctly.
expect(outputDepfile, exists);
final List<String> inputPaths = depfileService.parse(outputDepfile)
final List<String> inputPaths = environment.depFileService.parse(outputDepfile)
.inputs.map((File file) => file.path).toList();
final List<String> outputPaths = depfileService.parse(outputDepfile)
final List<String> outputPaths = environment.depFileService.parse(outputDepfile)
.outputs.map((File file) => file.path).toList();
// Depfile has expected sources.