Renames injectBuildTimePluginFilesForWebPlatform and removes unused named parameter. (#157944)
Closes https://github.com/flutter/flutter/issues/157943. --------- Co-authored-by: Andrew Kolos <andrewrkolos@gmail.com>
This commit is contained in:
@@ -79,7 +79,10 @@ class WebEntrypointTarget extends Target {
|
||||
final String importedEntrypoint = packageConfig.toPackageUri(importUri)?.toString()
|
||||
?? importUri.toString();
|
||||
|
||||
await injectBuildTimePluginFiles(flutterProject, webPlatform: true, destination: environment.buildDir);
|
||||
await injectBuildTimePluginFilesForWebPlatform(
|
||||
flutterProject,
|
||||
destination: environment.buildDir,
|
||||
);
|
||||
// The below works because `injectBuildTimePluginFiles` is configured to write
|
||||
// the web_plugin_registrant.dart file alongside the generated main.dart
|
||||
const String generatedImport = 'web_plugin_registrant.dart';
|
||||
|
||||
@@ -1051,16 +1051,13 @@ Future<void> refreshPluginsList(
|
||||
/// to inject a copy of the plugin registrant for web into .dart_tool/dartpad so
|
||||
/// dartpad can get the plugin registrant without needing to build the complete
|
||||
/// project. See: https://github.com/dart-lang/dart-services/pull/874
|
||||
Future<void> injectBuildTimePluginFiles(
|
||||
Future<void> injectBuildTimePluginFilesForWebPlatform(
|
||||
FlutterProject project, {
|
||||
required Directory destination,
|
||||
bool webPlatform = false,
|
||||
}) async {
|
||||
final List<Plugin> plugins = await findPlugins(project);
|
||||
final Map<String, List<Plugin>> pluginsByPlatform = _resolvePluginImplementations(plugins, pluginResolutionType: _PluginResolutionType.nativeOrDart);
|
||||
if (webPlatform) {
|
||||
await _writeWebPluginRegistrant(project, pluginsByPlatform[WebPlugin.kConfigKey]!, destination);
|
||||
}
|
||||
await _writeWebPluginRegistrant(project, pluginsByPlatform[WebPlugin.kConfigKey]!, destination);
|
||||
}
|
||||
|
||||
/// Injects plugins found in `pubspec.yaml` into the platform-specific projects.
|
||||
@@ -1071,7 +1068,7 @@ Future<void> injectBuildTimePluginFiles(
|
||||
/// Files written by this method end up in platform-specific locations that are
|
||||
/// configured by each [FlutterProject] subclass (except for the Web).
|
||||
///
|
||||
/// Web tooling uses [injectBuildTimePluginFiles] instead, which places files in the
|
||||
/// Web tooling uses [injectBuildTimePluginFilesForWebPlatform] instead, which places files in the
|
||||
/// current build (temp) directory, and doesn't modify the users' working copy.
|
||||
///
|
||||
/// Assumes [refreshPluginsList] has been called since last change to `pubspec.yaml`.
|
||||
|
||||
@@ -532,7 +532,10 @@ Please provide a valid TCP port (an integer between 0 and 65535, inclusive).
|
||||
result = _generatedEntrypointDirectory!.childFile('web_entrypoint.dart');
|
||||
|
||||
// Generates the generated_plugin_registrar
|
||||
await injectBuildTimePluginFiles(flutterProject, webPlatform: true, destination: _generatedEntrypointDirectory!);
|
||||
await injectBuildTimePluginFilesForWebPlatform(
|
||||
flutterProject,
|
||||
destination: _generatedEntrypointDirectory!,
|
||||
);
|
||||
// The below works because `injectBuildTimePluginFiles` is configured to write
|
||||
// the web_plugin_registrant.dart file alongside the generated main.dart
|
||||
const String generatedImport = 'web_plugin_registrant.dart';
|
||||
|
||||
@@ -1004,10 +1004,9 @@ class WebProject extends FlutterProjectPlatform {
|
||||
Future<void> ensureReadyForPlatformSpecificTooling() async {
|
||||
/// Create .dart_tool/dartpad/web_plugin_registrant.dart.
|
||||
/// See: https://github.com/dart-lang/dart-services/pull/874
|
||||
await injectBuildTimePluginFiles(
|
||||
await injectBuildTimePluginFilesForWebPlatform(
|
||||
parent,
|
||||
destination: dartpadToolDirectory,
|
||||
webPlatform: true,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -933,7 +933,10 @@ dependencies:
|
||||
addToPackageConfig('web_plugin_with_nested', webPluginWithNestedFile);
|
||||
|
||||
final Directory destination = flutterProject.directory.childDirectory('lib');
|
||||
await injectBuildTimePluginFiles(flutterProject, webPlatform: true, destination: destination);
|
||||
await injectBuildTimePluginFilesForWebPlatform(
|
||||
flutterProject,
|
||||
destination: destination,
|
||||
);
|
||||
|
||||
final File registrant = flutterProject.directory
|
||||
.childDirectory('lib')
|
||||
@@ -986,7 +989,7 @@ dependencies:
|
||||
flutterProject.isModule = true;
|
||||
|
||||
final Directory destination = flutterProject.directory.childDirectory('lib');
|
||||
await injectBuildTimePluginFiles(flutterProject, webPlatform: true, destination: destination);
|
||||
await injectBuildTimePluginFilesForWebPlatform(flutterProject, destination: destination);
|
||||
|
||||
final File registrant = flutterProject.directory
|
||||
.childDirectory('lib')
|
||||
|
||||
Reference in New Issue
Block a user