Skip to content

Commit 6cca066

Browse files
authored
Revert the preview-device feature, tests, and code that only existed for it. (flutter#162835)
Closes flutter#162693. Fortunately due to the power of `git`, it will live forever 🫡
1 parent 494c47c commit 6cca066

30 files changed

+24
-1195
lines changed

packages/flutter_tools/lib/executable.dart

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,11 +187,9 @@ List<FlutterCommand> generateCommands({required bool verboseHelp, required bool
187187
fileSystem: globals.fs,
188188
),
189189
BuildCommand(
190-
artifacts: globals.artifacts!,
191190
fileSystem: globals.fs,
192191
buildSystem: globals.buildSystem,
193192
osUtils: globals.os,
194-
processUtils: globals.processUtils,
195193
verboseHelp: verboseHelp,
196194
androidSdk: globals.androidSdk,
197195
logger: globals.logger,

packages/flutter_tools/lib/src/artifacts.dart

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,6 @@ enum Artifact {
7373

7474
/// The location of file generators.
7575
flutterToolsFileGenerators,
76-
77-
/// Pre-built desktop debug app.
78-
flutterPreviewDevice,
7976
}
8077

8178
/// A subset of [Artifact]s that are platform and build mode independent
@@ -241,8 +238,6 @@ String? _artifactToFileName(Artifact artifact, Platform hostPlatform, [BuildMode
241238
return 'const_finder.dart.snapshot';
242239
case Artifact.flutterToolsFileGenerators:
243240
return '';
244-
case Artifact.flutterPreviewDevice:
245-
return 'flutter_preview$exe';
246241
}
247242
}
248243

@@ -672,7 +667,6 @@ class CachedArtifacts implements Artifacts {
672667
case Artifact.windowsCppClientWrapper:
673668
case Artifact.windowsDesktopPath:
674669
case Artifact.flutterToolsFileGenerators:
675-
case Artifact.flutterPreviewDevice:
676670
return _getHostArtifactPath(artifact, platform, mode);
677671
}
678672
}
@@ -724,7 +718,6 @@ class CachedArtifacts implements Artifacts {
724718
case Artifact.windowsCppClientWrapper:
725719
case Artifact.windowsDesktopPath:
726720
case Artifact.flutterToolsFileGenerators:
727-
case Artifact.flutterPreviewDevice:
728721
return _getHostArtifactPath(artifact, platform, mode);
729722
}
730723
}
@@ -771,7 +764,6 @@ class CachedArtifacts implements Artifacts {
771764
case Artifact.windowsCppClientWrapper:
772765
case Artifact.windowsDesktopPath:
773766
case Artifact.flutterToolsFileGenerators:
774-
case Artifact.flutterPreviewDevice:
775767
return _getHostArtifactPath(artifact, platform, mode);
776768
}
777769
}
@@ -823,7 +815,6 @@ class CachedArtifacts implements Artifacts {
823815
case Artifact.windowsCppClientWrapper:
824816
case Artifact.windowsDesktopPath:
825817
case Artifact.flutterToolsFileGenerators:
826-
case Artifact.flutterPreviewDevice:
827818
return _getHostArtifactPath(artifact, platform, mode);
828819
}
829820
}
@@ -955,9 +946,6 @@ class CachedArtifacts implements Artifacts {
955946
throw StateError('Artifact $artifact not available for platform $platform.');
956947
case Artifact.flutterToolsFileGenerators:
957948
return _getFileGeneratorsPath();
958-
case Artifact.flutterPreviewDevice:
959-
assert(platform == TargetPlatform.windows_x64);
960-
return _cache.getArtifactDirectory('flutter_preview').childFile('flutter_preview.exe').path;
961949
}
962950
}
963951

@@ -1442,13 +1430,6 @@ class CachedLocalEngineArtifacts implements Artifacts {
14421430
return _fileSystem.path.join(_getDartSdkPath(), 'bin', 'snapshots', artifactFileName);
14431431
case Artifact.flutterToolsFileGenerators:
14441432
return _getFileGeneratorsPath();
1445-
case Artifact.flutterPreviewDevice:
1446-
return _backupCache.getArtifactPath(
1447-
artifact,
1448-
platform: platform,
1449-
mode: mode,
1450-
environmentType: environmentType,
1451-
);
14521433
}
14531434
}
14541435

@@ -1624,7 +1605,6 @@ class CachedLocalWebSdkArtifacts implements Artifacts {
16241605
case Artifact.fontSubset:
16251606
case Artifact.constFinder:
16261607
case Artifact.flutterToolsFileGenerators:
1627-
case Artifact.flutterPreviewDevice:
16281608
break;
16291609
}
16301610
}

packages/flutter_tools/lib/src/commands/build.dart

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,11 @@
55
import 'package:meta/meta.dart';
66

77
import '../android/android_sdk.dart';
8-
import '../artifacts.dart';
98
import '../base/file_system.dart';
109
import '../base/logger.dart';
1110
import '../base/os.dart';
12-
import '../base/process.dart';
1311
import '../build_info.dart';
1412
import '../build_system/build_system.dart';
15-
import '../cache.dart';
1613
import '../commands/build_linux.dart';
1714
import '../commands/build_macos.dart';
1815
import '../commands/build_windows.dart';
@@ -24,18 +21,15 @@ import 'build_bundle.dart';
2421
import 'build_ios.dart';
2522
import 'build_ios_framework.dart';
2623
import 'build_macos_framework.dart';
27-
import 'build_preview.dart';
2824
import 'build_web.dart';
2925

3026
class BuildCommand extends FlutterCommand {
3127
BuildCommand({
32-
required Artifacts artifacts,
3328
required FileSystem fileSystem,
3429
required BuildSystem buildSystem,
3530
required OperatingSystemUtils osUtils,
3631
required Logger logger,
3732
required AndroidSdk? androidSdk,
38-
required ProcessUtils processUtils,
3933
bool verboseHelp = false,
4034
}) {
4135
_addSubcommand(
@@ -71,16 +65,6 @@ class BuildCommand extends FlutterCommand {
7165
_addSubcommand(
7266
BuildWindowsCommand(logger: logger, operatingSystemUtils: osUtils, verboseHelp: verboseHelp),
7367
);
74-
_addSubcommand(
75-
BuildPreviewCommand(
76-
artifacts: artifacts,
77-
flutterRoot: Cache.flutterRoot!,
78-
fs: fileSystem,
79-
logger: logger,
80-
processUtils: processUtils,
81-
verboseHelp: verboseHelp,
82-
),
83-
);
8468
}
8569

8670
void _addSubcommand(BuildSubCommand command) {

packages/flutter_tools/lib/src/commands/build_preview.dart

Lines changed: 0 additions & 118 deletions
This file was deleted.

packages/flutter_tools/lib/src/commands/daemon.dart

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -585,23 +585,6 @@ class DaemonDomain extends Domain {
585585
'fixCode': _ReasonCode.config.name,
586586
});
587587
}
588-
case PlatformType.windowsPreview:
589-
// TODO(fujino): detect if there any plugins with native code
590-
if (!featureFlags.isPreviewDeviceEnabled) {
591-
reasons.add(<String, Object>{
592-
'reasonText': 'the Preview Device feature is not enabled',
593-
'fixText': 'Run "flutter config --enable-flutter-preview',
594-
'fixCode': _ReasonCode.config.name,
595-
});
596-
}
597-
if (!supportedPlatforms.contains(SupportedPlatform.windows)) {
598-
reasons.add(<String, Object>{
599-
'reasonText': 'the Windows platform is not enabled for this project',
600-
'fixText':
601-
'Run "flutter create --platforms=windows ." in your application directory',
602-
'fixCode': _ReasonCode.create.name,
603-
});
604-
}
605588
}
606589

607590
if (reasons.isEmpty) {

packages/flutter_tools/lib/src/commands/widget_preview.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,6 @@ final class WidgetPreviewStartCommand extends WidgetPreviewSubCommandBase with C
253253
linuxPlatform: platform.isLinux,
254254
macOSPlatform: platform.isMacOS,
255255
windowsPlatform: platform.isWindows,
256-
allowedPlugins: const <String>[],
257256
);
258257

259258
// Generate initial package_config.json, otherwise the build will fail.

packages/flutter_tools/lib/src/device.dart

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,7 @@ enum PlatformType {
5050
macos,
5151
windows,
5252
fuchsia,
53-
custom,
54-
windowsPreview;
53+
custom;
5554

5655
@override
5756
String toString() => name;

packages/flutter_tools/lib/src/features.dart

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,6 @@ abstract class FeatureFlags {
4848
/// Whether native assets compilation and bundling is enabled.
4949
bool get isNativeAssetsEnabled => false;
5050

51-
/// Whether native assets compilation and bundling is enabled.
52-
bool get isPreviewDeviceEnabled => true;
53-
5451
/// Whether Swift Package Manager dependency management is enabled.
5552
bool get isSwiftPackageManagerEnabled => false;
5653

@@ -75,7 +72,6 @@ const List<Feature> allFeatures = <Feature>[
7572
flutterCustomDevicesFeature,
7673
cliAnimation,
7774
nativeAssets,
78-
previewDevice,
7975
swiftPackageManager,
8076
explicitPackageDependencies,
8177
];
@@ -159,15 +155,6 @@ const Feature nativeAssets = Feature(
159155
master: FeatureChannelSetting(available: true),
160156
);
161157

162-
/// Enable Flutter preview prebuilt device.
163-
const Feature previewDevice = Feature(
164-
name: 'Flutter preview prebuilt device',
165-
configSetting: 'enable-flutter-preview',
166-
environmentOverride: 'FLUTTER_PREVIEW_DEVICE',
167-
master: FeatureChannelSetting(available: true),
168-
beta: FeatureChannelSetting(available: true),
169-
);
170-
171158
/// Enable Swift Package Manager as a darwin dependency manager.
172159
const Feature swiftPackageManager = Feature(
173160
name: 'support for Swift Package Manager for iOS and macOS',

packages/flutter_tools/lib/src/flutter_device_manager.dart

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ import 'macos/macos_ipad_device.dart';
2525
import 'macos/macos_workflow.dart';
2626
import 'macos/xcdevice.dart';
2727
import 'native_assets.dart';
28-
import 'preview_device.dart';
2928
import 'tester/flutter_tester.dart';
3029
import 'version.dart';
3130
import 'web/web_device.dart';
@@ -94,14 +93,6 @@ class FlutterDeviceManager extends DeviceManager {
9493
fileSystem: fileSystem,
9594
operatingSystemUtils: operatingSystemUtils,
9695
),
97-
PreviewDeviceDiscovery(
98-
platform: platform,
99-
artifacts: artifacts,
100-
fileSystem: fileSystem,
101-
logger: logger,
102-
processManager: processManager,
103-
featureFlags: featureFlags,
104-
),
10596
LinuxDevices(
10697
platform: platform,
10798
featureFlags: featureFlags,

packages/flutter_tools/lib/src/flutter_features.dart

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,6 @@ class FlutterFeatureFlags implements FeatureFlags {
5555
@override
5656
bool get isNativeAssetsEnabled => isEnabled(nativeAssets);
5757

58-
@override
59-
bool get isPreviewDeviceEnabled => isEnabled(previewDevice);
60-
6158
@override
6259
bool get isSwiftPackageManagerEnabled => isEnabled(swiftPackageManager);
6360

0 commit comments

Comments
 (0)