Revert "Read dart_plugin_registrant path from FlutterProject to support non-standard path." (#107850)

This commit is contained in:
Christopher Fujino
2022-07-18 12:58:10 -07:00
committed by GitHub
parent b156c0c440
commit 81045d4a44
11 changed files with 212 additions and 376 deletions

View File

@@ -4,7 +4,6 @@
import 'dart:async';
import 'package:file/file.dart';
import 'package:file/memory.dart';
import 'package:flutter_tools/src/artifacts.dart';
import 'package:flutter_tools/src/base/async_guard.dart';
@@ -395,43 +394,6 @@ void main() {
'line2\nline3\n'
));
});
testWithoutContext('incremental compile with dartPluginRegistrant', () async {
fakeProcessManager.addCommand(FakeCommand(
command: const <String>[
...frontendServerCommand,
'--filesystem-root',
'/foo/bar/fizz',
'--filesystem-scheme',
'scheme',
'--source',
'some/dir/plugin_registrant.dart',
'--source',
'package:flutter/src/dart_plugin_registrant.dart',
'-Dflutter.dart_plugin_registrant=some/dir/plugin_registrant.dart',
'--verbosity=error',
],
stdout: 'result abc\nline1\nline2\nabc\nabc /path/to/main.dart.dill 0',
stdin: frontendServerStdIn,
));
final MemoryFileSystem fs = MemoryFileSystem();
final File dartPluginRegistrant = fs.file('some/dir/plugin_registrant.dart')..createSync(recursive: true);
final CompilerOutput? output = await generatorWithScheme.recompile(
Uri.parse('file:///foo/bar/fizz/main.dart'),
null /* invalidatedFiles */,
outputPath: '/build/',
packageConfig: PackageConfig.empty,
fs: fs,
projectRootPath: '',
checkDartPluginRegistry: true,
dartPluginRegistrant: dartPluginRegistrant,
);
expect(frontendServerStdIn.getAndClear(), 'compile scheme:///main.dart\n');
expect(testLogger.errorText, equals('line1\nline2\n'));
expect(output?.outputFilename, equals('/path/to/main.dart.dill'));
expect(fakeProcessManager, hasNoRemainingExpectations);
});
}
Future<void> _recompile(

View File

@@ -581,7 +581,7 @@ class FakeResidentCompiler extends Fake implements ResidentCompiler {
Future<CompilerOutput> Function(Uri mainUri, List<Uri>? invalidatedFiles)? onRecompile;
@override
Future<CompilerOutput> recompile(Uri mainUri, List<Uri>? invalidatedFiles, {String? outputPath, PackageConfig? packageConfig, String? projectRootPath, FileSystem? fs, bool suppressErrors = false, bool checkDartPluginRegistry = false, File? dartPluginRegistrant}) {
Future<CompilerOutput> recompile(Uri mainUri, List<Uri>? invalidatedFiles, {String? outputPath, PackageConfig? packageConfig, String? projectRootPath, FileSystem? fs, bool suppressErrors = false, bool checkDartPluginRegistry = false}) {
return onRecompile?.call(mainUri, invalidatedFiles)
?? Future<CompilerOutput>.value(const CompilerOutput('', 1, <Uri>[]));
}

View File

@@ -2464,7 +2464,6 @@ class FakeResidentCompiler extends Fake implements ResidentCompiler {
@required FileSystem fs,
bool suppressErrors = false,
bool checkDartPluginRegistry = false,
File dartPluginRegistrant,
}) async {
didSuppressErrors = suppressErrors;
return nextOutput ?? const CompilerOutput('foo.dill', 0, <Uri>[]);
@@ -2624,7 +2623,6 @@ class FakeDevFS extends Fake implements DevFS {
bool bundleFirstUpload = false,
bool fullRestart = false,
String projectRootPath,
File dartPluginRegistrant,
}) async {
return nextUpdateReport;
}

View File

@@ -200,7 +200,6 @@ class FakeResidentCompiler extends Fake implements ResidentCompiler {
FileSystem? fs,
bool suppressErrors = false,
bool checkDartPluginRegistry = false,
File? dartPluginRegistrant,
}) async {
if (compilerOutput != null) {
fileSystem!.file(compilerOutput!.outputFilename).createSync(recursive: true);

View File

@@ -1120,7 +1120,6 @@ class FakeResidentCompiler extends Fake implements ResidentCompiler {
FileSystem fs,
bool suppressErrors = false,
bool checkDartPluginRegistry = false,
File dartPluginRegistrant,
}) async {
return output;
}