diff --git a/packages/flutter_tools/lib/executable.dart b/packages/flutter_tools/lib/executable.dart index bd6d7b7ced..889a84bad7 100644 --- a/packages/flutter_tools/lib/executable.dart +++ b/packages/flutter_tools/lib/executable.dart @@ -187,11 +187,9 @@ List generateCommands({required bool verboseHelp, required bool fileSystem: globals.fs, ), BuildCommand( - artifacts: globals.artifacts!, fileSystem: globals.fs, buildSystem: globals.buildSystem, osUtils: globals.os, - processUtils: globals.processUtils, verboseHelp: verboseHelp, androidSdk: globals.androidSdk, logger: globals.logger, diff --git a/packages/flutter_tools/lib/src/artifacts.dart b/packages/flutter_tools/lib/src/artifacts.dart index 56fc1f4fad..4914b80bbf 100644 --- a/packages/flutter_tools/lib/src/artifacts.dart +++ b/packages/flutter_tools/lib/src/artifacts.dart @@ -73,9 +73,6 @@ enum Artifact { /// The location of file generators. flutterToolsFileGenerators, - - /// Pre-built desktop debug app. - flutterPreviewDevice, } /// A subset of [Artifact]s that are platform and build mode independent @@ -241,8 +238,6 @@ String? _artifactToFileName(Artifact artifact, Platform hostPlatform, [BuildMode return 'const_finder.dart.snapshot'; case Artifact.flutterToolsFileGenerators: return ''; - case Artifact.flutterPreviewDevice: - return 'flutter_preview$exe'; } } @@ -672,7 +667,6 @@ class CachedArtifacts implements Artifacts { case Artifact.windowsCppClientWrapper: case Artifact.windowsDesktopPath: case Artifact.flutterToolsFileGenerators: - case Artifact.flutterPreviewDevice: return _getHostArtifactPath(artifact, platform, mode); } } @@ -724,7 +718,6 @@ class CachedArtifacts implements Artifacts { case Artifact.windowsCppClientWrapper: case Artifact.windowsDesktopPath: case Artifact.flutterToolsFileGenerators: - case Artifact.flutterPreviewDevice: return _getHostArtifactPath(artifact, platform, mode); } } @@ -771,7 +764,6 @@ class CachedArtifacts implements Artifacts { case Artifact.windowsCppClientWrapper: case Artifact.windowsDesktopPath: case Artifact.flutterToolsFileGenerators: - case Artifact.flutterPreviewDevice: return _getHostArtifactPath(artifact, platform, mode); } } @@ -823,7 +815,6 @@ class CachedArtifacts implements Artifacts { case Artifact.windowsCppClientWrapper: case Artifact.windowsDesktopPath: case Artifact.flutterToolsFileGenerators: - case Artifact.flutterPreviewDevice: return _getHostArtifactPath(artifact, platform, mode); } } @@ -955,9 +946,6 @@ class CachedArtifacts implements Artifacts { throw StateError('Artifact $artifact not available for platform $platform.'); case Artifact.flutterToolsFileGenerators: return _getFileGeneratorsPath(); - case Artifact.flutterPreviewDevice: - assert(platform == TargetPlatform.windows_x64); - return _cache.getArtifactDirectory('flutter_preview').childFile('flutter_preview.exe').path; } } @@ -1442,13 +1430,6 @@ class CachedLocalEngineArtifacts implements Artifacts { return _fileSystem.path.join(_getDartSdkPath(), 'bin', 'snapshots', artifactFileName); case Artifact.flutterToolsFileGenerators: return _getFileGeneratorsPath(); - case Artifact.flutterPreviewDevice: - return _backupCache.getArtifactPath( - artifact, - platform: platform, - mode: mode, - environmentType: environmentType, - ); } } @@ -1624,7 +1605,6 @@ class CachedLocalWebSdkArtifacts implements Artifacts { case Artifact.fontSubset: case Artifact.constFinder: case Artifact.flutterToolsFileGenerators: - case Artifact.flutterPreviewDevice: break; } } diff --git a/packages/flutter_tools/lib/src/commands/build.dart b/packages/flutter_tools/lib/src/commands/build.dart index f6cc6092c1..2d24bf80eb 100644 --- a/packages/flutter_tools/lib/src/commands/build.dart +++ b/packages/flutter_tools/lib/src/commands/build.dart @@ -5,14 +5,11 @@ import 'package:meta/meta.dart'; import '../android/android_sdk.dart'; -import '../artifacts.dart'; import '../base/file_system.dart'; import '../base/logger.dart'; import '../base/os.dart'; -import '../base/process.dart'; import '../build_info.dart'; import '../build_system/build_system.dart'; -import '../cache.dart'; import '../commands/build_linux.dart'; import '../commands/build_macos.dart'; import '../commands/build_windows.dart'; @@ -24,18 +21,15 @@ import 'build_bundle.dart'; import 'build_ios.dart'; import 'build_ios_framework.dart'; import 'build_macos_framework.dart'; -import 'build_preview.dart'; import 'build_web.dart'; class BuildCommand extends FlutterCommand { BuildCommand({ - required Artifacts artifacts, required FileSystem fileSystem, required BuildSystem buildSystem, required OperatingSystemUtils osUtils, required Logger logger, required AndroidSdk? androidSdk, - required ProcessUtils processUtils, bool verboseHelp = false, }) { _addSubcommand( @@ -71,16 +65,6 @@ class BuildCommand extends FlutterCommand { _addSubcommand( BuildWindowsCommand(logger: logger, operatingSystemUtils: osUtils, verboseHelp: verboseHelp), ); - _addSubcommand( - BuildPreviewCommand( - artifacts: artifacts, - flutterRoot: Cache.flutterRoot!, - fs: fileSystem, - logger: logger, - processUtils: processUtils, - verboseHelp: verboseHelp, - ), - ); } void _addSubcommand(BuildSubCommand command) { diff --git a/packages/flutter_tools/lib/src/commands/build_preview.dart b/packages/flutter_tools/lib/src/commands/build_preview.dart deleted file mode 100644 index 640f225e27..0000000000 --- a/packages/flutter_tools/lib/src/commands/build_preview.dart +++ /dev/null @@ -1,118 +0,0 @@ -// Copyright 2014 The Flutter Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -import 'package:file/file.dart'; - -import '../artifacts.dart'; -import '../base/common.dart'; -import '../base/io.dart'; -import '../base/process.dart'; -import '../build_info.dart'; -import '../cache.dart'; -import '../dart/package_map.dart'; -import '../globals.dart' as globals; -import '../project.dart'; -import '../runner/flutter_command.dart' show FlutterCommandResult; -import '../windows/build_windows.dart'; -import 'build.dart'; - -class BuildPreviewCommand extends BuildSubCommand { - BuildPreviewCommand({ - required super.logger, - required super.verboseHelp, - required this.fs, - required this.flutterRoot, - required this.processUtils, - required this.artifacts, - }); - - @override - final String name = '_preview'; - - @override - final bool hidden = true; - - @override - Future> get requiredArtifacts async => { - DevelopmentArtifact.windows, - }; - - @override - final String description = 'Build Flutter preview (desktop) app.'; - - final FileSystem fs; - final String flutterRoot; - final ProcessUtils processUtils; - final Artifacts artifacts; - - @override - void requiresPubspecYaml() {} - - static const String appName = 'flutter_preview'; - - @override - Future runCommand() async { - if (!globals.platform.isWindows) { - throwToolExit('"build _preview" is currently only supported on Windows hosts.'); - } - final Directory targetDir = fs.systemTempDirectory.createTempSync('flutter-build-preview'); - try { - final FlutterProject flutterProject = await _createProject(targetDir); - - final File packageConfigFile = findPackageConfigFileOrDefault(flutterProject.directory); - - final BuildInfo buildInfo = BuildInfo( - BuildMode.debug, - null, // no flavor - // users may add icons later - packageConfigPath: packageConfigFile.path, - packageConfig: await loadPackageConfigWithLogging(packageConfigFile, logger: logger), - treeShakeIcons: false, - ); - - // TODO(loic-sharma): Support windows-arm64 preview device, https://github.com/flutter/flutter/issues/139949. - await buildWindows(flutterProject.windows, buildInfo, TargetPlatform.windows_x64); - - final File previewDevice = targetDir - .childDirectory(getWindowsBuildDirectory(TargetPlatform.windows_x64)) - .childDirectory('runner') - .childDirectory('Debug') - .childFile('$appName.exe'); - if (!previewDevice.existsSync()) { - throw StateError('Preview device not found at ${previewDevice.absolute.path}'); - } - final String newPath = artifacts.getArtifactPath(Artifact.flutterPreviewDevice); - fs.file(newPath).parent.createSync(recursive: true); - previewDevice.copySync(newPath); - return FlutterCommandResult.success(); - } finally { - try { - targetDir.deleteSync(recursive: true); - } on FileSystemException catch (exception) { - logger.printError('Failed to delete ${targetDir.path}\n\n$exception'); - } - } - } - - Future _createProject(Directory targetDir) async { - final List cmd = [ - fs.path.join(flutterRoot, 'bin', 'flutter.bat'), - 'create', - '--empty', - '--project-name', - 'flutter_preview', - targetDir.path, - ]; - final RunResult result = await processUtils.run(cmd, allowReentrantFlutter: true); - if (result.exitCode != 0) { - final StringBuffer buffer = StringBuffer( - '${cmd.join(' ')} exited with code ${result.exitCode}\n', - ); - buffer.writeln('stdout:\n${result.stdout}\n'); - buffer.writeln('stderr:\n${result.stderr}'); - throw ProcessException(cmd.first, cmd.sublist(1), buffer.toString(), result.exitCode); - } - return FlutterProject.fromDirectory(targetDir); - } -} diff --git a/packages/flutter_tools/lib/src/commands/daemon.dart b/packages/flutter_tools/lib/src/commands/daemon.dart index e7621fcd1c..cd90b08d90 100644 --- a/packages/flutter_tools/lib/src/commands/daemon.dart +++ b/packages/flutter_tools/lib/src/commands/daemon.dart @@ -585,23 +585,6 @@ class DaemonDomain extends Domain { 'fixCode': _ReasonCode.config.name, }); } - case PlatformType.windowsPreview: - // TODO(fujino): detect if there any plugins with native code - if (!featureFlags.isPreviewDeviceEnabled) { - reasons.add({ - 'reasonText': 'the Preview Device feature is not enabled', - 'fixText': 'Run "flutter config --enable-flutter-preview', - 'fixCode': _ReasonCode.config.name, - }); - } - if (!supportedPlatforms.contains(SupportedPlatform.windows)) { - reasons.add({ - 'reasonText': 'the Windows platform is not enabled for this project', - 'fixText': - 'Run "flutter create --platforms=windows ." in your application directory', - 'fixCode': _ReasonCode.create.name, - }); - } } if (reasons.isEmpty) { diff --git a/packages/flutter_tools/lib/src/commands/widget_preview.dart b/packages/flutter_tools/lib/src/commands/widget_preview.dart index 862963d97e..51a67991ad 100644 --- a/packages/flutter_tools/lib/src/commands/widget_preview.dart +++ b/packages/flutter_tools/lib/src/commands/widget_preview.dart @@ -253,7 +253,6 @@ final class WidgetPreviewStartCommand extends WidgetPreviewSubCommandBase with C linuxPlatform: platform.isLinux, macOSPlatform: platform.isMacOS, windowsPlatform: platform.isWindows, - allowedPlugins: const [], ); // Generate initial package_config.json, otherwise the build will fail. diff --git a/packages/flutter_tools/lib/src/device.dart b/packages/flutter_tools/lib/src/device.dart index a1afbda16a..f36ae13ed1 100644 --- a/packages/flutter_tools/lib/src/device.dart +++ b/packages/flutter_tools/lib/src/device.dart @@ -50,8 +50,7 @@ enum PlatformType { macos, windows, fuchsia, - custom, - windowsPreview; + custom; @override String toString() => name; diff --git a/packages/flutter_tools/lib/src/features.dart b/packages/flutter_tools/lib/src/features.dart index 49be312c5a..c56927472a 100644 --- a/packages/flutter_tools/lib/src/features.dart +++ b/packages/flutter_tools/lib/src/features.dart @@ -48,9 +48,6 @@ abstract class FeatureFlags { /// Whether native assets compilation and bundling is enabled. bool get isNativeAssetsEnabled => false; - /// Whether native assets compilation and bundling is enabled. - bool get isPreviewDeviceEnabled => true; - /// Whether Swift Package Manager dependency management is enabled. bool get isSwiftPackageManagerEnabled => false; @@ -75,7 +72,6 @@ const List allFeatures = [ flutterCustomDevicesFeature, cliAnimation, nativeAssets, - previewDevice, swiftPackageManager, explicitPackageDependencies, ]; @@ -159,15 +155,6 @@ const Feature nativeAssets = Feature( master: FeatureChannelSetting(available: true), ); -/// Enable Flutter preview prebuilt device. -const Feature previewDevice = Feature( - name: 'Flutter preview prebuilt device', - configSetting: 'enable-flutter-preview', - environmentOverride: 'FLUTTER_PREVIEW_DEVICE', - master: FeatureChannelSetting(available: true), - beta: FeatureChannelSetting(available: true), -); - /// Enable Swift Package Manager as a darwin dependency manager. const Feature swiftPackageManager = Feature( name: 'support for Swift Package Manager for iOS and macOS', diff --git a/packages/flutter_tools/lib/src/flutter_device_manager.dart b/packages/flutter_tools/lib/src/flutter_device_manager.dart index d3e919f0f2..3e36d4d9ee 100644 --- a/packages/flutter_tools/lib/src/flutter_device_manager.dart +++ b/packages/flutter_tools/lib/src/flutter_device_manager.dart @@ -25,7 +25,6 @@ import 'macos/macos_ipad_device.dart'; import 'macos/macos_workflow.dart'; import 'macos/xcdevice.dart'; import 'native_assets.dart'; -import 'preview_device.dart'; import 'tester/flutter_tester.dart'; import 'version.dart'; import 'web/web_device.dart'; @@ -94,14 +93,6 @@ class FlutterDeviceManager extends DeviceManager { fileSystem: fileSystem, operatingSystemUtils: operatingSystemUtils, ), - PreviewDeviceDiscovery( - platform: platform, - artifacts: artifacts, - fileSystem: fileSystem, - logger: logger, - processManager: processManager, - featureFlags: featureFlags, - ), LinuxDevices( platform: platform, featureFlags: featureFlags, diff --git a/packages/flutter_tools/lib/src/flutter_features.dart b/packages/flutter_tools/lib/src/flutter_features.dart index 9be6cf993e..ff83f64008 100644 --- a/packages/flutter_tools/lib/src/flutter_features.dart +++ b/packages/flutter_tools/lib/src/flutter_features.dart @@ -55,9 +55,6 @@ class FlutterFeatureFlags implements FeatureFlags { @override bool get isNativeAssetsEnabled => isEnabled(nativeAssets); - @override - bool get isPreviewDeviceEnabled => isEnabled(previewDevice); - @override bool get isSwiftPackageManagerEnabled => isEnabled(swiftPackageManager); diff --git a/packages/flutter_tools/lib/src/flutter_plugins.dart b/packages/flutter_tools/lib/src/flutter_plugins.dart index bb896919c0..7901773e10 100644 --- a/packages/flutter_tools/lib/src/flutter_plugins.dart +++ b/packages/flutter_tools/lib/src/flutter_plugins.dart @@ -900,37 +900,12 @@ List _filterPluginsByVariant( Future writeWindowsPluginFiles( FlutterProject project, List plugins, - TemplateRenderer templateRenderer, { - Iterable? allowedPlugins, -}) async { + TemplateRenderer templateRenderer, +) async { final List methodChannelPlugins = _filterMethodChannelPlugins( plugins, WindowsPlugin.kConfigKey, ); - if (allowedPlugins != null) { - final List disallowedPlugins = - methodChannelPlugins.toList() - ..removeWhere((Plugin plugin) => allowedPlugins.contains(plugin.name)); - if (disallowedPlugins.isNotEmpty) { - final StringBuffer buffer = StringBuffer(); - buffer.writeln( - 'The Flutter Preview device does not support the following plugins from your pubspec.yaml:', - ); - buffer.writeln(); - buffer.writeln(disallowedPlugins.map((Plugin p) => p.name).toList().toString()); - buffer.writeln(); - buffer.writeln( - 'In order to build a Flutter app with plugins, you must use another target platform,', - ); - buffer.writeln( - 'such as Windows. Type `flutter doctor` into your terminal to see which target platforms', - ); - buffer.writeln( - 'are ready to be used, and how to get required dependencies for other platforms.', - ); - throwToolExit(buffer.toString()); - } - } final List win32Plugins = _filterPluginsByVariant( methodChannelPlugins, WindowsPlugin.kConfigKey, @@ -1212,7 +1187,6 @@ Future injectPlugins( bool linuxPlatform = false, bool macOSPlatform = false, bool windowsPlatform = false, - Iterable? allowedPlugins, DarwinDependencyManagement? darwinDependencyManagement, bool? releaseMode, }) async { @@ -1244,7 +1218,6 @@ Future injectPlugins( project, pluginsByPlatform[WindowsPlugin.kConfigKey]!, globals.templateRenderer, - allowedPlugins: allowedPlugins, ); } if (iosPlatform || macOSPlatform) { diff --git a/packages/flutter_tools/lib/src/preview_device.dart b/packages/flutter_tools/lib/src/preview_device.dart deleted file mode 100644 index 4dc1cf39f4..0000000000 --- a/packages/flutter_tools/lib/src/preview_device.dart +++ /dev/null @@ -1,261 +0,0 @@ -// Copyright 2014 The Flutter Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -import 'dart:async'; - -import 'package:meta/meta.dart'; -import 'package:process/process.dart'; - -import 'application_package.dart'; -import 'artifacts.dart'; -import 'base/file_system.dart'; -import 'base/io.dart'; -import 'base/logger.dart'; -import 'base/platform.dart'; -import 'build_info.dart'; -import 'bundle_builder.dart'; -import 'desktop_device.dart'; -import 'devfs.dart'; -import 'device.dart'; -import 'device_port_forwarder.dart'; -import 'features.dart'; -import 'project.dart'; -import 'protocol_discovery.dart'; - -typedef BundleBuilderFactory = BundleBuilder Function(); - -BundleBuilder _defaultBundleBuilder() { - return BundleBuilder(); -} - -class PreviewDeviceDiscovery extends PollingDeviceDiscovery { - PreviewDeviceDiscovery({ - required Platform platform, - required Artifacts artifacts, - required FileSystem fileSystem, - required Logger logger, - required ProcessManager processManager, - required FeatureFlags featureFlags, - }) : _artifacts = artifacts, - _logger = logger, - _processManager = processManager, - _fileSystem = fileSystem, - _platform = platform, - _features = featureFlags, - super('Flutter preview device'); - - final Platform _platform; - final Artifacts _artifacts; - final Logger _logger; - final ProcessManager _processManager; - final FileSystem _fileSystem; - final FeatureFlags _features; - - @override - bool get canListAnything => _platform.isWindows; - - @override - bool get supportsPlatform => _platform.isWindows; - - @override - List get wellKnownIds => ['preview']; - - @override - Future> pollingGetDevices({Duration? timeout}) async { - final File previewBinary = _fileSystem.file( - _artifacts.getArtifactPath(Artifact.flutterPreviewDevice), - ); - if (!previewBinary.existsSync()) { - return const []; - } - final PreviewDevice device = PreviewDevice( - artifacts: _artifacts, - fileSystem: _fileSystem, - logger: _logger, - processManager: _processManager, - previewBinary: previewBinary, - ); - return [if (_features.isPreviewDeviceEnabled) device]; - } - - @override - Future> discoverDevices({Duration? timeout, DeviceDiscoveryFilter? filter}) { - return devices(); - } -} - -/// A device type that runs a prebuilt desktop binary alongside a locally compiled kernel file. -class PreviewDevice extends Device { - PreviewDevice({ - required ProcessManager processManager, - required super.logger, - required FileSystem fileSystem, - required Artifacts artifacts, - required File previewBinary, - @visibleForTesting BundleBuilderFactory builderFactory = _defaultBundleBuilder, - }) : _previewBinary = previewBinary, - _processManager = processManager, - _logger = logger, - _fileSystem = fileSystem, - _bundleBuilderFactory = builderFactory, - _artifacts = artifacts, - super( - 'preview', - ephemeral: false, - category: Category.desktop, - platformType: PlatformType.windowsPreview, - ); - - final ProcessManager _processManager; - final Logger _logger; - final FileSystem _fileSystem; - final BundleBuilderFactory _bundleBuilderFactory; - final Artifacts _artifacts; - final File _previewBinary; - - /// The set of plugins that are allowed to be used by Preview users. - /// - /// Currently no plugins are supported. - static const List supportedPubPlugins = []; - - @override - void clearLogs() {} - - @override - Future dispose() async {} - - @override - Future get emulatorId async => null; - - final DesktopLogReader _logReader = DesktopLogReader(); - - @override - FutureOr getLogReader({ApplicationPackage? app, bool includePastLogs = false}) => - _logReader; - - @override - Future installApp(ApplicationPackage? app, {String? userIdentifier}) async => true; - - @override - Future isAppInstalled(ApplicationPackage app, {String? userIdentifier}) async => false; - - @override - Future isLatestBuildInstalled(ApplicationPackage app) async => false; - - @override - Future get isLocalEmulator async => false; - - @override - bool isSupported() => true; - - @override - bool isSupportedForProject(FlutterProject flutterProject) => true; - - @override - String get name => 'Preview'; - - @override - DevicePortForwarder get portForwarder => const NoOpDevicePortForwarder(); - - @override - Future get sdkNameAndVersion async => 'preview'; - - Process? _process; - - @override - Future startApp( - ApplicationPackage? package, { - String? mainPath, - String? route, - required DebuggingOptions debuggingOptions, - Map platformArgs = const {}, - bool prebuiltApplication = false, - String? userIdentifier, - }) async { - final Directory assetDirectory = _fileSystem.systemTempDirectory.createTempSync( - 'flutter_preview.', - ); - - // Build assets and perform initial compilation. - Status? status; - try { - status = _logger.startProgress('Compiling application for preview...'); - await _bundleBuilderFactory().build( - buildInfo: debuggingOptions.buildInfo, - mainPath: mainPath, - platform: TargetPlatform.windows_x64, - assetDirPath: getAssetBuildDirectory(), - ); - copyDirectory( - _fileSystem.directory(getAssetBuildDirectory()), - assetDirectory.childDirectory('data').childDirectory('flutter_assets'), - ); - } finally { - status?.stop(); - } - - // Merge with precompiled executable. - final String copiedPreviewBinaryPath = assetDirectory.childFile(_previewBinary.basename).path; - _previewBinary.copySync(copiedPreviewBinaryPath); - - final String windowsPath = _artifacts.getArtifactPath( - Artifact.windowsDesktopPath, - platform: TargetPlatform.windows_x64, - mode: BuildMode.debug, - ); - final File windowsDll = _fileSystem.file( - _fileSystem.path.join(windowsPath, 'flutter_windows.dll'), - ); - final File icu = _fileSystem.file(_fileSystem.path.join(windowsPath, 'icudtl.dat')); - windowsDll.copySync(assetDirectory.childFile('flutter_windows.dll').path); - icu.copySync(assetDirectory.childDirectory('data').childFile('icudtl.dat').path); - - final Process process = await _processManager.start([copiedPreviewBinaryPath]); - _process = process; - _logReader.initializeProcess(process); - - final ProtocolDiscovery vmServiceDiscovery = ProtocolDiscovery.vmService( - _logReader, - devicePort: debuggingOptions.deviceVmServicePort, - hostPort: debuggingOptions.hostVmServicePort, - ipv6: debuggingOptions.ipv6, - logger: _logger, - ); - try { - final Uri? vmServiceUri = await vmServiceDiscovery.uri; - if (vmServiceUri != null) { - return LaunchResult.succeeded(vmServiceUri: vmServiceUri); - } - _logger.printError( - 'Error waiting for a debug connection: ' - 'The log reader stopped unexpectedly.', - ); - } on Exception catch (error) { - _logger.printError('Error waiting for a debug connection: $error'); - } finally { - await vmServiceDiscovery.cancel(); - } - return LaunchResult.failed(); - } - - @override - Future stopApp(ApplicationPackage? app, {String? userIdentifier}) async { - return _process?.kill() ?? false; - } - - @override - Future get targetPlatform async { - return TargetPlatform.windows_x64; - } - - @override - Future uninstallApp(ApplicationPackage app, {String? userIdentifier}) async { - return true; - } - - @override - DevFSWriter createDevFSWriter(ApplicationPackage? app, String? userIdentifier) { - return LocalDevFSWriter(fileSystem: _fileSystem); - } -} diff --git a/packages/flutter_tools/lib/src/project.dart b/packages/flutter_tools/lib/src/project.dart index 6e6e1a735f..cfa7b18e63 100644 --- a/packages/flutter_tools/lib/src/project.dart +++ b/packages/flutter_tools/lib/src/project.dart @@ -325,13 +325,8 @@ class FlutterProject { /// registrants for app and module projects only. /// /// Will not create project platform directories if they do not already exist. - /// - /// If [allowedPlugins] is non-null, all plugins with method channels in the - /// project's pubspec.yaml will be validated to be in that set, or else a - /// [ToolExit] will be thrown. Future regeneratePlatformSpecificTooling({ DeprecationBehavior deprecationBehavior = DeprecationBehavior.none, - Iterable? allowedPlugins, bool? releaseMode, }) async { return ensureReadyForPlatformSpecificTooling( @@ -344,7 +339,6 @@ class FlutterProject { windowsPlatform: featureFlags.isWindowsEnabled && windows.existsSync(), webPlatform: featureFlags.isWebEnabled && web.existsSync(), deprecationBehavior: deprecationBehavior, - allowedPlugins: allowedPlugins, releaseMode: releaseMode, ); } @@ -359,7 +353,6 @@ class FlutterProject { bool windowsPlatform = false, bool webPlatform = false, DeprecationBehavior deprecationBehavior = DeprecationBehavior.none, - Iterable? allowedPlugins, bool? releaseMode, }) async { if (!directory.existsSync() || isPlugin) { @@ -391,7 +384,6 @@ class FlutterProject { linuxPlatform: linuxPlatform, macOSPlatform: macOSPlatform, windowsPlatform: windowsPlatform, - allowedPlugins: allowedPlugins, releaseMode: releaseMode, ); } diff --git a/packages/flutter_tools/lib/src/runner/flutter_command.dart b/packages/flutter_tools/lib/src/runner/flutter_command.dart index cea6e30505..b2a12bd292 100644 --- a/packages/flutter_tools/lib/src/runner/flutter_command.dart +++ b/packages/flutter_tools/lib/src/runner/flutter_command.dart @@ -27,7 +27,6 @@ import '../dart/pub.dart'; import '../device.dart'; import '../features.dart'; import '../globals.dart' as globals; -import '../preview_device.dart'; import '../project.dart'; import '../reporting/reporting.dart'; import '../reporting/unified_analytics.dart'; @@ -1945,19 +1944,7 @@ Run 'flutter -h' (or 'flutter -h') for available flutter commands and return; } - // TODO(matanlurey): Determine if PreviewDevice should be kept. - // https://github.com/flutter/flutter/issues/162693 - final List? allowedPlugins; - if (stringArg(FlutterGlobalOptions.kDeviceIdOption, global: true) == 'preview') { - // The preview device does not currently support any plugins. - allowedPlugins = PreviewDevice.supportedPubPlugins; - } else { - // null means all plugins are allowed - allowedPlugins = null; - } - await project.regeneratePlatformSpecificTooling( - allowedPlugins: allowedPlugins, // TODO(matanlurey): Move this up, i.e. releaseMode ??= getBuildMode().release. // // As it stands, this is a breaking change until https://github.com/flutter/flutter/issues/162704 is diff --git a/packages/flutter_tools/test/commands.shard/hermetic/build_aar_test.dart b/packages/flutter_tools/test/commands.shard/hermetic/build_aar_test.dart index 5eadfe0f43..351d2275d5 100644 --- a/packages/flutter_tools/test/commands.shard/hermetic/build_aar_test.dart +++ b/packages/flutter_tools/test/commands.shard/hermetic/build_aar_test.dart @@ -3,11 +3,9 @@ // found in the LICENSE file. import 'package:file/memory.dart'; -import 'package:flutter_tools/src/artifacts.dart'; import 'package:flutter_tools/src/base/file_system.dart'; import 'package:flutter_tools/src/base/logger.dart'; import 'package:flutter_tools/src/base/platform.dart'; -import 'package:flutter_tools/src/base/process.dart'; import 'package:flutter_tools/src/build_system/build_system.dart'; import 'package:flutter_tools/src/cache.dart'; import 'package:flutter_tools/src/commands/build.dart'; @@ -23,7 +21,6 @@ import '../../src/test_flutter_command_runner.dart'; void main() { late BufferLogger logger; late MemoryFileSystem fs; - late Artifacts artifacts; late FakeProcessManager processManager; late Platform platform; late Cache cache; @@ -37,7 +34,6 @@ void main() { fs = MemoryFileSystem.test(); final Directory flutterRoot = fs.directory('flutter'); Cache.flutterRoot = flutterRoot.path; - artifacts = Artifacts.test(fileSystem: fs); logger = BufferLogger.test(); platform = FakePlatform(environment: const {'PATH': ''}); processManager = FakeProcessManager.empty(); @@ -63,12 +59,10 @@ flutter: final BuildCommand command = BuildCommand( androidSdk: FakeAndroidSdk(), - artifacts: artifacts, buildSystem: TestBuildSystem.all(BuildResult(success: true)), fileSystem: fs, logger: logger, osUtils: FakeOperatingSystemUtils(), - processUtils: ProcessUtils(logger: logger, processManager: processManager), ); expect( @@ -120,12 +114,10 @@ flutter: final BuildCommand command = BuildCommand( androidSdk: FakeAndroidSdk(), - artifacts: artifacts, buildSystem: TestBuildSystem.all(BuildResult(success: true)), fileSystem: fs, logger: logger, osUtils: FakeOperatingSystemUtils(), - processUtils: ProcessUtils(logger: logger, processManager: processManager), ); await createTestCommandRunner(command).run(const ['build', 'aar', '--no-pub']); diff --git a/packages/flutter_tools/test/commands.shard/hermetic/build_ios_test.dart b/packages/flutter_tools/test/commands.shard/hermetic/build_ios_test.dart index 9befd460d8..2c070a600a 100644 --- a/packages/flutter_tools/test/commands.shard/hermetic/build_ios_test.dart +++ b/packages/flutter_tools/test/commands.shard/hermetic/build_ios_test.dart @@ -5,13 +5,11 @@ import 'package:args/command_runner.dart'; import 'package:file/memory.dart'; import 'package:flutter_tools/src/android/android_sdk.dart'; -import 'package:flutter_tools/src/artifacts.dart'; import 'package:flutter_tools/src/base/common.dart'; import 'package:flutter_tools/src/base/file_system.dart'; import 'package:flutter_tools/src/base/logger.dart'; import 'package:flutter_tools/src/base/os.dart'; import 'package:flutter_tools/src/base/platform.dart'; -import 'package:flutter_tools/src/base/process.dart'; import 'package:flutter_tools/src/build_info.dart'; import 'package:flutter_tools/src/build_system/build_system.dart'; import 'package:flutter_tools/src/cache.dart'; @@ -71,8 +69,6 @@ void main() { late FakeAnalytics fakeAnalytics; late BufferLogger logger; late FakeProcessManager processManager; - late ProcessUtils processUtils; - late Artifacts artifacts; setUpAll(() { Cache.disableLocking(); @@ -80,14 +76,12 @@ void main() { setUp(() { fileSystem = MemoryFileSystem.test(); - artifacts = Artifacts.test(fileSystem: fileSystem); fakeAnalytics = getInitializedFakeAnalyticsInstance( fs: fileSystem, fakeFlutterVersion: FakeFlutterVersion(), ); logger = BufferLogger.test(); processManager = FakeProcessManager.empty(); - processUtils = ProcessUtils(logger: logger, processManager: processManager); }); // Sets up the minimal mock project files necessary to look like a Flutter project. @@ -205,12 +199,10 @@ void main() { 'ios build fails when there is no ios project', () async { final BuildCommand command = BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), fileSystem: fileSystem, logger: logger, - processUtils: processUtils, osUtils: FakeOperatingSystemUtils(), ); createCoreMockProjectFiles(); @@ -232,12 +224,10 @@ void main() { 'ios build fails in debug with code analysis', () async { final BuildCommand command = BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), fileSystem: fileSystem, logger: logger, - processUtils: processUtils, osUtils: FakeOperatingSystemUtils(), ); createCoreMockProjectFiles(); @@ -261,12 +251,10 @@ void main() { 'ios build fails on non-macOS platform', () async { final BuildCommand command = BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), fileSystem: fileSystem, logger: logger, - processUtils: processUtils, osUtils: FakeOperatingSystemUtils(), ); fileSystem.file('pubspec.yaml').createSync(); @@ -295,12 +283,10 @@ void main() { 'ios build outputs path and size when successful', () async { final BuildCommand command = BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), fileSystem: MemoryFileSystem.test(), logger: BufferLogger.test(), - processUtils: processUtils, osUtils: FakeOperatingSystemUtils(), ); createMinimalMockProjectFiles(); @@ -335,12 +321,10 @@ void main() { 'ios build invokes xcode build', () async { final BuildCommand command = BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), fileSystem: fileSystem, logger: logger, - processUtils: processUtils, osUtils: FakeOperatingSystemUtils(), ); createMinimalMockProjectFiles(); @@ -373,12 +357,10 @@ void main() { 'ios build invokes xcode build with disable port publication setting', () async { final BuildCommand command = BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), fileSystem: fileSystem, logger: logger, - processUtils: processUtils, osUtils: FakeOperatingSystemUtils(), ); createMinimalMockProjectFiles(); @@ -413,12 +395,10 @@ void main() { 'ios build invokes xcode build without disable port publication setting when not in CI', () async { final BuildCommand command = BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), fileSystem: fileSystem, logger: logger, - processUtils: processUtils, osUtils: FakeOperatingSystemUtils(), ); createMinimalMockProjectFiles(); @@ -452,13 +432,11 @@ void main() { 'ios build invokes xcode build with renamed xcodeproj and xcworkspace', () async { final BuildCommand command = BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), osUtils: FakeOperatingSystemUtils(), fileSystem: fileSystem, logger: logger, - processUtils: processUtils, ); processManager.addCommands([ @@ -501,12 +479,10 @@ void main() { 'ios build invokes xcode build with device ID', () async { final BuildCommand command = BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), fileSystem: fileSystem, logger: logger, - processUtils: processUtils, osUtils: FakeOperatingSystemUtils(), ); processManager.addCommands([ @@ -541,12 +517,10 @@ void main() { 'ios simulator build invokes xcode build', () async { final BuildCommand command = BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), fileSystem: fileSystem, logger: logger, - processUtils: processUtils, osUtils: FakeOperatingSystemUtils(), ); processManager.addCommands([ @@ -580,12 +554,10 @@ void main() { 'ios build invokes xcode build with verbosity', () async { final BuildCommand command = BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), fileSystem: fileSystem, logger: logger, - processUtils: processUtils, osUtils: FakeOperatingSystemUtils(), ); createMinimalMockProjectFiles(); @@ -617,12 +589,10 @@ void main() { 'Performs code size analysis and sends analytics', () async { final BuildCommand command = BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), fileSystem: fileSystem, logger: logger, - processUtils: processUtils, osUtils: FakeOperatingSystemUtils(), ); processManager.addCommands([ @@ -698,13 +668,11 @@ void main() { 'Sends an analytics event when Impeller is enabled', () async { final BuildCommand command = BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), fileSystem: MemoryFileSystem.test(), logger: BufferLogger.test(), osUtils: FakeOperatingSystemUtils(), - processUtils: processUtils, ); createMinimalMockProjectFiles(); @@ -749,13 +717,11 @@ void main() { 'Sends an analytics event when Impeller is disabled', () async { final BuildCommand command = BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), fileSystem: fileSystem, logger: BufferLogger.test(), osUtils: FakeOperatingSystemUtils(), - processUtils: processUtils, ); createMinimalMockProjectFiles(); @@ -821,12 +787,10 @@ void main() { 'Trace error if xcresult is empty.', () async { final BuildCommand command = BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), fileSystem: fileSystem, logger: logger, - processUtils: processUtils, osUtils: FakeOperatingSystemUtils(), ); processManager.addCommands([ @@ -864,12 +828,10 @@ void main() { 'Display xcresult issues on console if parsed, suppress Xcode output', () async { final BuildCommand command = BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), fileSystem: fileSystem, logger: logger, - processUtils: processUtils, osUtils: FakeOperatingSystemUtils(), ); processManager.addCommands([ @@ -914,12 +876,10 @@ void main() { 'Do not display xcresult issues that needs to be discarded.', () async { final BuildCommand command = BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), fileSystem: fileSystem, logger: logger, - processUtils: processUtils, osUtils: FakeOperatingSystemUtils(), ); processManager.addCommands([ @@ -969,12 +929,10 @@ void main() { 'Trace if xcresult bundle does not exist.', () async { final BuildCommand command = BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), fileSystem: fileSystem, logger: logger, - processUtils: processUtils, osUtils: FakeOperatingSystemUtils(), ); processManager.addCommands([ @@ -1009,12 +967,10 @@ void main() { 'Extra error message for provision profile issue in xcresult bundle.', () async { final BuildCommand command = BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), fileSystem: fileSystem, logger: logger, - processUtils: processUtils, osUtils: FakeOperatingSystemUtils(), ); processManager.addCommands([ @@ -1067,12 +1023,10 @@ void main() { 'Display xcresult issues with no provisioning profile.', () async { final BuildCommand command = BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), fileSystem: fileSystem, logger: logger, - processUtils: processUtils, osUtils: FakeOperatingSystemUtils(), ); processManager.addCommands([ @@ -1116,12 +1070,10 @@ void main() { 'Extra error message for missing simulator platform in xcresult bundle.', () async { final BuildCommand command = BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), fileSystem: fileSystem, logger: logger, - processUtils: processUtils, osUtils: FakeOperatingSystemUtils(), ); processManager.addCommands([ @@ -1159,12 +1111,10 @@ void main() { 'Delete xcresult bundle before each xcodebuild command.', () async { final BuildCommand command = BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), fileSystem: fileSystem, logger: logger, - processUtils: processUtils, osUtils: FakeOperatingSystemUtils(), ); processManager.addCommands([ @@ -1219,12 +1169,10 @@ void main() { 'Failed to parse xcresult but display missing provisioning profile issue from stdout.', () async { final BuildCommand command = BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), fileSystem: fileSystem, logger: logger, - processUtils: processUtils, osUtils: FakeOperatingSystemUtils(), ); processManager.addCommands([ @@ -1265,12 +1213,10 @@ Runner requires a provisioning profile. Select a provisioning profile in the Sig 'Failed to parse xcresult but detected no development team issue.', () async { final BuildCommand command = BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), fileSystem: fileSystem, logger: logger, - processUtils: processUtils, osUtils: FakeOperatingSystemUtils(), ); processManager.addCommands([ @@ -1309,12 +1255,10 @@ Runner requires a provisioning profile. Select a provisioning profile in the Sig 'xcresult did not detect issue but detected by stdout.', () async { final BuildCommand command = BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), fileSystem: fileSystem, logger: logger, - processUtils: processUtils, osUtils: FakeOperatingSystemUtils(), ); @@ -1357,12 +1301,10 @@ Runner requires a provisioning profile. Select a provisioning profile in the Sig 'xcresult did not detect issue, no development team is detected from build setting.', () async { final BuildCommand command = BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), fileSystem: fileSystem, logger: logger, - processUtils: processUtils, osUtils: FakeOperatingSystemUtils(), ); processManager.addCommands([ @@ -1400,12 +1342,10 @@ Runner requires a provisioning profile. Select a provisioning profile in the Sig 'No development team issue error message is not displayed if no provisioning profile issue is detected from xcresult first.', () async { final BuildCommand command = BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), fileSystem: fileSystem, logger: logger, - processUtils: processUtils, osUtils: FakeOperatingSystemUtils(), ); processManager.addCommands([ @@ -1445,12 +1385,10 @@ Runner requires a provisioning profile. Select a provisioning profile in the Sig 'General provisioning profile issue error message is not displayed if no development team issue is detected first.', () async { final BuildCommand command = BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), fileSystem: fileSystem, logger: logger, - processUtils: processUtils, osUtils: FakeOperatingSystemUtils(), ); processManager.addCommands([ @@ -1499,12 +1437,10 @@ Runner requires a provisioning profile. Select a provisioning profile in the Sig 'Trace error if xcresult is empty.', () async { final BuildCommand command = BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), fileSystem: fileSystem, logger: logger, - processUtils: processUtils, osUtils: FakeOperatingSystemUtils(), ); processManager.addCommands([ @@ -1545,12 +1481,10 @@ Runner requires a provisioning profile. Select a provisioning profile in the Sig 'Display xcresult issues on console if parsed.', () async { final BuildCommand command = BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), fileSystem: fileSystem, logger: logger, - processUtils: processUtils, osUtils: FakeOperatingSystemUtils(), ); processManager.addCommands([ @@ -1595,12 +1529,10 @@ Runner requires a provisioning profile. Select a provisioning profile in the Sig 'Do not display xcresult issues that needs to be discarded.', () async { final BuildCommand command = BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), fileSystem: fileSystem, logger: logger, - processUtils: processUtils, osUtils: FakeOperatingSystemUtils(), ); @@ -1654,12 +1586,10 @@ Runner requires a provisioning profile. Select a provisioning profile in the Sig 'Trace if xcresult bundle does not exist.', () async { final BuildCommand command = BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), fileSystem: fileSystem, logger: logger, - processUtils: processUtils, osUtils: FakeOperatingSystemUtils(), ); processManager.addCommands([ diff --git a/packages/flutter_tools/test/commands.shard/hermetic/build_ipa_test.dart b/packages/flutter_tools/test/commands.shard/hermetic/build_ipa_test.dart index 40eb4d8e45..a1624d61e5 100644 --- a/packages/flutter_tools/test/commands.shard/hermetic/build_ipa_test.dart +++ b/packages/flutter_tools/test/commands.shard/hermetic/build_ipa_test.dart @@ -6,11 +6,9 @@ import 'dart:typed_data'; import 'package:args/command_runner.dart'; import 'package:file/memory.dart'; -import 'package:flutter_tools/src/artifacts.dart'; import 'package:flutter_tools/src/base/file_system.dart'; import 'package:flutter_tools/src/base/logger.dart'; import 'package:flutter_tools/src/base/platform.dart'; -import 'package:flutter_tools/src/base/process.dart'; import 'package:flutter_tools/src/base/version.dart'; import 'package:flutter_tools/src/build_system/build_system.dart'; import 'package:flutter_tools/src/cache.dart'; @@ -74,10 +72,8 @@ class FakePlistUtils extends Fake implements PlistParser { void main() { late MemoryFileSystem fileSystem; late FakeProcessManager fakeProcessManager; - late ProcessUtils processUtils; late FakePlistUtils plistUtils; late BufferLogger logger; - late Artifacts artifacts; late FakeAnalytics fakeAnalytics; setUpAll(() { @@ -86,10 +82,8 @@ void main() { setUp(() { fileSystem = MemoryFileSystem.test(); - artifacts = Artifacts.test(fileSystem: fileSystem); fakeProcessManager = FakeProcessManager.empty(); logger = BufferLogger.test(); - processUtils = ProcessUtils(logger: logger, processManager: fakeProcessManager); plistUtils = FakePlistUtils(); fakeAnalytics = getInitializedFakeAnalyticsInstance( fs: fileSystem, @@ -234,12 +228,10 @@ void main() { 'ipa build fails when there is no ios project', () async { final BuildCommand command = BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), logger: logger, fileSystem: fileSystem, - processUtils: processUtils, osUtils: FakeOperatingSystemUtils(), ); createCoreMockProjectFiles(); @@ -261,12 +253,10 @@ void main() { 'ipa build fails in debug with code analysis', () async { final BuildCommand command = BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), logger: logger, fileSystem: fileSystem, - processUtils: processUtils, osUtils: FakeOperatingSystemUtils(), ); createCoreMockProjectFiles(); @@ -290,12 +280,10 @@ void main() { 'ipa build fails on non-macOS platform', () async { final BuildCommand command = BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), logger: logger, fileSystem: fileSystem, - processUtils: processUtils, osUtils: FakeOperatingSystemUtils(), ); fileSystem.file('pubspec.yaml').createSync(); @@ -325,12 +313,10 @@ void main() { 'ipa build fails when export plist does not exist', () async { final BuildCommand command = BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), logger: logger, fileSystem: fileSystem, - processUtils: processUtils, osUtils: FakeOperatingSystemUtils(), ); createMinimalMockProjectFiles(); @@ -356,12 +342,10 @@ void main() { () async { final Directory bogus = fileSystem.directory('bogus')..createSync(); final BuildCommand command = BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), logger: logger, fileSystem: fileSystem, - processUtils: processUtils, osUtils: FakeOperatingSystemUtils(), ); createMinimalMockProjectFiles(); @@ -385,12 +369,10 @@ void main() { 'ipa build fails when --export-options-plist and --export-method are used together', () async { final BuildCommand command = BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), logger: logger, fileSystem: fileSystem, - processUtils: processUtils, osUtils: FakeOperatingSystemUtils(), ); createMinimalMockProjectFiles(); @@ -420,12 +402,10 @@ void main() { 'ipa build reports method from --export-method when used', () async { final BuildCommand command = BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), logger: logger, fileSystem: fileSystem, - processUtils: processUtils, osUtils: FakeOperatingSystemUtils(), ); fakeProcessManager.addCommands([ @@ -456,12 +436,10 @@ void main() { () async { final File cachedExportOptionsPlist = fileSystem.file('/CachedExportOptions.plist'); final BuildCommand command = BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), logger: logger, fileSystem: fileSystem, - processUtils: processUtils, osUtils: FakeOperatingSystemUtils(), ); fakeProcessManager.addCommands([ @@ -512,12 +490,10 @@ void main() { () async { final File cachedExportOptionsPlist = fileSystem.file('/CachedExportOptions.plist'); final BuildCommand command = BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), logger: logger, fileSystem: fileSystem, - processUtils: processUtils, osUtils: FakeOperatingSystemUtils(), ); fakeProcessManager.addCommands([ @@ -568,12 +544,10 @@ void main() { () async { final File cachedExportOptionsPlist = fileSystem.file('/CachedExportOptions.plist'); final BuildCommand command = BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), logger: logger, fileSystem: fileSystem, - processUtils: processUtils, osUtils: FakeOperatingSystemUtils(), ); fakeProcessManager.addCommands([ @@ -623,12 +597,10 @@ void main() { 'ipa build accepts "enterprise" export method when on Xcode versions <= 15.3', () async { final BuildCommand command = BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), logger: logger, fileSystem: fileSystem, - processUtils: processUtils, osUtils: FakeOperatingSystemUtils(), ); fakeProcessManager.addCommands([ @@ -658,12 +630,10 @@ void main() { () async { final File cachedExportOptionsPlist = fileSystem.file('/CachedExportOptions.plist'); final BuildCommand command = BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), logger: logger, fileSystem: fileSystem, - processUtils: processUtils, osUtils: FakeOperatingSystemUtils(), ); fakeProcessManager.addCommands([ @@ -713,12 +683,10 @@ void main() { 'ipa build accepts legacy methods when on Xcode versions <= 15.3', () async { final BuildCommand command = BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), logger: logger, fileSystem: fileSystem, - processUtils: processUtils, osUtils: FakeOperatingSystemUtils(), ); fakeProcessManager.addCommands([ @@ -760,12 +728,10 @@ void main() { exportArchiveCommand(exportOptionsPlist: exportOptions.path), ]); final BuildCommand command = BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), logger: logger, fileSystem: fileSystem, - processUtils: processUtils, osUtils: FakeOperatingSystemUtils(), ); await createTestCommandRunner( @@ -790,12 +756,10 @@ void main() { 'ipa build reports when IPA fails', () async { final BuildCommand command = BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), logger: logger, fileSystem: fileSystem, - processUtils: processUtils, osUtils: FakeOperatingSystemUtils(), ); fakeProcessManager.addCommands([ @@ -851,12 +815,10 @@ void main() { () async { final File cachedExportOptionsPlist = fileSystem.file('/CachedExportOptions.plist'); final BuildCommand command = BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), logger: logger, fileSystem: fileSystem, - processUtils: processUtils, osUtils: FakeOperatingSystemUtils(), ); fakeProcessManager.addCommands([ @@ -888,12 +850,10 @@ void main() { () async { final File cachedExportOptionsPlist = fileSystem.file('/CachedExportOptions.plist'); final BuildCommand command = BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), logger: logger, fileSystem: fileSystem, - processUtils: processUtils, osUtils: FakeOperatingSystemUtils(), ); fakeProcessManager.addCommands([ @@ -947,12 +907,10 @@ void main() { () async { final File cachedExportOptionsPlist = fileSystem.file('/CachedExportOptions.plist'); final BuildCommand command = BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), logger: logger, fileSystem: fileSystem, - processUtils: processUtils, osUtils: FakeOperatingSystemUtils(), ); fakeProcessManager.addCommands([ @@ -1008,12 +966,10 @@ void main() { () async { final File cachedExportOptionsPlist = fileSystem.file('/CachedExportOptions.plist'); final BuildCommand command = BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), logger: logger, fileSystem: fileSystem, - processUtils: processUtils, osUtils: FakeOperatingSystemUtils(), ); fakeProcessManager.addCommands([ @@ -1068,12 +1024,10 @@ void main() { 'ipa build invokes xcode build with verbosity', () async { final BuildCommand command = BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), logger: logger, fileSystem: fileSystem, - processUtils: processUtils, osUtils: FakeOperatingSystemUtils(), ); fakeProcessManager.addCommands([ @@ -1100,12 +1054,10 @@ void main() { 'ipa build invokes xcode build without disablePortPublication', () async { final BuildCommand command = BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), logger: logger, fileSystem: fileSystem, - processUtils: processUtils, osUtils: FakeOperatingSystemUtils(), ); fakeProcessManager.addCommands([ @@ -1133,12 +1085,10 @@ void main() { 'ipa build --no-codesign skips codesigning and IPA creation', () async { final BuildCommand command = BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), logger: logger, fileSystem: fileSystem, - processUtils: processUtils, osUtils: FakeOperatingSystemUtils(), ); fakeProcessManager.addCommands([ @@ -1195,12 +1145,10 @@ void main() { 'code size analysis fails when app not found', () async { final BuildCommand command = BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), logger: logger, fileSystem: fileSystem, - processUtils: processUtils, osUtils: FakeOperatingSystemUtils(), ); createMinimalMockProjectFiles(); @@ -1226,12 +1174,10 @@ void main() { 'Performs code size analysis and sends analytics', () async { final BuildCommand command = BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), logger: logger, fileSystem: fileSystem, - processUtils: processUtils, osUtils: FakeOperatingSystemUtils(), ); createMinimalMockProjectFiles(); @@ -1293,12 +1239,10 @@ void main() { ); final File exportOptions = fileSystem.file('ExportOptions.plist')..createSync(); final BuildCommand command = BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), logger: logger, fileSystem: fileSystem, - processUtils: processUtils, osUtils: FakeOperatingSystemUtils(), ); fakeProcessManager.addCommands([ @@ -1337,12 +1281,10 @@ void main() { 'Trace error if xcresult is empty.', () async { final BuildCommand command = BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), logger: logger, fileSystem: fileSystem, - processUtils: processUtils, osUtils: FakeOperatingSystemUtils(), ); fakeProcessManager.addCommands([ @@ -1379,12 +1321,10 @@ void main() { 'Display xcresult issues on console if parsed.', () async { final BuildCommand command = BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), logger: logger, fileSystem: fileSystem, - processUtils: processUtils, osUtils: FakeOperatingSystemUtils(), ); fakeProcessManager.addCommands([ @@ -1425,12 +1365,10 @@ void main() { 'Do not display xcresult issues that needs to be discarded.', () async { final BuildCommand command = BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), logger: logger, fileSystem: fileSystem, - processUtils: processUtils, osUtils: FakeOperatingSystemUtils(), ); fakeProcessManager.addCommands([ @@ -1479,12 +1417,10 @@ void main() { 'Trace if xcresult bundle does not exist.', () async { final BuildCommand command = BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), logger: logger, fileSystem: fileSystem, - processUtils: processUtils, osUtils: FakeOperatingSystemUtils(), ); fakeProcessManager.addCommands([ @@ -1518,12 +1454,10 @@ void main() { 'Extra error message for provision profile issue in xcresult bundle.', () async { final BuildCommand command = BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), logger: logger, fileSystem: fileSystem, - processUtils: processUtils, osUtils: FakeOperatingSystemUtils(), ); fakeProcessManager.addCommands([ @@ -1593,12 +1527,10 @@ void main() { }; final BuildCommand command = BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), logger: logger, fileSystem: fileSystem, - processUtils: processUtils, osUtils: FakeOperatingSystemUtils(), ); await createTestCommandRunner(command).run(['build', 'ipa', '--no-pub']); @@ -1659,12 +1591,10 @@ void main() { }; final BuildCommand command = BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), logger: logger, fileSystem: fileSystem, - processUtils: processUtils, osUtils: FakeOperatingSystemUtils(), ); await createTestCommandRunner(command).run(['build', 'ipa', '--no-pub']); @@ -1723,12 +1653,10 @@ void main() { }; final BuildCommand command = BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), logger: logger, fileSystem: fileSystem, - processUtils: processUtils, osUtils: FakeOperatingSystemUtils(), ); await createTestCommandRunner(command).run(['build', 'ipa', '--no-pub']); @@ -1782,12 +1710,10 @@ void main() { }; final BuildCommand command = BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), logger: logger, fileSystem: fileSystem, - processUtils: processUtils, osUtils: FakeOperatingSystemUtils(), ); await createTestCommandRunner(command).run(['build', 'ipa', '--no-pub']); @@ -1832,12 +1758,10 @@ void main() { }; final BuildCommand command = BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), logger: logger, fileSystem: fileSystem, - processUtils: processUtils, osUtils: FakeOperatingSystemUtils(), ); await createTestCommandRunner(command).run(['build', 'ipa', '--no-pub']); @@ -1929,12 +1853,10 @@ void main() { createMinimalMockProjectFiles(); final BuildCommand command = BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), logger: logger, fileSystem: fileSystem, - processUtils: processUtils, osUtils: FakeOperatingSystemUtils(), ); await createTestCommandRunner(command).run(['build', 'ipa', '--no-pub']); @@ -2023,12 +1945,10 @@ void main() { createMinimalMockProjectFiles(); final BuildCommand command = BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), logger: logger, fileSystem: fileSystem, - processUtils: processUtils, osUtils: FakeOperatingSystemUtils(), ); await createTestCommandRunner(command).run(['build', 'ipa', '--no-pub']); @@ -2101,12 +2021,10 @@ void main() { createMinimalMockProjectFiles(); final BuildCommand command = BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), logger: logger, fileSystem: fileSystem, - processUtils: processUtils, osUtils: FakeOperatingSystemUtils(), ); await createTestCommandRunner(command).run(['build', 'ipa', '--no-pub']); @@ -2177,12 +2095,10 @@ void main() { createMinimalMockProjectFiles(); final BuildCommand command = BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), logger: logger, fileSystem: fileSystem, - processUtils: processUtils, osUtils: FakeOperatingSystemUtils(), ); await createTestCommandRunner(command).run(['build', 'ipa', '--no-pub']); @@ -2253,12 +2169,10 @@ void main() { createMinimalMockProjectFiles(); final BuildCommand command = BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), logger: logger, fileSystem: fileSystem, - processUtils: processUtils, osUtils: FakeOperatingSystemUtils(), ); await createTestCommandRunner(command).run(['build', 'ipa', '--no-pub']); @@ -2330,12 +2244,10 @@ void main() { createMinimalMockProjectFiles(); final BuildCommand command = BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), logger: logger, fileSystem: fileSystem, - processUtils: processUtils, osUtils: FakeOperatingSystemUtils(), ); await createTestCommandRunner(command).run(['build', 'ipa', '--no-pub']); @@ -2450,12 +2362,10 @@ void main() { createMinimalMockProjectFiles(); final BuildCommand command = BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), logger: logger, fileSystem: fileSystem, - processUtils: processUtils, osUtils: FakeOperatingSystemUtils(), ); await createTestCommandRunner(command).run(['build', 'ipa', '--no-pub']); @@ -2543,12 +2453,10 @@ void main() { createMinimalMockProjectFiles(); final BuildCommand command = BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), logger: logger, fileSystem: fileSystem, - processUtils: processUtils, osUtils: FakeOperatingSystemUtils(), ); await createTestCommandRunner(command).run(['build', 'ipa', '--no-pub']); @@ -2635,12 +2543,10 @@ void main() { createMinimalMockProjectFiles(); final BuildCommand command = BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), logger: logger, fileSystem: fileSystem, - processUtils: processUtils, osUtils: FakeOperatingSystemUtils(), ); await createTestCommandRunner(command).run(['build', 'ipa', '--no-pub']); diff --git a/packages/flutter_tools/test/commands.shard/hermetic/build_linux_test.dart b/packages/flutter_tools/test/commands.shard/hermetic/build_linux_test.dart index bb7ffd9299..6e229a70c8 100644 --- a/packages/flutter_tools/test/commands.shard/hermetic/build_linux_test.dart +++ b/packages/flutter_tools/test/commands.shard/hermetic/build_linux_test.dart @@ -5,12 +5,10 @@ import 'package:args/command_runner.dart'; import 'package:file/memory.dart'; import 'package:file_testing/file_testing.dart'; -import 'package:flutter_tools/src/artifacts.dart'; import 'package:flutter_tools/src/base/file_system.dart'; import 'package:flutter_tools/src/base/logger.dart'; import 'package:flutter_tools/src/base/os.dart'; import 'package:flutter_tools/src/base/platform.dart'; -import 'package:flutter_tools/src/base/process.dart'; import 'package:flutter_tools/src/base/utils.dart'; import 'package:flutter_tools/src/build_system/build_system.dart'; import 'package:flutter_tools/src/cache.dart'; @@ -45,18 +43,14 @@ void main() { late MemoryFileSystem fileSystem; late FakeProcessManager processManager; - late ProcessUtils processUtils; late Logger logger; - late Artifacts artifacts; late FakeAnalytics fakeAnalytics; setUp(() { fileSystem = MemoryFileSystem.test(); - artifacts = Artifacts.test(fileSystem: fileSystem); Cache.flutterRoot = _kTestFlutterRoot; logger = BufferLogger.test(); processManager = FakeProcessManager.empty(); - processUtils = ProcessUtils(logger: logger, processManager: processManager); fakeAnalytics = getInitializedFakeAnalyticsInstance( fs: fileSystem, fakeFlutterVersion: FakeFlutterVersion(), @@ -116,12 +110,10 @@ void main() { 'Linux build fails when there is no linux project', () async { final BuildCommand command = BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), fileSystem: fileSystem, logger: logger, - processUtils: processUtils, osUtils: FakeOperatingSystemUtils(), ); setUpMockCoreProjectFiles(); @@ -148,12 +140,11 @@ void main() { 'Linux build fails on non-linux platform', () async { final BuildCommand command = BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), fileSystem: fileSystem, logger: logger, - processUtils: processUtils, + osUtils: FakeOperatingSystemUtils(), ); setUpMockProjectFilesForBuild(); @@ -175,12 +166,11 @@ void main() { 'Linux build fails when feature is disabled', () async { final BuildCommand command = BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), fileSystem: fileSystem, logger: logger, - processUtils: processUtils, + osUtils: FakeOperatingSystemUtils(), ); setUpMockProjectFilesForBuild(); @@ -205,12 +195,11 @@ void main() { 'Linux build outputs path when successful', () async { final BuildCommand command = BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), fileSystem: MemoryFileSystem.test(), logger: BufferLogger.test(), - processUtils: processUtils, + osUtils: FakeOperatingSystemUtils(), ); processManager = FakeProcessManager.list([ @@ -236,12 +225,11 @@ void main() { 'Linux build invokes CMake and ninja, and writes temporary files', () async { final BuildCommand command = BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), fileSystem: fileSystem, logger: logger, - processUtils: processUtils, + osUtils: FakeOperatingSystemUtils(), ); processManager.addCommands([cmakeCommand('release'), ninjaCommand('release')]); @@ -282,12 +270,11 @@ void main() { 'Handles missing cmake', () async { final BuildCommand command = BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), fileSystem: fileSystem, logger: logger, - processUtils: processUtils, + osUtils: FakeOperatingSystemUtils(), ); setUpMockProjectFilesForBuild(); @@ -311,12 +298,11 @@ void main() { 'Handles argument error from missing ninja', () async { final BuildCommand command = BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), fileSystem: fileSystem, logger: logger, - processUtils: processUtils, + osUtils: FakeOperatingSystemUtils(), ); setUpMockProjectFilesForBuild(); @@ -348,12 +334,11 @@ void main() { 'Linux build does not spew stdout to status logger', () async { final BuildCommand command = BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), fileSystem: fileSystem, logger: logger, - processUtils: processUtils, + osUtils: FakeOperatingSystemUtils(), ); setUpMockProjectFilesForBuild(); @@ -383,12 +368,11 @@ void main() { 'Linux build extracts errors from stdout', () async { final BuildCommand command = BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), fileSystem: fileSystem, logger: logger, - processUtils: processUtils, + osUtils: FakeOperatingSystemUtils(), ); setUpMockProjectFilesForBuild(); @@ -445,12 +429,11 @@ ERROR: No file or variants found for asset: images/a_dot_burr.jpeg 'Linux verbose build sets VERBOSE_SCRIPT_LOGGING', () async { final BuildCommand command = BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), fileSystem: fileSystem, logger: logger, - processUtils: processUtils, + osUtils: FakeOperatingSystemUtils(), ); setUpMockProjectFilesForBuild(); @@ -485,12 +468,11 @@ ERROR: No file or variants found for asset: images/a_dot_burr.jpeg 'Linux on x64 build --debug passes debug mode to cmake and ninja', () async { final BuildCommand command = BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), fileSystem: fileSystem, logger: logger, - processUtils: processUtils, + osUtils: FakeOperatingSystemUtils(), ); setUpMockProjectFilesForBuild(); @@ -514,12 +496,11 @@ ERROR: No file or variants found for asset: images/a_dot_burr.jpeg 'Linux on ARM64 build --debug passes debug mode to cmake and ninja', () async { final BuildCommand command = BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), fileSystem: fileSystem, logger: logger, - processUtils: processUtils, + osUtils: CustomFakeOperatingSystemUtils(hostPlatform: HostPlatform.linux_arm64), ); setUpMockProjectFilesForBuild(); @@ -544,12 +525,11 @@ ERROR: No file or variants found for asset: images/a_dot_burr.jpeg 'Linux on x64 build --profile passes profile mode to make', () async { final BuildCommand command = BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), fileSystem: fileSystem, logger: logger, - processUtils: processUtils, + osUtils: FakeOperatingSystemUtils(), ); setUpMockProjectFilesForBuild(); @@ -572,12 +552,11 @@ ERROR: No file or variants found for asset: images/a_dot_burr.jpeg 'Linux on ARM64 build --profile passes profile mode to make', () async { final BuildCommand command = BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), fileSystem: fileSystem, logger: logger, - processUtils: processUtils, + osUtils: CustomFakeOperatingSystemUtils(hostPlatform: HostPlatform.linux_arm64), ); setUpMockProjectFilesForBuild(); @@ -602,12 +581,11 @@ ERROR: No file or variants found for asset: images/a_dot_burr.jpeg 'Not support Linux cross-build for x64 on arm64', () async { final BuildCommand command = BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), fileSystem: fileSystem, logger: logger, - processUtils: processUtils, + osUtils: CustomFakeOperatingSystemUtils(hostPlatform: HostPlatform.linux_arm64), ); @@ -628,12 +606,11 @@ ERROR: No file or variants found for asset: images/a_dot_burr.jpeg 'Linux build configures CMake exports', () async { final BuildCommand command = BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), fileSystem: fileSystem, logger: logger, - processUtils: processUtils, + osUtils: FakeOperatingSystemUtils(), ); setUpMockProjectFilesForBuild(); @@ -733,12 +710,11 @@ set(BINARY_NAME "fizz_bar") () { final CommandRunner runner = createTestCommandRunner( BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), fileSystem: fileSystem, logger: logger, - processUtils: processUtils, + osUtils: FakeOperatingSystemUtils(), ), ); @@ -786,12 +762,11 @@ set(BINARY_NAME "fizz_bar") 'Performs code size analysis and sends analytics', () async { final BuildCommand command = BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), fileSystem: fileSystem, logger: logger, - processUtils: processUtils, + osUtils: FakeOperatingSystemUtils(), ); setUpMockProjectFilesForBuild(); @@ -847,12 +822,11 @@ set(BINARY_NAME "fizz_bar") 'Linux on ARM64 build --release passes, and check if the LinuxBuildDirectory for arm64 can be referenced correctly by using analytics', () async { final BuildCommand command = BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), fileSystem: fileSystem, logger: logger, - processUtils: processUtils, + osUtils: CustomFakeOperatingSystemUtils(hostPlatform: HostPlatform.linux_arm64), ); setUpMockProjectFilesForBuild(); diff --git a/packages/flutter_tools/test/commands.shard/hermetic/build_macos_test.dart b/packages/flutter_tools/test/commands.shard/hermetic/build_macos_test.dart index 81f4feb5b6..fc7a8cde8b 100644 --- a/packages/flutter_tools/test/commands.shard/hermetic/build_macos_test.dart +++ b/packages/flutter_tools/test/commands.shard/hermetic/build_macos_test.dart @@ -11,7 +11,6 @@ import 'package:flutter_tools/src/artifacts.dart'; import 'package:flutter_tools/src/base/file_system.dart'; import 'package:flutter_tools/src/base/logger.dart'; import 'package:flutter_tools/src/base/platform.dart'; -import 'package:flutter_tools/src/base/process.dart'; import 'package:flutter_tools/src/build_info.dart'; import 'package:flutter_tools/src/build_system/build_system.dart'; import 'package:flutter_tools/src/cache.dart'; @@ -55,10 +54,8 @@ final Platform notMacosPlatform = FakePlatform(environment: {'FL void main() { late MemoryFileSystem fileSystem; late FakeProcessManager fakeProcessManager; - late ProcessUtils processUtils; late BufferLogger logger; late XcodeProjectInterpreter xcodeProjectInterpreter; - late Artifacts artifacts; late FakeAnalytics fakeAnalytics; setUpAll(() { @@ -67,10 +64,8 @@ void main() { setUp(() { fileSystem = MemoryFileSystem.test(); - artifacts = Artifacts.test(fileSystem: fileSystem); logger = BufferLogger.test(); fakeProcessManager = FakeProcessManager.empty(); - processUtils = ProcessUtils(logger: logger, processManager: fakeProcessManager); xcodeProjectInterpreter = FakeXcodeProjectInterpreter(); fakeAnalytics = getInitializedFakeAnalyticsInstance( fs: fileSystem, @@ -156,12 +151,10 @@ STDERR STUFF 'macOS build fails when there is no macos project', () async { final BuildCommand command = BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), fileSystem: fileSystem, logger: logger, - processUtils: processUtils, osUtils: FakeOperatingSystemUtils(), ); createCoreMockProjectFiles(); @@ -188,12 +181,10 @@ STDERR STUFF 'macOS build successfully with renamed .xcodeproj/.xcworkspace files', () async { final BuildCommand command = BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), fileSystem: fileSystem, logger: logger, - processUtils: processUtils, osUtils: FakeOperatingSystemUtils(), ); @@ -230,12 +221,10 @@ STDERR STUFF 'macOS build fails on non-macOS platform', () async { final BuildCommand command = BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), fileSystem: fileSystem, logger: logger, - processUtils: processUtils, osUtils: FakeOperatingSystemUtils(), ); fileSystem.file('pubspec.yaml').createSync(); @@ -258,12 +247,10 @@ STDERR STUFF 'macOS build fails when feature is disabled', () async { final BuildCommand command = BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), fileSystem: fileSystem, logger: logger, - processUtils: processUtils, osUtils: FakeOperatingSystemUtils(), ); fileSystem.file('pubspec.yaml').createSync(); @@ -289,12 +276,10 @@ STDERR STUFF 'macOS build forwards error stdout to status logger error', () async { final BuildCommand command = BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), fileSystem: fileSystem, logger: logger, - processUtils: processUtils, osUtils: FakeOperatingSystemUtils(), ); createMinimalMockProjectFiles(); @@ -332,11 +317,9 @@ STDERR STUFF 'macOS build outputs path and size when successful', () async { final BuildCommand command = BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), fileSystem: MemoryFileSystem.test(), - processUtils: processUtils, logger: BufferLogger.test(), osUtils: FakeOperatingSystemUtils(), ); @@ -362,12 +345,10 @@ STDERR STUFF 'macOS build invokes xcode build (debug)', () async { final BuildCommand command = BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), fileSystem: fileSystem, logger: logger, - processUtils: processUtils, osUtils: FakeOperatingSystemUtils(), ); createMinimalMockProjectFiles(); @@ -390,12 +371,10 @@ STDERR STUFF 'macOS build invokes xcode build (debug) with verbosity', () async { final BuildCommand command = BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), fileSystem: fileSystem, logger: logger, - processUtils: processUtils, osUtils: FakeOperatingSystemUtils(), ); createMinimalMockProjectFiles(); @@ -420,12 +399,10 @@ STDERR STUFF 'macOS build invokes xcode build (profile)', () async { final BuildCommand command = BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), fileSystem: fileSystem, logger: logger, - processUtils: processUtils, osUtils: FakeOperatingSystemUtils(), ); createMinimalMockProjectFiles(); @@ -449,12 +426,10 @@ STDERR STUFF 'macOS build invokes xcode build (release)', () async { final BuildCommand command = BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), fileSystem: fileSystem, logger: logger, - processUtils: processUtils, osUtils: FakeOperatingSystemUtils(), ); createMinimalMockProjectFiles(); @@ -477,12 +452,10 @@ STDERR STUFF 'macOS build supports standard desktop build options', () async { final BuildCommand command = BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), fileSystem: fileSystem, logger: logger, - processUtils: processUtils, osUtils: FakeOperatingSystemUtils(), ); createMinimalMockProjectFiles(); @@ -578,12 +551,10 @@ STDERR STUFF ]); final BuildCommand command = BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), fileSystem: fileSystem, logger: logger, - processUtils: processUtils, osUtils: FakeOperatingSystemUtils(), ); @@ -607,12 +578,10 @@ STDERR STUFF 'macOS build supports build-name and build-number', () async { final BuildCommand command = BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), fileSystem: fileSystem, logger: logger, - processUtils: processUtils, osUtils: FakeOperatingSystemUtils(), ); createMinimalMockProjectFiles(); @@ -648,12 +617,10 @@ STDERR STUFF () { final CommandRunner runner = createTestCommandRunner( BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), fileSystem: fileSystem, logger: logger, - processUtils: processUtils, osUtils: FakeOperatingSystemUtils(), ), ); @@ -694,12 +661,10 @@ STDERR STUFF 'code size analysis throws StateError if no code size snapshot generated by gen_snapshot', () async { final BuildCommand command = BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), fileSystem: fileSystem, logger: logger, - processUtils: processUtils, osUtils: FakeOperatingSystemUtils(), ); createMinimalMockProjectFiles(); @@ -741,12 +706,10 @@ STDERR STUFF 'Performs code size analysis and sends analytics from arm64 host', () async { final BuildCommand command = BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), fileSystem: fileSystem, logger: logger, - processUtils: processUtils, osUtils: FakeOperatingSystemUtils(), ); createMinimalMockProjectFiles(); @@ -804,12 +767,10 @@ STDERR STUFF 'macOS build overrides CODE_SIGN_ENTITLEMENTS when in CI if entitlement file exists (debug)', () async { final BuildCommand command = BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), fileSystem: fileSystem, logger: logger, - processUtils: processUtils, osUtils: FakeOperatingSystemUtils(), ); createMinimalMockProjectFiles(); @@ -875,12 +836,10 @@ STDERR STUFF 'macOS build overrides CODE_SIGN_ENTITLEMENTS when in CI if entitlement file exists (release)', () async { final BuildCommand command = BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), fileSystem: fileSystem, logger: logger, - processUtils: processUtils, osUtils: FakeOperatingSystemUtils(), ); createMinimalMockProjectFiles(); diff --git a/packages/flutter_tools/test/commands.shard/hermetic/build_test.dart b/packages/flutter_tools/test/commands.shard/hermetic/build_test.dart index a687951be4..3fbdf1cd7f 100644 --- a/packages/flutter_tools/test/commands.shard/hermetic/build_test.dart +++ b/packages/flutter_tools/test/commands.shard/hermetic/build_test.dart @@ -4,10 +4,8 @@ import 'package:args/command_runner.dart'; import 'package:file/memory.dart'; -import 'package:flutter_tools/src/artifacts.dart'; import 'package:flutter_tools/src/base/file_system.dart'; import 'package:flutter_tools/src/base/logger.dart'; -import 'package:flutter_tools/src/base/process.dart'; import 'package:flutter_tools/src/build_system/build_system.dart'; import 'package:flutter_tools/src/cache.dart'; import 'package:flutter_tools/src/commands/build.dart'; @@ -39,30 +37,24 @@ void main() { late MemoryFileSystem fs; late BufferLogger logger; late ProcessManager processManager; - late ProcessUtils processUtils; - late Artifacts artifacts; setUp(() { fs = MemoryFileSystem.test(); - artifacts = Artifacts.test(fileSystem: fs); fs.file('/package/pubspec.yaml').createSync(recursive: true); fs.currentDirectory = '/package'; Cache.disableLocking(); logger = BufferLogger.test(); processManager = FakeProcessManager.empty(); - processUtils = ProcessUtils(logger: logger, processManager: processManager); }); testUsingContext( "doesn't fail if --fatal-warnings specified and no warnings occur", () async { command = FakeBuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), fileSystem: fs, logger: logger, - processUtils: processUtils, osUtils: FakeOperatingSystemUtils(), ); try { @@ -80,12 +72,10 @@ void main() { "doesn't fail if --fatal-warnings not specified", () async { command = FakeBuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), fileSystem: fs, logger: logger, - processUtils: processUtils, osUtils: FakeOperatingSystemUtils(), ); testLogger.printWarning('Warning: Mild annoyance Will Robinson!'); @@ -102,12 +92,10 @@ void main() { 'fails if --fatal-warnings specified and warnings emitted', () async { command = FakeBuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), fileSystem: fs, logger: logger, - processUtils: processUtils, osUtils: FakeOperatingSystemUtils(), ); testLogger.printWarning('Warning: Mild annoyance Will Robinson!'); @@ -128,12 +116,10 @@ void main() { 'fails if --fatal-warnings specified and errors emitted', () async { command = FakeBuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), fileSystem: fs, logger: logger, - processUtils: processUtils, osUtils: FakeOperatingSystemUtils(), ); testLogger.printError('Error: Danger Will Robinson!'); @@ -178,8 +164,6 @@ class FakeBuildCommand extends BuildCommand { required super.osUtils, required Logger logger, required super.androidSdk, - required super.processUtils, - required super.artifacts, bool verboseHelp = false, }) : super(logger: logger) { addSubcommand(FakeBuildSubcommand(logger: logger, verboseHelp: verboseHelp)); diff --git a/packages/flutter_tools/test/commands.shard/hermetic/build_web_test.dart b/packages/flutter_tools/test/commands.shard/hermetic/build_web_test.dart index 7c174b1445..76b3dea300 100644 --- a/packages/flutter_tools/test/commands.shard/hermetic/build_web_test.dart +++ b/packages/flutter_tools/test/commands.shard/hermetic/build_web_test.dart @@ -4,12 +4,10 @@ import 'package:args/command_runner.dart'; import 'package:file/memory.dart'; -import 'package:flutter_tools/src/artifacts.dart'; import 'package:flutter_tools/src/base/common.dart'; import 'package:flutter_tools/src/base/file_system.dart'; import 'package:flutter_tools/src/base/logger.dart'; import 'package:flutter_tools/src/base/platform.dart'; -import 'package:flutter_tools/src/base/process.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/targets/web.dart'; @@ -31,10 +29,8 @@ import '../../src/test_flutter_command_runner.dart'; void main() { late FileSystem fileSystem; final Platform fakePlatform = FakePlatform(environment: {'FLUTTER_ROOT': '/'}); - late ProcessUtils processUtils; late BufferLogger logger; late ProcessManager processManager; - late Artifacts artifacts; // TODO(matanlurey): Remove after `explicit-package-dependencies` is enabled by default. // See https://github.com/flutter/flutter/issues/160257 for details. @@ -59,10 +55,8 @@ void main() { fileSystem.directory('.dart_tool').childFile('package_config.json').createSync(recursive: true); fileSystem.file(fileSystem.path.join('web', 'index.html')).createSync(recursive: true); fileSystem.file(fileSystem.path.join('lib', 'main.dart')).createSync(recursive: true); - artifacts = Artifacts.test(fileSystem: fileSystem); logger = BufferLogger.test(); processManager = FakeProcessManager.any(); - processUtils = ProcessUtils(logger: logger, processManager: processManager); }); testUsingContext( @@ -71,12 +65,10 @@ void main() { fileSystem.file(fileSystem.path.join('web', 'index.html')).deleteSync(); final CommandRunner runner = createTestCommandRunner( BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), fileSystem: fileSystem, logger: logger, - processUtils: processUtils, osUtils: FakeOperatingSystemUtils(), ), ); @@ -99,12 +91,10 @@ void main() { () async { final CommandRunner runner = createTestCommandRunner( BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), fileSystem: MemoryFileSystem.test(), logger: logger, - processUtils: processUtils, osUtils: FakeOperatingSystemUtils(), ), ); @@ -129,12 +119,10 @@ void main() { 'Setup for a web build with default output directory', () async { final BuildCommand buildCommand = BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), fileSystem: fileSystem, logger: logger, - processUtils: processUtils, osUtils: FakeOperatingSystemUtils(), ); final CommandRunner runner = createTestCommandRunner(buildCommand); @@ -182,13 +170,11 @@ void main() { 'Does not allow -O0 optimization level', () async { final BuildCommand buildCommand = BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), fileSystem: fileSystem, logger: BufferLogger.test(), osUtils: FakeOperatingSystemUtils(), - processUtils: processUtils, ); final CommandRunner runner = createTestCommandRunner(buildCommand); setupFileSystemForEndToEndTest(fileSystem); @@ -244,12 +230,10 @@ void main() { 'Setup for a web build with a user specified output directory', () async { final BuildCommand buildCommand = BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), fileSystem: fileSystem, logger: logger, - processUtils: processUtils, osUtils: FakeOperatingSystemUtils(), ); final CommandRunner runner = createTestCommandRunner(buildCommand); diff --git a/packages/flutter_tools/test/commands.shard/hermetic/daemon_test.dart b/packages/flutter_tools/test/commands.shard/hermetic/daemon_test.dart index 9a9663eeea..afbd74b8ea 100644 --- a/packages/flutter_tools/test/commands.shard/hermetic/daemon_test.dart +++ b/packages/flutter_tools/test/commands.shard/hermetic/daemon_test.dart @@ -8,11 +8,9 @@ import 'dart:typed_data'; import 'package:fake_async/fake_async.dart'; import 'package:file/file.dart'; -import 'package:file/memory.dart'; import 'package:flutter_tools/src/android/android_device.dart'; import 'package:flutter_tools/src/android/android_workflow.dart'; import 'package:flutter_tools/src/application_package.dart'; -import 'package:flutter_tools/src/artifacts.dart'; import 'package:flutter_tools/src/base/dds.dart'; import 'package:flutter_tools/src/base/logger.dart'; import 'package:flutter_tools/src/base/utils.dart'; @@ -23,7 +21,6 @@ import 'package:flutter_tools/src/device.dart'; import 'package:flutter_tools/src/features.dart'; import 'package:flutter_tools/src/globals.dart' as globals; import 'package:flutter_tools/src/ios/ios_workflow.dart'; -import 'package:flutter_tools/src/preview_device.dart'; import 'package:flutter_tools/src/resident_runner.dart'; import 'package:flutter_tools/src/vmservice.dart'; import 'package:flutter_tools/src/windows/windows_workflow.dart'; @@ -127,7 +124,7 @@ void main() { expect(response.data['id'], 0); expect(response.data['result'], isNotEmpty); expect(response.data['result']! as Map, const { - 'platforms': ['macos', 'windows', 'windowsPreview'], + 'platforms': ['macos', 'windows'], 'platformTypes': >{ 'web': { 'isSupported': false, @@ -197,7 +194,6 @@ void main() { }, ], }, - 'windowsPreview': {'isSupported': true}, }, }); }, @@ -208,7 +204,6 @@ void main() { isAndroidEnabled: false, isIOSEnabled: false, isMacOSEnabled: true, - isPreviewDeviceEnabled: true, isWindowsEnabled: true, ), }, @@ -424,20 +419,9 @@ void main() { final FakePollingDeviceDiscovery discoverer = FakePollingDeviceDiscovery(); daemon.deviceDomain.addDeviceDiscoverer(discoverer); discoverer.addDevice(FakeAndroidDevice()); - final MemoryFileSystem fs = MemoryFileSystem.test(); - discoverer.addDevice( - PreviewDevice( - processManager: FakeProcessManager.empty(), - logger: BufferLogger.test(), - fileSystem: fs, - previewBinary: fs.file(r'preview_device.exe'), - artifacts: Artifacts.test(fileSystem: fs), - builderFactory: () => throw UnimplementedError('TODO implement builder factory'), - ), - ); final List> names = >[]; - await daemonStreams.outputs.stream.skipWhile(_isConnectedEvent).take(2).forEach(( + await daemonStreams.outputs.stream.skipWhile(_isConnectedEvent).take(1).forEach(( DaemonMessage response, ) async { expect(response.data['event'], 'device.added'); @@ -472,28 +456,6 @@ void main() { 'startPaused': true, }, }, - { - 'id': 'preview', - 'name': 'Preview', - 'platform': 'windows-x64', - 'emulator': false, - 'category': 'desktop', - 'platformType': 'windowsPreview', - 'ephemeral': false, - 'emulatorId': null, - 'sdk': 'preview', - 'isConnected': true, - 'connectionInterface': 'attached', - 'capabilities': { - 'hotReload': true, - 'hotRestart': true, - 'screenshot': false, - 'fastStart': false, - 'flutterExit': true, - 'hardwareRendering': true, - 'startPaused': true, - }, - }, ]), ); }, diff --git a/packages/flutter_tools/test/general.shard/artifacts_test.dart b/packages/flutter_tools/test/general.shard/artifacts_test.dart index 396161dfe9..97df1ffb1d 100644 --- a/packages/flutter_tools/test/general.shard/artifacts_test.dart +++ b/packages/flutter_tools/test/general.shard/artifacts_test.dart @@ -534,21 +534,6 @@ void main() { ), ); - expect( - artifacts.getArtifactPath( - Artifact.flutterPreviewDevice, - platform: TargetPlatform.windows_x64, - ), - fileSystem.path.join( - 'root', - 'bin', - 'cache', - 'artifacts', - 'flutter_preview', - 'flutter_preview.exe', - ), - ); - fileSystem .file(fileSystem.path.join('/out', 'host_debug_unopt', 'impellerc')) .createSync(recursive: true); diff --git a/packages/flutter_tools/test/general.shard/commands/build_test.dart b/packages/flutter_tools/test/general.shard/commands/build_test.dart index 8270d6c963..4a63865ecf 100644 --- a/packages/flutter_tools/test/general.shard/commands/build_test.dart +++ b/packages/flutter_tools/test/general.shard/commands/build_test.dart @@ -5,12 +5,10 @@ import 'package:args/args.dart'; import 'package:args/command_runner.dart'; import 'package:file/memory.dart'; -import 'package:flutter_tools/src/artifacts.dart'; import 'package:flutter_tools/src/base/file_system.dart'; import 'package:flutter_tools/src/base/io.dart'; import 'package:flutter_tools/src/base/logger.dart'; import 'package:flutter_tools/src/base/platform.dart'; -import 'package:flutter_tools/src/base/process.dart'; import 'package:flutter_tools/src/base/signals.dart'; import 'package:flutter_tools/src/base/terminal.dart'; import 'package:flutter_tools/src/build_info.dart'; @@ -115,18 +113,12 @@ void main() { testUsingContext('Include only supported sub commands', () { final BufferLogger logger = BufferLogger.test(); - final ProcessUtils processUtils = ProcessUtils( - logger: logger, - processManager: FakeProcessManager.empty(), - ); final MemoryFileSystem fs = MemoryFileSystem.test(); final BuildCommand command = BuildCommand( - artifacts: Artifacts.test(fileSystem: fs), androidSdk: FakeAndroidSdk(), buildSystem: TestBuildSystem.all(BuildResult(success: true)), fileSystem: fs, logger: logger, - processUtils: processUtils, osUtils: FakeOperatingSystemUtils(), ); for (final Command x in command.subcommands.values) { diff --git a/packages/flutter_tools/test/general.shard/plugins_test.dart b/packages/flutter_tools/test/general.shard/plugins_test.dart index 4a49019486..6652210e3d 100644 --- a/packages/flutter_tools/test/general.shard/plugins_test.dart +++ b/packages/flutter_tools/test/general.shard/plugins_test.dart @@ -23,7 +23,6 @@ import 'package:flutter_tools/src/ios/xcodeproj.dart'; import 'package:flutter_tools/src/macos/darwin_dependency_management.dart'; import 'package:flutter_tools/src/platform_plugins.dart'; import 'package:flutter_tools/src/plugins.dart'; -import 'package:flutter_tools/src/preview_device.dart'; import 'package:flutter_tools/src/project.dart'; import 'package:flutter_tools/src/version.dart'; import 'package:test/fake.dart'; @@ -1892,37 +1891,6 @@ flutter: }, ); - testUsingContext( - 'injectPlugins will validate if all plugins in the project are part of the passed allowedPlugins', - () async { - // Re-run the setup using the Windows filesystem. - setUpProject(fsWindows); - createFakePlugins(fsWindows, const ['plugin_one', 'plugin_two']); - - expect( - () => injectPlugins( - flutterProject, - linuxPlatform: true, - windowsPlatform: true, - allowedPlugins: PreviewDevice.supportedPubPlugins, - ), - throwsToolExit( - message: ''' -The Flutter Preview device does not support the following plugins from your pubspec.yaml: - -[plugin_one, plugin_two] -''', - ), - ); - }, - overrides: { - FileSystem: () => fsWindows, - ProcessManager: () => FakeProcessManager.empty(), - FeatureFlags: enableExplicitPackageDependencies, - Pub: FakePubWithPrimedDeps.new, - }, - ); - testUsingContext( 'iOS and macOS project setup up Darwin Dependency Management', () async { diff --git a/packages/flutter_tools/test/general.shard/preview_device_test.dart b/packages/flutter_tools/test/general.shard/preview_device_test.dart deleted file mode 100644 index 1f68ca0076..0000000000 --- a/packages/flutter_tools/test/general.shard/preview_device_test.dart +++ /dev/null @@ -1,220 +0,0 @@ -// Copyright 2014 The Flutter Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -import 'dart:async'; - -import 'package:file/memory.dart'; -import 'package:flutter_tools/src/application_package.dart'; -import 'package:flutter_tools/src/artifacts.dart'; -import 'package:flutter_tools/src/base/file_system.dart'; -import 'package:flutter_tools/src/base/logger.dart'; -import 'package:flutter_tools/src/base/platform.dart'; -import 'package:flutter_tools/src/build_info.dart'; -import 'package:flutter_tools/src/build_system/build_system.dart'; -import 'package:flutter_tools/src/bundle.dart'; -import 'package:flutter_tools/src/bundle_builder.dart'; -import 'package:flutter_tools/src/cache.dart'; -import 'package:flutter_tools/src/device.dart'; -import 'package:flutter_tools/src/preview_device.dart'; -import 'package:flutter_tools/src/project.dart'; -import 'package:meta/meta.dart'; -import 'package:test/fake.dart'; - -import '../src/common.dart'; -import '../src/context.dart'; -import '../src/fakes.dart'; - -void main() { - String? flutterRootBackup; - late MemoryFileSystem fs; - late File previewBinary; - - setUp(() { - fs = MemoryFileSystem.test(style: FileSystemStyle.windows); - Cache.flutterRoot = r'C:\path\to\flutter'; - previewBinary = fs.file( - '${Cache.flutterRoot}\\bin\\cache\\artifacts\\flutter_preview\\flutter_preview.exe', - ); - previewBinary.createSync(recursive: true); - flutterRootBackup = Cache.flutterRoot; - }); - - tearDown(() { - Cache.flutterRoot = flutterRootBackup; - }); - - testWithoutContext('PreviewDevice defaults', () async { - final PreviewDevice device = PreviewDevice( - artifacts: Artifacts.test(), - fileSystem: fs, - processManager: FakeProcessManager.any(), - previewBinary: previewBinary, - logger: BufferLogger.test(), - ); - - expect(await device.isLocalEmulator, false); - expect(device.name, 'Preview'); - expect(await device.sdkNameAndVersion, 'preview'); - expect(await device.targetPlatform, TargetPlatform.windows_x64); - expect(device.category, Category.desktop); - expect(device.ephemeral, false); - expect(device.id, 'preview'); - - expect(device.isSupported(), true); - expect(device.isSupportedForProject(FakeFlutterProject()), true); - expect(await device.isLatestBuildInstalled(FakeApplicationPackage()), false); - expect(await device.isAppInstalled(FakeApplicationPackage()), false); - expect(await device.uninstallApp(FakeApplicationPackage()), true); - }); - - testUsingContext('Can build a simulator app', () async { - final Completer completer = Completer(); - final BufferLogger logger = BufferLogger.test(); - final PreviewDevice device = PreviewDevice( - artifacts: Artifacts.test(), - fileSystem: fs, - previewBinary: previewBinary, - processManager: FakeProcessManager.list([ - FakeCommand( - command: const [r'C:\.tmp_rand0\flutter_preview.rand0\flutter_preview.exe'], - stdout: 'The Dart VM service is listening on http://127.0.0.1:64494/fZ_B2N6JRwY=/\n', - completer: completer, - ), - ]), - logger: logger, - builderFactory: () => FakeBundleBuilder(fs), - ); - final Directory previewDeviceCacheDir = fs.directory( - 'Artifact.windowsDesktopPath.TargetPlatform.windows_x64.debug', - )..createSync(recursive: true); - previewDeviceCacheDir.childFile('flutter_windows.dll').writeAsStringSync('1010101'); - previewDeviceCacheDir.childFile('icudtl.dat').writeAsStringSync('1010101'); - - final LaunchResult result = await device.startApp( - FakeApplicationPackage(), - debuggingOptions: DebuggingOptions.enabled(BuildInfo.debug), - ); - - expect(result.started, true); - expect(result.vmServiceUri, Uri.parse('http://127.0.0.1:64494/fZ_B2N6JRwY=/')); - }); - - group('PreviewDeviceDiscovery', () { - late Artifacts artifacts; - late ProcessManager processManager; - final FakePlatform windowsPlatform = FakePlatform(operatingSystem: 'windows'); - final FakePlatform macPlatform = FakePlatform(operatingSystem: 'macos'); - final FakePlatform linuxPlatform = FakePlatform(); - final TestFeatureFlags featureFlags = TestFeatureFlags(isPreviewDeviceEnabled: true); - - setUp(() { - artifacts = Artifacts.test(fileSystem: fs); - processManager = FakeProcessManager.empty(); - }); - - testWithoutContext('PreviewDeviceDiscovery on linux', () async { - final PreviewDeviceDiscovery discovery = PreviewDeviceDiscovery( - artifacts: artifacts, - fileSystem: fs, - logger: BufferLogger.test(), - processManager: processManager, - platform: linuxPlatform, - featureFlags: featureFlags, - ); - - final List devices = await discovery.devices(); - - expect(devices, isEmpty); - }); - - testWithoutContext('PreviewDeviceDiscovery on macOS', () async { - final PreviewDeviceDiscovery discovery = PreviewDeviceDiscovery( - artifacts: artifacts, - fileSystem: fs, - logger: BufferLogger.test(), - processManager: processManager, - platform: macPlatform, - featureFlags: featureFlags, - ); - - final List devices = await discovery.devices(); - - expect(devices, isEmpty); - }); - - testWithoutContext( - 'PreviewDeviceDiscovery on Windows returns preview when binary exists', - () async { - // ensure Flutter preview binary exists in cache. - fs.file(artifacts.getArtifactPath(Artifact.flutterPreviewDevice)).writeAsBytesSync([ - 1, - 0, - 0, - 1, - ]); - final PreviewDeviceDiscovery discovery = PreviewDeviceDiscovery( - artifacts: artifacts, - fileSystem: fs, - logger: BufferLogger.test(), - processManager: processManager, - platform: windowsPlatform, - featureFlags: featureFlags, - ); - - final List devices = await discovery.devices(); - - expect(devices, hasLength(1)); - final Device previewDevice = devices.first; - expect(previewDevice, isA()); - }, - ); - - testWithoutContext( - 'PreviewDeviceDiscovery on Windows returns nothing when binary does not exist', - () async { - final PreviewDeviceDiscovery discovery = PreviewDeviceDiscovery( - artifacts: artifacts, - fileSystem: fs, - logger: BufferLogger.test(), - processManager: processManager, - platform: windowsPlatform, - featureFlags: featureFlags, - ); - - final List devices = await discovery.devices(); - - expect(devices, isEmpty); - }, - ); - }); -} - -class FakeFlutterProject extends Fake implements FlutterProject {} - -class FakeApplicationPackage extends Fake implements ApplicationPackage {} - -class FakeBundleBuilder extends Fake implements BundleBuilder { - FakeBundleBuilder(this.fileSystem); - - final FileSystem fileSystem; - - @override - Future build({ - required TargetPlatform platform, - required BuildInfo buildInfo, - FlutterProject? project, - String? mainPath, - String manifestPath = defaultManifestPath, - String? applicationKernelFilePath, - String? depfilePath, - String? assetDirPath, - bool buildNativeAssets = true, - @visibleForTesting BuildSystem? buildSystem, - }) async { - final Directory assetDirectory = fileSystem - .directory(assetDirPath) - .childDirectory('flutter_assets')..createSync(recursive: true); - assetDirectory.childFile('kernel_blob.bin').createSync(); - } -} diff --git a/packages/flutter_tools/test/general.shard/unified_analytics_test.dart b/packages/flutter_tools/test/general.shard/unified_analytics_test.dart index 2052912702..0f7195a42a 100644 --- a/packages/flutter_tools/test/general.shard/unified_analytics_test.dart +++ b/packages/flutter_tools/test/general.shard/unified_analytics_test.dart @@ -37,14 +37,10 @@ void main() { testWithoutContext('getEnabledFeatures not null', () { config.setValue('cli-animations', true); - config.setValue('enable-flutter-preview', true); final String? enabledFeatures = getEnabledFeatures(config); expect(enabledFeatures, isNotNull); - expect( - enabledFeatures!.split(','), - unorderedEquals(['enable-flutter-preview', 'cli-animations']), - ); + expect(enabledFeatures!.split(','), unorderedEquals(['cli-animations'])); }); }); diff --git a/packages/flutter_tools/test/general.shard/web/migrations/scrub_generated_plugin_registrant_test.dart b/packages/flutter_tools/test/general.shard/web/migrations/scrub_generated_plugin_registrant_test.dart index a1e9c76f4e..eb59a200b9 100644 --- a/packages/flutter_tools/test/general.shard/web/migrations/scrub_generated_plugin_registrant_test.dart +++ b/packages/flutter_tools/test/general.shard/web/migrations/scrub_generated_plugin_registrant_test.dart @@ -3,10 +3,8 @@ // found in the LICENSE file. import 'package:file/memory.dart'; -import 'package:flutter_tools/src/artifacts.dart'; import 'package:flutter_tools/src/base/file_system.dart'; import 'package:flutter_tools/src/base/logger.dart'; -import 'package:flutter_tools/src/base/process.dart'; import 'package:flutter_tools/src/build_system/build_system.dart'; import 'package:flutter_tools/src/cache.dart'; import 'package:flutter_tools/src/commands/build.dart'; @@ -41,20 +39,16 @@ void main() { late File registrant; // Environment overrides - late Artifacts artifacts; late FileSystem fileSystem; late ProcessManager processManager; late BuildSystem buildSystem; - late ProcessUtils processUtils; late BufferLogger logger; setUp(() { // Prepare environment overrides fileSystem = MemoryFileSystem.test(); - artifacts = Artifacts.test(fileSystem: fileSystem); processManager = FakeProcessManager.any(); logger = BufferLogger.test(); - processUtils = ProcessUtils(processManager: processManager, logger: logger); buildSystem = TestBuildSystem.all(BuildResult(success: true)); // Write some initial state into our testing filesystem @@ -72,13 +66,11 @@ void main() { await createTestCommandRunner( BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: buildSystem, fileSystem: fileSystem, logger: BufferLogger.test(), osUtils: FakeOperatingSystemUtils(), - processUtils: processUtils, ), ).run(['build', 'web', '--no-pub']); @@ -104,13 +96,11 @@ void main() { await createTestCommandRunner( BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: buildSystem, fileSystem: fileSystem, logger: logger, osUtils: FakeOperatingSystemUtils(), - processUtils: processUtils, ), ).run(['build', 'web', '--no-pub']); @@ -135,12 +125,10 @@ void main() { await createTestCommandRunner( BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: buildSystem, fileSystem: fileSystem, logger: logger, - processUtils: processUtils, osUtils: FakeOperatingSystemUtils(), ), ).run(['build', 'web', '--no-pub']); @@ -168,12 +156,10 @@ void main() { await createTestCommandRunner( BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: buildSystem, fileSystem: fileSystem, logger: logger, - processUtils: processUtils, osUtils: FakeOperatingSystemUtils(), ), ).run(['build', 'web', '--no-pub']); @@ -200,12 +186,10 @@ void main() { await createTestCommandRunner( BuildCommand( - artifacts: artifacts, androidSdk: FakeAndroidSdk(), buildSystem: buildSystem, fileSystem: fileSystem, logger: logger, - processUtils: processUtils, osUtils: FakeOperatingSystemUtils(), ), ).run(['build', 'web', '--no-pub']); diff --git a/packages/flutter_tools/test/integration.shard/build_preview_test.dart b/packages/flutter_tools/test/integration.shard/build_preview_test.dart deleted file mode 100644 index bcd6e59315..0000000000 --- a/packages/flutter_tools/test/integration.shard/build_preview_test.dart +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright 2014 The Flutter Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -import 'dart:io'; - -import 'package:file_testing/file_testing.dart'; -import 'package:flutter_tools/src/base/file_system.dart'; -import 'package:flutter_tools/src/base/platform.dart'; -import 'package:flutter_tools/src/cache.dart'; - -import '../src/common.dart'; -import '../src/context.dart'; -import 'test_utils.dart'; - -void main() { - Cache.disableLocking(); - - late Directory tempDir; - final FileSystem fs = LocalFileSystemBlockingSetCurrentDirectory(); - final File previewBin = fs - .directory(getFlutterRoot()) - .childDirectory('bin') - .childDirectory('cache') - .childDirectory('artifacts') - .childDirectory('flutter_preview') - .childFile('flutter_preview.exe'); - - setUp(() { - tempDir = fs.systemTempDirectory.createTempSync('flutter_tools_preview_integration_test.'); - }); - - tearDown(() { - tryToDelete(tempDir); - tryToDelete(previewBin); - }); - - testUsingContext( - 'flutter build _preview creates preview device', - () async { - final ProcessResult result = await processManager.run([ - flutterBin, - 'build', - '_preview', - '--verbose', - ]); - - expect(result, const ProcessResultMatcher()); - expect(previewBin, exists); - }, - // [intended] Flutter Preview only supported on Windows currently - skip: !const LocalPlatform().isWindows, - ); -} diff --git a/packages/flutter_tools/test/src/fakes.dart b/packages/flutter_tools/test/src/fakes.dart index 8af27529f3..fc292adc07 100644 --- a/packages/flutter_tools/test/src/fakes.dart +++ b/packages/flutter_tools/test/src/fakes.dart @@ -484,7 +484,6 @@ class TestFeatureFlags implements FeatureFlags { this.areCustomDevicesEnabled = false, this.isCliAnimationEnabled = true, this.isNativeAssetsEnabled = false, - this.isPreviewDeviceEnabled = false, this.isSwiftPackageManagerEnabled = false, this.isExplicitPackageDependenciesEnabled = false, }); @@ -519,9 +518,6 @@ class TestFeatureFlags implements FeatureFlags { @override final bool isNativeAssetsEnabled; - @override - final bool isPreviewDeviceEnabled; - @override final bool isSwiftPackageManagerEnabled;