Revert: Split the platform and cpuArch part of TargetPlatform (#190258)
Reverts: [Split the platform and cpuArch part of
TargetPlatform](https://github.com/flutter/flutter/pull/189479)
Initiated by: @chingjun
Reason for reverting: Broke postsubmit test. See
https://github.com/flutter/flutter/issues/190252
Original PR Author: @chingjun
Reviewed By: @bkonyi
The original PR description is provided below:
Convert `enum TargetPlatform` into a class with two fields:
`TargetPlatformType` and `CpuArch`.
Fixes: https://github.com/flutter/flutter/issues/190252
diff --git a/packages/flutter_tools/bin/fuchsia_asset_builder.dart b/packages/flutter_tools/bin/fuchsia_asset_builder.dart
index 1aaa82d..d6ad78f 100644
--- a/packages/flutter_tools/bin/fuchsia_asset_builder.dart
+++ b/packages/flutter_tools/bin/fuchsia_asset_builder.dart
@@ -66,7 +66,7 @@
packageConfigPath:
argResults[_kOptionPackages] as String? ??
findPackageConfigFileOrDefault(globals.fs.currentDirectory).path,
- targetPlatform: const TargetPlatform(.fuchsia, .arm64), // This is not arch specific.
+ targetPlatform: TargetPlatform.fuchsia_arm64, // This is not arch specific.
);
if (assets == null) {
diff --git a/packages/flutter_tools/lib/src/android/android_device.dart b/packages/flutter_tools/lib/src/android/android_device.dart
index 0535322..29cf0ae 100644
--- a/packages/flutter_tools/lib/src/android/android_device.dart
+++ b/packages/flutter_tools/lib/src/android/android_device.dart
@@ -191,6 +191,16 @@
}
@override
+ late final Future<TargetPlatform> targetPlatform = () async {
+ return switch (await cpuArch) {
+ CpuArch.arm64 => TargetPlatform.android_arm64,
+ CpuArch.armv7 => TargetPlatform.android_arm,
+ CpuArch.x64 => TargetPlatform.android_x64,
+ CpuArch.x86 || CpuArch.riscv64 || CpuArch.unknown => TargetPlatform.unsupported,
+ };
+ }();
+
+ @override
late final Future<CpuArch> cpuArch = () async {
// http://developer.android.com/ndk/guides/abis.html (x86, armeabi-v7a, ...)
final String? abi = await _getProperty('ro.product.cpu.abi');
@@ -217,7 +227,26 @@
@override
Future<bool> supportsRuntimeMode(BuildMode buildMode) async {
- return buildMode != .jitRelease;
+ switch (await targetPlatform) {
+ case TargetPlatform.android_arm:
+ case TargetPlatform.android_arm64:
+ case TargetPlatform.android_x64:
+ return buildMode != BuildMode.jitRelease;
+ case TargetPlatform.android:
+ case TargetPlatform.darwin:
+ case TargetPlatform.fuchsia_arm64:
+ case TargetPlatform.fuchsia_x64:
+ case TargetPlatform.ios:
+ case TargetPlatform.linux_arm64:
+ case TargetPlatform.linux_riscv64:
+ case TargetPlatform.linux_x64:
+ case TargetPlatform.tester:
+ case TargetPlatform.web_javascript:
+ case TargetPlatform.windows_x64:
+ case TargetPlatform.windows_arm64:
+ case TargetPlatform.unsupported:
+ throw UnsupportedError('Invalid target platform for Android');
+ }
}
@override
@@ -844,9 +873,13 @@
@override
Future<bool> isSupported() async {
- return switch (await cpuArch) {
- .arm64 || .armv7 || .x64 => true,
- .x86 || .riscv64 || .unknown => false,
+ final TargetPlatform platform = await targetPlatform;
+ return switch (platform) {
+ TargetPlatform.android ||
+ TargetPlatform.android_arm ||
+ TargetPlatform.android_arm64 ||
+ TargetPlatform.android_x64 => true,
+ _ => false,
};
}
diff --git a/packages/flutter_tools/lib/src/android/android_emulator.dart b/packages/flutter_tools/lib/src/android/android_emulator.dart
index c72d3a7..b8938b5 100644
--- a/packages/flutter_tools/lib/src/android/android_emulator.dart
+++ b/packages/flutter_tools/lib/src/android/android_emulator.dart
@@ -13,7 +13,6 @@
import '../base/logger.dart';
import '../base/process.dart';
import '../base/utils.dart';
-import '../build_info.dart';
import '../device.dart';
import '../emulator.dart';
import 'android_sdk.dart';
diff --git a/packages/flutter_tools/lib/src/android/gradle_utils.dart b/packages/flutter_tools/lib/src/android/gradle_utils.dart
index 16fa52f..770e287 100644
--- a/packages/flutter_tools/lib/src/android/gradle_utils.dart
+++ b/packages/flutter_tools/lib/src/android/gradle_utils.dart
@@ -1191,13 +1191,13 @@
if (buildInfo != null) {
changeIfNecessary('flutter.buildMode', buildInfo.modeName);
final String? buildName = validatedBuildNameForPlatform(
- PlatformType.android,
+ TargetPlatform.android_arm,
buildInfo.buildName ?? project.manifest.buildName,
globals.logger,
);
changeIfNecessary('flutter.versionName', buildName);
final String? buildNumber = validatedBuildNumberForPlatform(
- PlatformType.android,
+ TargetPlatform.android_arm,
buildInfo.buildNumber ?? project.manifest.buildNumber,
globals.logger,
);
diff --git a/packages/flutter_tools/lib/src/artifacts.dart b/packages/flutter_tools/lib/src/artifacts.dart
index e9ee816..2c4d4b7 100644
--- a/packages/flutter_tools/lib/src/artifacts.dart
+++ b/packages/flutter_tools/lib/src/artifacts.dart
@@ -197,18 +197,37 @@
// TODO(knopp): Remove once darwin artifacts are universal and moved out of darwin-x64
String _enginePlatformDirectoryName(TargetPlatform platform) {
- if (platform.type == .macos) {
+ if (platform == TargetPlatform.darwin) {
return 'darwin-x64';
}
- // iOS engine artifacts live in a single `ios` directory regardless of the
- // target architecture, so the arch-qualified name from [getName] is not used
- // here.
- if (platform.type == .ios) {
- return 'ios';
- }
return platform.getName();
}
+// Remove android target platform type.
+TargetPlatform? _mapTargetPlatform(TargetPlatform? targetPlatform) {
+ switch (targetPlatform) {
+ case TargetPlatform.android:
+ return TargetPlatform.android_arm64;
+ case TargetPlatform.ios:
+ case TargetPlatform.darwin:
+ case TargetPlatform.linux_x64:
+ case TargetPlatform.linux_arm64:
+ case TargetPlatform.linux_riscv64:
+ case TargetPlatform.windows_x64:
+ case TargetPlatform.windows_arm64:
+ case TargetPlatform.fuchsia_arm64:
+ case TargetPlatform.fuchsia_x64:
+ case TargetPlatform.tester:
+ case TargetPlatform.web_javascript:
+ case TargetPlatform.android_arm:
+ case TargetPlatform.android_arm64:
+ case TargetPlatform.android_x64:
+ case TargetPlatform.unsupported:
+ case null:
+ return targetPlatform;
+ }
+}
+
class EngineBuildPaths {
const EngineBuildPaths({
required this.targetEngine,
@@ -402,34 +421,35 @@
BuildMode? mode,
EnvironmentType? environmentType,
}) {
- switch (platform?.type) {
- case .android:
- // A generic Android target has an unknown CPU architecture (e.g. the
- // architecture-independent patched SDK requested when compiling the
- // app's Dart kernel). Default to arm64 in that case, matching the
- // historical behavior of the removed `_mapTargetPlatform` helper.
- final TargetPlatform androidPlatform = platform!.cpuArch == .unknown
- ? const TargetPlatform(.android, .arm64)
- : platform;
- return _getAndroidArtifactPath(artifact, androidPlatform, mode!);
- case .ios:
+ platform = _mapTargetPlatform(platform);
+ switch (platform) {
+ case TargetPlatform.android:
+ case TargetPlatform.android_arm:
+ case TargetPlatform.android_arm64:
+ case TargetPlatform.android_x64:
+ assert(platform != TargetPlatform.android);
+ return _getAndroidArtifactPath(artifact, platform!, mode!);
+ case TargetPlatform.ios:
return _getIosArtifactPath(artifact, platform!, mode, environmentType);
- case .macos:
- case .linux:
- case .windows:
+ case TargetPlatform.darwin:
+ case TargetPlatform.linux_x64:
+ case TargetPlatform.linux_arm64:
+ case TargetPlatform.linux_riscv64:
+ case TargetPlatform.windows_x64:
+ case TargetPlatform.windows_arm64:
return _getDesktopArtifactPath(artifact, platform!, mode);
- case .fuchsia:
+ case TargetPlatform.fuchsia_arm64:
+ case TargetPlatform.fuchsia_x64:
return _getFuchsiaArtifactPath(artifact, platform!, mode!);
- case .tester:
- case .web:
- case .custom:
+ case TargetPlatform.tester:
+ case TargetPlatform.web_javascript:
case null:
return _getHostArtifactPath(
artifact,
platform ?? _currentHostPlatform(_platform, _operatingSystemUtils),
mode,
);
- case .unsupported:
+ case TargetPlatform.unsupported:
TargetPlatform.throwUnsupportedTarget();
}
}
@@ -657,11 +677,7 @@
case Artifact.genSnapshotX64:
// For script snapshots any gen_snapshot binary will do. Returning gen_snapshot for
// android_arm in profile mode because it is available on all supported host platforms.
- return _getAndroidArtifactPath(
- artifact,
- const TargetPlatform(.android, .armv7),
- BuildMode.profile,
- );
+ return _getAndroidArtifactPath(artifact, TargetPlatform.android_arm, BuildMode.profile);
case Artifact.frontendServerSnapshotForEngineDartSdk:
return _fileSystem.path.join(
_dartSdkPath(_cache),
@@ -769,10 +785,13 @@
String? _getEngineArtifactsPath(TargetPlatform platform, [BuildMode? mode]) {
final String engineDir = _cache.getArtifactDirectory('engine').path;
final String platformName = _enginePlatformDirectoryName(platform);
- switch (platform.type) {
- case .linux:
- case .macos:
- case .windows:
+ switch (platform) {
+ case TargetPlatform.linux_x64:
+ case TargetPlatform.linux_arm64:
+ case TargetPlatform.linux_riscv64:
+ case TargetPlatform.darwin:
+ case TargetPlatform.windows_x64:
+ case TargetPlatform.windows_arm64:
// TODO(zanderso): remove once debug desktop artifacts are uploaded
// under a separate directory from the host artifacts.
// https://github.com/flutter/flutter/issues/38935
@@ -781,25 +800,23 @@
}
final suffix = mode != BuildMode.debug ? '-${kebabCase(mode.cliName)}' : '';
return _fileSystem.path.join(engineDir, platformName + suffix);
- case .fuchsia:
- case .tester:
- case .web:
+ case TargetPlatform.fuchsia_arm64:
+ case TargetPlatform.fuchsia_x64:
+ case TargetPlatform.tester:
+ case TargetPlatform.web_javascript:
assert(mode == null, 'Platform $platform does not support different build modes.');
return _fileSystem.path.join(engineDir, platformName);
- case .ios:
+ case TargetPlatform.ios:
+ case TargetPlatform.android_arm:
+ case TargetPlatform.android_arm64:
+ case TargetPlatform.android_x64:
assert(mode != null, 'Need to specify a build mode for platform $platform.');
final suffix = mode != BuildMode.debug ? '-${kebabCase(mode!.cliName)}' : '';
return _fileSystem.path.join(engineDir, platformName + suffix);
- case .android:
- assert(
- platform.cpuArch != .unknown,
- 'cannot use a generic Android platform to look up artifacts',
- );
- assert(mode != null, 'Need to specify a build mode for platform $platform.');
- final suffix = mode != BuildMode.debug ? '-${kebabCase(mode!.cliName)}' : '';
- return _fileSystem.path.join(engineDir, platformName + suffix);
- case .custom:
- case .unsupported:
+ case TargetPlatform.android:
+ assert(false, 'cannot use TargetPlatform.android to look up artifacts');
+ return null;
+ case TargetPlatform.unsupported:
TargetPlatform.throwUnsupportedTarget();
}
}
@@ -809,15 +826,20 @@
}
TargetPlatform _currentHostPlatform(Platform platform, OperatingSystemUtils operatingSystemUtils) {
- final cpuArch = CpuArch.fromHostPlatform(operatingSystemUtils.hostPlatform);
if (platform.isMacOS) {
- return TargetPlatform(.macos, cpuArch);
+ return TargetPlatform.darwin;
}
if (platform.isLinux) {
- return TargetPlatform(.linux, cpuArch);
+ return switch (operatingSystemUtils.hostPlatform) {
+ HostPlatform.linux_x64 => TargetPlatform.linux_x64,
+ HostPlatform.linux_riscv64 => TargetPlatform.linux_riscv64,
+ _ => TargetPlatform.linux_arm64,
+ };
}
if (platform.isWindows) {
- return TargetPlatform(.windows, cpuArch);
+ return operatingSystemUtils.hostPlatform == HostPlatform.windows_arm64
+ ? TargetPlatform.windows_arm64
+ : TargetPlatform.windows_x64;
}
throw UnimplementedError('Host OS not supported.');
}
@@ -1039,6 +1061,7 @@
EnvironmentType? environmentType,
}) {
platform ??= _currentHostPlatform(_platform, _operatingSystemUtils);
+ platform = _mapTargetPlatform(platform);
final isDirectoryArtifact = artifact == Artifact.flutterPatchedSdkPath;
final String? artifactFileName = isDirectoryArtifact
? null
@@ -1050,7 +1073,7 @@
case Artifact.genSnapshotX64:
return _genSnapshotPath(artifact);
case Artifact.flutterTester:
- return _flutterTesterPath(platform);
+ return _flutterTesterPath(platform!);
case Artifact.isolateSnapshotData:
case Artifact.vmSnapshotData:
return _fileSystem.path.join(
@@ -1066,7 +1089,7 @@
case Artifact.flutterMacOSXcframework:
return _fileSystem.path.join(localEngineInfo.targetOutPath, artifactFileName);
case Artifact.platformKernelDill:
- if (platform.type == .fuchsia) {
+ if (platform == TargetPlatform.fuchsia_x64 || platform == TargetPlatform.fuchsia_arm64) {
return _fileSystem.path.join(
localEngineInfo.targetOutPath,
'flutter_runner_patched_sdk',
@@ -1099,7 +1122,7 @@
// what was specified in [mode] argument because local engine will
// have only one flutter_patched_sdk in standard location, that
// is happen to be what debug(non-release) mode is using.
- if (platform.type == .fuchsia) {
+ if (platform == TargetPlatform.fuchsia_x64 || platform == TargetPlatform.fuchsia_arm64) {
return _fileSystem.path.join(localEngineInfo.targetOutPath, 'flutter_runner_patched_sdk');
}
return _getFlutterPatchedSdkPath(BuildMode.debug);
@@ -1237,7 +1260,7 @@
BuildMode? mode,
EnvironmentType? environmentType,
}) {
- if (platform?.type == .web) {
+ if (platform == TargetPlatform.web_javascript) {
switch (artifact) {
case Artifact.engineDartSdkPath:
return _getDartSdkPath();
@@ -1444,7 +1467,7 @@
final buffer = StringBuffer();
buffer.write(artifact);
if (platform != null) {
- buffer.write('.${_enginePlatformDirectoryName(platform)}');
+ buffer.write('.$platform');
}
if (mode != null) {
buffer.write('.$mode');
@@ -1553,25 +1576,30 @@
String _getPrebuiltTarget(Platform platform, OperatingSystemUtils operatingSystemUtils) {
final TargetPlatform hostPlatform = _currentHostPlatform(platform, operatingSystemUtils);
- switch (hostPlatform.type) {
- case .macos:
+ switch (hostPlatform) {
+ case TargetPlatform.darwin:
return 'macos-x64';
- case .linux:
- return switch (hostPlatform.cpuArch) {
- .riscv64 => 'linux-riscv64',
- .arm64 => 'linux-arm64',
- _ => 'linux-x64',
- };
- case .windows:
- return hostPlatform.cpuArch == .arm64 ? 'windows-arm64' : 'windows-x64';
- case .ios:
- case .android:
- case .fuchsia:
- case .web:
- case .tester:
- case .custom:
+ case TargetPlatform.linux_riscv64:
+ return 'linux-riscv64';
+ case TargetPlatform.linux_arm64:
+ return 'linux-arm64';
+ case TargetPlatform.linux_x64:
+ return 'linux-x64';
+ case TargetPlatform.windows_x64:
+ return 'windows-x64';
+ case TargetPlatform.windows_arm64:
+ return 'windows-arm64';
+ case TargetPlatform.ios:
+ case TargetPlatform.android:
+ case TargetPlatform.android_arm:
+ case TargetPlatform.android_arm64:
+ case TargetPlatform.android_x64:
+ case TargetPlatform.fuchsia_arm64:
+ case TargetPlatform.fuchsia_x64:
+ case TargetPlatform.web_javascript:
+ case TargetPlatform.tester:
throwToolExit('Unsupported host platform: $hostPlatform');
- case .unsupported:
+ case TargetPlatform.unsupported:
TargetPlatform.throwUnsupportedTarget();
}
}
diff --git a/packages/flutter_tools/lib/src/asset.dart b/packages/flutter_tools/lib/src/asset.dart
index b106b3c..70af6b2 100644
--- a/packages/flutter_tools/lib/src/asset.dart
+++ b/packages/flutter_tools/lib/src/asset.dart
@@ -356,7 +356,7 @@
transformers: const <AssetTransformerEntry>[],
);
// Create .bin.json on web builds.
- if (targetPlatform.type == .web) {
+ if (targetPlatform == TargetPlatform.web_javascript) {
entries[_kAssetManifestBinJsonFilename] = AssetBundleEntry(
DevFSStringContent('""'),
kind: AssetKind.regular,
@@ -660,7 +660,7 @@
_setIfChanged(_kAssetManifestBinFilename, assetManifestBinary, AssetKind.regular);
// Create .bin.json on web builds.
- if (targetPlatform.type == .web) {
+ if (targetPlatform == TargetPlatform.web_javascript) {
final assetManifestBinaryJson = DevFSStringContent(
json.encode(base64.encode(assetManifestBinary.bytes)),
);
@@ -719,7 +719,7 @@
// On the web, don't compress the NOTICES file since the client doesn't have
// dart:io to decompress it. So use the standard _setIfChanged to check if
// the strings still match.
- if (targetPlatform.type == .web) {
+ if (targetPlatform == TargetPlatform.web_javascript) {
_setIfChanged(_kNoticeFile, DevFSStringContent(combinedLicenses), AssetKind.regular);
return;
}
@@ -1398,11 +1398,7 @@
required Set<String> platforms,
required List<AssetTransformerEntry> transformers,
}) {
- _ensureAssetPathIsValid(
- assetsBaseDir: assetsBaseDir,
- assetUri: assetUri,
- packageName: packageName,
- );
+ _ensureAssetPathIsValid(assetsBaseDir: assetsBaseDir, assetUri: assetUri, packageName: packageName);
if (assetUri.pathSegments.first == 'packages' &&
!_fileSystem.isFileSync(
_fileSystem.path.join(assetsBaseDir, _fileSystem.path.fromUri(assetUri)),
@@ -1546,7 +1542,7 @@
}
bool matchesPlatform(TargetPlatform targetPlatform) {
- if (platforms.isEmpty || targetPlatform.type == .tester) {
+ if (platforms.isEmpty || targetPlatform == TargetPlatform.tester) {
return true;
}
diff --git a/packages/flutter_tools/lib/src/base/build.dart b/packages/flutter_tools/lib/src/base/build.dart
index 55abebb..d836785 100644
--- a/packages/flutter_tools/lib/src/base/build.dart
+++ b/packages/flutter_tools/lib/src/base/build.dart
@@ -57,18 +57,26 @@
Future<int> run({
required SnapshotType snapshotType,
+ // TODO(chingjun): The [CpuArch] parameter is only used for iOS builds (to
+ // select the correct per-architecture gen_snapshot). This architecture
+ // information should instead be consolidated into [TargetPlatform] so that
+ // callers do not need to pass it separately.
+ CpuArch? cpuArch,
Iterable<String> additionalArgs = const <String>[],
}) {
+ assert(cpuArch != CpuArch.armv7);
+ assert(snapshotType.platform != TargetPlatform.ios || cpuArch != null);
final args = <String>[...additionalArgs];
// iOS and macOS have separate gen_snapshot binaries for each target
- // architecture (iOS: arm64; macOS: x86_64, arm64). Select the right
+ // architecture (iOS: armv7, arm64; macOS: x86_64, arm64). Select the right
// one for the target architecture in question.
Artifact genSnapshotArtifact;
- if (snapshotType.platform.type == .ios || snapshotType.platform.type == .macos) {
- final CpuArch cpuArch = snapshotType.platform.cpuArch;
- assert(cpuArch == .arm64 || cpuArch == .x64);
- genSnapshotArtifact = cpuArch == .arm64 ? Artifact.genSnapshotArm64 : Artifact.genSnapshotX64;
+ if (snapshotType.platform == TargetPlatform.ios ||
+ snapshotType.platform == TargetPlatform.darwin) {
+ genSnapshotArtifact = cpuArch == CpuArch.arm64
+ ? Artifact.genSnapshotArm64
+ : Artifact.genSnapshotX64;
} else {
genSnapshotArtifact = Artifact.genSnapshot;
}
@@ -109,12 +117,15 @@
required BuildMode buildMode,
required String mainPath,
required String outputPath,
+ CpuArch? cpuArch,
String? sdkRoot,
List<String> extraGenSnapshotOptions = const <String>[],
String? splitDebugInfo,
required bool dartObfuscation,
bool quiet = false,
}) async {
+ assert(platform != TargetPlatform.ios || cpuArch != null);
+
if (!_isValidAotPlatform(platform, buildMode)) {
_logger.printError('${platform.getName()} does not support AOT compilation.');
return 1;
@@ -125,14 +136,19 @@
final genSnapshotArgs = <String>['--deterministic'];
- final bool targetingApplePlatform = platform.type == .ios || platform.type == .macos;
+ final bool targetingApplePlatform =
+ platform == TargetPlatform.ios || platform == TargetPlatform.darwin;
_logger.printTrace('targetingApplePlatform = $targetingApplePlatform');
final bool extractAppleDebugSymbols =
buildMode == BuildMode.profile || buildMode == BuildMode.release;
_logger.printTrace('extractAppleDebugSymbols = $extractAppleDebugSymbols');
- final targetingAndroidPlatform = platform.type == .android;
+ final bool targetingAndroidPlatform =
+ platform == TargetPlatform.android ||
+ platform == TargetPlatform.android_arm ||
+ platform == TargetPlatform.android_arm64 ||
+ platform == TargetPlatform.android_x64;
_logger.printTrace('targetingAndroidPlatform = $targetingAndroidPlatform');
// We strip snapshot by default, but allow to suppress this behavior
@@ -156,7 +172,7 @@
// library that the end-developer can link into their app.
const frameworkName = 'App.framework';
if (!quiet) {
- final String targetArch = platform.cpuArch.darwinArchName;
+ final String targetArch = cpuArch!.darwinArchName;
_logger.printStatus('Building $frameworkName for $targetArch...');
}
frameworkPath = _fileSystem.path.join(outputPath, frameworkName);
@@ -168,7 +184,7 @@
// When the minimum version is updated, remember to update
// template MinimumOSVersion.
// https://github.com/flutter/flutter/pull/62902
- final minOSVersion = platform.type == .ios
+ final minOSVersion = platform == TargetPlatform.ios
? FlutterDarwinPlatform.ios.deploymentTarget().toString()
: FlutterDarwinPlatform.macos.deploymentTarget().toString();
genSnapshotArgs.addAll(<String>[
@@ -202,7 +218,7 @@
}
}
- if (platform == const TargetPlatform(.android, .armv7)) {
+ if (platform == TargetPlatform.android_arm) {
// Use softfp for Android armv7 devices.
// TODO(cbracken): eliminate this when we fix https://github.com/flutter/flutter/issues/17489
genSnapshotArgs.add('--no-sim-use-hardfp');
@@ -213,9 +229,8 @@
// The name of the debug file must contain additional information about
// the architecture, since a single build command may produce
- // multiple debug files. [TargetPlatform.getName] already includes the
- // architecture for the platforms that need it (e.g. `ios-arm64`).
- final String archName = platform.getName();
+ // multiple debug files.
+ final String archName = platform.getName(cpuArch: cpuArch);
final debugFilename = 'app.$archName.symbols';
final bool shouldSplitDebugInfo = splitDebugInfo?.isNotEmpty ?? false;
if (shouldSplitDebugInfo) {
@@ -238,6 +253,7 @@
final int genSnapshotExitCode = await _genSnapshot.run(
snapshotType: snapshotType,
additionalArgs: genSnapshotArgs,
+ cpuArch: cpuArch,
);
if (genSnapshotExitCode != 0) {
_logger.printError('Dart snapshot generator failed with exit code $genSnapshotExitCode');
@@ -285,9 +301,17 @@
if (buildMode == BuildMode.debug) {
return false;
}
- return switch (platform.type) {
- .android || .ios || .macos || .linux || .windows => true,
- _ => false,
- };
+ return const <TargetPlatform>[
+ TargetPlatform.android_arm,
+ TargetPlatform.android_arm64,
+ TargetPlatform.android_x64,
+ TargetPlatform.ios,
+ TargetPlatform.darwin,
+ TargetPlatform.linux_x64,
+ TargetPlatform.linux_arm64,
+ TargetPlatform.linux_riscv64,
+ TargetPlatform.windows_x64,
+ TargetPlatform.windows_arm64,
+ ].contains(platform);
}
}
diff --git a/packages/flutter_tools/lib/src/base/dds.dart b/packages/flutter_tools/lib/src/base/dds.dart
index a8889ee..e498bde 100644
--- a/packages/flutter_tools/lib/src/base/dds.dart
+++ b/packages/flutter_tools/lib/src/base/dds.dart
@@ -10,6 +10,7 @@
import 'package:meta/meta.dart';
import '../artifacts.dart';
+import '../build_info.dart';
import '../device.dart';
import '../globals.dart' as globals;
import '../resident_runner.dart';
@@ -266,7 +267,7 @@
if (!(await _waitForExtensionsForDevice(device, method))) {
return;
}
- if (device.targetPlatform.type == .web) {
+ if (device.targetPlatform == TargetPlatform.web_javascript) {
await device.vmService!.callMethodWrapper(method, args: params);
return;
}
diff --git a/packages/flutter_tools/lib/src/build_info.dart b/packages/flutter_tools/lib/src/build_info.dart
index ed83b8b..551da4d 100644
--- a/packages/flutter_tools/lib/src/build_info.dart
+++ b/packages/flutter_tools/lib/src/build_info.dart
@@ -513,14 +513,14 @@
enum EnvironmentType { physical, simulator }
String? validatedBuildNumberForPlatform(
- PlatformType platformType,
+ TargetPlatform targetPlatform,
String? buildNumber,
Logger logger,
) {
if (buildNumber == null) {
return null;
}
- if (platformType == .ios || platformType == .macos) {
+ if (targetPlatform == TargetPlatform.ios || targetPlatform == TargetPlatform.darwin) {
// See CFBundleVersion at https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
final disallowed = RegExp(r'[^\d\.]');
String tmpBuildNumber = buildNumber.replaceAll(disallowed, '');
@@ -543,7 +543,9 @@
}
return tmpBuildNumber;
}
- if (platformType == .android) {
+ if (targetPlatform == TargetPlatform.android_arm ||
+ targetPlatform == TargetPlatform.android_arm64 ||
+ targetPlatform == TargetPlatform.android_x64) {
// See versionCode at https://developer.android.com/studio/publish/versioning
final disallowed = RegExp(r'[^\d]');
String tmpBuildNumberStr = buildNumber.replaceAll(disallowed, '');
@@ -563,11 +565,15 @@
return buildNumber;
}
-String? validatedBuildNameForPlatform(PlatformType platformType, String? buildName, Logger logger) {
+String? validatedBuildNameForPlatform(
+ TargetPlatform targetPlatform,
+ String? buildName,
+ Logger logger,
+) {
if (buildName == null) {
return null;
}
- if (platformType == .ios || platformType == .macos) {
+ if (targetPlatform == TargetPlatform.ios || targetPlatform == TargetPlatform.darwin) {
// See CFBundleShortVersionString at https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
final disallowed = RegExp(r'[^\d\.]');
String tmpBuildName = buildName.replaceAll(disallowed, '');
@@ -590,7 +596,13 @@
}
return tmpBuildName;
}
- // See versionName at https://developer.android.com/studio/publish/versioning for Android.
+ if (targetPlatform == TargetPlatform.android ||
+ targetPlatform == TargetPlatform.android_arm ||
+ targetPlatform == TargetPlatform.android_arm64 ||
+ targetPlatform == TargetPlatform.android_x64) {
+ // See versionName at https://developer.android.com/studio/publish/versioning
+ return buildName;
+ }
return buildName;
}
@@ -683,162 +695,109 @@
};
}
-/// The type of platform (OS / runtime family) that a target or device
-/// represents.
-///
-/// This is combined with a [CpuArch] to form a [TargetPlatform].
-enum PlatformType {
- web,
- android,
- ios,
- linux,
- macos,
- windows,
- fuchsia,
- custom,
- tester,
- unsupported;
+enum TargetPlatform {
+ android('android'),
+ ios('ios'),
+ darwin('darwin'),
+ linux_x64('linux-x64'),
+ linux_arm64('linux-arm64'),
+ linux_riscv64('linux-riscv64'),
+ windows_x64('windows-x64'),
+ windows_arm64('windows-arm64'),
+ fuchsia_arm64('fuchsia-arm64'),
+ fuchsia_x64('fuchsia-x64'),
+ tester('flutter-tester'),
+ web_javascript('web-javascript'),
+ // The arch specific android target platforms are soft-deprecated.
+ // Instead of using TargetPlatform as a combination arch + platform
+ // the code will be updated to carry arch information in [CpuArch].
+ android_arm('android-arm'),
+ android_arm64('android-arm64'),
+ android_x64('android-x64'),
+ unsupported('unsupported');
- @override
- String toString() => name;
-
- static PlatformType? fromString(String platformType) => values.asNameMap()[platformType];
-}
-
-/// The platform a Flutter application is built for.
-///
-/// A [TargetPlatform] is the combination of a [PlatformType] (the OS / runtime
-/// family, e.g. Android or macOS) and a [CpuArch] (the CPU architecture, e.g.
-/// arm64).
-///
-/// Code that needs to branch on the platform should generally inspect [type]
-/// and/or [cpuArch].
-@immutable
-final class TargetPlatform {
- const TargetPlatform(this.type, this.cpuArch);
+ const TargetPlatform(this._defaultName);
factory TargetPlatform.fromName(String name) {
return switch (name) {
- 'android' => const TargetPlatform(.android, .unknown),
- 'android-arm' => const TargetPlatform(.android, .armv7),
- 'android-arm64' => const TargetPlatform(.android, .arm64),
- 'android-x64' => const TargetPlatform(.android, .x64),
- 'fuchsia-arm64' => const TargetPlatform(.fuchsia, .arm64),
- 'fuchsia-x64' => const TargetPlatform(.fuchsia, .x64),
- // `ios` is architecture-agnostic and defaults to arm64; `ios-arm64` and
- // `ios-x64` (simulator) name a specific architecture.
- 'ios' || 'ios-arm64' => const TargetPlatform(.ios, .arm64),
- 'ios-x64' => const TargetPlatform(.ios, .x64),
- 'ios-armv7' => const TargetPlatform(.ios, .armv7),
- // `darwin` is architecture-agnostic and defaults to arm64 (Apple
- // Silicon); `darwin-x64` and `darwin-arm64` name a specific architecture.
- 'darwin' || 'darwin-arm64' => const TargetPlatform(.macos, .arm64),
- 'darwin-x64' => const TargetPlatform(.macos, .x64),
- 'linux-x64' => const TargetPlatform(.linux, .x64),
- 'linux-arm64' => const TargetPlatform(.linux, .arm64),
- 'linux-riscv64' => const TargetPlatform(.linux, .riscv64),
- 'windows-x64' => const TargetPlatform(.windows, .x64),
- 'windows-arm64' => const TargetPlatform(.windows, .arm64),
- 'web-javascript' => const TargetPlatform(.web, .unknown),
- 'flutter-tester' => const TargetPlatform(.tester, .unknown),
+ 'android' => TargetPlatform.android,
+ 'android-arm' => TargetPlatform.android_arm,
+ 'android-arm64' => TargetPlatform.android_arm64,
+ 'android-x64' => TargetPlatform.android_x64,
+ 'fuchsia-arm64' => TargetPlatform.fuchsia_arm64,
+ 'fuchsia-x64' => TargetPlatform.fuchsia_x64,
+ 'ios' => TargetPlatform.ios,
+ // For backward-compatibility and also for Tester, where it must match
+ // host platform name (HostPlatform.darwin_x64)
+ 'darwin' || 'darwin-x64' || 'darwin-arm64' => TargetPlatform.darwin,
+ 'linux-x64' => TargetPlatform.linux_x64,
+ 'linux-arm64' => TargetPlatform.linux_arm64,
+ 'linux-riscv64' => TargetPlatform.linux_riscv64,
+ 'windows-x64' => TargetPlatform.windows_x64,
+ 'windows-arm64' => TargetPlatform.windows_arm64,
+ 'web-javascript' => TargetPlatform.web_javascript,
+ 'flutter-tester' => TargetPlatform.tester,
_ => throw Exception('Unsupported platform name "$name"'),
};
}
- /// The platform type (OS / runtime family).
- final PlatformType type;
+ final String _defaultName;
- /// The CPU architecture of the target.
- ///
- /// This is [CpuArch.unknown] only when a CPU architecture is not applicable
- /// (e.g. web) or has not yet been resolved (e.g. a generic Android target).
- final CpuArch cpuArch;
-
- /// The canonical set of known target platforms.
- ///
- /// This mirrors the values that used to exist when [TargetPlatform] was an
- /// enum, and is primarily useful for tests that need to iterate over all
- /// known platforms.
- static const List<TargetPlatform> values = <TargetPlatform>[
- TargetPlatform(.android, .unknown),
- TargetPlatform(.ios, .arm64),
- TargetPlatform(.macos, .arm64),
- TargetPlatform(.linux, .x64),
- TargetPlatform(.linux, .arm64),
- TargetPlatform(.linux, .riscv64),
- TargetPlatform(.windows, .x64),
- TargetPlatform(.windows, .arm64),
- TargetPlatform(.fuchsia, .arm64),
- TargetPlatform(.fuchsia, .x64),
- TargetPlatform(.tester, .unknown),
- TargetPlatform(.web, .unknown),
- TargetPlatform(.android, .armv7),
- TargetPlatform(.android, .arm64),
- TargetPlatform(.android, .x64),
- TargetPlatform(.unsupported, .unknown),
- ];
-
- @override
- bool operator ==(Object other) =>
- other is TargetPlatform && other.type == type && other.cpuArch == cpuArch;
-
- @override
- int get hashCode => Object.hash(type, cpuArch);
-
- /// The canonical string name for this target platform.
- ///
- /// The name generally follows the `<platform>-<arch>` convention (e.g.
- /// `linux-x64`, `android-arm64`, `ios-arm64`, `darwin-x64`), with a few
- /// historical exceptions retained for backward compatibility (e.g. the macOS
- /// platform is named `darwin`, and `flutter-tester`). When the architecture
- /// is not known ([CpuArch.unknown]), the bare platform name is used (e.g.
- /// `ios`, `darwin`, `android`).
- String getName() {
- return switch (type) {
- .android => cpuArch == .unknown ? 'android' : cpuArch.androidPlatformName,
- .ios => cpuArch == .unknown ? 'ios' : 'ios-${cpuArch.dartName}',
- .macos => cpuArch == .unknown ? 'darwin' : 'darwin-${cpuArch.dartName}',
- .linux || .windows || .fuchsia => '${type.name}-${cpuArch.dartName}',
- .tester => 'flutter-tester',
- .web => 'web-javascript',
- .unsupported => 'unsupported',
- .custom => throw UnsupportedError('Unexpected target platform $this'),
+ String getName({CpuArch? cpuArch}) {
+ return switch (this) {
+ TargetPlatform.ios when cpuArch != null => 'ios-${cpuArch.darwinArchName}',
+ TargetPlatform.darwin when cpuArch != null => 'darwin-${cpuArch.darwinArchName}',
+ _ => _defaultName,
};
}
- /// The platform name used to identify a device, e.g. in the `flutter devices`
- /// output, the daemon protocol, and analytics.
- ///
- /// This is like [getName], but omits the CPU architecture for iOS and macOS,
- /// preserving the historical device platform identifiers (`ios`, `darwin`).
- /// The architecture of a device is reported separately (e.g. via the device's
- /// `cpuArch`), so it is not duplicated here.
- String get devicePlatformName => switch (type) {
- .ios => 'ios',
- .macos => 'darwin',
- _ => getName(),
+ String get fuchsiaArchForTargetPlatform => switch (this) {
+ fuchsia_arm64 => 'arm64',
+ fuchsia_x64 => 'x64',
+ android ||
+ android_arm ||
+ android_arm64 ||
+ android_x64 ||
+ darwin ||
+ ios ||
+ linux_arm64 ||
+ linux_riscv64 ||
+ linux_x64 ||
+ tester ||
+ web_javascript ||
+ windows_x64 ||
+ windows_arm64 ||
+ unsupported => throw UnsupportedError('Unexpected Fuchsia platform $this'),
};
- String get fuchsiaArchForTargetPlatform => switch (type) {
- .fuchsia => cpuArch == .arm64 ? 'arm64' : 'x64',
- _ => throw UnsupportedError('Unexpected Fuchsia platform $this'),
+ String get osName => switch (this) {
+ linux_x64 || linux_arm64 || linux_riscv64 => 'linux',
+ darwin => 'macos',
+ windows_x64 || windows_arm64 => 'windows',
+ android || android_arm || android_arm64 || android_x64 => 'android',
+ fuchsia_arm64 || fuchsia_x64 => 'fuchsia',
+ ios => 'ios',
+ tester => 'flutter-tester',
+ web_javascript => 'web',
+ unsupported => throw UnsupportedError('Unexpected target platform $this'),
};
- String get osName => switch (type) {
- .linux => 'linux',
- .macos => 'macos',
- .windows => 'windows',
- .android => 'android',
- .fuchsia => 'fuchsia',
- .ios => 'ios',
- .tester => 'flutter-tester',
- .web => 'web',
- .custom || .unsupported => throw UnsupportedError('Unexpected target platform $this'),
+ String get simpleName => switch (this) {
+ linux_x64 || darwin || windows_x64 => 'x64',
+ linux_arm64 || windows_arm64 => 'arm64',
+ linux_riscv64 => 'riscv64',
+ android ||
+ android_arm ||
+ android_arm64 ||
+ android_x64 ||
+ fuchsia_arm64 ||
+ fuchsia_x64 ||
+ ios ||
+ tester ||
+ web_javascript ||
+ unsupported => throw UnsupportedError('Unexpected target platform $this'),
};
- @override
- String toString() => getName();
-
static Never throwUnsupportedTarget() =>
throw UnsupportedError('Target platform is unsupported.');
}
@@ -992,7 +951,7 @@
String getLinuxBuildDirectory([TargetPlatform? targetPlatform, String? flavor]) {
final String arch = (targetPlatform == null)
? _getCurrentHostPlatformArchName()
- : targetPlatform.cpuArch.dartName;
+ : targetPlatform.simpleName;
final String subDirs = (flavor != null && flavor.isNotEmpty)
? globals.fs.path.join('linux', arch, flavor)
: globals.fs.path.join('linux', arch);
@@ -1004,7 +963,7 @@
/// When [flavor] is non-empty, a `/<flavor>` segment is inserted so that
/// different flavors can coexist on disk without overwriting each other.
String getWindowsBuildDirectory(TargetPlatform targetPlatform, [String? flavor]) {
- final String arch = targetPlatform.cpuArch.dartName;
+ final String arch = targetPlatform.simpleName;
final String subDirs = (flavor != null && flavor.isNotEmpty)
? globals.fs.path.join('windows', arch, flavor)
: globals.fs.path.join('windows', arch);
@@ -1263,8 +1222,8 @@
// flutter_ignore: deprecation_syntax (see analyze.dart)
@Deprecated('Use TargetPlatform.getName() instead')
-String getNameForTargetPlatform(TargetPlatform platform) {
- return platform.getName();
+String getNameForTargetPlatform(TargetPlatform platform, {CpuArch? cpuArch}) {
+ return platform.getName(cpuArch: cpuArch);
}
// flutter_ignore: deprecation_syntax (see analyze.dart)
diff --git a/packages/flutter_tools/lib/src/build_system/targets/android.dart b/packages/flutter_tools/lib/src/build_system/targets/android.dart
index 8d90f76..76c2c31 100644
--- a/packages/flutter_tools/lib/src/build_system/targets/android.dart
+++ b/packages/flutter_tools/lib/src/build_system/targets/android.dart
@@ -77,7 +77,7 @@
environment,
outputDirectory,
dartHookResult: dartHookResult,
- targetPlatform: const TargetPlatform(.android, .unknown),
+ targetPlatform: TargetPlatform.android,
buildMode: buildMode,
flavor: environment.defines[kFlavor],
additionalContent: <String, DevFSContent>{
@@ -141,7 +141,7 @@
@override
List<Target> get dependencies => const <Target>[
- AotElfProfile(TargetPlatform(.android, .armv7)),
+ AotElfProfile(TargetPlatform.android_arm),
AotAndroidAssetBundle(),
];
}
@@ -155,7 +155,7 @@
@override
List<Target> get dependencies => const <Target>[
- AotElfRelease(TargetPlatform(.android, .armv7)),
+ AotElfRelease(TargetPlatform.android_arm),
AotAndroidAssetBundle(),
];
}
@@ -287,12 +287,12 @@
}
// AndroidAot instances used by the bundle rules below.
-const androidArmProfile = AndroidAot(TargetPlatform(.android, .armv7), BuildMode.profile);
-const androidArm64Profile = AndroidAot(TargetPlatform(.android, .arm64), BuildMode.profile);
-const androidx64Profile = AndroidAot(TargetPlatform(.android, .x64), BuildMode.profile);
-const androidArmRelease = AndroidAot(TargetPlatform(.android, .armv7), BuildMode.release);
-const androidArm64Release = AndroidAot(TargetPlatform(.android, .arm64), BuildMode.release);
-const androidx64Release = AndroidAot(TargetPlatform(.android, .x64), BuildMode.release);
+const androidArmProfile = AndroidAot(TargetPlatform.android_arm, BuildMode.profile);
+const androidArm64Profile = AndroidAot(TargetPlatform.android_arm64, BuildMode.profile);
+const androidx64Profile = AndroidAot(TargetPlatform.android_x64, BuildMode.profile);
+const androidArmRelease = AndroidAot(TargetPlatform.android_arm, BuildMode.release);
+const androidArm64Release = AndroidAot(TargetPlatform.android_arm64, BuildMode.release);
+const androidx64Release = AndroidAot(TargetPlatform.android_x64, BuildMode.release);
/// A rule paired with [AndroidAot] that copies the produced so file and manifest.json (if present) into the output directory.
class AndroidAotBundle extends Target {
diff --git a/packages/flutter_tools/lib/src/build_system/targets/assets.dart b/packages/flutter_tools/lib/src/build_system/targets/assets.dart
index 12f73fa..dcbe48c 100644
--- a/packages/flutter_tools/lib/src/build_system/targets/assets.dart
+++ b/packages/flutter_tools/lib/src/build_system/targets/assets.dart
@@ -295,7 +295,7 @@
@override
Future<void> build(
Environment environment, {
- TargetPlatform targetPlatform = const TargetPlatform(.android, .unknown),
+ TargetPlatform targetPlatform = TargetPlatform.android,
}) async {
final String? buildModeEnvironment = environment.defines[kBuildMode];
if (buildModeEnvironment == null) {
diff --git a/packages/flutter_tools/lib/src/build_system/targets/common.dart b/packages/flutter_tools/lib/src/build_system/targets/common.dart
index 948a573..b66db67 100644
--- a/packages/flutter_tools/lib/src/build_system/targets/common.dart
+++ b/packages/flutter_tools/lib/src/build_system/targets/common.dart
@@ -92,7 +92,7 @@
environment,
environment.outputDir,
dartHookResult: dartHookResult,
- targetPlatform: const TargetPlatform(.android, .unknown),
+ targetPlatform: TargetPlatform.android,
buildMode: buildMode,
flavor: flavor,
additionalContent: <String, DevFSContent>{
@@ -229,28 +229,50 @@
final String? fileSystemScheme = environment.defines[kFileSystemScheme];
TargetModel targetModel = TargetModel.flutter;
- if (targetPlatform.type == .fuchsia) {
+ if (targetPlatform == TargetPlatform.fuchsia_x64 ||
+ targetPlatform == TargetPlatform.fuchsia_arm64) {
targetModel = TargetModel.flutterRunner;
}
// Force linking of the platform for desktop embedder targets since these
// do not correctly load the core snapshots in debug mode.
// See https://github.com/flutter/flutter/issues/44724
- final bool forceLinkPlatform = switch (targetPlatform.type) {
- .macos || .windows => true,
- .linux => targetPlatform.cpuArch == .x64,
- .unsupported => TargetPlatform.throwUnsupportedTarget(),
- .web || .android || .ios || .fuchsia || .custom || .tester => false,
- };
+ final bool forceLinkPlatform;
+ switch (targetPlatform) {
+ case TargetPlatform.darwin:
+ case TargetPlatform.windows_x64:
+ case TargetPlatform.windows_arm64:
+ case TargetPlatform.linux_x64:
+ forceLinkPlatform = true;
+ case TargetPlatform.android:
+ case TargetPlatform.android_arm:
+ case TargetPlatform.android_arm64:
+ case TargetPlatform.android_x64:
+ case TargetPlatform.fuchsia_arm64:
+ case TargetPlatform.fuchsia_x64:
+ case TargetPlatform.ios:
+ case TargetPlatform.linux_arm64:
+ case TargetPlatform.linux_riscv64:
+ case TargetPlatform.tester:
+ case TargetPlatform.web_javascript:
+ forceLinkPlatform = false;
+ case TargetPlatform.unsupported:
+ TargetPlatform.throwUnsupportedTarget();
+ }
- final String? targetOS = switch (targetPlatform.type) {
- .fuchsia => 'fuchsia',
- .android => 'android',
- .macos => 'macos',
- .ios => 'ios',
- .linux => 'linux',
- .windows => 'windows',
- .tester || .web || .custom => null,
- .unsupported => TargetPlatform.throwUnsupportedTarget(),
+ final String? targetOS = switch (targetPlatform) {
+ TargetPlatform.fuchsia_arm64 || TargetPlatform.fuchsia_x64 => 'fuchsia',
+ TargetPlatform.android ||
+ TargetPlatform.android_arm ||
+ TargetPlatform.android_arm64 ||
+ TargetPlatform.android_x64 => 'android',
+ TargetPlatform.darwin => 'macos',
+ TargetPlatform.ios => 'ios',
+ TargetPlatform.linux_arm64 ||
+ TargetPlatform.linux_riscv64 ||
+ TargetPlatform.linux_x64 => 'linux',
+ TargetPlatform.windows_arm64 || TargetPlatform.windows_x64 => 'windows',
+ TargetPlatform.tester || TargetPlatform.web_javascript => null,
+ TargetPlatform.unsupported => TargetPlatform.throwUnsupportedTarget(),
};
final PackageConfig packageConfig = await loadPackageConfigWithLogging(
diff --git a/packages/flutter_tools/lib/src/build_system/targets/dart_plugin_registrant.dart b/packages/flutter_tools/lib/src/build_system/targets/dart_plugin_registrant.dart
index 64064d6..26b717f 100644
--- a/packages/flutter_tools/lib/src/build_system/targets/dart_plugin_registrant.dart
+++ b/packages/flutter_tools/lib/src/build_system/targets/dart_plugin_registrant.dart
@@ -56,7 +56,9 @@
// code should just do the right thing on every platform.
// Failing that, consider throwing if `targetPlatform` isn't set and finding
// all violations, as it's not consistently set here.
- return targetPlatform?.type == .fuchsia || targetPlatform?.type == .web;
+ return targetPlatform == TargetPlatform.fuchsia_arm64 ||
+ targetPlatform == TargetPlatform.fuchsia_x64 ||
+ targetPlatform == TargetPlatform.web_javascript;
}
@override
diff --git a/packages/flutter_tools/lib/src/build_system/targets/icon_tree_shaker.dart b/packages/flutter_tools/lib/src/build_system/targets/icon_tree_shaker.dart
index 16f707a..aeefa12 100644
--- a/packages/flutter_tools/lib/src/build_system/targets/icon_tree_shaker.dart
+++ b/packages/flutter_tools/lib/src/build_system/targets/icon_tree_shaker.dart
@@ -140,7 +140,9 @@
}
// Add space as an optional code point, as web uses it to measure the font height.
- final optionalCodePoints = _targetPlatform.type == .web ? <int>[kSpacePoint] : <int>[];
+ final optionalCodePoints = _targetPlatform == TargetPlatform.web_javascript
+ ? <int>[kSpacePoint]
+ : <int>[];
result[entry.value] = _IconTreeShakerData(
family: entry.key,
relativePath: entry.value,
diff --git a/packages/flutter_tools/lib/src/build_system/targets/ios.dart b/packages/flutter_tools/lib/src/build_system/targets/ios.dart
index 4034fe7..9535489 100644
--- a/packages/flutter_tools/lib/src/build_system/targets/ios.dart
+++ b/packages/flutter_tools/lib/src/build_system/targets/ios.dart
@@ -75,7 +75,7 @@
final List<CpuArch> cpuArchs =
environment.defines[kIosArchs]?.split(' ').map(getCpuArchForName).toList() ??
<CpuArch>[CpuArch.arm64];
- if (targetPlatform.type != .ios) {
+ if (targetPlatform != TargetPlatform.ios) {
throw Exception('aot_assembly is only supported for iOS applications.');
}
@@ -108,10 +108,11 @@
}
pending.add(
snapshotter.build(
- platform: TargetPlatform(.ios, cpuArch),
+ platform: targetPlatform,
buildMode: buildMode,
mainPath: environment.buildDir.childFile('app.dill').path,
outputPath: environment.fileSystem.path.join(buildOutputPath, cpuArch.darwinArchName),
+ cpuArch: cpuArch,
sdkRoot: sdkRoot,
quiet: true,
splitDebugInfo: splitDebugInfo,
@@ -162,7 +163,7 @@
// it resolves to a file (ios/gen_snapshot) that never exists. This was
// split into gen_snapshot_arm64 and gen_snapshot_armv7.
// Source.artifact(Artifact.genSnapshot,
- // platform: TargetPlatform(.ios, .arm64),
+ // platform: TargetPlatform.ios,
// mode: BuildMode.release,
// ),
];
@@ -191,7 +192,7 @@
// it resolves to a file (ios/gen_snapshot) that never exists. This was
// split into gen_snapshot_arm64 and gen_snapshot_armv7.
// Source.artifact(Artifact.genSnapshot,
- // platform: TargetPlatform(.ios, .arm64),
+ // platform: TargetPlatform.ios,
// mode: BuildMode.profile,
// ),
];
@@ -249,11 +250,7 @@
const Source.pattern(
'{FLUTTER_ROOT}/packages/flutter_tools/lib/src/build_system/targets/ios.dart',
),
- Source.artifact(
- Artifact.flutterXcframework,
- platform: darwinPlatform.targetPlatform,
- mode: buildMode,
- ),
+ Source.artifact(Artifact.flutterXcframework, platform: TargetPlatform.ios, mode: buildMode),
];
@override
@@ -288,7 +285,7 @@
environment,
environmentType: environmentType,
framework: Artifact.flutterFramework,
- targetPlatform: darwinPlatform.targetPlatform,
+ targetPlatform: TargetPlatform.ios,
buildMode: buildMode,
);
await _copyFrameworkDysm(environment, sdkRoot: sdkRoot, environmentType: environmentType);
@@ -314,7 +311,7 @@
final Directory frameworkDsym = environment.fileSystem.directory(
environment.artifacts.getArtifactPath(
Artifact.flutterFrameworkDsym,
- platform: darwinPlatform.targetPlatform,
+ platform: TargetPlatform.ios,
mode: buildMode,
environmentType: environmentType,
),
@@ -718,7 +715,7 @@
environment,
assetDirectory,
dartHookResult: dartHookResult,
- targetPlatform: FlutterDarwinPlatform.ios.targetPlatform,
+ targetPlatform: TargetPlatform.ios,
buildMode: buildMode,
additionalInputs: <File>[
flutterProject.ios.infoPlist,
diff --git a/packages/flutter_tools/lib/src/build_system/targets/macos.dart b/packages/flutter_tools/lib/src/build_system/targets/macos.dart
index ff95a1c..e42533a 100644
--- a/packages/flutter_tools/lib/src/build_system/targets/macos.dart
+++ b/packages/flutter_tools/lib/src/build_system/targets/macos.dart
@@ -140,7 +140,7 @@
final Directory frameworkDsym = environment.fileSystem.directory(
environment.artifacts.getArtifactPath(
Artifact.flutterMacOSFrameworkDsym,
- platform: darwinPlatform.targetPlatform,
+ platform: TargetPlatform.darwin,
mode: buildMode,
),
);
@@ -288,7 +288,7 @@
);
final targetPlatform = TargetPlatform.fromName(targetPlatformEnvironment);
final List<CpuArch> cpuArchs = getCpuArchsFromEnv(environment.defines);
- if (targetPlatform.type != .macos) {
+ if (targetPlatform != TargetPlatform.darwin) {
throw Exception('compile_macos_framework is only supported for darwin TargetPlatform.');
}
@@ -321,7 +321,8 @@
buildMode: buildMode,
mainPath: environment.buildDir.childFile('app.dill').path,
outputPath: environment.fileSystem.path.join(buildOutputPath, cpuArch.darwinArchName),
- platform: TargetPlatform(.macos, cpuArch),
+ platform: TargetPlatform.darwin,
+ cpuArch: cpuArch,
splitDebugInfo: splitDebugInfo,
dartObfuscation: dartObfuscation,
extraGenSnapshotOptions: extraGenSnapshotOptions,
@@ -358,16 +359,10 @@
List<Target> get dependencies => const <Target>[KernelSnapshot()];
@override
- List<Source> get inputs => <Source>[
- const Source.pattern('{BUILD_DIR}/app.dill'),
- const Source.pattern(
- '{FLUTTER_ROOT}/packages/flutter_tools/lib/src/build_system/targets/macos.dart',
- ),
- Source.artifact(
- Artifact.genSnapshot,
- mode: BuildMode.release,
- platform: FlutterDarwinPlatform.macos.targetPlatform,
- ),
+ List<Source> get inputs => const <Source>[
+ Source.pattern('{BUILD_DIR}/app.dill'),
+ Source.pattern('{FLUTTER_ROOT}/packages/flutter_tools/lib/src/build_system/targets/macos.dart'),
+ Source.artifact(Artifact.genSnapshot, mode: BuildMode.release, platform: TargetPlatform.darwin),
];
@override
@@ -456,7 +451,7 @@
environment,
assetDirectory,
dartHookResult: dartHookResult,
- targetPlatform: FlutterDarwinPlatform.macos.targetPlatform,
+ targetPlatform: TargetPlatform.darwin,
buildMode: buildMode,
flavor: flavor,
additionalContent: <String, DevFSContent>{
@@ -510,12 +505,12 @@
try {
final String vmSnapshotData = environment.artifacts.getArtifactPath(
Artifact.vmSnapshotData,
- platform: FlutterDarwinPlatform.macos.targetPlatform,
+ platform: TargetPlatform.darwin,
mode: BuildMode.debug,
);
final String isolateSnapshotData = environment.artifacts.getArtifactPath(
Artifact.isolateSnapshotData,
- platform: FlutterDarwinPlatform.macos.targetPlatform,
+ platform: TargetPlatform.darwin,
mode: BuildMode.debug,
);
environment.fileSystem
@@ -587,14 +582,14 @@
List<Source> get inputs => <Source>[
...super.inputs,
const Source.pattern('{BUILD_DIR}/app.dill'),
- Source.artifact(
+ const Source.artifact(
Artifact.isolateSnapshotData,
- platform: FlutterDarwinPlatform.macos.targetPlatform,
+ platform: TargetPlatform.darwin,
mode: BuildMode.debug,
),
- Source.artifact(
+ const Source.artifact(
Artifact.vmSnapshotData,
- platform: FlutterDarwinPlatform.macos.targetPlatform,
+ platform: TargetPlatform.darwin,
mode: BuildMode.debug,
),
];
diff --git a/packages/flutter_tools/lib/src/build_system/targets/native_assets.dart b/packages/flutter_tools/lib/src/build_system/targets/native_assets.dart
index 3bd75b8..f729bae 100644
--- a/packages/flutter_tools/lib/src/build_system/targets/native_assets.dart
+++ b/packages/flutter_tools/lib/src/build_system/targets/native_assets.dart
@@ -46,7 +46,7 @@
final FileSystem fileSystem = environment.fileSystem;
final TargetPlatform targetPlatform = platform == HookPlatform.web
- ? const TargetPlatform(.web, .unknown)
+ ? TargetPlatform.web_javascript
: _getTargetPlatformFromEnvironment(environment, name);
final Uri projectUri = environment.projectDir.uri;
@@ -193,7 +193,7 @@
final Uri projectUri = environment.projectDir.uri;
final FileSystem fileSystem = environment.fileSystem;
final TargetPlatform targetPlatform = platform == HookPlatform.web
- ? const TargetPlatform(.web, .unknown)
+ ? TargetPlatform.web_javascript
: _getTargetPlatformFromEnvironment(environment, name);
final String? buildModeEnvironment = environment.defines[kBuildMode];
diff --git a/packages/flutter_tools/lib/src/build_system/targets/web.dart b/packages/flutter_tools/lib/src/build_system/targets/web.dart
index 22eacaf..57775b9 100644
--- a/packages/flutter_tools/lib/src/build_system/targets/web.dart
+++ b/packages/flutter_tools/lib/src/build_system/targets/web.dart
@@ -187,10 +187,7 @@
.getHostArtifact(HostArtifact.webPlatformKernelFolder)
.path;
final sharedCommandOptions = <String>[
- artifacts.getArtifactPath(
- Artifact.engineDartBinary,
- platform: const TargetPlatform(.web, .unknown),
- ),
+ artifacts.getArtifactPath(Artifact.engineDartBinary, platform: TargetPlatform.web_javascript),
'compile',
'js',
'--platform-binaries=$platformBinariesPath',
@@ -363,10 +360,7 @@
final List<String> dartDefines = computeDartDefines(environment);
final compilationArgs = <String>[
- artifacts.getArtifactPath(
- Artifact.engineDartBinary,
- platform: const TargetPlatform(.web, .unknown),
- ),
+ artifacts.getArtifactPath(Artifact.engineDartBinary, platform: TargetPlatform.web_javascript),
'compile',
'wasm',
'--packages=${findPackageConfigFileOrDefault(environment.projectDir).path}',
@@ -671,7 +665,7 @@
environment,
environment.outputDir.childDirectory('assets'),
dartHookResult: dartHookResult,
- targetPlatform: const TargetPlatform(.web, .unknown),
+ targetPlatform: TargetPlatform.web_javascript,
buildMode: buildMode,
);
final Depfile bundledDepfile = _bundleLocalRobotoFallback(environment, depfile);
diff --git a/packages/flutter_tools/lib/src/build_system/tools/shader_compiler.dart b/packages/flutter_tools/lib/src/build_system/tools/shader_compiler.dart
index c3510e0..a87a369 100644
--- a/packages/flutter_tools/lib/src/build_system/tools/shader_compiler.dart
+++ b/packages/flutter_tools/lib/src/build_system/tools/shader_compiler.dart
@@ -175,10 +175,16 @@
bool _hasLoggedSecurityBlockError = false;
List<String> _shaderTargetsFromTargetPlatform(TargetPlatform targetPlatform) {
- switch (targetPlatform.type) {
- case .android:
- case .linux:
- case .windows:
+ switch (targetPlatform) {
+ case TargetPlatform.android_x64:
+ case TargetPlatform.android_arm:
+ case TargetPlatform.android_arm64:
+ case TargetPlatform.android:
+ case TargetPlatform.linux_x64:
+ case TargetPlatform.linux_arm64:
+ case TargetPlatform.linux_riscv64:
+ case TargetPlatform.windows_x64:
+ case TargetPlatform.windows_arm64:
return <String>[
'--sksl',
'--runtime-stage-gles',
@@ -186,20 +192,20 @@
'--runtime-stage-vulkan',
];
- case .ios:
+ case TargetPlatform.ios:
return <String>['--runtime-stage-metal'];
- case .macos:
+ case TargetPlatform.darwin:
return <String>['--sksl', '--runtime-stage-metal'];
- case .fuchsia:
- case .tester:
+ case TargetPlatform.fuchsia_arm64:
+ case TargetPlatform.fuchsia_x64:
+ case TargetPlatform.tester:
return <String>['--sksl', '--runtime-stage-vulkan'];
- case .web:
+ case TargetPlatform.web_javascript:
return <String>['--sksl'];
- case .custom:
- case .unsupported:
+ case TargetPlatform.unsupported:
TargetPlatform.throwUnsupportedTarget();
}
}
@@ -242,7 +248,7 @@
impellerc.path,
...targets,
'--iplr',
- if (targetPlatform.type == .web) '--json',
+ if (targetPlatform == TargetPlatform.web_javascript) '--json',
'--sl=$outputPath',
'--spirv=$outputPath.spirv',
'--input=${input.path}',
diff --git a/packages/flutter_tools/lib/src/commands/assemble.dart b/packages/flutter_tools/lib/src/commands/assemble.dart
index 63e626c..61203a9 100644
--- a/packages/flutter_tools/lib/src/commands/assemble.dart
+++ b/packages/flutter_tools/lib/src/commands/assemble.dart
@@ -31,8 +31,8 @@
// Shared targets
const CopyAssets(),
const KernelSnapshot(),
- const AotElfProfile(TargetPlatform(.android, .armv7)),
- const AotElfRelease(TargetPlatform(.android, .armv7)),
+ const AotElfProfile(TargetPlatform.android_arm),
+ const AotElfRelease(TargetPlatform.android_arm),
const AotAssemblyProfile(),
const AotAssemblyRelease(),
// macOS targets
@@ -44,15 +44,15 @@
const ProfileUnpackMacOS(),
const ReleaseUnpackMacOS(),
// Linux targets
- const DebugBundleLinuxAssets(TargetPlatform(.linux, .x64)),
- const DebugBundleLinuxAssets(TargetPlatform(.linux, .arm64)),
- const DebugBundleLinuxAssets(TargetPlatform(.linux, .riscv64)),
- const ProfileBundleLinuxAssets(TargetPlatform(.linux, .x64)),
- const ProfileBundleLinuxAssets(TargetPlatform(.linux, .arm64)),
- const ProfileBundleLinuxAssets(TargetPlatform(.linux, .riscv64)),
- const ReleaseBundleLinuxAssets(TargetPlatform(.linux, .x64)),
- const ReleaseBundleLinuxAssets(TargetPlatform(.linux, .arm64)),
- const ReleaseBundleLinuxAssets(TargetPlatform(.linux, .riscv64)),
+ const DebugBundleLinuxAssets(TargetPlatform.linux_x64),
+ const DebugBundleLinuxAssets(TargetPlatform.linux_arm64),
+ const DebugBundleLinuxAssets(TargetPlatform.linux_riscv64),
+ const ProfileBundleLinuxAssets(TargetPlatform.linux_x64),
+ const ProfileBundleLinuxAssets(TargetPlatform.linux_arm64),
+ const ProfileBundleLinuxAssets(TargetPlatform.linux_riscv64),
+ const ReleaseBundleLinuxAssets(TargetPlatform.linux_x64),
+ const ReleaseBundleLinuxAssets(TargetPlatform.linux_arm64),
+ const ReleaseBundleLinuxAssets(TargetPlatform.linux_riscv64),
const ReleaseAndroidApplication(),
// This is a one-off rule for bundle and aot compat.
const CopyFlutterBundle(),
@@ -81,14 +81,14 @@
const ProfileUnpackIOS(),
const ReleaseUnpackIOS(),
// Windows targets
- const UnpackWindows(TargetPlatform(.windows, .x64)),
- const UnpackWindows(TargetPlatform(.windows, .arm64)),
- const DebugBundleWindowsAssets(TargetPlatform(.windows, .x64)),
- const DebugBundleWindowsAssets(TargetPlatform(.windows, .arm64)),
- const ProfileBundleWindowsAssets(TargetPlatform(.windows, .x64)),
- const ProfileBundleWindowsAssets(TargetPlatform(.windows, .arm64)),
- const ReleaseBundleWindowsAssets(TargetPlatform(.windows, .x64)),
- const ReleaseBundleWindowsAssets(TargetPlatform(.windows, .arm64)),
+ const UnpackWindows(TargetPlatform.windows_x64),
+ const UnpackWindows(TargetPlatform.windows_arm64),
+ const DebugBundleWindowsAssets(TargetPlatform.windows_x64),
+ const DebugBundleWindowsAssets(TargetPlatform.windows_arm64),
+ const ProfileBundleWindowsAssets(TargetPlatform.windows_x64),
+ const ProfileBundleWindowsAssets(TargetPlatform.windows_arm64),
+ const ReleaseBundleWindowsAssets(TargetPlatform.windows_x64),
+ const ReleaseBundleWindowsAssets(TargetPlatform.windows_arm64),
];
/// Assemble provides a low level API to interact with the flutter tool build
diff --git a/packages/flutter_tools/lib/src/commands/build_bundle.dart b/packages/flutter_tools/lib/src/commands/build_bundle.dart
index d4df076..32ef91f 100644
--- a/packages/flutter_tools/lib/src/commands/build_bundle.dart
+++ b/packages/flutter_tools/lib/src/commands/build_bundle.dart
@@ -111,27 +111,33 @@
final String targetPlatform = stringArg('target-platform')!;
final platform = TargetPlatform.fromName(targetPlatform);
// Check for target platforms that are only allowed via feature flags.
- switch (platform.type) {
- case .macos:
+ switch (platform) {
+ case TargetPlatform.darwin:
if (!featureFlags.isMacOSEnabled) {
throwToolExit('macOS is not a supported target platform.');
}
- case .windows:
+ case TargetPlatform.windows_x64:
+ case TargetPlatform.windows_arm64:
if (!featureFlags.isWindowsEnabled) {
throwToolExit('Windows is not a supported target platform.');
}
- case .linux:
+ case TargetPlatform.linux_x64:
+ case TargetPlatform.linux_arm64:
+ case TargetPlatform.linux_riscv64:
if (!featureFlags.isLinuxEnabled) {
throwToolExit('Linux is not a supported target platform.');
}
- case .android:
- case .fuchsia:
- case .ios:
- case .tester:
- case .web:
- case .custom:
+ case TargetPlatform.android:
+ case TargetPlatform.android_arm:
+ case TargetPlatform.android_arm64:
+ case TargetPlatform.android_x64:
+ case TargetPlatform.fuchsia_arm64:
+ case TargetPlatform.fuchsia_x64:
+ case TargetPlatform.ios:
+ case TargetPlatform.tester:
+ case TargetPlatform.web_javascript:
break;
- case .unsupported:
+ case TargetPlatform.unsupported:
TargetPlatform.throwUnsupportedTarget();
}
diff --git a/packages/flutter_tools/lib/src/commands/build_ios.dart b/packages/flutter_tools/lib/src/commands/build_ios.dart
index c6faa58..5131df9 100644
--- a/packages/flutter_tools/lib/src/commands/build_ios.dart
+++ b/packages/flutter_tools/lib/src/commands/build_ios.dart
@@ -936,7 +936,7 @@
late final Future<BuildableIOSApp> buildableIOSApp = () async {
final app =
await applicationPackages?.getPackageForPlatform(
- FlutterDarwinPlatform.ios.targetPlatform,
+ TargetPlatform.ios,
buildInfo: await cachedBuildInfo,
)
as BuildableIOSApp?;
@@ -978,10 +978,7 @@
final BuildableIOSApp app = await buildableIOSApp;
final logTarget = environmentType == EnvironmentType.simulator ? 'simulator' : 'device';
- final String typeName = globals.artifacts!.getEngineType(
- FlutterDarwinPlatform.ios.targetPlatform,
- buildInfo.mode,
- );
+ final String typeName = globals.artifacts!.getEngineType(TargetPlatform.ios, buildInfo.mode);
globals.printStatus(switch (xcodeBuildAction) {
XcodeBuildAction.build => 'Building $app for $logTarget ($typeName)...',
XcodeBuildAction.archive => 'Archiving $app...',
diff --git a/packages/flutter_tools/lib/src/commands/build_ios_framework.dart b/packages/flutter_tools/lib/src/commands/build_ios_framework.dart
index e4dcc6e..432e951 100644
--- a/packages/flutter_tools/lib/src/commands/build_ios_framework.dart
+++ b/packages/flutter_tools/lib/src/commands/build_ios_framework.dart
@@ -744,7 +744,7 @@
final Status status = globals.logger.startProgress(' ├─Copying Flutter.xcframework...');
final String engineCacheFlutterFrameworkDirectory = globals.artifacts!.getArtifactPath(
Artifact.flutterXcframework,
- platform: FlutterDarwinPlatform.ios.targetPlatform,
+ platform: TargetPlatform.ios,
mode: buildInfo.mode,
);
final String flutterFrameworkFileName = globals.fs.path.basename(
@@ -798,7 +798,7 @@
flutterRootDir: globals.fs.directory(Cache.flutterRoot),
defines: <String, String>{
kTargetFile: targetFile,
- kTargetPlatform: FlutterDarwinPlatform.ios.targetPlatform.getName(),
+ kTargetPlatform: TargetPlatform.ios.getName(),
kIosArchs: defaultIOSArchsForEnvironment(
sdkType,
globals.artifacts!,
diff --git a/packages/flutter_tools/lib/src/commands/build_linux.dart b/packages/flutter_tools/lib/src/commands/build_linux.dart
index 2ba9369..fc8f602 100644
--- a/packages/flutter_tools/lib/src/commands/build_linux.dart
+++ b/packages/flutter_tools/lib/src/commands/build_linux.dart
@@ -72,7 +72,7 @@
final BuildInfo buildInfo = await getBuildInfo();
final targetPlatform = TargetPlatform.fromName(stringArg('target-platform')!);
final needCrossBuild =
- _operatingSystemUtils.hostPlatform.platformName != targetPlatform.cpuArch.dartName;
+ _operatingSystemUtils.hostPlatform.platformName != targetPlatform.simpleName;
if (!featureFlags.isLinuxEnabled) {
throwToolExit(
@@ -88,14 +88,14 @@
}
// TODO(fujino): https://github.com/flutter/flutter/issues/74929
if (_operatingSystemUtils.hostPlatform == HostPlatform.linux_x64 &&
- targetPlatform == const TargetPlatform(.linux, .arm64)) {
+ targetPlatform == TargetPlatform.linux_arm64) {
throwToolExit(
'Cross-build from Linux x64 host to Linux arm64 target is not currently supported.',
);
}
// Building for riscv64 (on a non-riscv64 host) is experimental
if (_operatingSystemUtils.hostPlatform != HostPlatform.linux_riscv64 &&
- targetPlatform == const TargetPlatform(.linux, .riscv64) &&
+ targetPlatform == TargetPlatform.linux_riscv64 &&
!featureFlags.isRiscv64SupportEnabled) {
throwToolExit(
'Building for Linux riscv64 is currently an experimental feature. To enable, run "flutter config --enable-riscv64"',
diff --git a/packages/flutter_tools/lib/src/commands/build_macos_framework.dart b/packages/flutter_tools/lib/src/commands/build_macos_framework.dart
index d26ada8..52cf414 100644
--- a/packages/flutter_tools/lib/src/commands/build_macos_framework.dart
+++ b/packages/flutter_tools/lib/src/commands/build_macos_framework.dart
@@ -258,7 +258,7 @@
flutterRootDir: globals.fs.directory(Cache.flutterRoot),
defines: <String, String>{
kTargetFile: targetFile,
- kTargetPlatform: FlutterDarwinPlatform.macos.targetPlatform.getName(),
+ kTargetPlatform: TargetPlatform.darwin.getName(),
kDarwinArchs: defaultMacOSArchsForEnvironment(
globals.artifacts!,
).map((CpuArch e) => e.darwinArchName).join(' '),
@@ -316,7 +316,7 @@
final Status status = globals.logger.startProgress(' ├─Copying FlutterMacOS.xcframework...');
final String engineCacheFlutterFrameworkDirectory = globals.artifacts!.getArtifactPath(
Artifact.flutterMacOSXcframework,
- platform: FlutterDarwinPlatform.macos.targetPlatform,
+ platform: TargetPlatform.darwin,
mode: buildInfo.mode,
);
final String flutterFrameworkFileName = globals.fs.path.basename(
diff --git a/packages/flutter_tools/lib/src/commands/daemon.dart b/packages/flutter_tools/lib/src/commands/daemon.dart
index f88fbe5..fb29bc4 100644
--- a/packages/flutter_tools/lib/src/commands/daemon.dart
+++ b/packages/flutter_tools/lib/src/commands/daemon.dart
@@ -468,11 +468,7 @@
void handlePlatformType(PlatformType platform) {
final reasons = <Map<String, Object>>[];
switch (platform) {
- case .tester:
- case .unsupported:
- // Not user-facing project platforms.
- return;
- case .linux:
+ case PlatformType.linux:
if (!featureFlags.isLinuxEnabled) {
reasons.add(<String, Object>{
'reasonText': 'the Linux feature is not enabled',
@@ -487,7 +483,7 @@
'fixCode': _ReasonCode.create.name,
});
}
- case .macos:
+ case PlatformType.macos:
if (!featureFlags.isMacOSEnabled) {
reasons.add(<String, Object>{
'reasonText': 'the macOS feature is not enabled',
@@ -502,7 +498,7 @@
'fixCode': _ReasonCode.create.name,
});
}
- case .windows:
+ case PlatformType.windows:
if (!featureFlags.isWindowsEnabled) {
reasons.add(<String, Object>{
'reasonText': 'the Windows feature is not enabled',
@@ -518,7 +514,7 @@
'fixCode': _ReasonCode.create.name,
});
}
- case .ios:
+ case PlatformType.ios:
if (!featureFlags.isIOSEnabled) {
reasons.add(<String, Object>{
'reasonText': 'the iOS feature is not enabled',
@@ -533,7 +529,7 @@
'fixCode': _ReasonCode.create.name,
});
}
- case .android:
+ case PlatformType.android:
if (!featureFlags.isAndroidEnabled) {
reasons.add(<String, Object>{
'reasonText': 'the Android feature is not enabled',
@@ -549,7 +545,7 @@
'fixCode': _ReasonCode.create.name,
});
}
- case .web:
+ case PlatformType.web:
if (!featureFlags.isWebEnabled) {
reasons.add(<String, Object>{
'reasonText': 'the Web feature is not enabled',
@@ -564,7 +560,7 @@
'fixCode': _ReasonCode.create.name,
});
}
- case .fuchsia:
+ case PlatformType.fuchsia:
if (!featureFlags.isFuchsiaEnabled) {
reasons.add(<String, Object>{
'reasonText': 'the Fuchsia feature is not enabled',
@@ -580,7 +576,7 @@
'fixCode': _ReasonCode.create.name,
});
}
- case .custom:
+ case PlatformType.custom:
if (!featureFlags.areCustomDevicesEnabled) {
reasons.add(<String, Object>{
'reasonText': 'the custom devices feature is not enabled',
@@ -701,7 +697,7 @@
ResidentRunner runner;
- if ((await device.targetPlatform).type == .web) {
+ if (await device.targetPlatform == TargetPlatform.web_javascript) {
runner = webRunnerFactory!.createWebRunner(
flutterDevice,
flutterProject: flutterProject,
@@ -1420,7 +1416,7 @@
return <String, Object?>{
'id': device.id,
'name': device.displayName,
- 'platform': (await device.targetPlatform).devicePlatformName,
+ 'platform': (await device.targetPlatform).getName(),
'emulator': await device.isLocalEmulator,
'category': device.category?.toString(),
'platformType': device.platformType?.toString(),
diff --git a/packages/flutter_tools/lib/src/commands/run.dart b/packages/flutter_tools/lib/src/commands/run.dart
index d092a63..ff27612 100644
--- a/packages/flutter_tools/lib/src/commands/run.dart
+++ b/packages/flutter_tools/lib/src/commands/run.dart
@@ -556,7 +556,7 @@
if (featureFlags.isWebEnabled &&
devices != null &&
devices!.length == 1 &&
- (await devices!.single.targetPlatform).type == .web) {
+ await devices!.single.targetPlatform == TargetPlatform.web_javascript) {
final WebDevServerConfig webDevServerConfig = await webDevServerConfigCore();
return webDevServerConfig;
}
@@ -578,7 +578,7 @@
if (devices!.length > 1) {
return '$command/all';
}
- return '$command/${(await devices![0].targetPlatform).devicePlatformName}';
+ return '$command/${(await devices![0].targetPlatform).getName()}';
}
@override
@@ -616,12 +616,12 @@
} else if (devices!.length == 1) {
final Device device = devices![0];
final TargetPlatform platform = await device.targetPlatform;
- anyAndroidDevices = platform.type == .android;
- anyIOSDevices = platform.type == .ios;
+ anyAndroidDevices = platform == TargetPlatform.android;
+ anyIOSDevices = platform == TargetPlatform.ios;
if (device is IOSDevice && device.isWirelesslyConnected) {
anyWirelessIOSDevices = true;
}
- deviceType = platform.devicePlatformName;
+ deviceType = platform.getName();
deviceOsVersion = await device.sdkNameAndVersion;
isEmulator = await device.isLocalEmulator;
} else {
@@ -630,8 +630,8 @@
isEmulator = false;
for (final Device device in devices!) {
final TargetPlatform platform = await device.targetPlatform;
- anyAndroidDevices = anyAndroidDevices || (platform.type == .android);
- anyIOSDevices = anyIOSDevices || (platform.type == .ios);
+ anyAndroidDevices = anyAndroidDevices || (platform == TargetPlatform.android);
+ anyIOSDevices = anyIOSDevices || (platform == TargetPlatform.ios);
if (device is IOSDevice && device.isWirelesslyConnected) {
anyWirelessIOSDevices = true;
}
@@ -723,7 +723,7 @@
}
if (userIdentifier != null &&
- devices!.every((Device device) => device.platformType != .android)) {
+ devices!.every((Device device) => device.platformType != PlatformType.android)) {
throwToolExit(
'--${FlutterOptions.kDeviceUser} is only supported for Android. At least one Android device is required.',
);
@@ -967,10 +967,7 @@
timingLabelParts: <String?>[
if (hotMode) 'hot' else 'cold',
getBuildMode().cliName,
- if (devices!.length == 1)
- (await devices![0].targetPlatform).devicePlatformName
- else
- 'multiple',
+ if (devices!.length == 1) (await devices![0].targetPlatform).getName() else 'multiple',
if (devices!.length == 1 && await devices![0].isLocalEmulator) 'emulator' else null,
],
endTimeOverride: appStartedTime,
diff --git a/packages/flutter_tools/lib/src/commands/test.dart b/packages/flutter_tools/lib/src/commands/test.dart
index 76d56f0..78f4cd5 100644
--- a/packages/flutter_tools/lib/src/commands/test.dart
+++ b/packages/flutter_tools/lib/src/commands/test.dart
@@ -640,7 +640,7 @@
'Ensure that `flutter doctor` shows at least one connected device',
);
}
- if (integrationTestDevice.platformType == .web) {
+ if (integrationTestDevice.platformType == PlatformType.web) {
// TODO(jiahaog): Support web. https://github.com/flutter/flutter/issues/66264
throwToolExit('Web devices are not supported for integration tests yet.');
}
@@ -802,7 +802,7 @@
packageConfigPath: packageConfigPath,
flavor: flavor,
includeAssetsFromDevDependencies: true,
- targetPlatform: const TargetPlatform(.tester, .unknown),
+ targetPlatform: TargetPlatform.tester,
);
if (build != 0) {
throwToolExit('Error: Failed to build asset bundle');
@@ -811,7 +811,7 @@
await writeBundle(
globals.fs.directory(globals.fs.path.join('build', 'unit_test_assets')),
assetBundle.entries,
- targetPlatform: const TargetPlatform(.tester, .unknown),
+ targetPlatform: TargetPlatform.tester,
impellerStatus: impellerStatus,
processManager: globals.processManager,
fileSystem: globals.fs,
diff --git a/packages/flutter_tools/lib/src/compile.dart b/packages/flutter_tools/lib/src/compile.dart
index 40dbf07..51d2c27 100644
--- a/packages/flutter_tools/lib/src/compile.dart
+++ b/packages/flutter_tools/lib/src/compile.dart
@@ -65,9 +65,9 @@
/// Infers the appropriate [TargetModel] from a given [TargetPlatform].
static TargetModel fromTargetPlatform(TargetPlatform? platform) {
- return switch (platform?.type) {
- .web => TargetModel.dartdevc,
- .fuchsia => TargetModel.flutterRunner,
+ return switch (platform) {
+ TargetPlatform.web_javascript => TargetModel.dartdevc,
+ TargetPlatform.fuchsia_arm64 || TargetPlatform.fuchsia_x64 => TargetModel.flutterRunner,
_ => TargetModel.flutter,
};
}
@@ -280,7 +280,7 @@
String? nativeAssets,
}) async {
final TargetPlatform? platform = targetModel == TargetModel.dartdevc
- ? const TargetPlatform(.web, .unknown)
+ ? TargetPlatform.web_javascript
: null;
// This is a URI, not a file path, so the forward slash is correct even on Windows.
if (!sdkRoot.endsWith('/')) {
@@ -545,7 +545,7 @@
TargetModel targetModel = targetModelOverride ?? .flutter;
// Configure the compiler to target the DDC runtime.
- if (targetPlatform.type == .web) {
+ if (targetPlatform case .web_javascript) {
sdkRoot = artifacts.getHostArtifact(HostArtifact.flutterWebSdk).path;
targetModel = .dartdevc;
@@ -578,7 +578,7 @@
],
);
} else {
- if (targetPlatform.type == .fuchsia) {
+ if (targetPlatform case .fuchsia_arm64 || .fuchsia_x64) {
targetModel = .flutterRunner;
}
buildInfo = buildInfo.copyWith(
@@ -935,7 +935,7 @@
String? nativeAssetsUri,
}) async {
final TargetPlatform? platform = (targetModel == TargetModel.dartdevc)
- ? const TargetPlatform(.web, .unknown)
+ ? TargetPlatform.web_javascript
: null;
late final List<String> commandToStartFrontendServer;
if (frontendServerStarterPath != null && frontendServerStarterPath!.isNotEmpty) {
diff --git a/packages/flutter_tools/lib/src/custom_devices/custom_device.dart b/packages/flutter_tools/lib/src/custom_devices/custom_device.dart
index f9c1770..55e70bf 100644
--- a/packages/flutter_tools/lib/src/custom_devices/custom_device.dart
+++ b/packages/flutter_tools/lib/src/custom_devices/custom_device.dart
@@ -776,15 +776,14 @@
}
@override
- Future<TargetPlatform> get targetPlatform async =>
- _config.platform ?? const TargetPlatform(.linux, .arm64);
+ Future<TargetPlatform> get targetPlatform async => _config.platform ?? TargetPlatform.linux_arm64;
@override
Future<CpuArch> get cpuArch async {
// Custom devices only support Linux target platforms (see
// CustomDeviceConfig), so the arch is derived from that.
- return switch (_config.platform?.cpuArch) {
- .x64 => CpuArch.x64,
+ return switch (_config.platform) {
+ TargetPlatform.linux_x64 => CpuArch.x64,
_ => CpuArch.arm64,
};
}
diff --git a/packages/flutter_tools/lib/src/custom_devices/custom_device_config.dart b/packages/flutter_tools/lib/src/custom_devices/custom_device_config.dart
index 535c338..ad2080c 100644
--- a/packages/flutter_tools/lib/src/custom_devices/custom_device_config.dart
+++ b/packages/flutter_tools/lib/src/custom_devices/custom_device_config.dart
@@ -98,8 +98,8 @@
}) : assert(forwardPortCommand == null || forwardPortSuccessRegex != null),
assert(
platform == null ||
- platform == const TargetPlatform(.linux, .x64) ||
- platform == const TargetPlatform(.linux, .arm64),
+ platform == TargetPlatform.linux_x64 ||
+ platform == TargetPlatform.linux_arm64,
);
/// Create a CustomDeviceConfig from some JSON value.
@@ -144,8 +144,8 @@
}
if (platform != null &&
- platform != const TargetPlatform(.linux, .arm64) &&
- platform != const TargetPlatform(.linux, .x64)) {
+ platform != TargetPlatform.linux_arm64 &&
+ platform != TargetPlatform.linux_x64) {
throw const CustomDeviceRevivalException.fromDescriptions(
_kPlatform,
'null or one of linux-arm64, linux-x64',
@@ -243,7 +243,7 @@
id: 'pi',
label: 'Raspberry Pi',
sdkNameAndVersion: 'Raspberry Pi 4 Model B+',
- platform: const TargetPlatform(.linux, .arm64),
+ platform: TargetPlatform.linux_arm64,
enabled: false,
pingCommand: const <String>['ping', '-w', '500', '-n', '1', 'raspberrypi'],
pingSuccessRegex: RegExp(r'[<=]\d+ms'),
diff --git a/packages/flutter_tools/lib/src/darwin/darwin.dart b/packages/flutter_tools/lib/src/darwin/darwin.dart
index 3a1f109..87feaf9 100644
--- a/packages/flutter_tools/lib/src/darwin/darwin.dart
+++ b/packages/flutter_tools/lib/src/darwin/darwin.dart
@@ -18,7 +18,7 @@
enum FlutterDarwinPlatform {
ios(
binaryName: 'Flutter',
- targetPlatform: TargetPlatform(.ios, .arm64),
+ targetPlatform: TargetPlatform.ios,
swiftPackagePlatform: SwiftPackagePlatform.ios,
artifactName: 'ios',
artifactZip: 'artifacts.zip',
@@ -27,7 +27,7 @@
),
macos(
binaryName: 'FlutterMacOS',
- targetPlatform: TargetPlatform(.macos, .x64),
+ targetPlatform: TargetPlatform.darwin,
swiftPackagePlatform: SwiftPackagePlatform.macos,
artifactName: 'darwin-x64',
artifactZip: 'framework.zip',
@@ -110,10 +110,7 @@
/// Returns corresponding [FlutterDarwinPlatform] for the [targetPlatform].
static FlutterDarwinPlatform? fromTargetPlatform(TargetPlatform targetPlatform) {
for (final FlutterDarwinPlatform darwinPlatform in FlutterDarwinPlatform.values) {
- // Match on the platform type (family) only. A [FlutterDarwinPlatform]
- // describes an OS (iOS or macOS) and is architecture-agnostic, whereas
- // [TargetPlatform] equality also considers the CPU architecture.
- if (targetPlatform.type == darwinPlatform.targetPlatform.type) {
+ if (targetPlatform == darwinPlatform.targetPlatform) {
return darwinPlatform;
}
}
diff --git a/packages/flutter_tools/lib/src/device.dart b/packages/flutter_tools/lib/src/device.dart
index 423e8d6..13382fe 100644
--- a/packages/flutter_tools/lib/src/device.dart
+++ b/packages/flutter_tools/lib/src/device.dart
@@ -41,6 +41,23 @@
}
}
+/// The platform sub-folder that a device type supports.
+enum PlatformType {
+ web,
+ android,
+ ios,
+ linux,
+ macos,
+ windows,
+ fuchsia,
+ custom;
+
+ @override
+ String toString() => name;
+
+ static PlatformType? fromString(String platformType) => values.asNameMap()[platformType];
+}
+
/// A discovery mechanism for flutter-supported development devices.
abstract class DeviceManager {
DeviceManager({required Logger logger}) : _logger = logger;
@@ -339,8 +356,9 @@
Future<bool> isDeviceSupportedForAll(Device device) async {
final TargetPlatform devicePlatform = await device.targetPlatform;
return await device.isSupported() &&
- devicePlatform.type != .fuchsia &&
- devicePlatform.type != .web &&
+ devicePlatform != TargetPlatform.fuchsia_arm64 &&
+ devicePlatform != TargetPlatform.fuchsia_x64 &&
+ devicePlatform != TargetPlatform.web_javascript &&
await isDeviceSupportedForProject(device);
}
@@ -687,16 +705,13 @@
Future<String> supportMessage() async => await isSupported() ? 'Supported' : 'Unsupported';
/// The device's platform.
- ///
- /// By default this is derived from [platformType] and [cpuArch]. Subclasses
- /// may override this if they need custom behavior.
- Future<TargetPlatform> get targetPlatform async => TargetPlatform(platformType!, await cpuArch);
+ Future<TargetPlatform> get targetPlatform;
/// The CPU architecture of the device.
Future<CpuArch> get cpuArch;
/// Platform name for display only.
- Future<String> get targetPlatformDisplayName async => (await targetPlatform).devicePlatformName;
+ Future<String> get targetPlatformDisplayName async => (await targetPlatform).getName();
Future<String> get sdkNameAndVersion;
@@ -834,7 +849,7 @@
var supportIndicator = await device.isSupported() ? '' : ' (unsupported)';
final TargetPlatform targetPlatform = await device.targetPlatform;
if (await device.isLocalEmulator) {
- final type = targetPlatform.type == .ios ? 'simulator' : 'emulator';
+ final type = targetPlatform == TargetPlatform.ios ? 'simulator' : 'emulator';
supportIndicator += ' ($type)';
}
table.add(<String>[
@@ -870,7 +885,7 @@
'name': name,
'id': id,
'isSupported': await isSupported(),
- 'targetPlatform': (await targetPlatform).devicePlatformName,
+ 'targetPlatform': (await targetPlatform).getName(),
'cpuArch': (await cpuArch).name,
'emulator': isLocalEmu,
'sdk': await sdkNameAndVersion,
diff --git a/packages/flutter_tools/lib/src/emulator.dart b/packages/flutter_tools/lib/src/emulator.dart
index fcfe2d6..1dbd5c9 100644
--- a/packages/flutter_tools/lib/src/emulator.dart
+++ b/packages/flutter_tools/lib/src/emulator.dart
@@ -15,7 +15,6 @@
import 'base/file_system.dart';
import 'base/logger.dart';
import 'base/process.dart';
-import 'build_info.dart';
import 'device.dart';
import 'ios/ios_emulators.dart';
diff --git a/packages/flutter_tools/lib/src/flutter_application_package.dart b/packages/flutter_tools/lib/src/flutter_application_package.dart
index 9ff3c40..c61de49 100644
--- a/packages/flutter_tools/lib/src/flutter_application_package.dart
+++ b/packages/flutter_tools/lib/src/flutter_application_package.dart
@@ -49,8 +49,11 @@
BuildInfo? buildInfo,
File? applicationBinary,
}) async {
- switch (platform.type) {
- case .android:
+ switch (platform) {
+ case TargetPlatform.android:
+ case TargetPlatform.android_arm:
+ case TargetPlatform.android_arm64:
+ case TargetPlatform.android_x64:
if (applicationBinary == null) {
return AndroidApk.fromAndroidProject(
FlutterProject.current().android,
@@ -71,32 +74,35 @@
userMessages: _userMessages,
processUtils: _processUtils,
);
- case .ios:
+ case TargetPlatform.ios:
return applicationBinary == null
? await IOSApp.fromIosProject(FlutterProject.current().ios, buildInfo)
: IOSApp.fromPrebuiltApp(applicationBinary);
- case .tester:
+ case TargetPlatform.tester:
return FlutterTesterApp.fromCurrentDirectory(globals.fs);
- case .macos:
+ case TargetPlatform.darwin:
return applicationBinary == null
? MacOSApp.fromMacOSProject(FlutterProject.current().macos)
: MacOSApp.fromPrebuiltApp(applicationBinary);
- case .web:
+ case TargetPlatform.web_javascript:
if (!FlutterProject.current().web.existsSync()) {
return null;
}
return WebApplicationPackage(FlutterProject.current());
- case .linux:
+ case TargetPlatform.linux_x64:
+ case TargetPlatform.linux_arm64:
+ case TargetPlatform.linux_riscv64:
return applicationBinary == null
? LinuxApp.fromLinuxProject(FlutterProject.current().linux)
: LinuxApp.fromPrebuiltApp(applicationBinary);
- case .windows:
+ case TargetPlatform.windows_x64:
+ case TargetPlatform.windows_arm64:
return applicationBinary == null
? WindowsApp.fromWindowsProject(FlutterProject.current().windows)
: WindowsApp.fromPrebuiltApp(applicationBinary);
- case .fuchsia:
- case .custom:
- case .unsupported:
+ case TargetPlatform.fuchsia_arm64:
+ case TargetPlatform.fuchsia_x64:
+ case TargetPlatform.unsupported:
TargetPlatform.throwUnsupportedTarget();
}
}
diff --git a/packages/flutter_tools/lib/src/ios/devices.dart b/packages/flutter_tools/lib/src/ios/devices.dart
index 89d9c2a..48f9fa1 100644
--- a/packages/flutter_tools/lib/src/ios/devices.dart
+++ b/packages/flutter_tools/lib/src/ios/devices.dart
@@ -1238,6 +1238,9 @@
}
@override
+ Future<TargetPlatform> get targetPlatform async => TargetPlatform.ios;
+
+ @override
Future<String> get sdkNameAndVersion async => 'iOS ${_sdkVersion ?? 'unknown version'}';
@override
diff --git a/packages/flutter_tools/lib/src/ios/ios_emulators.dart b/packages/flutter_tools/lib/src/ios/ios_emulators.dart
index 2800d04..3483122 100644
--- a/packages/flutter_tools/lib/src/ios/ios_emulators.dart
+++ b/packages/flutter_tools/lib/src/ios/ios_emulators.dart
@@ -4,7 +4,6 @@
import '../base/common.dart';
import '../base/process.dart';
-import '../build_info.dart';
import '../device.dart';
import '../emulator.dart';
import '../globals.dart' as globals;
diff --git a/packages/flutter_tools/lib/src/ios/mac.dart b/packages/flutter_tools/lib/src/ios/mac.dart
index c9dc71e..4a4fa84 100644
--- a/packages/flutter_tools/lib/src/ios/mac.dart
+++ b/packages/flutter_tools/lib/src/ios/mac.dart
@@ -463,7 +463,7 @@
if (!hasWatchCompanion) {
// ONLY_ACTIVE_ARCH specifies whether the product includes only code for
// the native architecture.
- final onlyActiveArch = activeArch == .fromHostPlatform(getCurrentHostPlatform());
+ final onlyActiveArch = activeArch == CpuArch.fromHostPlatform(getCurrentHostPlatform());
buildCommands.add('ONLY_ACTIVE_ARCH=${onlyActiveArch ? 'YES' : 'NO'}');
buildCommands.add('ARCHS=${activeArch.darwinArchName}');
@@ -729,7 +729,7 @@
}) {
final String? basePath = artifacts?.getArtifactPath(
Artifact.flutterFramework,
- platform: FlutterDarwinPlatform.ios.targetPlatform,
+ platform: TargetPlatform.ios,
mode: mode,
environmentType: environmentType,
);
diff --git a/packages/flutter_tools/lib/src/ios/simulators.dart b/packages/flutter_tools/lib/src/ios/simulators.dart
index 645e00c..f91b650 100644
--- a/packages/flutter_tools/lib/src/ios/simulators.dart
+++ b/packages/flutter_tools/lib/src/ios/simulators.dart
@@ -623,6 +623,9 @@
}
@override
+ Future<TargetPlatform> get targetPlatform async => TargetPlatform.ios;
+
+ @override
Future<String> get sdkNameAndVersion async => simulatorCategory;
final _iosSdkRegExp = RegExp(r'iOS( |-)(\d+)');
diff --git a/packages/flutter_tools/lib/src/ios/xcode_build_settings.dart b/packages/flutter_tools/lib/src/ios/xcode_build_settings.dart
index 3ac5662..30f8d09 100644
--- a/packages/flutter_tools/lib/src/ios/xcode_build_settings.dart
+++ b/packages/flutter_tools/lib/src/ios/xcode_build_settings.dart
@@ -7,7 +7,6 @@
import '../base/file_system.dart';
import '../build_info.dart';
import '../cache.dart';
-import '../darwin/darwin.dart';
import '../flutter_manifest.dart';
import '../globals.dart' as globals;
import '../project.dart';
@@ -16,7 +15,7 @@
String flutterMacOSFrameworkDir(BuildMode mode, FileSystem fileSystem, Artifacts artifacts) {
final String flutterMacOSFramework = artifacts.getArtifactPath(
Artifact.flutterMacOSFramework,
- platform: FlutterDarwinPlatform.macos.targetPlatform,
+ platform: TargetPlatform.darwin,
mode: mode,
);
return fileSystem.path.normalize(fileSystem.path.dirname(flutterMacOSFramework));
@@ -134,14 +133,14 @@
/// Build name parsed and validated from build info and manifest. Used for CFBundleShortVersionString.
String? parsedBuildName({required FlutterManifest manifest, BuildInfo? buildInfo}) {
final String? buildNameToParse = buildInfo?.buildName ?? manifest.buildName;
- return validatedBuildNameForPlatform(PlatformType.ios, buildNameToParse, globals.logger);
+ return validatedBuildNameForPlatform(TargetPlatform.ios, buildNameToParse, globals.logger);
}
/// Build number parsed and validated from build info and manifest. Used for CFBundleVersion.
String? parsedBuildNumber({required FlutterManifest manifest, BuildInfo? buildInfo}) {
String? buildNumberToParse = buildInfo?.buildNumber ?? manifest.buildNumber;
final String? buildNumber = validatedBuildNumberForPlatform(
- PlatformType.ios,
+ TargetPlatform.ios,
buildNumberToParse,
globals.logger,
);
@@ -151,7 +150,7 @@
// Drop back to parsing build name if build number is not present. Build number is optional in the manifest, but
// FLUTTER_BUILD_NUMBER is required as the backing value for the required CFBundleVersion.
buildNumberToParse = buildInfo?.buildName ?? manifest.buildName;
- return validatedBuildNumberForPlatform(PlatformType.ios, buildNumberToParse, globals.logger);
+ return validatedBuildNumberForPlatform(TargetPlatform.ios, buildNumberToParse, globals.logger);
}
/// List of lines of build settings. Example: 'FLUTTER_BUILD_DIR=build'
diff --git a/packages/flutter_tools/lib/src/isolated/devfs_web.dart b/packages/flutter_tools/lib/src/isolated/devfs_web.dart
index 581c51f..bd8702f 100644
--- a/packages/flutter_tools/lib/src/isolated/devfs_web.dart
+++ b/packages/flutter_tools/lib/src/isolated/devfs_web.dart
@@ -480,7 +480,7 @@
fileSystem.path.join(
globals.artifacts!.getArtifactPath(
Artifact.engineDartSdkPath,
- platform: const TargetPlatform(.web, .unknown),
+ platform: TargetPlatform.web_javascript,
),
'lib',
'dev_compiler',
@@ -494,7 +494,7 @@
fileSystem.path.join(
globals.artifacts!.getArtifactPath(
Artifact.engineDartSdkPath,
- platform: const TargetPlatform(.web, .unknown),
+ platform: TargetPlatform.web_javascript,
),
'lib',
'dev_compiler',
@@ -516,7 +516,7 @@
fileSystem.path.join(
globals.artifacts!.getArtifactPath(
Artifact.engineDartSdkPath,
- platform: const TargetPlatform(.web, .unknown),
+ platform: TargetPlatform.web_javascript,
),
'lib',
'dev_compiler',
diff --git a/packages/flutter_tools/lib/src/isolated/native_assets/native_assets.dart b/packages/flutter_tools/lib/src/isolated/native_assets/native_assets.dart
index 654d6d6..3e0ec38 100644
--- a/packages/flutter_tools/lib/src/isolated/native_assets/native_assets.dart
+++ b/packages/flutter_tools/lib/src/isolated/native_assets/native_assets.dart
@@ -97,7 +97,10 @@
buildDataAssets: buildDataAssets,
);
- final BuildMode buildMode = _getBuildMode(environmentDefines, targetPlatform.type == .tester);
+ final BuildMode buildMode = _getBuildMode(
+ environmentDefines,
+ targetPlatform == TargetPlatform.tester,
+ );
final bool linkingEnabled = _nativeAssetsLinkingEnabled(buildMode);
final DartHooksResult linkResult;
if (linkingEnabled) {
@@ -222,7 +225,10 @@
if (featureFlags.isDartDataAssetsEnabled && buildDataAssets) SupportedAssetTypes.dataAssets,
];
- final BuildMode buildMode = _getBuildMode(environmentDefines, targetPlatform.type == .tester);
+ final BuildMode buildMode = _getBuildMode(
+ environmentDefines,
+ targetPlatform == TargetPlatform.tester,
+ );
return AssetBuildTarget.targetsFor(
targetPlatform: targetPlatform,
@@ -256,7 +262,10 @@
if (featureFlags.isDartDataAssetsEnabled && buildDataAssets) SupportedAssetTypes.dataAssets,
];
- final BuildMode buildMode = _getBuildMode(environmentDefines, targetPlatform.type == .tester);
+ final BuildMode buildMode = _getBuildMode(
+ environmentDefines,
+ targetPlatform == TargetPlatform.tester,
+ );
if (supportedAssetTypes.contains(SupportedAssetTypes.codeAssets)) {
for (final CodeAssetTarget target in targets.whereType<CodeAssetTarget>()) {
@@ -476,7 +485,7 @@
required Uri targetUri,
}) async {
final OS targetOS = getNativeOSFromTargetPlatform(targetPlatform);
- final flutterTester = targetPlatform.type == .tester;
+ final flutterTester = targetPlatform == TargetPlatform.tester;
final BuildMode buildMode = _getBuildMode(environmentDefines, flutterTester);
final String? codesignIdentity = environmentDefines[kCodesignIdentity];
@@ -953,20 +962,27 @@
}
OS getNativeOSFromTargetPlatform(TargetPlatform platform) {
- switch (platform.type) {
- case .ios:
+ switch (platform) {
+ case TargetPlatform.ios:
return OS.iOS;
- case .macos:
+ case TargetPlatform.darwin:
return OS.macOS;
- case .linux:
+ case TargetPlatform.linux_x64:
+ case TargetPlatform.linux_arm64:
+ case TargetPlatform.linux_riscv64:
return OS.linux;
- case .windows:
+ case TargetPlatform.windows_x64:
+ case TargetPlatform.windows_arm64:
return OS.windows;
- case .fuchsia:
+ case TargetPlatform.fuchsia_arm64:
+ case TargetPlatform.fuchsia_x64:
return OS.fuchsia;
- case .android:
+ case TargetPlatform.android:
+ case TargetPlatform.android_arm:
+ case TargetPlatform.android_arm64:
+ case TargetPlatform.android_x64:
return OS.android;
- case .tester:
+ case TargetPlatform.tester:
if (const LocalPlatform().isMacOS) {
return OS.macOS;
} else if (const LocalPlatform().isLinux) {
@@ -976,10 +992,9 @@
} else {
throw StateError('Unknown operating system');
}
- case .web:
+ case TargetPlatform.web_javascript:
throw StateError('No dart builds for web yet.');
- case .custom:
- case .unsupported:
+ case TargetPlatform.unsupported:
TargetPlatform.throwUnsupportedTarget();
}
}
diff --git a/packages/flutter_tools/lib/src/isolated/native_assets/targets.dart b/packages/flutter_tools/lib/src/isolated/native_assets/targets.dart
index 2b3129b..afe0ed3 100644
--- a/packages/flutter_tools/lib/src/isolated/native_assets/targets.dart
+++ b/packages/flutter_tools/lib/src/isolated/native_assets/targets.dart
@@ -67,32 +67,33 @@
required List<SupportedAssetTypes> supportedAssetTypes,
required Directory? buildDirectory,
}) {
- switch (targetPlatform.type) {
- case .windows:
- return _windowsTarget(
- supportedAssetTypes,
- targetPlatform.cpuArch == .arm64 ? Architecture.arm64 : Architecture.x64,
- );
- case .linux:
- final Architecture architecture = switch (targetPlatform.cpuArch) {
- .arm64 => Architecture.arm64,
- .riscv64 => Architecture.riscv64,
- _ => Architecture.x64,
- };
- return _linuxTarget(supportedAssetTypes, architecture, buildMode, buildDirectory);
- case .macos:
+ switch (targetPlatform) {
+ case TargetPlatform.windows_x64:
+ return _windowsTarget(supportedAssetTypes, Architecture.x64);
+ case TargetPlatform.linux_x64:
+ return _linuxTarget(supportedAssetTypes, Architecture.x64, buildMode, buildDirectory);
+ case TargetPlatform.linux_arm64:
+ return _linuxTarget(supportedAssetTypes, Architecture.arm64, buildMode, buildDirectory);
+ case TargetPlatform.linux_riscv64:
+ return _linuxTarget(supportedAssetTypes, Architecture.riscv64, buildMode, buildDirectory);
+ case TargetPlatform.windows_arm64:
+ return _windowsTarget(supportedAssetTypes, Architecture.arm64);
+ case TargetPlatform.darwin:
return _macTargets(environmentDefines, supportedAssetTypes);
- case .android:
+ case TargetPlatform.android:
+ case TargetPlatform.android_arm:
+ case TargetPlatform.android_arm64:
+ case TargetPlatform.android_x64:
return _androidTargets(targetPlatform, environmentDefines, supportedAssetTypes);
- case .ios:
+ case TargetPlatform.ios:
return _iosTargets(environmentDefines, fileSystem, supportedAssetTypes);
- case .web:
+ case TargetPlatform.web_javascript:
return _webTarget(supportedAssetTypes);
- case .tester:
+ case TargetPlatform.tester:
return _flutterTesterTarget(supportedAssetTypes);
- case .fuchsia:
- case .custom:
- case .unsupported:
+ case TargetPlatform.fuchsia_arm64:
+ case TargetPlatform.fuchsia_x64:
+ case TargetPlatform.unsupported:
throwToolExit('No targets defined for target platform $targetPlatform.');
}
}
@@ -418,16 +419,32 @@
}
List<CpuArch> _androidArchs(TargetPlatform targetPlatform, String? androidArchsEnvironment) {
- if (targetPlatform.type != .android) {
- throwToolExit('Unsupported Android target platform: $targetPlatform.');
+ switch (targetPlatform) {
+ case TargetPlatform.android_arm:
+ return <CpuArch>[CpuArch.armv7];
+ case TargetPlatform.android_arm64:
+ return <CpuArch>[CpuArch.arm64];
+ case TargetPlatform.android_x64:
+ return <CpuArch>[CpuArch.x64];
+ case TargetPlatform.android:
+ if (androidArchsEnvironment == null) {
+ throw MissingDefineException(kAndroidArchs, 'native_assets');
+ }
+ return androidArchsEnvironment.split(' ').map(getCpuArchForName).toList();
+ case TargetPlatform.darwin:
+ case TargetPlatform.fuchsia_arm64:
+ case TargetPlatform.fuchsia_x64:
+ case TargetPlatform.ios:
+ case TargetPlatform.linux_arm64:
+ case TargetPlatform.linux_riscv64:
+ case TargetPlatform.linux_x64:
+ case TargetPlatform.tester:
+ case TargetPlatform.web_javascript:
+ case TargetPlatform.windows_x64:
+ case TargetPlatform.windows_arm64:
+ case TargetPlatform.unsupported:
+ throwToolExit('Unsupported Android target platform: $targetPlatform.');
}
- return switch (targetPlatform.cpuArch) {
- .armv7 || .arm64 || .x64 => <CpuArch>[targetPlatform.cpuArch],
- CpuArch.unknown when androidArchsEnvironment != null =>
- androidArchsEnvironment.split(' ').map(getCpuArchForName).toList(),
- .unknown => throw MissingDefineException(kAndroidArchs, 'native_assets'),
- .x86 || .riscv64 => throwToolExit('Unsupported Android target platform: $targetPlatform.'),
- };
}
String? _emptyToNull(String? input) {
diff --git a/packages/flutter_tools/lib/src/isolated/native_assets/test/native_assets.dart b/packages/flutter_tools/lib/src/isolated/native_assets/test/native_assets.dart
index 0adf4ba..73bc965 100644
--- a/packages/flutter_tools/lib/src/isolated/native_assets/test/native_assets.dart
+++ b/packages/flutter_tools/lib/src/isolated/native_assets/test/native_assets.dart
@@ -62,7 +62,7 @@
// Only `flutter test` uses the
// `build/native_assets/<os>/native_assets.json` file which uses absolute
// paths to the shared libraries.
- final OS targetOS = getNativeOSFromTargetPlatform(const TargetPlatform(.tester, .unknown));
+ final OS targetOS = getNativeOSFromTargetPlatform(TargetPlatform.tester);
final String buildDir = getBuildDirectory();
final String osName = targetOS.name;
final Uri buildUri = projectUri.resolve('$buildDir/native_assets/$osName/');
@@ -74,7 +74,7 @@
final DartHooksResult dartHookResult = await runFlutterSpecificHooks(
environmentDefines: environmentDefines,
buildRunner: buildRunner,
- targetPlatform: const TargetPlatform(.tester, .unknown),
+ targetPlatform: TargetPlatform.tester,
projectUri: projectUri,
fileSystem: globals.fs,
buildCodeAssets: const BuildCodeAssetsOptions(
@@ -89,7 +89,7 @@
await installCodeAssets(
dartHookResult: dartHookResult,
environmentDefines: environmentDefines,
- targetPlatform: const TargetPlatform(.tester, .unknown),
+ targetPlatform: TargetPlatform.tester,
projectUri: projectUri,
fileSystem: globals.fs,
nativeAssetsFileUri: nativeAssetsFileUri,
diff --git a/packages/flutter_tools/lib/src/isolated/resident_web_runner.dart b/packages/flutter_tools/lib/src/isolated/resident_web_runner.dart
index f6e5879..6f49a8b 100644
--- a/packages/flutter_tools/lib/src/isolated/resident_web_runner.dart
+++ b/packages/flutter_tools/lib/src/isolated/resident_web_runner.dart
@@ -263,7 +263,7 @@
}) async {
final ApplicationPackage? package = await ApplicationPackageFactory.instance!
.getPackageForPlatform(
- const TargetPlatform(.web, .unknown),
+ TargetPlatform.web_javascript,
buildInfo: debuggingOptions.buildInfo,
);
if (package == null) {
@@ -292,9 +292,7 @@
? WebExpressionCompiler(flutterDevice!.generator!, fileSystem: _fileSystem)
: null;
- flutterDevice!.developmentShaderCompiler.configureCompiler(
- const TargetPlatform(.web, .unknown),
- );
+ flutterDevice!.developmentShaderCompiler.configureCompiler(TargetPlatform.web_javascript);
flutterDevice!.devFS = WebDevFS(
webDevServerConfig: updatedConfig,
@@ -463,7 +461,7 @@
status = _logger.startProgress('Performing hot reload...', progressId: 'hot.reload');
}
- final String targetPlatform = const TargetPlatform(.web, .unknown).getName();
+ final String targetPlatform = TargetPlatform.web_javascript.getName();
final String sdkName = await flutterDevice!.device!.sdkNameAndVersion;
// Will be null if there is no report.
@@ -752,12 +750,12 @@
_logger.printTrace('Updating assets');
final int result = await assetBundle.build(
flutterHookResult: await dartBuilder?.runHooks(
- targetPlatform: const TargetPlatform(.web, .unknown),
+ targetPlatform: TargetPlatform.web_javascript,
environment: environment,
logger: _logger,
),
packageConfigPath: debuggingOptions.buildInfo.packageConfigPath,
- targetPlatform: const TargetPlatform(.web, .unknown),
+ targetPlatform: TargetPlatform.web_javascript,
);
if (result != 0) {
return UpdateFSReport();
diff --git a/packages/flutter_tools/lib/src/isolated/web_asset_server.dart b/packages/flutter_tools/lib/src/isolated/web_asset_server.dart
index ed794b5..8ba8c0f 100644
--- a/packages/flutter_tools/lib/src/isolated/web_asset_server.dart
+++ b/packages/flutter_tools/lib/src/isolated/web_asset_server.dart
@@ -737,7 +737,7 @@
.directory(
globals.artifacts!.getArtifactPath(
Artifact.engineDartSdkPath,
- platform: const TargetPlatform(.web, .unknown),
+ platform: TargetPlatform.web_javascript,
),
)
.parent;
diff --git a/packages/flutter_tools/lib/src/linux/build_linux.dart b/packages/flutter_tools/lib/src/linux/build_linux.dart
index af5c5f2..d13755bd 100644
--- a/packages/flutter_tools/lib/src/linux/build_linux.dart
+++ b/packages/flutter_tools/lib/src/linux/build_linux.dart
@@ -168,8 +168,10 @@
await buildDir.create(recursive: true);
final String buildFlag = sentenceCase(buildModeName);
- final bool needCrossBuildOptionsForArm64 = needCrossBuild && targetPlatform.cpuArch == .arm64;
- final bool needCrossBuildOptionsForRiscv64 = needCrossBuild && targetPlatform.cpuArch == .riscv64;
+ final bool needCrossBuildOptionsForArm64 =
+ needCrossBuild && targetPlatform == TargetPlatform.linux_arm64;
+ final bool needCrossBuildOptionsForRiscv64 =
+ needCrossBuild && targetPlatform == TargetPlatform.linux_riscv64;
int result;
if (!globals.processManager.canRun('cmake')) {
throwToolExit(globals.userMessages.cmakeMissing);
diff --git a/packages/flutter_tools/lib/src/linux/linux_device.dart b/packages/flutter_tools/lib/src/linux/linux_device.dart
index 9cec26d..13a3a73 100644
--- a/packages/flutter_tools/lib/src/linux/linux_device.dart
+++ b/packages/flutter_tools/lib/src/linux/linux_device.dart
@@ -41,6 +41,16 @@
String get name => 'Linux';
@override
+ late final Future<TargetPlatform> targetPlatform = () async {
+ if (_operatingSystemUtils.hostPlatform == HostPlatform.linux_x64) {
+ return TargetPlatform.linux_x64;
+ } else if (_operatingSystemUtils.hostPlatform == HostPlatform.linux_riscv64) {
+ return TargetPlatform.linux_riscv64;
+ }
+ return TargetPlatform.linux_arm64;
+ }();
+
+ @override
Future<CpuArch> get cpuArch async => CpuArch.fromHostPlatform(_operatingSystemUtils.hostPlatform);
@override
diff --git a/packages/flutter_tools/lib/src/macos/macos_device.dart b/packages/flutter_tools/lib/src/macos/macos_device.dart
index 8c465ba..dee6441 100644
--- a/packages/flutter_tools/lib/src/macos/macos_device.dart
+++ b/packages/flutter_tools/lib/src/macos/macos_device.dart
@@ -43,6 +43,9 @@
bool get supportsFlavors => true;
@override
+ Future<TargetPlatform> get targetPlatform async => TargetPlatform.darwin;
+
+ @override
Future<CpuArch> get cpuArch async => CpuArch.fromHostPlatform(_operatingSystemUtils.hostPlatform);
@override
diff --git a/packages/flutter_tools/lib/src/macos/macos_ipad_device.dart b/packages/flutter_tools/lib/src/macos/macos_ipad_device.dart
index 9396524..6255712 100644
--- a/packages/flutter_tools/lib/src/macos/macos_ipad_device.dart
+++ b/packages/flutter_tools/lib/src/macos/macos_ipad_device.dart
@@ -35,6 +35,9 @@
@override
String get name => 'Mac Designed for iPad';
+ @override
+ Future<TargetPlatform> get targetPlatform async => TargetPlatform.darwin;
+
// "Designed for iPad" apps are only supported on Apple Silicon Macs.
@override
Future<CpuArch> get cpuArch async => CpuArch.arm64;
diff --git a/packages/flutter_tools/lib/src/mdns_discovery.dart b/packages/flutter_tools/lib/src/mdns_discovery.dart
index 1cd1be7..0840c95 100644
--- a/packages/flutter_tools/lib/src/mdns_discovery.dart
+++ b/packages/flutter_tools/lib/src/mdns_discovery.dart
@@ -579,8 +579,8 @@
return;
}
final TargetPlatform targetPlatform = await device.targetPlatform;
- switch (targetPlatform.type) {
- case .ios:
+ switch (targetPlatform) {
+ case TargetPlatform.ios:
_analytics.send(
Event.appleUsageEvent(workflow: 'ios-mdns', parameter: 'no-ipv4-link-local'),
);
@@ -591,16 +591,22 @@
'under System Preferences > Network > iPhone USB. '
'See https://github.com/flutter/flutter/issues/46698 for details.',
);
- case .android:
- case .macos:
- case .fuchsia:
- case .linux:
- case .tester:
- case .web:
- case .windows:
- case .custom:
+ case TargetPlatform.android:
+ case TargetPlatform.android_arm:
+ case TargetPlatform.android_arm64:
+ case TargetPlatform.android_x64:
+ case TargetPlatform.darwin:
+ case TargetPlatform.fuchsia_arm64:
+ case TargetPlatform.fuchsia_x64:
+ case TargetPlatform.linux_arm64:
+ case TargetPlatform.linux_riscv64:
+ case TargetPlatform.linux_x64:
+ case TargetPlatform.tester:
+ case TargetPlatform.web_javascript:
+ case TargetPlatform.windows_x64:
+ case TargetPlatform.windows_arm64:
_logger.printTrace('No interface with an ipv4 link local address was found.');
- case .unsupported:
+ case TargetPlatform.unsupported:
TargetPlatform.throwUnsupportedTarget();
}
}
diff --git a/packages/flutter_tools/lib/src/proxied_devices/devices.dart b/packages/flutter_tools/lib/src/proxied_devices/devices.dart
index b9beb1d..65fd5e1 100644
--- a/packages/flutter_tools/lib/src/proxied_devices/devices.dart
+++ b/packages/flutter_tools/lib/src/proxied_devices/devices.dart
@@ -493,7 +493,7 @@
final String id = _cast<String>(
await connection.sendRequest('device.uploadApplicationPackage', <String, Object>{
- 'targetPlatform': _targetPlatform.devicePlatformName,
+ 'targetPlatform': _targetPlatform.getName(),
'applicationBinary': fileName,
}),
);
diff --git a/packages/flutter_tools/lib/src/resident_runner.dart b/packages/flutter_tools/lib/src/resident_runner.dart
index fa37c80..12d366f 100644
--- a/packages/flutter_tools/lib/src/resident_runner.dart
+++ b/packages/flutter_tools/lib/src/resident_runner.dart
@@ -738,7 +738,7 @@
return false;
}
for (final FlutterDevice? device in flutterDevices) {
- if (device!.targetPlatform.type == .web) {
+ if (device!.targetPlatform == TargetPlatform.web_javascript) {
continue;
}
final List<FlutterView> views = await device.vmService!.getFlutterViews();
@@ -891,7 +891,7 @@
}
Future<bool> _takeVmServiceScreenshot(FlutterDevice device, File outputFile) async {
- if (device.targetPlatform.type != .web) {
+ if (device.targetPlatform != TargetPlatform.web_javascript) {
return false;
}
assert(supportsServiceProtocol);
@@ -1487,7 +1487,7 @@
commandHelp.b.print();
} else {
final bool isRunningOnWeb = flutterDevices.every((FlutterDevice? flutterDevice) {
- return flutterDevice?.targetPlatform.type == .web;
+ return flutterDevice?.targetPlatform == TargetPlatform.web_javascript;
});
if (!isRunningOnWeb) {
@@ -1556,7 +1556,7 @@
}
// 3. Perform the standard, cross-platform eviction calls.
- final supportsShaderReload = device.targetPlatform.type != .web;
+ final supportsShaderReload = device.targetPlatform != TargetPlatform.web_javascript;
for (final String assetPath in devFS.assetPathsToEvict) {
// Flutter GPU shader bundles reload the compiled ShaderLibrary in place
// via the `ext.ui.gpu.reinitializeShaderLibrary` extension. It is
@@ -1578,7 +1578,7 @@
// this throws an internal RPCError (-32603) instead of a standard MethodNotFound
// error, which would break the hot reload.
// See https://github.com/flutter/flutter/issues/137265
- if (device.targetPlatform.type != .web) {
+ if (device.targetPlatform != TargetPlatform.web_javascript) {
for (final String assetPath in devFS.shaderPathsToEvict) {
futures.add(vmService.flutterEvictShader(assetPath, isolateId: firstUiIsolate.id!));
}
@@ -1637,25 +1637,28 @@
}
Future<String?> getMissingPackageHintForPlatform(TargetPlatform platform) async {
- switch (platform.type) {
- case .android:
- if (platform.cpuArch == .unknown) {
- return null;
- }
+ switch (platform) {
+ case TargetPlatform.android_arm:
+ case TargetPlatform.android_arm64:
+ case TargetPlatform.android_x64:
final FlutterProject project = FlutterProject.current();
final String manifestPath = globals.fs.path.relative(project.android.appManifestFile.path);
return 'Is your project missing an $manifestPath?\nConsider running "flutter create ." to create one.';
- case .ios:
+ case TargetPlatform.ios:
return 'Is your project missing an ios/Runner/Info.plist?\nConsider running "flutter create ." to create one.';
- case .macos:
- case .fuchsia:
- case .linux:
- case .tester:
- case .web:
- case .windows:
- case .custom:
+ case TargetPlatform.android:
+ case TargetPlatform.darwin:
+ case TargetPlatform.fuchsia_arm64:
+ case TargetPlatform.fuchsia_x64:
+ case TargetPlatform.linux_arm64:
+ case TargetPlatform.linux_riscv64:
+ case TargetPlatform.linux_x64:
+ case TargetPlatform.tester:
+ case TargetPlatform.web_javascript:
+ case TargetPlatform.windows_x64:
+ case TargetPlatform.windows_arm64:
return null;
- case .unsupported:
+ case TargetPlatform.unsupported:
TargetPlatform.throwUnsupportedTarget();
}
}
@@ -1911,12 +1914,14 @@
final bool isRunningOnWeb = residentRunner.flutterDevices.every((
FlutterDevice? flutterDevice,
) {
- return flutterDevice?.targetPlatform.type == .web;
+ return flutterDevice?.targetPlatform == TargetPlatform.web_javascript;
});
if (residentRunner.isRunningDebug || !isRunningOnWeb) {
// DevTools are only supported in debug mode for web, see https://docs.flutter.dev/testing/build-modes#profile
return residentRunner.flutterDevices
- .where((FlutterDevice? device) => device?.targetPlatform.type != .web)
+ .where(
+ (FlutterDevice? device) => device?.targetPlatform != TargetPlatform.web_javascript,
+ )
.fold<bool>(
true,
(bool s, FlutterDevice? device) =>
diff --git a/packages/flutter_tools/lib/src/run_hot.dart b/packages/flutter_tools/lib/src/run_hot.dart
index d039691..17ca7be 100644
--- a/packages/flutter_tools/lib/src/run_hot.dart
+++ b/packages/flutter_tools/lib/src/run_hot.dart
@@ -156,7 +156,7 @@
case 1:
final Device device = flutterDevices.first.device!;
final TargetPlatform targetPlatform = await device.targetPlatform;
- _targetPlatformName = targetPlatform.devicePlatformName;
+ _targetPlatformName = targetPlatform.getName();
_targetPlatforms.add(targetPlatform);
_sdkName = await device.sdkNameAndVersion;
_emulator = await device.isLocalEmulator;
@@ -1124,8 +1124,9 @@
uiIsolateId: view.uiIsolate!.id,
viewId: view.id,
windows:
- (device.targetPlatform.type == .tester && globals.platform.isWindows) ||
- device.targetPlatform.type == .windows,
+ (device.targetPlatform == TargetPlatform.tester && globals.platform.isWindows) ||
+ device.targetPlatform == TargetPlatform.windows_x64 ||
+ device.targetPlatform == TargetPlatform.windows_arm64,
),
),
);
diff --git a/packages/flutter_tools/lib/src/runner/flutter_command.dart b/packages/flutter_tools/lib/src/runner/flutter_command.dart
index f722399..bbc03a2 100644
--- a/packages/flutter_tools/lib/src/runner/flutter_command.dart
+++ b/packages/flutter_tools/lib/src/runner/flutter_command.dart
@@ -2201,32 +2201,38 @@
// if none is supported
@protected
DevelopmentArtifact? artifactFromTargetPlatform(TargetPlatform targetPlatform) {
- switch (targetPlatform.type) {
- case .android:
+ switch (targetPlatform) {
+ case TargetPlatform.android:
+ case TargetPlatform.android_arm:
+ case TargetPlatform.android_arm64:
+ case TargetPlatform.android_x64:
return DevelopmentArtifact.androidGenSnapshot;
- case .web:
+ case TargetPlatform.web_javascript:
return DevelopmentArtifact.web;
- case .ios:
+ case TargetPlatform.ios:
return DevelopmentArtifact.iOS;
- case .macos:
+ case TargetPlatform.darwin:
if (featureFlags.isMacOSEnabled) {
return DevelopmentArtifact.macOS;
}
return null;
- case .windows:
+ case TargetPlatform.windows_x64:
+ case TargetPlatform.windows_arm64:
if (featureFlags.isWindowsEnabled) {
return DevelopmentArtifact.windows;
}
return null;
- case .linux:
+ case TargetPlatform.linux_x64:
+ case TargetPlatform.linux_arm64:
+ case TargetPlatform.linux_riscv64:
if (featureFlags.isLinuxEnabled) {
return DevelopmentArtifact.linux;
}
return null;
- case .fuchsia:
- case .tester:
- case .custom:
- case .unsupported:
+ case TargetPlatform.fuchsia_arm64:
+ case TargetPlatform.fuchsia_x64:
+ case TargetPlatform.tester:
+ case TargetPlatform.unsupported:
return null;
}
}
diff --git a/packages/flutter_tools/lib/src/test/flutter_web_platform.dart b/packages/flutter_tools/lib/src/test/flutter_web_platform.dart
index efb1c97..5a31e32 100644
--- a/packages/flutter_tools/lib/src/test/flutter_web_platform.dart
+++ b/packages/flutter_tools/lib/src/test/flutter_web_platform.dart
@@ -246,7 +246,7 @@
_fileSystem.path.join(
_artifacts!.getArtifactPath(
Artifact.engineDartSdkPath,
- platform: const TargetPlatform(.web, .unknown),
+ platform: TargetPlatform.web_javascript,
),
'lib',
'dev_compiler',
@@ -260,7 +260,7 @@
_fileSystem.path.join(
_artifacts!.getArtifactPath(
Artifact.engineDartSdkPath,
- platform: const TargetPlatform(.web, .unknown),
+ platform: TargetPlatform.web_javascript,
),
'lib',
'dev_compiler',
@@ -274,7 +274,7 @@
_fileSystem.path.join(
_artifacts!.getArtifactPath(
Artifact.engineDartSdkPath,
- platform: const TargetPlatform(.web, .unknown),
+ platform: TargetPlatform.web_javascript,
),
'lib',
'dev_compiler',
diff --git a/packages/flutter_tools/lib/src/test/runner.dart b/packages/flutter_tools/lib/src/test/runner.dart
index c0e8000..af01c96 100644
--- a/packages/flutter_tools/lib/src/test/runner.dart
+++ b/packages/flutter_tools/lib/src/test/runner.dart
@@ -554,7 +554,7 @@
final Stopwatch? testTimeRecorderStopwatch = testTimeRecorder?.start(TestTimePhases.Compile);
final ResidentCompiler residentCompiler = residentCompilerFactory.create(
- targetPlatform: const TargetPlatform(.tester, .unknown),
+ targetPlatform: .tester,
artifacts: globals.artifacts!,
logger: globals.logger,
processManager: globals.processManager,
diff --git a/packages/flutter_tools/lib/src/test/test_compiler.dart b/packages/flutter_tools/lib/src/test/test_compiler.dart
index 45d5a91..28cefab 100644
--- a/packages/flutter_tools/lib/src/test/test_compiler.dart
+++ b/packages/flutter_tools/lib/src/test/test_compiler.dart
@@ -201,7 +201,7 @@
fileSystem: globals.fs,
shutdownHooks: globals.shutdownHooks,
config: globals.config,
- targetPlatform: const TargetPlatform(.tester, .unknown),
+ targetPlatform: .tester,
);
return residentCompiler;
}
diff --git a/packages/flutter_tools/lib/src/test/web_test_compiler.dart b/packages/flutter_tools/lib/src/test/web_test_compiler.dart
index 801d385..b1dace1 100644
--- a/packages/flutter_tools/lib/src/test/web_test_compiler.dart
+++ b/packages/flutter_tools/lib/src/test/web_test_compiler.dart
@@ -149,7 +149,7 @@
fileSystem: _fileSystem,
shutdownHooks: _shutdownHooks,
config: _config,
- targetPlatform: const TargetPlatform(.web, .unknown),
+ targetPlatform: .web_javascript,
);
final CompilerOutput? output = await residentCompiler.recompile(
@@ -204,7 +204,7 @@
final compilationArgs = <String>[
_artifacts.getArtifactPath(
Artifact.engineDartBinary,
- platform: const TargetPlatform(.web, .unknown),
+ platform: TargetPlatform.web_javascript,
),
'compile',
'wasm',
diff --git a/packages/flutter_tools/lib/src/tester/flutter_tester.dart b/packages/flutter_tools/lib/src/tester/flutter_tester.dart
index 306d548..f87c657 100644
--- a/packages/flutter_tools/lib/src/tester/flutter_tester.dart
+++ b/packages/flutter_tools/lib/src/tester/flutter_tester.dart
@@ -94,7 +94,7 @@
bool get supportsFlavors => true;
@override
- Future<TargetPlatform> get targetPlatform async => const TargetPlatform(.tester, .unknown);
+ Future<TargetPlatform> get targetPlatform async => TargetPlatform.tester;
@override
Future<CpuArch> get cpuArch async => CpuArch.unknown;
@@ -152,7 +152,7 @@
buildInfo: buildInfo,
mainPath: mainPath,
applicationKernelFilePath: applicationKernelFilePath,
- platform: const TargetPlatform(.tester, .unknown),
+ platform: TargetPlatform.tester,
assetDirPath: assetDirectory.path,
);
diff --git a/packages/flutter_tools/lib/src/web/web_device.dart b/packages/flutter_tools/lib/src/web/web_device.dart
index a99a631..d6ea3be 100644
--- a/packages/flutter_tools/lib/src/web/web_device.dart
+++ b/packages/flutter_tools/lib/src/web/web_device.dart
@@ -168,6 +168,9 @@
}
@override
+ Future<TargetPlatform> get targetPlatform async => TargetPlatform.web_javascript;
+
+ @override
Future<bool> uninstallApp(ApplicationPackage app, {String? userIdentifier}) async => true;
@override
@@ -467,6 +470,9 @@
}
@override
+ Future<TargetPlatform> get targetPlatform async => TargetPlatform.web_javascript;
+
+ @override
Future<bool> uninstallApp(ApplicationPackage app, {String? userIdentifier}) async {
return true;
}
diff --git a/packages/flutter_tools/lib/src/windows/build_windows.dart b/packages/flutter_tools/lib/src/windows/build_windows.dart
index 62183da..70ae440 100644
--- a/packages/flutter_tools/lib/src/windows/build_windows.dart
+++ b/packages/flutter_tools/lib/src/windows/build_windows.dart
@@ -170,12 +170,10 @@
}
String getCmakeWindowsArch(TargetPlatform targetPlatform) {
- if (targetPlatform.type != .windows) {
- throw Exception('Unsupported target platform "$targetPlatform".');
- }
- return switch (targetPlatform.cpuArch) {
- .arm64 => 'ARM64',
- _ => 'x64',
+ return switch (targetPlatform) {
+ TargetPlatform.windows_x64 => 'x64',
+ TargetPlatform.windows_arm64 => 'ARM64',
+ _ => throw Exception('Unsupported target platform "$targetPlatform".'),
};
}
diff --git a/packages/flutter_tools/lib/src/windows/windows_device.dart b/packages/flutter_tools/lib/src/windows/windows_device.dart
index 3acc69d..e3014cf 100644
--- a/packages/flutter_tools/lib/src/windows/windows_device.dart
+++ b/packages/flutter_tools/lib/src/windows/windows_device.dart
@@ -38,9 +38,12 @@
@override
String get name => 'Windows';
+ @override
+ Future<TargetPlatform> get targetPlatform async => _targetPlatform;
+
TargetPlatform get _targetPlatform => switch (_operatingSystemUtils.hostPlatform) {
- HostPlatform.windows_arm64 => const TargetPlatform(.windows, .arm64),
- _ => const TargetPlatform(.windows, .x64),
+ HostPlatform.windows_arm64 => TargetPlatform.windows_arm64,
+ _ => TargetPlatform.windows_x64,
};
@override
diff --git a/packages/flutter_tools/test/commands.shard/hermetic/attach_test.dart b/packages/flutter_tools/test/commands.shard/hermetic/attach_test.dart
index fcb79e5..1cc3967 100644
--- a/packages/flutter_tools/test/commands.shard/hermetic/attach_test.dart
+++ b/packages/flutter_tools/test/commands.shard/hermetic/attach_test.dart
@@ -1882,7 +1882,7 @@
Future<String> get targetPlatformDisplayName async => 'android';
@override
- Future<TargetPlatform> get targetPlatform async => const TargetPlatform(.android, .armv7);
+ Future<TargetPlatform> get targetPlatform async => TargetPlatform.android_arm;
@override
DeviceConnectionInterface get connectionInterface => DeviceConnectionInterface.attached;
@@ -1996,7 +1996,7 @@
String get displayName => name;
@override
- Future<TargetPlatform> get targetPlatform async => const TargetPlatform(.ios, .arm64);
+ Future<TargetPlatform> get targetPlatform async => TargetPlatform.ios;
@override
final PlatformType platformType = PlatformType.ios;
@@ -2075,7 +2075,7 @@
bool get ephemeral => true;
@override
- Future<TargetPlatform> get targetPlatform async => const TargetPlatform(.ios, .arm64);
+ Future<TargetPlatform> get targetPlatform async => TargetPlatform.ios;
@override
final PlatformType platformType = PlatformType.ios;
diff --git a/packages/flutter_tools/test/commands.shard/hermetic/build_darwin_framework_test.dart b/packages/flutter_tools/test/commands.shard/hermetic/build_darwin_framework_test.dart
index a927136..84ae4fc 100644
--- a/packages/flutter_tools/test/commands.shard/hermetic/build_darwin_framework_test.dart
+++ b/packages/flutter_tools/test/commands.shard/hermetic/build_darwin_framework_test.dart
@@ -442,7 +442,7 @@
// Mock engine artifacts. _TestArtifacts uses a string like this for getArtifactPath.
memoryFileSystem
- .directory('Artifact.flutterXcframework.ios.debug')
+ .directory('Artifact.flutterXcframework.TargetPlatform.ios.debug')
.createSync(recursive: true);
final Directory buildDir =
@@ -528,7 +528,7 @@
// Mock engine artifacts
memoryFileSystem
- .directory('Artifact.flutterXcframework.ios.debug')
+ .directory('Artifact.flutterXcframework.TargetPlatform.ios.debug')
.createSync(recursive: true);
final Directory buildDir =
diff --git a/packages/flutter_tools/test/commands.shard/hermetic/build_swift_package_test.dart b/packages/flutter_tools/test/commands.shard/hermetic/build_swift_package_test.dart
index aab69e3..a2b47fe 100644
--- a/packages/flutter_tools/test/commands.shard/hermetic/build_swift_package_test.dart
+++ b/packages/flutter_tools/test/commands.shard/hermetic/build_swift_package_test.dart
@@ -740,7 +740,7 @@
expectedEngineVersion: _engineVersion,
expectedDefines: <String, String>{
'TargetFile': 'lib/main.dart',
- 'TargetPlatform': 'darwin-x64',
+ 'TargetPlatform': 'darwin',
'DarwinArchs': 'x86_64 arm64',
'BuildMode': 'debug',
'DartObfuscation': 'false',
@@ -848,7 +848,7 @@
expectedEngineVersion: _engineVersion,
expectedDefines: <String, String>{
'TargetFile': 'lib/main.dart',
- 'TargetPlatform': 'darwin-x64',
+ 'TargetPlatform': 'darwin',
'DarwinArchs': 'x86_64 arm64',
'BuildMode': 'release',
'DartObfuscation': 'false',
@@ -974,7 +974,7 @@
expectedEngineVersion: _engineVersion,
expectedDefines: <String, String>{
'TargetFile': 'lib/main.dart',
- 'TargetPlatform': 'darwin-x64',
+ 'TargetPlatform': 'darwin',
'DarwinArchs': 'x86_64 arm64',
'BuildMode': 'release',
'DartObfuscation': 'false',
@@ -1085,7 +1085,7 @@
expectedEngineVersion: _engineVersion,
expectedDefines: <String, String>{
'TargetFile': 'lib/main.dart',
- 'TargetPlatform': 'ios-arm64',
+ 'TargetPlatform': 'ios',
'IosArchs': 'arm64',
'SdkRoot': _iosSdkRoot,
'BuildMode': 'debug',
@@ -1107,7 +1107,7 @@
expectedEngineVersion: _engineVersion,
expectedDefines: <String, String>{
'TargetFile': 'lib/main.dart',
- 'TargetPlatform': 'ios-arm64',
+ 'TargetPlatform': 'ios',
'IosArchs': 'x86_64 arm64',
'SdkRoot': _iosSdkRoot,
'BuildMode': 'debug',
@@ -1219,7 +1219,7 @@
expectedEngineVersion: _engineVersion,
expectedDefines: <String, String>{
'TargetFile': 'lib/main.dart',
- 'TargetPlatform': 'ios-arm64',
+ 'TargetPlatform': 'ios',
'IosArchs': 'arm64',
'SdkRoot': _iosSdkRoot,
'BuildMode': 'debug',
@@ -1241,7 +1241,7 @@
expectedEngineVersion: _engineVersion,
expectedDefines: <String, String>{
'TargetFile': 'lib/main.dart',
- 'TargetPlatform': 'ios-arm64',
+ 'TargetPlatform': 'ios',
'IosArchs': 'x86_64 arm64',
'SdkRoot': _iosSdkRoot,
'BuildMode': 'debug',
@@ -2917,7 +2917,7 @@
expectedEngineVersion: _engineVersion,
expectedDefines: <String, String>{
'TargetFile': 'lib/main.dart',
- 'TargetPlatform': 'ios-arm64',
+ 'TargetPlatform': 'ios',
'IosArchs': 'arm64',
'SdkRoot': _iosSdkRoot,
'BuildMode': 'debug',
@@ -2939,7 +2939,7 @@
expectedEngineVersion: _engineVersion,
expectedDefines: <String, String>{
'TargetFile': 'lib/main.dart',
- 'TargetPlatform': 'ios-arm64',
+ 'TargetPlatform': 'ios',
'IosArchs': 'x86_64 arm64',
'SdkRoot': _iosSdkRoot,
'BuildMode': 'debug',
diff --git a/packages/flutter_tools/test/commands.shard/hermetic/build_windows_test.dart b/packages/flutter_tools/test/commands.shard/hermetic/build_windows_test.dart
index 18aeb31..11c5746 100644
--- a/packages/flutter_tools/test/commands.shard/hermetic/build_windows_test.dart
+++ b/packages/flutter_tools/test/commands.shard/hermetic/build_windows_test.dart
@@ -79,7 +79,7 @@
FakeCommand cmakeGenerationCommand({
void Function(List<String> command)? onRun,
String generator = _defaultGenerator,
- TargetPlatform targetPlatform = const TargetPlatform(.windows, .x64),
+ TargetPlatform targetPlatform = TargetPlatform.windows_x64,
}) {
return FakeCommand(
command: <String>[
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 0ce272c..541d227 100644
--- a/packages/flutter_tools/test/commands.shard/hermetic/daemon_test.dart
+++ b/packages/flutter_tools/test/commands.shard/hermetic/daemon_test.dart
@@ -577,10 +577,7 @@
);
expect(applicationPackageIdResponse.data['id'], 0);
expect(applicationPackageFactory.applicationBinaryRequested!.basename, 'test_file');
- expect(
- applicationPackageFactory.platformRequested,
- const TargetPlatform(.android, .unknown),
- );
+ expect(applicationPackageFactory.platformRequested, TargetPlatform.android);
final applicationPackageId = applicationPackageIdResponse.data['result'] as String?;
// Try starting the app.
@@ -1165,7 +1162,7 @@
Future<String> get emulatorId async => 'device';
@override
- Future<TargetPlatform> get targetPlatform async => const TargetPlatform(.android, .armv7);
+ Future<TargetPlatform> get targetPlatform async => TargetPlatform.android_arm;
@override
Future<CpuArch> get cpuArch async => CpuArch.armv7;
diff --git a/packages/flutter_tools/test/commands.shard/hermetic/doctor_test.dart b/packages/flutter_tools/test/commands.shard/hermetic/doctor_test.dart
index 4da698d..c2a4f07 100644
--- a/packages/flutter_tools/test/commands.shard/hermetic/doctor_test.dart
+++ b/packages/flutter_tools/test/commands.shard/hermetic/doctor_test.dart
@@ -114,148 +114,176 @@
});
group('doctor with fake validators', () {
- testUsingContext('validate non-verbose output format for run without issues', () async {
- expect(await FakeQuietDoctor(logger).diagnose(verbose: false), isTrue);
- expect(
- logger.statusText,
- equals(
- 'Doctor summary (to see all details, run flutter doctor -v):\n'
- '[✓] Passing Validator (with statusInfo)\n'
- '[✓] Another Passing Validator (with statusInfo)\n'
- '[✓] Validators are fun (with statusInfo)\n'
- '[✓] Four score and seven validators ago (with statusInfo)\n'
- '\n'
- '• No issues found!\n',
- ),
- );
- }, overrides: <Type, Generator>{AnsiTerminal: () => FakeTerminal()});
+ testUsingContext(
+ 'validate non-verbose output format for run without issues',
+ () async {
+ expect(await FakeQuietDoctor(logger).diagnose(verbose: false), isTrue);
+ expect(
+ logger.statusText,
+ equals(
+ 'Doctor summary (to see all details, run flutter doctor -v):\n'
+ '[✓] Passing Validator (with statusInfo)\n'
+ '[✓] Another Passing Validator (with statusInfo)\n'
+ '[✓] Validators are fun (with statusInfo)\n'
+ '[✓] Four score and seven validators ago (with statusInfo)\n'
+ '\n'
+ '• No issues found!\n',
+ ),
+ );
+ },
+ overrides: <Type, Generator>{AnsiTerminal: () => FakeTerminal()},
+ );
- testUsingContext('validate non-verbose output format for run with crash', () async {
- expect(await FakeCrashingDoctor(logger).diagnose(verbose: false), isFalse);
- expect(
- logger.statusText,
- equals(
- 'Doctor summary (to see all details, run flutter doctor -v):\n'
- '[✓] Passing Validator (with statusInfo)\n'
- '[✓] Another Passing Validator (with statusInfo)\n'
- '[☠] Crashing validator (the doctor check crashed)\n'
- ' ✗ Due to an error, the doctor check did not complete. If the error message below is not helpful, '
- 'please let us know about this issue at https://github.com/flutter/flutter/issues.\n'
- ' ✗ Bad state: fatal error\n'
- '[✓] Validators are fun (with statusInfo)\n'
- '[✓] Four score and seven validators ago (with statusInfo)\n'
- '\n'
- '! Doctor found issues in 1 category.\n',
- ),
- );
- }, overrides: <Type, Generator>{AnsiTerminal: () => FakeTerminal()});
+ testUsingContext(
+ 'validate non-verbose output format for run with crash',
+ () async {
+ expect(await FakeCrashingDoctor(logger).diagnose(verbose: false), isFalse);
+ expect(
+ logger.statusText,
+ equals(
+ 'Doctor summary (to see all details, run flutter doctor -v):\n'
+ '[✓] Passing Validator (with statusInfo)\n'
+ '[✓] Another Passing Validator (with statusInfo)\n'
+ '[☠] Crashing validator (the doctor check crashed)\n'
+ ' ✗ Due to an error, the doctor check did not complete. If the error message below is not helpful, '
+ 'please let us know about this issue at https://github.com/flutter/flutter/issues.\n'
+ ' ✗ Bad state: fatal error\n'
+ '[✓] Validators are fun (with statusInfo)\n'
+ '[✓] Four score and seven validators ago (with statusInfo)\n'
+ '\n'
+ '! Doctor found issues in 1 category.\n',
+ ),
+ );
+ },
+ overrides: <Type, Generator>{AnsiTerminal: () => FakeTerminal()},
+ );
testUsingContext('validate verbose output format contains trace for run with crash', () async {
expect(await FakeCrashingDoctor(logger).diagnose(), isFalse);
expect(logger.statusText, contains('#0 CrashingValidator.validate'));
});
- testUsingContext('validate tool exit when exceeding timeout', () async {
- FakeAsync().run<void>((FakeAsync time) {
- final Doctor doctor = FakeAsyncStuckDoctor(logger);
- doctor.diagnose(verbose: false);
- time.elapse(const Duration(minutes: 5));
- time.flushMicrotasks();
- });
+ testUsingContext(
+ 'validate tool exit when exceeding timeout',
+ () async {
+ FakeAsync().run<void>((FakeAsync time) {
+ final Doctor doctor = FakeAsyncStuckDoctor(logger);
+ doctor.diagnose(verbose: false);
+ time.elapse(const Duration(minutes: 5));
+ time.flushMicrotasks();
+ });
- expect(
- logger.statusText,
- contains('Stuck validator that never completes exceeded maximum allowed duration of '),
- );
- }, overrides: <Type, Generator>{AnsiTerminal: () => FakeTerminal()});
-
- testUsingContext('validate non-verbose output format for run with an async crash', () async {
- final completer = Completer<void>();
- await FakeAsync().run((FakeAsync time) {
- unawaited(
- FakeAsyncCrashingDoctor(time, logger).diagnose(verbose: false).then((bool r) {
- expect(r, isFalse);
- completer.complete();
- }),
+ expect(
+ logger.statusText,
+ contains('Stuck validator that never completes exceeded maximum allowed duration of '),
);
- time.elapse(const Duration(seconds: 1));
- time.flushMicrotasks();
- return completer.future;
- });
- expect(
- logger.statusText,
- equals(
- 'Doctor summary (to see all details, run flutter doctor -v):\n'
- '[✓] Passing Validator (with statusInfo)\n'
- '[✓] Another Passing Validator (with statusInfo)\n'
- '[☠] Async crashing validator (the doctor check crashed)\n'
- ' ✗ Due to an error, the doctor check did not complete. If the error message below is not helpful, '
- 'please let us know about this issue at https://github.com/flutter/flutter/issues.\n'
- ' ✗ Bad state: fatal error\n'
- '[✓] Validators are fun (with statusInfo)\n'
- '[✓] Four score and seven validators ago (with statusInfo)\n'
- '\n'
- '! Doctor found issues in 1 category.\n',
- ),
- );
- }, overrides: <Type, Generator>{AnsiTerminal: () => FakeTerminal()});
+ },
+ overrides: <Type, Generator>{AnsiTerminal: () => FakeTerminal()},
+ );
- testUsingContext('validate non-verbose output format when only one category fails', () async {
- expect(await FakeSinglePassingDoctor(logger).diagnose(verbose: false), isTrue);
- expect(
- logger.statusText,
- equals(
- 'Doctor summary (to see all details, run flutter doctor -v):\n'
- '[!] Partial Validator with only a Hint\n'
- ' ! There is a hint here\n'
- '\n'
- '! Doctor found issues in 1 category.\n',
- ),
- );
- }, overrides: <Type, Generator>{AnsiTerminal: () => FakeTerminal()});
+ testUsingContext(
+ 'validate non-verbose output format for run with an async crash',
+ () async {
+ final completer = Completer<void>();
+ await FakeAsync().run((FakeAsync time) {
+ unawaited(
+ FakeAsyncCrashingDoctor(time, logger).diagnose(verbose: false).then((bool r) {
+ expect(r, isFalse);
+ completer.complete();
+ }),
+ );
+ time.elapse(const Duration(seconds: 1));
+ time.flushMicrotasks();
+ return completer.future;
+ });
+ expect(
+ logger.statusText,
+ equals(
+ 'Doctor summary (to see all details, run flutter doctor -v):\n'
+ '[✓] Passing Validator (with statusInfo)\n'
+ '[✓] Another Passing Validator (with statusInfo)\n'
+ '[☠] Async crashing validator (the doctor check crashed)\n'
+ ' ✗ Due to an error, the doctor check did not complete. If the error message below is not helpful, '
+ 'please let us know about this issue at https://github.com/flutter/flutter/issues.\n'
+ ' ✗ Bad state: fatal error\n'
+ '[✓] Validators are fun (with statusInfo)\n'
+ '[✓] Four score and seven validators ago (with statusInfo)\n'
+ '\n'
+ '! Doctor found issues in 1 category.\n',
+ ),
+ );
+ },
+ overrides: <Type, Generator>{AnsiTerminal: () => FakeTerminal()},
+ );
- testUsingContext('validate non-verbose output format for a passing run', () async {
- expect(await FakePassingDoctor(logger).diagnose(verbose: false), isTrue);
- expect(
- logger.statusText,
- equals(
- 'Doctor summary (to see all details, run flutter doctor -v):\n'
- '[✓] Passing Validator (with statusInfo)\n'
- '[!] Partial Validator with only a Hint\n'
- ' ! There is a hint here\n'
- '[!] Partial Validator with Errors\n'
- ' ✗ An error message indicating partial installation\n'
- ' ! Maybe a hint will help the user\n'
- '[✓] Another Passing Validator (with statusInfo)\n'
- '\n'
- '! Doctor found issues in 2 categories.\n',
- ),
- );
- }, overrides: <Type, Generator>{AnsiTerminal: () => FakeTerminal()});
+ testUsingContext(
+ 'validate non-verbose output format when only one category fails',
+ () async {
+ expect(await FakeSinglePassingDoctor(logger).diagnose(verbose: false), isTrue);
+ expect(
+ logger.statusText,
+ equals(
+ 'Doctor summary (to see all details, run flutter doctor -v):\n'
+ '[!] Partial Validator with only a Hint\n'
+ ' ! There is a hint here\n'
+ '\n'
+ '! Doctor found issues in 1 category.\n',
+ ),
+ );
+ },
+ overrides: <Type, Generator>{AnsiTerminal: () => FakeTerminal()},
+ );
- testUsingContext('validate non-verbose output format', () async {
- expect(await FakeDoctor(logger).diagnose(verbose: false), isFalse);
- expect(
- logger.statusText,
- equals(
- 'Doctor summary (to see all details, run flutter doctor -v):\n'
- '[✓] Passing Validator (with statusInfo)\n'
- '[✗] Missing Validator\n'
- ' ✗ A useful error message\n'
- ' ! A hint message\n'
- '[!] Not Available Validator\n'
- ' ✗ A useful error message\n'
- ' ! A hint message\n'
- '[!] Partial Validator with only a Hint\n'
- ' ! There is a hint here\n'
- '[!] Partial Validator with Errors\n'
- ' ✗ An error message indicating partial installation\n'
- ' ! Maybe a hint will help the user\n'
- '\n'
- '! Doctor found issues in 4 categories.\n',
- ),
- );
- }, overrides: <Type, Generator>{AnsiTerminal: () => FakeTerminal()});
+ testUsingContext(
+ 'validate non-verbose output format for a passing run',
+ () async {
+ expect(await FakePassingDoctor(logger).diagnose(verbose: false), isTrue);
+ expect(
+ logger.statusText,
+ equals(
+ 'Doctor summary (to see all details, run flutter doctor -v):\n'
+ '[✓] Passing Validator (with statusInfo)\n'
+ '[!] Partial Validator with only a Hint\n'
+ ' ! There is a hint here\n'
+ '[!] Partial Validator with Errors\n'
+ ' ✗ An error message indicating partial installation\n'
+ ' ! Maybe a hint will help the user\n'
+ '[✓] Another Passing Validator (with statusInfo)\n'
+ '\n'
+ '! Doctor found issues in 2 categories.\n',
+ ),
+ );
+ },
+ overrides: <Type, Generator>{AnsiTerminal: () => FakeTerminal()},
+ );
+
+ testUsingContext(
+ 'validate non-verbose output format',
+ () async {
+ expect(await FakeDoctor(logger).diagnose(verbose: false), isFalse);
+ expect(
+ logger.statusText,
+ equals(
+ 'Doctor summary (to see all details, run flutter doctor -v):\n'
+ '[✓] Passing Validator (with statusInfo)\n'
+ '[✗] Missing Validator\n'
+ ' ✗ A useful error message\n'
+ ' ! A hint message\n'
+ '[!] Not Available Validator\n'
+ ' ✗ A useful error message\n'
+ ' ! A hint message\n'
+ '[!] Partial Validator with only a Hint\n'
+ ' ! There is a hint here\n'
+ '[!] Partial Validator with Errors\n'
+ ' ✗ An error message indicating partial installation\n'
+ ' ! Maybe a hint will help the user\n'
+ '\n'
+ '! Doctor found issues in 4 categories.\n',
+ ),
+ );
+ },
+ overrides: <Type, Generator>{AnsiTerminal: () => FakeTerminal()},
+ );
testUsingContext('validate verbose output format', () async {
expect(await FakeDoctor(logger).diagnose(), isFalse);
@@ -377,41 +405,45 @@
});
});
- testUsingContext('validate non-verbose output wrapping', () async {
- final wrapLogger = BufferLogger.test(
- outputPreferences: OutputPreferences(wrapText: true, wrapColumn: 30),
- );
- expect(await FakeDoctor(wrapLogger).diagnose(verbose: false), isFalse);
- expect(
- wrapLogger.statusText,
- equals(
- 'Doctor summary (to see all\n'
- 'details, run flutter doctor\n'
- '-v):\n'
- '[✓] Passing Validator (with\n'
- ' statusInfo)\n'
- '[✗] Missing Validator\n'
- ' ✗ A useful error message\n'
- ' ! A hint message\n'
- '[!] Not Available Validator\n'
- ' ✗ A useful error message\n'
- ' ! A hint message\n'
- '[!] Partial Validator with\n'
- ' only a Hint\n'
- ' ! There is a hint here\n'
- '[!] Partial Validator with\n'
- ' Errors\n'
- ' ✗ An error message\n'
- ' indicating partial\n'
- ' installation\n'
- ' ! Maybe a hint will help\n'
- ' the user\n'
- '\n'
- '! Doctor found issues in 4\n'
- ' categories.\n',
- ),
- );
- }, overrides: <Type, Generator>{AnsiTerminal: () => FakeTerminal()});
+ testUsingContext(
+ 'validate non-verbose output wrapping',
+ () async {
+ final wrapLogger = BufferLogger.test(
+ outputPreferences: OutputPreferences(wrapText: true, wrapColumn: 30),
+ );
+ expect(await FakeDoctor(wrapLogger).diagnose(verbose: false), isFalse);
+ expect(
+ wrapLogger.statusText,
+ equals(
+ 'Doctor summary (to see all\n'
+ 'details, run flutter doctor\n'
+ '-v):\n'
+ '[✓] Passing Validator (with\n'
+ ' statusInfo)\n'
+ '[✗] Missing Validator\n'
+ ' ✗ A useful error message\n'
+ ' ! A hint message\n'
+ '[!] Not Available Validator\n'
+ ' ✗ A useful error message\n'
+ ' ! A hint message\n'
+ '[!] Partial Validator with\n'
+ ' only a Hint\n'
+ ' ! There is a hint here\n'
+ '[!] Partial Validator with\n'
+ ' Errors\n'
+ ' ✗ An error message\n'
+ ' indicating partial\n'
+ ' installation\n'
+ ' ! Maybe a hint will help\n'
+ ' the user\n'
+ '\n'
+ '! Doctor found issues in 4\n'
+ ' categories.\n',
+ ),
+ );
+ },
+ overrides: <Type, Generator>{AnsiTerminal: () => FakeTerminal()},
+ );
testUsingContext('validate verbose output wrapping', () async {
final wrapLogger = BufferLogger.test(
@@ -462,38 +494,46 @@
}, overrides: <Type, Generator>{AnsiTerminal: () => FakeTerminal()});
group('doctor with grouped validators', () {
- testUsingContext('validate diagnose combines validator output', () async {
- expect(await FakeGroupedDoctor(logger).diagnose(), isTrue);
- expect(
- logger.statusText,
- equals(
- '[✓] Category 1 [0ms]\n'
- ' • A helpful message\n'
- ' • A helpful message\n'
- '\n'
- '[!] Category 2 [0ms]\n'
- ' • A helpful message\n'
- ' ✗ A useful error message\n'
- '\n'
- '! Doctor found issues in 1 category.\n',
- ),
- );
- }, overrides: <Type, Generator>{AnsiTerminal: () => FakeTerminal()});
+ testUsingContext(
+ 'validate diagnose combines validator output',
+ () async {
+ expect(await FakeGroupedDoctor(logger).diagnose(), isTrue);
+ expect(
+ logger.statusText,
+ equals(
+ '[✓] Category 1 [0ms]\n'
+ ' • A helpful message\n'
+ ' • A helpful message\n'
+ '\n'
+ '[!] Category 2 [0ms]\n'
+ ' • A helpful message\n'
+ ' ✗ A useful error message\n'
+ '\n'
+ '! Doctor found issues in 1 category.\n',
+ ),
+ );
+ },
+ overrides: <Type, Generator>{AnsiTerminal: () => FakeTerminal()},
+ );
- testUsingContext('validate merging assigns statusInfo and title', () async {
- // There are two subvalidators. Only the second contains statusInfo.
- expect(await FakeGroupedDoctorWithStatus(logger).diagnose(), isTrue);
- expect(
- logger.statusText,
- equals(
- '[✓] First validator title (A status message) [0ms]\n'
- ' • A helpful message\n'
- ' • A different message\n'
- '\n'
- '• No issues found!\n',
- ),
- );
- }, overrides: <Type, Generator>{AnsiTerminal: () => FakeTerminal()});
+ testUsingContext(
+ 'validate merging assigns statusInfo and title',
+ () async {
+ // There are two subvalidators. Only the second contains statusInfo.
+ expect(await FakeGroupedDoctorWithStatus(logger).diagnose(), isTrue);
+ expect(
+ logger.statusText,
+ equals(
+ '[✓] First validator title (A status message) [0ms]\n'
+ ' • A helpful message\n'
+ ' • A different message\n'
+ '\n'
+ '• No issues found!\n',
+ ),
+ );
+ },
+ overrides: <Type, Generator>{AnsiTerminal: () => FakeTerminal()},
+ );
});
group('grouped validator merging results', () {
@@ -501,50 +541,86 @@
final partial = PartialGroupedValidator('Category');
final missing = MissingGroupedValidator('Category');
- testUsingContext('validate installed + installed = installed', () async {
- expect(await FakeSmallGroupDoctor(logger, installed, installed).diagnose(), isTrue);
- expect(logger.statusText, startsWith('[✓]'));
- }, overrides: <Type, Generator>{AnsiTerminal: () => FakeTerminal()});
+ testUsingContext(
+ 'validate installed + installed = installed',
+ () async {
+ expect(await FakeSmallGroupDoctor(logger, installed, installed).diagnose(), isTrue);
+ expect(logger.statusText, startsWith('[✓]'));
+ },
+ overrides: <Type, Generator>{AnsiTerminal: () => FakeTerminal()},
+ );
- testUsingContext('validate installed + partial = partial', () async {
- expect(await FakeSmallGroupDoctor(logger, installed, partial).diagnose(), isTrue);
- expect(logger.statusText, startsWith('[!]'));
- }, overrides: <Type, Generator>{AnsiTerminal: () => FakeTerminal()});
+ testUsingContext(
+ 'validate installed + partial = partial',
+ () async {
+ expect(await FakeSmallGroupDoctor(logger, installed, partial).diagnose(), isTrue);
+ expect(logger.statusText, startsWith('[!]'));
+ },
+ overrides: <Type, Generator>{AnsiTerminal: () => FakeTerminal()},
+ );
- testUsingContext('validate installed + missing = partial', () async {
- expect(await FakeSmallGroupDoctor(logger, installed, missing).diagnose(), isTrue);
- expect(logger.statusText, startsWith('[!]'));
- }, overrides: <Type, Generator>{AnsiTerminal: () => FakeTerminal()});
+ testUsingContext(
+ 'validate installed + missing = partial',
+ () async {
+ expect(await FakeSmallGroupDoctor(logger, installed, missing).diagnose(), isTrue);
+ expect(logger.statusText, startsWith('[!]'));
+ },
+ overrides: <Type, Generator>{AnsiTerminal: () => FakeTerminal()},
+ );
- testUsingContext('validate partial + installed = partial', () async {
- expect(await FakeSmallGroupDoctor(logger, partial, installed).diagnose(), isTrue);
- expect(logger.statusText, startsWith('[!]'));
- }, overrides: <Type, Generator>{AnsiTerminal: () => FakeTerminal()});
+ testUsingContext(
+ 'validate partial + installed = partial',
+ () async {
+ expect(await FakeSmallGroupDoctor(logger, partial, installed).diagnose(), isTrue);
+ expect(logger.statusText, startsWith('[!]'));
+ },
+ overrides: <Type, Generator>{AnsiTerminal: () => FakeTerminal()},
+ );
- testUsingContext('validate partial + partial = partial', () async {
- expect(await FakeSmallGroupDoctor(logger, partial, partial).diagnose(), isTrue);
- expect(logger.statusText, startsWith('[!]'));
- }, overrides: <Type, Generator>{AnsiTerminal: () => FakeTerminal()});
+ testUsingContext(
+ 'validate partial + partial = partial',
+ () async {
+ expect(await FakeSmallGroupDoctor(logger, partial, partial).diagnose(), isTrue);
+ expect(logger.statusText, startsWith('[!]'));
+ },
+ overrides: <Type, Generator>{AnsiTerminal: () => FakeTerminal()},
+ );
- testUsingContext('validate partial + missing = partial', () async {
- expect(await FakeSmallGroupDoctor(logger, partial, missing).diagnose(), isTrue);
- expect(logger.statusText, startsWith('[!]'));
- }, overrides: <Type, Generator>{AnsiTerminal: () => FakeTerminal()});
+ testUsingContext(
+ 'validate partial + missing = partial',
+ () async {
+ expect(await FakeSmallGroupDoctor(logger, partial, missing).diagnose(), isTrue);
+ expect(logger.statusText, startsWith('[!]'));
+ },
+ overrides: <Type, Generator>{AnsiTerminal: () => FakeTerminal()},
+ );
- testUsingContext('validate missing + installed = partial', () async {
- expect(await FakeSmallGroupDoctor(logger, missing, installed).diagnose(), isTrue);
- expect(logger.statusText, startsWith('[!]'));
- }, overrides: <Type, Generator>{AnsiTerminal: () => FakeTerminal()});
+ testUsingContext(
+ 'validate missing + installed = partial',
+ () async {
+ expect(await FakeSmallGroupDoctor(logger, missing, installed).diagnose(), isTrue);
+ expect(logger.statusText, startsWith('[!]'));
+ },
+ overrides: <Type, Generator>{AnsiTerminal: () => FakeTerminal()},
+ );
- testUsingContext('validate missing + partial = partial', () async {
- expect(await FakeSmallGroupDoctor(logger, missing, partial).diagnose(), isTrue);
- expect(logger.statusText, startsWith('[!]'));
- }, overrides: <Type, Generator>{AnsiTerminal: () => FakeTerminal()});
+ testUsingContext(
+ 'validate missing + partial = partial',
+ () async {
+ expect(await FakeSmallGroupDoctor(logger, missing, partial).diagnose(), isTrue);
+ expect(logger.statusText, startsWith('[!]'));
+ },
+ overrides: <Type, Generator>{AnsiTerminal: () => FakeTerminal()},
+ );
- testUsingContext('validate missing + missing = missing', () async {
- expect(await FakeSmallGroupDoctor(logger, missing, missing).diagnose(), isFalse);
- expect(logger.statusText, startsWith('[✗]'));
- }, overrides: <Type, Generator>{AnsiTerminal: () => FakeTerminal()});
+ testUsingContext(
+ 'validate missing + missing = missing',
+ () async {
+ expect(await FakeSmallGroupDoctor(logger, missing, missing).diagnose(), isFalse);
+ expect(logger.statusText, startsWith('[✗]'));
+ },
+ overrides: <Type, Generator>{AnsiTerminal: () => FakeTerminal()},
+ );
});
testUsingContext(
@@ -562,13 +638,17 @@
},
);
- testUsingContext('CustomDevicesWorkflow is a part of validator workflows if enabled', () async {
- final List<Workflow> workflows = DoctorValidatorsProvider.test(
- featureFlags: TestFeatureFlags(areCustomDevicesEnabled: true),
- platform: FakePlatform(),
- ).workflows;
- expect(workflows, contains(isA<CustomDeviceWorkflow>()));
- }, overrides: <Type, Generator>{FileSystem: () => fs, ProcessManager: () => fakeProcessManager});
+ testUsingContext(
+ 'CustomDevicesWorkflow is a part of validator workflows if enabled',
+ () async {
+ final List<Workflow> workflows = DoctorValidatorsProvider.test(
+ featureFlags: TestFeatureFlags(areCustomDevicesEnabled: true),
+ platform: FakePlatform(),
+ ).workflows;
+ expect(workflows, contains(isA<CustomDeviceWorkflow>()));
+ },
+ overrides: <Type, Generator>{FileSystem: () => fs, ProcessManager: () => fakeProcessManager},
+ );
group('FlutterValidator', () {
late FakeFlutterVersion initialVersion;
@@ -634,10 +714,14 @@
);
});
- testUsingContext('ensure fake is being used and initialized', () {
- expect(fakeAnalytics.sentEvents.length, 0);
- expect(fakeAnalytics.okToSend, true);
- }, overrides: <Type, Generator>{Analytics: () => fakeAnalytics});
+ testUsingContext(
+ 'ensure fake is being used and initialized',
+ () {
+ expect(fakeAnalytics.sentEvents.length, 0);
+ expect(fakeAnalytics.okToSend, true);
+ },
+ overrides: <Type, Generator>{Analytics: () => fakeAnalytics},
+ );
testUsingContext(
'contains installed',
@@ -795,22 +879,26 @@
},
);
- testUsingContext('grouped validator subresult and subvalidators different lengths', () async {
- final fakeDoctor = FakeGroupedDoctorWithCrash(logger, clock: fakeSystemClock);
- await fakeDoctor.diagnose(verbose: false);
+ testUsingContext(
+ 'grouped validator subresult and subvalidators different lengths',
+ () async {
+ final fakeDoctor = FakeGroupedDoctorWithCrash(logger, clock: fakeSystemClock);
+ await fakeDoctor.diagnose(verbose: false);
- expect(fakeDoctor.validators, hasLength(1));
- expect(fakeDoctor.validators.first.runtimeType == FakeGroupedValidatorWithCrash, true);
- expect(fakeAnalytics.sentEvents, hasLength(0));
+ expect(fakeDoctor.validators, hasLength(1));
+ expect(fakeDoctor.validators.first.runtimeType == FakeGroupedValidatorWithCrash, true);
+ expect(fakeAnalytics.sentEvents, hasLength(0));
- // Attempt to send a random event to ensure that the
- // analytics package is still working, despite not sending
- // above (as expected)
- final testEvent = Event.analyticsCollectionEnabled(status: true);
- fakeAnalytics.send(testEvent);
- expect(fakeAnalytics.sentEvents, hasLength(1));
- expect(fakeAnalytics.sentEvents, contains(testEvent));
- }, overrides: <Type, Generator>{Analytics: () => fakeAnalytics});
+ // Attempt to send a random event to ensure that the
+ // analytics package is still working, despite not sending
+ // above (as expected)
+ final testEvent = Event.analyticsCollectionEnabled(status: true);
+ fakeAnalytics.send(testEvent);
+ expect(fakeAnalytics.sentEvents, hasLength(1));
+ expect(fakeAnalytics.sentEvents, contains(testEvent));
+ },
+ overrides: <Type, Generator>{Analytics: () => fakeAnalytics},
+ );
testUsingContext('sending events can be skipped', () async {
await FakePassingDoctor(logger).diagnose(verbose: false, sendEvent: false);
@@ -1238,8 +1326,7 @@
Future<String> get sdkNameAndVersion async => '1.2.3';
@override
- Future<TargetPlatform> get targetPlatform =>
- Future<TargetPlatform>.value(const TargetPlatform(.android, .unknown));
+ Future<TargetPlatform> get targetPlatform => Future<TargetPlatform>.value(TargetPlatform.android);
}
class FakeTerminal extends Fake implements AnsiTerminal {
diff --git a/packages/flutter_tools/test/commands.shard/hermetic/drive_test.dart b/packages/flutter_tools/test/commands.shard/hermetic/drive_test.dart
index fb15a01..2271447 100644
--- a/packages/flutter_tools/test/commands.shard/hermetic/drive_test.dart
+++ b/packages/flutter_tools/test/commands.shard/hermetic/drive_test.dart
@@ -935,7 +935,7 @@
final id = 'fake_device';
@override
- Future<TargetPlatform> get targetPlatform async => const TargetPlatform(.android, .unknown);
+ Future<TargetPlatform> get targetPlatform async => TargetPlatform.android;
@override
bool supportsScreenshot = true;
@@ -1130,7 +1130,7 @@
bool get isWirelesslyConnected => connectionInterface == DeviceConnectionInterface.wireless;
@override
- Future<TargetPlatform> get targetPlatform async => const TargetPlatform(.ios, .arm64);
+ Future<TargetPlatform> get targetPlatform async => TargetPlatform.ios;
}
class FakeChromiumDriveDevice extends Fake implements ChromiumDevice {
@@ -1162,7 +1162,7 @@
Future<String> get sdkNameAndVersion async => 'Google Chrome 0.0';
@override
- Future<TargetPlatform> get targetPlatform async => const TargetPlatform(.web, .unknown);
+ Future<TargetPlatform> get targetPlatform async => TargetPlatform.web_javascript;
@override
DeviceLogReader getLogReader({ApplicationPackage? app, bool includePastLogs = false}) {
diff --git a/packages/flutter_tools/test/commands.shard/hermetic/install_test.dart b/packages/flutter_tools/test/commands.shard/hermetic/install_test.dart
index 3244e0b..f953604 100644
--- a/packages/flutter_tools/test/commands.shard/hermetic/install_test.dart
+++ b/packages/flutter_tools/test/commands.shard/hermetic/install_test.dart
@@ -180,7 +180,7 @@
class FakeIOSDevice extends Fake implements IOSDevice {
@override
- Future<TargetPlatform> get targetPlatform async => const TargetPlatform(.ios, .arm64);
+ Future<TargetPlatform> get targetPlatform async => TargetPlatform.ios;
@override
Future<bool> isAppInstalled(ApplicationPackage app, {String? userIdentifier}) async => false;
@@ -194,7 +194,7 @@
class FakeAndroidDevice extends Fake implements AndroidDevice {
@override
- Future<TargetPlatform> get targetPlatform async => const TargetPlatform(.android, .armv7);
+ Future<TargetPlatform> get targetPlatform async => TargetPlatform.android_arm;
@override
Future<bool> isAppInstalled(ApplicationPackage app, {String? userIdentifier}) async => false;
diff --git a/packages/flutter_tools/test/commands.shard/hermetic/proxied_devices_test.dart b/packages/flutter_tools/test/commands.shard/hermetic/proxied_devices_test.dart
index 1ad4ee4..e9b100f 100644
--- a/packages/flutter_tools/test/commands.shard/hermetic/proxied_devices_test.dart
+++ b/packages/flutter_tools/test/commands.shard/hermetic/proxied_devices_test.dart
@@ -169,7 +169,7 @@
applicationPackageFactory.applicationBinaryRequested!.readAsStringSync(),
'dummy content',
);
- expect(applicationPackageFactory.platformRequested, const TargetPlatform(.android, .armv7));
+ expect(applicationPackageFactory.platformRequested, TargetPlatform.android_arm);
expect(fakeDevice.startAppPackage, applicationPackage);
@@ -254,7 +254,7 @@
Future<String> get emulatorId async => 'device';
@override
- Future<TargetPlatform> get targetPlatform async => const TargetPlatform(.android, .armv7);
+ Future<TargetPlatform> get targetPlatform async => TargetPlatform.android_arm;
@override
Future<CpuArch> get cpuArch async => CpuArch.arm64;
diff --git a/packages/flutter_tools/test/commands.shard/hermetic/run_test.dart b/packages/flutter_tools/test/commands.shard/hermetic/run_test.dart
index c9717c0..e096756 100644
--- a/packages/flutter_tools/test/commands.shard/hermetic/run_test.dart
+++ b/packages/flutter_tools/test/commands.shard/hermetic/run_test.dart
@@ -286,7 +286,7 @@
() async {
final command = RunCommand();
final mockDevice = FakeDevice(
- targetPlatform: const TargetPlatform(.android, .armv7),
+ targetPlatform: TargetPlatform.android_arm,
isLocalEmulator: true,
sdkNameAndVersion: 'api-14',
isSupported: false,
@@ -545,7 +545,7 @@
final command = RunCommand();
final device = FakeDevice(
platformType: PlatformType.web,
- targetPlatform: const TargetPlatform(.web, .unknown),
+ targetPlatform: TargetPlatform.web_javascript,
);
testDeviceManager.devices = <Device>[device];
@@ -691,7 +691,7 @@
'should only request artifacts corresponding to connected devices',
() async {
testDeviceManager.devices = <Device>[
- FakeDevice(targetPlatform: const TargetPlatform(.android, .armv7)),
+ FakeDevice(targetPlatform: TargetPlatform.android_arm),
];
expect(
@@ -714,7 +714,7 @@
testDeviceManager.devices = <Device>[
FakeDevice(),
- FakeDevice(targetPlatform: const TargetPlatform(.android, .armv7)),
+ FakeDevice(targetPlatform: TargetPlatform.android_arm),
];
expect(
@@ -727,7 +727,7 @@
);
testDeviceManager.devices = <Device>[
- FakeDevice(targetPlatform: const TargetPlatform(.web, .unknown)),
+ FakeDevice(targetPlatform: TargetPlatform.web_javascript),
];
expect(
@@ -752,7 +752,7 @@
() async {
final devices = <Device>[
FakeDevice(
- targetPlatform: const TargetPlatform(.android, .armv7),
+ targetPlatform: TargetPlatform.android_arm,
platformType: PlatformType.android,
),
];
@@ -986,7 +986,7 @@
final device = FakeDevice(
isLocalEmulator: true,
platformType: PlatformType.web,
- targetPlatform: const TargetPlatform(.web, .unknown),
+ targetPlatform: TargetPlatform.web_javascript,
);
testDeviceManager.devices = <Device>[device];
});
@@ -1160,7 +1160,7 @@
final device = FakeDevice(
isLocalEmulator: true,
platformType: PlatformType.web,
- targetPlatform: const TargetPlatform(.web, .unknown),
+ targetPlatform: TargetPlatform.web_javascript,
);
testDeviceManager.devices = <Device>[device];
});
@@ -1425,7 +1425,7 @@
final device = FakeDevice(
isLocalEmulator: true,
platformType: PlatformType.web,
- targetPlatform: const TargetPlatform(.web, .unknown),
+ targetPlatform: TargetPlatform.web_javascript,
);
testDeviceManager.devices = <Device>[device];
});
@@ -1931,7 +1931,7 @@
class FakeDevice extends Fake implements Device {
FakeDevice({
bool isLocalEmulator = false,
- TargetPlatform targetPlatform = const TargetPlatform(.ios, .arm64),
+ TargetPlatform targetPlatform = TargetPlatform.ios,
String sdkNameAndVersion = '',
PlatformType platformType = PlatformType.ios,
bool isSupported = true,
@@ -1999,7 +1999,7 @@
Future<String> get sdkNameAndVersion => Future<String>.value(_sdkNameAndVersion);
@override
- Future<String> get targetPlatformDisplayName async => (await targetPlatform).devicePlatformName;
+ Future<String> get targetPlatformDisplayName async => (await targetPlatform).getName();
@override
DeviceLogReader getLogReader({ApplicationPackage? app, bool includePastLogs = false}) {
@@ -2086,7 +2086,7 @@
bool get isWirelesslyConnected => connectionInterface == DeviceConnectionInterface.wireless;
@override
- Future<TargetPlatform> get targetPlatform async => const TargetPlatform(.ios, .arm64);
+ Future<TargetPlatform> get targetPlatform async => TargetPlatform.ios;
}
class TestRunCommandForUsageValues extends RunCommand {
diff --git a/packages/flutter_tools/test/commands.shard/hermetic/screenshot_command_test.dart b/packages/flutter_tools/test/commands.shard/hermetic/screenshot_command_test.dart
index d8d48d8..76a40dd 100644
--- a/packages/flutter_tools/test/commands.shard/hermetic/screenshot_command_test.dart
+++ b/packages/flutter_tools/test/commands.shard/hermetic/screenshot_command_test.dart
@@ -147,45 +147,53 @@
testDeviceManager = _TestDeviceManager(logger: BufferLogger.test());
});
- testUsingContext('should not throw for a single device', () async {
- final command = ScreenshotCommand(fs: MemoryFileSystem.test());
+ testUsingContext(
+ 'should not throw for a single device',
+ () async {
+ final command = ScreenshotCommand(fs: MemoryFileSystem.test());
- final deviceUnsupportedForProject = _ScreenshotDevice(
- id: '123',
- name: 'Device 1',
- isSupportedForProject: false,
- );
+ final deviceUnsupportedForProject = _ScreenshotDevice(
+ id: '123',
+ name: 'Device 1',
+ isSupportedForProject: false,
+ );
- testDeviceManager.devices = <Device>[deviceUnsupportedForProject];
+ testDeviceManager.devices = <Device>[deviceUnsupportedForProject];
- await createTestCommandRunner(command).run(<String>['screenshot']);
- }, overrides: <Type, Generator>{DeviceManager: () => testDeviceManager});
+ await createTestCommandRunner(command).run(<String>['screenshot']);
+ },
+ overrides: <Type, Generator>{DeviceManager: () => testDeviceManager},
+ );
- testUsingContext('should tool exit for multiple devices', () async {
- final command = ScreenshotCommand(fs: MemoryFileSystem.test());
+ testUsingContext(
+ 'should tool exit for multiple devices',
+ () async {
+ final command = ScreenshotCommand(fs: MemoryFileSystem.test());
- final devicesUnsupportedForProject = <_ScreenshotDevice>[
- _ScreenshotDevice(id: '123', name: 'Device 1', isSupportedForProject: false),
- _ScreenshotDevice(id: '456', name: 'Device 2', isSupportedForProject: false),
- ];
+ final devicesUnsupportedForProject = <_ScreenshotDevice>[
+ _ScreenshotDevice(id: '123', name: 'Device 1', isSupportedForProject: false),
+ _ScreenshotDevice(id: '456', name: 'Device 2', isSupportedForProject: false),
+ ];
- testDeviceManager.devices = devicesUnsupportedForProject;
+ testDeviceManager.devices = devicesUnsupportedForProject;
- await expectLater(
- () => createTestCommandRunner(command).run(<String>['screenshot']),
- throwsToolExit(message: 'Must have a connected device for screenshot type device'),
- );
+ await expectLater(
+ () => createTestCommandRunner(command).run(<String>['screenshot']),
+ throwsToolExit(message: 'Must have a connected device for screenshot type device'),
+ );
- expect(
- testLogger.statusText,
- contains('''
+ expect(
+ testLogger.statusText,
+ contains('''
More than one device connected; please specify a device with the '-d <deviceId>' flag, or use '-d all' to act on all devices.
Device 1 (mobile) • 123 • android • 1.2.3
Device 2 (mobile) • 456 • android • 1.2.3
'''),
- );
- }, overrides: <Type, Generator>{DeviceManager: () => testDeviceManager});
+ );
+ },
+ overrides: <Type, Generator>{DeviceManager: () => testDeviceManager},
+ );
});
}
@@ -234,8 +242,7 @@
Future<String> get sdkNameAndVersion async => '1.2.3';
@override
- Future<TargetPlatform> get targetPlatform =>
- Future<TargetPlatform>.value(const TargetPlatform(.android, .unknown));
+ Future<TargetPlatform> get targetPlatform => Future<TargetPlatform>.value(TargetPlatform.android);
@override
Future<bool> get isLocalEmulator async => false;
diff --git a/packages/flutter_tools/test/commands.shard/permeable/widget_preview/widget_preview_test.dart b/packages/flutter_tools/test/commands.shard/permeable/widget_preview/widget_preview_test.dart
index adc20ec..90b23c3 100644
--- a/packages/flutter_tools/test/commands.shard/permeable/widget_preview/widget_preview_test.dart
+++ b/packages/flutter_tools/test/commands.shard/permeable/widget_preview/widget_preview_test.dart
@@ -110,7 +110,7 @@
class FakeGoogleChromeDevice extends Fake implements GoogleChromeDevice {
@override
- Future<TargetPlatform> get targetPlatform async => const TargetPlatform(.web, .unknown);
+ Future<TargetPlatform> get targetPlatform async => TargetPlatform.web_javascript;
@override
PlatformType? get platformType => PlatformType.web;
@@ -121,7 +121,7 @@
class FakeMicrosoftEdgeDevice extends Fake implements MicrosoftEdgeDevice {
@override
- Future<TargetPlatform> get targetPlatform async => const TargetPlatform(.web, .unknown);
+ Future<TargetPlatform> get targetPlatform async => TargetPlatform.web_javascript;
@override
PlatformType? get platformType => PlatformType.web;
@@ -132,7 +132,7 @@
class FakeCustomBrowserDevice extends Fake implements ChromiumDevice {
@override
- Future<TargetPlatform> get targetPlatform async => const TargetPlatform(.web, .unknown);
+ Future<TargetPlatform> get targetPlatform async => TargetPlatform.web_javascript;
@override
PlatformType? get platformType => PlatformType.web;
diff --git a/packages/flutter_tools/test/general.shard/android/android_device_start_test.dart b/packages/flutter_tools/test/general.shard/android/android_device_start_test.dart
index fe91491..460cd8e 100644
--- a/packages/flutter_tools/test/general.shard/android/android_device_start_test.dart
+++ b/packages/flutter_tools/test/general.shard/android/android_device_start_test.dart
@@ -49,9 +49,9 @@
});
for (final targetPlatform in <TargetPlatform>[
- const TargetPlatform(.android, .armv7),
- const TargetPlatform(.android, .arm64),
- const TargetPlatform(.android, .x64),
+ TargetPlatform.android_arm,
+ TargetPlatform.android_arm64,
+ TargetPlatform.android_x64,
]) {
testWithoutContext('AndroidDevice.startApp allows release builds on $targetPlatform', () async {
final String arch = getCpuArchForName(targetPlatform.getName()).androidArchName;
diff --git a/packages/flutter_tools/test/general.shard/android/android_device_test.dart b/packages/flutter_tools/test/general.shard/android/android_device_test.dart
index eff4521..160786c 100644
--- a/packages/flutter_tools/test/general.shard/android/android_device_test.dart
+++ b/packages/flutter_tools/test/general.shard/android/android_device_test.dart
@@ -77,11 +77,11 @@
'abi and abiList', () async {
// The format is [ABI, ABI list]: expected target platform.
final values = <List<String>, TargetPlatform>{
- <String>['x86_64', 'unknown']: const TargetPlatform(.android, .x64),
- <String>['armeabi-v7a', 'unknown']: const TargetPlatform(.android, .armv7),
- <String>['arm64-v8a', 'arm64-v8a,']: const TargetPlatform(.android, .arm64),
+ <String>['x86_64', 'unknown']: TargetPlatform.android_x64,
+ <String>['armeabi-v7a', 'unknown']: TargetPlatform.android_arm,
+ <String>['arm64-v8a', 'arm64-v8a,']: TargetPlatform.android_arm64,
// The Kindle Fire runs 32 bit apps on 64 bit hardware.
- <String>['arm64-v8a', 'arm']: const TargetPlatform(.android, .armv7),
+ <String>['arm64-v8a', 'arm']: TargetPlatform.android_arm,
};
for (final MapEntry<List<String>, TargetPlatform> entry in values.entries) {
diff --git a/packages/flutter_tools/test/general.shard/android/android_emulator_test.dart b/packages/flutter_tools/test/general.shard/android/android_emulator_test.dart
index 9b39480..e754dcb 100644
--- a/packages/flutter_tools/test/general.shard/android/android_emulator_test.dart
+++ b/packages/flutter_tools/test/general.shard/android/android_emulator_test.dart
@@ -7,8 +7,8 @@
import 'package:flutter_tools/src/android/android_emulator.dart';
import 'package:flutter_tools/src/android/android_sdk.dart';
import 'package:flutter_tools/src/base/common.dart';
+
import 'package:flutter_tools/src/base/logger.dart';
-import 'package:flutter_tools/src/build_info.dart';
import 'package:flutter_tools/src/device.dart';
import 'package:test/fake.dart';
diff --git a/packages/flutter_tools/test/general.shard/application_package_test.dart b/packages/flutter_tools/test/general.shard/application_package_test.dart
index 7237025..d34273a 100644
--- a/packages/flutter_tools/test/general.shard/application_package_test.dart
+++ b/packages/flutter_tools/test/general.shard/application_package_test.dart
@@ -88,7 +88,7 @@
);
await ApplicationPackageFactory.instance!.getPackageForPlatform(
- const TargetPlatform(.android, .armv7),
+ TargetPlatform.android_arm,
applicationBinary: apkFile,
);
final logger = BufferLogger.test();
@@ -158,7 +158,7 @@
);
await ApplicationPackageFactory.instance!.getPackageForPlatform(
- const TargetPlatform(.android, .armv7),
+ TargetPlatform.android_arm,
applicationBinary: apkFile,
);
final logger = BufferLogger.test();
@@ -214,10 +214,7 @@
);
final ApplicationPackage applicationPackage = (await ApplicationPackageFactory.instance!
- .getPackageForPlatform(
- const TargetPlatform(.android, .armv7),
- applicationBinary: apkFile,
- ))!;
+ .getPackageForPlatform(TargetPlatform.android_arm, applicationBinary: apkFile))!;
expect(applicationPackage.name, 'app-debug.apk');
expect(applicationPackage, isA<PrebuiltApplicationPackage>());
expect(
@@ -245,7 +242,7 @@
gradleWrapperDir.childFile('gradlew.bat').writeAsStringSync('irrelevant');
await ApplicationPackageFactory.instance!.getPackageForPlatform(
- const TargetPlatform(.android, .armv7),
+ TargetPlatform.android_arm,
applicationBinary: globals.fs.file('app-debug.apk'),
);
expect(fakeProcessManager, hasNoRemainingExpectations);
@@ -257,9 +254,7 @@
final AndroidSdkVersion sdkVersion = FakeAndroidSdkVersion();
sdk.latestVersion = sdkVersion;
- await ApplicationPackageFactory.instance!.getPackageForPlatform(
- const TargetPlatform(.android, .armv7),
- );
+ await ApplicationPackageFactory.instance!.getPackageForPlatform(TargetPlatform.android_arm);
expect(fakeProcessManager, hasNoRemainingExpectations);
},
overrides: overrides,
diff --git a/packages/flutter_tools/test/general.shard/artifacts_test.dart b/packages/flutter_tools/test/general.shard/artifacts_test.dart
index 4005395..46cacd1 100644
--- a/packages/flutter_tools/test/general.shard/artifacts_test.dart
+++ b/packages/flutter_tools/test/general.shard/artifacts_test.dart
@@ -44,7 +44,7 @@
testWithoutContext('getArtifactPath', () {
final String xcframeworkPath = artifacts.getArtifactPath(
Artifact.flutterXcframework,
- platform: const TargetPlatform(.ios, .arm64),
+ platform: TargetPlatform.ios,
mode: BuildMode.release,
);
expect(
@@ -62,7 +62,7 @@
expect(
() => artifacts.getArtifactPath(
Artifact.flutterFramework,
- platform: const TargetPlatform(.ios, .arm64),
+ platform: TargetPlatform.ios,
mode: BuildMode.release,
environmentType: EnvironmentType.simulator,
),
@@ -72,7 +72,7 @@
expect(
() => artifacts.getArtifactPath(
Artifact.flutterFramework,
- platform: const TargetPlatform(.ios, .arm64),
+ platform: TargetPlatform.ios,
mode: BuildMode.release,
environmentType: EnvironmentType.simulator,
),
@@ -93,7 +93,7 @@
expect(
artifacts.getArtifactPath(
Artifact.flutterFramework,
- platform: const TargetPlatform(.ios, .arm64),
+ platform: TargetPlatform.ios,
mode: BuildMode.release,
environmentType: EnvironmentType.simulator,
),
@@ -101,7 +101,7 @@
);
final String actualReleaseFrameworkArtifact = artifacts.getArtifactPath(
Artifact.flutterFramework,
- platform: const TargetPlatform(.ios, .arm64),
+ platform: TargetPlatform.ios,
mode: BuildMode.release,
environmentType: EnvironmentType.physical,
);
@@ -114,7 +114,7 @@
expect(
artifacts.getArtifactPath(
Artifact.flutterXcframework,
- platform: const TargetPlatform(.ios, .arm64),
+ platform: TargetPlatform.ios,
mode: BuildMode.release,
),
fileSystem.path.join(
@@ -140,10 +140,7 @@
),
);
expect(
- artifacts.getArtifactPath(
- Artifact.flutterTester,
- platform: const TargetPlatform(.linux, .arm64),
- ),
+ artifacts.getArtifactPath(Artifact.flutterTester, platform: TargetPlatform.linux_arm64),
fileSystem.path.join(
'root',
'bin',
@@ -192,7 +189,7 @@
expect(
artifacts.getArtifactPath(
Artifact.flutterMacOSXcframework,
- platform: const TargetPlatform(.macos, .x64),
+ platform: TargetPlatform.darwin,
mode: BuildMode.release,
),
xcframeworkPath,
@@ -204,7 +201,7 @@
expect(
() => artifacts.getArtifactPath(
Artifact.flutterMacOSFramework,
- platform: const TargetPlatform(.macos, .x64),
+ platform: TargetPlatform.darwin,
mode: BuildMode.release,
),
throwsToolExit(message: 'No xcframework found at $xcframeworkPath.'),
@@ -217,7 +214,7 @@
expect(
() => artifacts.getArtifactPath(
Artifact.flutterMacOSFramework,
- platform: const TargetPlatform(.macos, .x64),
+ platform: TargetPlatform.darwin,
mode: BuildMode.release,
),
throwsToolExit(message: 'No macOS frameworks found in $xcframeworkPath'),
@@ -230,7 +227,7 @@
expect(
artifacts.getArtifactPath(
Artifact.flutterMacOSFramework,
- platform: const TargetPlatform(.macos, .x64),
+ platform: TargetPlatform.darwin,
mode: BuildMode.release,
),
fileSystem.path.join(xcframeworkPath, 'macos-arm64_x86_64', 'FlutterMacOS.framework'),
@@ -266,36 +263,9 @@
);
testWithoutContext('getEngineType', () {
- expect(
- artifacts.getEngineType(const TargetPlatform(.android, .armv7), BuildMode.debug),
- 'android-arm',
- );
- expect(
- artifacts.getEngineType(const TargetPlatform(.ios, .arm64), BuildMode.release),
- 'ios-release',
- );
- expect(artifacts.getEngineType(const TargetPlatform(.macos, .x64)), 'darwin-x64');
- });
-
- testWithoutContext('getArtifactPath resolves a generic Android target to arm64 for '
- 'architecture-independent artifacts', () {
- // The Dart kernel / patched SDK is architecture independent, so the
- // build system requests it with a generic Android target whose CPU
- // architecture is unknown. This must not throw and should resolve to
- // the same path as an explicit arm64 target. Regression test for the
- // assertion crash introduced by the PlatformType + CpuArch refactor.
- expect(
- artifacts.getArtifactPath(
- Artifact.flutterPatchedSdkPath,
- platform: const TargetPlatform(.android, .unknown),
- mode: BuildMode.release,
- ),
- artifacts.getArtifactPath(
- Artifact.flutterPatchedSdkPath,
- platform: const TargetPlatform(.android, .arm64),
- mode: BuildMode.release,
- ),
- );
+ expect(artifacts.getEngineType(TargetPlatform.android_arm, BuildMode.debug), 'android-arm');
+ expect(artifacts.getEngineType(TargetPlatform.ios, BuildMode.release), 'ios-release');
+ expect(artifacts.getEngineType(TargetPlatform.darwin), 'darwin-x64');
});
testWithoutContext(
@@ -365,7 +335,7 @@
expect(
artifacts.getArtifactPath(
Artifact.flutterMacOSXcframework,
- platform: const TargetPlatform(.macos, .x64),
+ platform: TargetPlatform.darwin,
mode: BuildMode.release,
),
xcframeworkPath,
@@ -377,7 +347,7 @@
expect(
() => artifacts.getArtifactPath(
Artifact.flutterMacOSFramework,
- platform: const TargetPlatform(.macos, .x64),
+ platform: TargetPlatform.darwin,
mode: BuildMode.release,
),
throwsToolExit(
@@ -394,7 +364,7 @@
expect(
() => artifacts.getArtifactPath(
Artifact.flutterMacOSFramework,
- platform: const TargetPlatform(.macos, .x64),
+ platform: TargetPlatform.darwin,
mode: BuildMode.release,
),
throwsToolExit(
@@ -419,7 +389,7 @@
expect(
artifacts.getArtifactPath(
Artifact.flutterMacOSFramework,
- platform: const TargetPlatform(.macos, .x64),
+ platform: TargetPlatform.darwin,
mode: BuildMode.release,
),
fileSystem.path.join(xcframeworkPath, 'macos-arm64_x86_64', 'FlutterMacOS.framework'),
@@ -434,7 +404,7 @@
testWithoutContext('getArtifactPath', () {
final String xcframeworkPath = artifacts.getArtifactPath(
Artifact.flutterXcframework,
- platform: const TargetPlatform(.ios, .arm64),
+ platform: TargetPlatform.ios,
mode: BuildMode.release,
);
expect(
@@ -444,7 +414,7 @@
expect(
() => artifacts.getArtifactPath(
Artifact.flutterFramework,
- platform: const TargetPlatform(.ios, .arm64),
+ platform: TargetPlatform.ios,
mode: BuildMode.release,
environmentType: EnvironmentType.simulator,
),
@@ -456,7 +426,7 @@
expect(
() => artifacts.getArtifactPath(
Artifact.flutterFramework,
- platform: const TargetPlatform(.ios, .arm64),
+ platform: TargetPlatform.ios,
mode: BuildMode.release,
environmentType: EnvironmentType.simulator,
),
@@ -485,7 +455,7 @@
expect(
artifacts.getArtifactPath(
Artifact.flutterFramework,
- platform: const TargetPlatform(.ios, .arm64),
+ platform: TargetPlatform.ios,
mode: BuildMode.release,
environmentType: EnvironmentType.simulator,
),
@@ -494,7 +464,7 @@
expect(
artifacts.getArtifactPath(
Artifact.flutterFramework,
- platform: const TargetPlatform(.ios, .arm64),
+ platform: TargetPlatform.ios,
mode: BuildMode.release,
environmentType: EnvironmentType.physical,
),
@@ -503,7 +473,7 @@
expect(
artifacts.getArtifactPath(
Artifact.flutterXcframework,
- platform: const TargetPlatform(.ios, .arm64),
+ platform: TargetPlatform.ios,
mode: BuildMode.release,
),
fileSystem.path.join('/out', 'android_debug_unopt', 'Flutter.xcframework'),
@@ -602,21 +572,21 @@
expect(
() => webArtifacts.getArtifactPath(
Artifact.frontendServerSnapshotForEngineDartSdk,
- platform: const TargetPlatform(.web, .unknown),
+ platform: TargetPlatform.web_javascript,
),
throwsToolExit(message: failureMessage),
);
expect(
() => webArtifacts.getArtifactPath(
Artifact.engineDartSdkPath,
- platform: const TargetPlatform(.web, .unknown),
+ platform: TargetPlatform.web_javascript,
),
throwsToolExit(message: failureMessage),
);
expect(
() => webArtifacts.getArtifactPath(
Artifact.engineDartBinary,
- platform: const TargetPlatform(.web, .unknown),
+ platform: TargetPlatform.web_javascript,
),
throwsToolExit(message: failureMessage),
);
@@ -632,7 +602,7 @@
expect(
webArtifacts.getArtifactPath(
Artifact.frontendServerSnapshotForEngineDartSdk,
- platform: const TargetPlatform(.web, .unknown),
+ platform: TargetPlatform.web_javascript,
),
fileSystem.path.join(
'/flutter',
@@ -647,21 +617,21 @@
expect(
webArtifacts.getArtifactPath(
Artifact.engineDartSdkPath,
- platform: const TargetPlatform(.web, .unknown),
+ platform: TargetPlatform.web_javascript,
),
fileSystem.path.join('/flutter', 'prebuilts', 'linux-x64', 'dart-sdk'),
);
expect(
webArtifacts.getArtifactPath(
Artifact.engineDartBinary,
- platform: const TargetPlatform(.web, .unknown),
+ platform: TargetPlatform.web_javascript,
),
fileSystem.path.join('/flutter', 'prebuilts', 'linux-x64', 'dart-sdk', 'bin', 'dart'),
);
expect(
webArtifacts.getArtifactPath(
Artifact.engineDartAotRuntime,
- platform: const TargetPlatform(.web, .unknown),
+ platform: TargetPlatform.web_javascript,
),
fileSystem.path.join(
'/flutter',
@@ -684,7 +654,7 @@
expect(
() => artifacts.getArtifactPath(
Artifact.engineDartSdkPath,
- platform: const TargetPlatform(.web, .unknown),
+ platform: TargetPlatform.web_javascript,
),
throwsToolExit(message: failureMessage),
);
@@ -699,7 +669,7 @@
expect(
artifacts.getArtifactPath(
Artifact.engineDartSdkPath,
- platform: const TargetPlatform(.web, .unknown),
+ platform: TargetPlatform.web_javascript,
),
fileSystem.path.join('/out', 'host_debug_unopt', 'dart-sdk'),
);
@@ -707,14 +677,11 @@
testWithoutContext('getEngineType', () {
expect(
- artifacts.getEngineType(const TargetPlatform(.android, .armv7), BuildMode.debug),
+ artifacts.getEngineType(TargetPlatform.android_arm, BuildMode.debug),
'android_debug_unopt',
);
- expect(
- artifacts.getEngineType(const TargetPlatform(.ios, .arm64), BuildMode.release),
- 'android_debug_unopt',
- );
- expect(artifacts.getEngineType(const TargetPlatform(.macos, .x64)), 'android_debug_unopt');
+ expect(artifacts.getEngineType(TargetPlatform.ios, BuildMode.release), 'android_debug_unopt');
+ expect(artifacts.getEngineType(TargetPlatform.darwin), 'android_debug_unopt');
});
testWithoutContext('Looks up dart.exe on windows platforms', () async {
@@ -797,7 +764,7 @@
expect(
artifacts.getArtifactPath(
Artifact.engineDartBinary,
- platform: const TargetPlatform(.web, .unknown),
+ platform: TargetPlatform.web_javascript,
),
fileSystem.path.join('/flutter', 'prebuilts', 'windows-x64', 'dart-sdk', 'bin', 'dart.exe'),
);
@@ -835,7 +802,7 @@
expect(
artifacts.getArtifactPath(
Artifact.engineDartBinary,
- platform: const TargetPlatform(.web, .unknown),
+ platform: TargetPlatform.web_javascript,
),
fileSystem.path.join('/flutter', 'prebuilts', 'macos-x64', 'dart-sdk', 'bin', 'dart'),
);
diff --git a/packages/flutter_tools/test/general.shard/asset_bundle_flavors_test.dart b/packages/flutter_tools/test/general.shard/asset_bundle_flavors_test.dart
index fd4a604..ac44f43 100644
--- a/packages/flutter_tools/test/general.shard/asset_bundle_flavors_test.dart
+++ b/packages/flutter_tools/test/general.shard/asset_bundle_flavors_test.dart
@@ -38,7 +38,7 @@
packageConfigPath: '.dart_tool/package_config.json',
flutterProject: FlutterProject.fromDirectoryTest(fileSystem.currentDirectory),
flavor: flavor,
- targetPlatform: const TargetPlatform(.tester, .unknown),
+ targetPlatform: TargetPlatform.tester,
);
return bundle;
}
diff --git a/packages/flutter_tools/test/general.shard/asset_bundle_package_fonts_test.dart b/packages/flutter_tools/test/general.shard/asset_bundle_package_fonts_test.dart
index 8fd2a46..e4f3c16 100644
--- a/packages/flutter_tools/test/general.shard/asset_bundle_package_fonts_test.dart
+++ b/packages/flutter_tools/test/general.shard/asset_bundle_package_fonts_test.dart
@@ -65,7 +65,7 @@
final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
await bundle.build(
packageConfigPath: '.dart_tool/package_config.json',
- targetPlatform: const TargetPlatform(.tester, .unknown),
+ targetPlatform: TargetPlatform.tester,
);
for (final packageName in packages) {
@@ -120,7 +120,7 @@
final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
await bundle.build(
packageConfigPath: '.dart_tool/package_config.json',
- targetPlatform: const TargetPlatform(.tester, .unknown),
+ targetPlatform: TargetPlatform.tester,
);
expect(
bundle.entries.keys,
diff --git a/packages/flutter_tools/test/general.shard/asset_bundle_package_test.dart b/packages/flutter_tools/test/general.shard/asset_bundle_package_test.dart
index 412c47f..d1b2c97 100644
--- a/packages/flutter_tools/test/general.shard/asset_bundle_package_test.dart
+++ b/packages/flutter_tools/test/general.shard/asset_bundle_package_test.dart
@@ -87,7 +87,7 @@
await bundle.build(
packageConfigPath: '.dart_tool/package_config.json',
flavor: flavor,
- targetPlatform: const TargetPlatform(.tester, .unknown),
+ targetPlatform: TargetPlatform.tester,
);
for (final packageName in packages) {
@@ -153,7 +153,7 @@
expect(
() => bundle.build(
packageConfigPath: '.dart_tool/package_config.json',
- targetPlatform: const TargetPlatform(.tester, .unknown),
+ targetPlatform: TargetPlatform.tester,
),
throwsToolExit(message: 'resolves to a location outside the package directory'),
);
@@ -178,7 +178,7 @@
final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
await bundle.build(
packageConfigPath: '.dart_tool/package_config.json',
- targetPlatform: const TargetPlatform(.tester, .unknown),
+ targetPlatform: TargetPlatform.tester,
);
expect(
bundle.entries.keys,
@@ -209,7 +209,7 @@
final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
await bundle.build(
packageConfigPath: '.dart_tool/package_config.json',
- targetPlatform: const TargetPlatform(.tester, .unknown),
+ targetPlatform: TargetPlatform.tester,
);
expect(
bundle.entries.keys,
@@ -711,7 +711,7 @@
final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
await bundle.build(
packageConfigPath: '.dart_tool/package_config.json',
- targetPlatform: const TargetPlatform(.tester, .unknown),
+ targetPlatform: TargetPlatform.tester,
);
expect(
@@ -803,7 +803,7 @@
final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
await bundle.build(
packageConfigPath: '.dart_tool/package_config.json',
- targetPlatform: const TargetPlatform(.tester, .unknown),
+ targetPlatform: TargetPlatform.tester,
);
},
overrides: <Type, Generator>{
diff --git a/packages/flutter_tools/test/general.shard/asset_bundle_test.dart b/packages/flutter_tools/test/general.shard/asset_bundle_test.dart
index 1bbc7df..e332c6c 100644
--- a/packages/flutter_tools/test/general.shard/asset_bundle_test.dart
+++ b/packages/flutter_tools/test/general.shard/asset_bundle_test.dart
@@ -47,7 +47,7 @@
expect(
await ab.build(
packageConfigPath: '.dart_tool/package_config.json',
- targetPlatform: const TargetPlatform(.tester, .unknown),
+ targetPlatform: TargetPlatform.tester,
),
0,
);
@@ -70,7 +70,7 @@
final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
await bundle.build(
packageConfigPath: '.dart_tool/package_config.json',
- targetPlatform: const TargetPlatform(.tester, .unknown),
+ targetPlatform: TargetPlatform.tester,
);
expect(bundle.entries.keys, unorderedEquals(<String>['AssetManifest.bin']));
const expectedBinAssetManifest = <Object, Object>{};
@@ -120,7 +120,7 @@
final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
await bundle.build(
packageConfigPath: '.dart_tool/package_config.json',
- targetPlatform: const TargetPlatform(.tester, .unknown),
+ targetPlatform: TargetPlatform.tester,
);
expect(
@@ -163,7 +163,7 @@
final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
await bundle.build(
packageConfigPath: '.dart_tool/package_config.json',
- targetPlatform: const TargetPlatform(.tester, .unknown),
+ targetPlatform: TargetPlatform.tester,
);
expect(
bundle.entries.keys,
@@ -182,7 +182,7 @@
expect(bundle.needsBuild(), true);
await bundle.build(
packageConfigPath: '.dart_tool/package_config.json',
- targetPlatform: const TargetPlatform(.tester, .unknown),
+ targetPlatform: TargetPlatform.tester,
);
expect(
bundle.entries.keys,
@@ -223,7 +223,7 @@
final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
await bundle.build(
packageConfigPath: '.dart_tool/package_config.json',
- targetPlatform: const TargetPlatform(.tester, .unknown),
+ targetPlatform: TargetPlatform.tester,
);
expect(
bundle.entries.keys,
@@ -254,7 +254,7 @@
expect(bundle.needsBuild(), true);
await bundle.build(
packageConfigPath: '.dart_tool/package_config.json',
- targetPlatform: const TargetPlatform(.tester, .unknown),
+ targetPlatform: TargetPlatform.tester,
);
expect(
bundle.entries.keys,
@@ -295,7 +295,7 @@
final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
await bundle.build(
packageConfigPath: '.dart_tool/package_config.json',
- targetPlatform: const TargetPlatform(.tester, .unknown),
+ targetPlatform: TargetPlatform.tester,
);
expect(
bundle.entries.keys,
@@ -350,7 +350,7 @@
await bundle.build(
packageConfigPath: '.dart_tool/package_config.json',
deferredComponentsEnabled: true,
- targetPlatform: const TargetPlatform(.tester, .unknown),
+ targetPlatform: TargetPlatform.tester,
);
expect(
bundle.entries.keys,
@@ -401,7 +401,7 @@
final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
await bundle.build(
packageConfigPath: '.dart_tool/package_config.json',
- targetPlatform: const TargetPlatform(.tester, .unknown),
+ targetPlatform: TargetPlatform.tester,
);
expect(
bundle.entries.keys,
@@ -462,7 +462,7 @@
await bundle.build(
packageConfigPath: '.dart_tool/package_config.json',
deferredComponentsEnabled: true,
- targetPlatform: const TargetPlatform(.tester, .unknown),
+ targetPlatform: TargetPlatform.tester,
);
expect(
bundle.entries.keys,
@@ -486,7 +486,7 @@
await bundle.build(
packageConfigPath: '.dart_tool/package_config.json',
deferredComponentsEnabled: true,
- targetPlatform: const TargetPlatform(.tester, .unknown),
+ targetPlatform: TargetPlatform.tester,
);
expect(
@@ -540,7 +540,7 @@
() => bundle.build(
packageConfigPath: '.dart_tool/package_config.json',
flutterProject: FlutterProject.fromDirectoryTest(fileSystem.currentDirectory),
- targetPlatform: const TargetPlatform(.tester, .unknown),
+ targetPlatform: TargetPlatform.tester,
),
throwsToolExit(
message:
@@ -580,7 +580,7 @@
() => bundle.build(
packageConfigPath: '.dart_tool/package_config.json',
flutterProject: FlutterProject.fromDirectoryTest(fileSystem.currentDirectory),
- targetPlatform: const TargetPlatform(.tester, .unknown),
+ targetPlatform: TargetPlatform.tester,
),
throwsToolExit(
message:
@@ -625,7 +625,7 @@
await bundle.build(
packageConfigPath: '.dart_tool/package_config.json',
flutterProject: FlutterProject.fromDirectoryTest(fileSystem.currentDirectory),
- targetPlatform: const TargetPlatform(.tester, .unknown),
+ targetPlatform: TargetPlatform.tester,
);
expect(bundle.entries['my-asset.txt']!.content.isModified, isTrue);
@@ -634,7 +634,7 @@
await bundle.build(
packageConfigPath: '.dart_tool/package_config.json',
flutterProject: FlutterProject.fromDirectoryTest(fileSystem.currentDirectory),
- targetPlatform: const TargetPlatform(.tester, .unknown),
+ targetPlatform: TargetPlatform.tester,
);
expect(bundle.entries['my-asset.txt']!.content.isModified, isFalse);
@@ -652,7 +652,7 @@
await bundle.build(
packageConfigPath: '.dart_tool/package_config.json',
flutterProject: FlutterProject.fromDirectoryTest(fileSystem.currentDirectory),
- targetPlatform: const TargetPlatform(.tester, .unknown),
+ targetPlatform: TargetPlatform.tester,
);
expect(bundle.entries['my-asset.txt']!.content.isModified, isTrue);
@@ -682,7 +682,7 @@
final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
await bundle.build(
packageConfigPath: '.dart_tool/package_config.json',
- targetPlatform: const TargetPlatform(.web, .unknown),
+ targetPlatform: TargetPlatform.web_javascript,
);
expect(
@@ -721,7 +721,7 @@
final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
await bundle.build(
packageConfigPath: '.dart_tool/package_config.json',
- targetPlatform: const TargetPlatform(.web, .unknown),
+ targetPlatform: TargetPlatform.web_javascript,
);
expect(
@@ -774,7 +774,7 @@
await writeBundle(
directory,
const <String, AssetBundleEntry>{},
- targetPlatform: const TargetPlatform(.android, .unknown),
+ targetPlatform: TargetPlatform.android,
impellerStatus: ImpellerStatus.disabled,
processManager: globals.processManager,
fileSystem: globals.fs,
@@ -803,7 +803,7 @@
final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
await bundle.build(
packageConfigPath: '.dart_tool/package_config.json',
- targetPlatform: const TargetPlatform(.tester, .unknown),
+ targetPlatform: TargetPlatform.tester,
);
final AssetBundleEntry? fontManifest = bundle.entries['FontManifest.json'];
@@ -811,7 +811,7 @@
await bundle.build(
packageConfigPath: '.dart_tool/package_config.json',
- targetPlatform: const TargetPlatform(.tester, .unknown),
+ targetPlatform: TargetPlatform.tester,
);
expect(fontManifest, bundle.entries['FontManifest.json']);
@@ -843,7 +843,7 @@
expect(
await bundle.build(
packageConfigPath: '.dart_tool/package_config.json',
- targetPlatform: const TargetPlatform(.tester, .unknown),
+ targetPlatform: TargetPlatform.tester,
),
0,
);
@@ -878,7 +878,7 @@
expect(
await bundle.build(
packageConfigPath: '.dart_tool/package_config.json',
- targetPlatform: const TargetPlatform(.tester, .unknown),
+ targetPlatform: TargetPlatform.tester,
),
0,
);
@@ -931,7 +931,7 @@
expect(
await bundle.build(
packageConfigPath: '.dart_tool/package_config.json',
- targetPlatform: const TargetPlatform(.tester, .unknown),
+ targetPlatform: TargetPlatform.tester,
),
0,
);
@@ -939,7 +939,7 @@
await writeBundle(
output,
bundle.entries,
- targetPlatform: const TargetPlatform(.android, .unknown),
+ targetPlatform: TargetPlatform.android,
impellerStatus: ImpellerStatus.disabled,
processManager: globals.processManager,
fileSystem: globals.fs,
@@ -994,7 +994,7 @@
expect(
await bundle.build(
packageConfigPath: '.dart_tool/package_config.json',
- targetPlatform: const TargetPlatform(.web, .unknown),
+ targetPlatform: TargetPlatform.web_javascript,
),
0,
);
@@ -1002,7 +1002,7 @@
await writeBundle(
output,
bundle.entries,
- targetPlatform: const TargetPlatform(.web, .unknown),
+ targetPlatform: TargetPlatform.web_javascript,
impellerStatus: ImpellerStatus.disabled,
processManager: globals.processManager,
fileSystem: globals.fs,
@@ -1156,7 +1156,7 @@
expect(
await bundle.build(
packageConfigPath: '.dart_tool/package_config.json',
- targetPlatform: const TargetPlatform(.web, .unknown),
+ targetPlatform: TargetPlatform.web_javascript,
),
0,
);
@@ -1164,7 +1164,7 @@
await writeBundle(
output,
bundle.entries,
- targetPlatform: const TargetPlatform(.web, .unknown),
+ targetPlatform: TargetPlatform.web_javascript,
impellerStatus: ImpellerStatus.disabled,
processManager: globals.processManager,
fileSystem: globals.fs,
@@ -1215,7 +1215,7 @@
expect(
await bundle.build(
packageConfigPath: '.dart_tool/package_config.json',
- targetPlatform: const TargetPlatform(.tester, .unknown),
+ targetPlatform: TargetPlatform.tester,
),
0,
);
@@ -1258,7 +1258,7 @@
await bundle.build(
packageConfigPath: '.dart_tool/package_config.json',
- targetPlatform: const TargetPlatform(.tester, .unknown),
+ targetPlatform: TargetPlatform.tester,
);
expect(
@@ -1315,7 +1315,7 @@
expect(
await bundle.build(
packageConfigPath: '.dart_tool/package_config.json',
- targetPlatform: const TargetPlatform(.tester, .unknown),
+ targetPlatform: TargetPlatform.tester,
),
1,
);
@@ -1350,7 +1350,7 @@
expect(
await bundle.build(
packageConfigPath: '.dart_tool/package_config.json',
- targetPlatform: const TargetPlatform(.tester, .unknown),
+ targetPlatform: TargetPlatform.tester,
),
1,
);
@@ -1395,7 +1395,7 @@
expect(
await bundle.build(
packageConfigPath: '.dart_tool/package_config.json',
- targetPlatform: const TargetPlatform(.tester, .unknown),
+ targetPlatform: TargetPlatform.tester,
),
0,
);
@@ -1437,7 +1437,7 @@
expect(
await bundle.build(
packageConfigPath: '.dart_tool/package_config.json',
- targetPlatform: const TargetPlatform(.tester, .unknown),
+ targetPlatform: TargetPlatform.tester,
),
0,
);
@@ -1487,7 +1487,7 @@
expect(
await bundle.build(
packageConfigPath: '.dart_tool/package_config.json',
- targetPlatform: const TargetPlatform(.tester, .unknown),
+ targetPlatform: TargetPlatform.tester,
),
0,
);
@@ -1529,7 +1529,7 @@
() => bundle.build(
packageConfigPath: '.dart_tool/package_config.json',
flutterProject: FlutterProject.fromDirectoryTest(fileSystem.currentDirectory),
- targetPlatform: const TargetPlatform(.tester, .unknown),
+ targetPlatform: TargetPlatform.tester,
),
throwsToolExit(
message:
diff --git a/packages/flutter_tools/test/general.shard/asset_bundle_variant_test.dart b/packages/flutter_tools/test/general.shard/asset_bundle_variant_test.dart
index 3b58ecb..91f24c6 100644
--- a/packages/flutter_tools/test/general.shard/asset_bundle_variant_test.dart
+++ b/packages/flutter_tools/test/general.shard/asset_bundle_variant_test.dart
@@ -87,7 +87,7 @@
await bundle.build(
packageConfigPath: '.dart_tool/package_config.json',
flutterProject: FlutterProject.fromDirectoryTest(fs.currentDirectory),
- targetPlatform: const TargetPlatform(.tester, .unknown),
+ targetPlatform: TargetPlatform.tester,
);
final Map<Object?, Object?> smcBinManifest = await extractAssetManifestSmcBinFromBundle(
@@ -135,7 +135,7 @@
await bundle.build(
packageConfigPath: '.dart_tool/package_config.json',
flutterProject: FlutterProject.fromDirectoryTest(fs.currentDirectory),
- targetPlatform: const TargetPlatform(.tester, .unknown),
+ targetPlatform: TargetPlatform.tester,
);
final Map<Object?, Object?> smcBinManifest = await extractAssetManifestSmcBinFromBundle(
@@ -179,7 +179,7 @@
await bundle.build(
packageConfigPath: '.dart_tool/package_config.json',
flutterProject: FlutterProject.fromDirectoryTest(fs.currentDirectory),
- targetPlatform: const TargetPlatform(.tester, .unknown),
+ targetPlatform: TargetPlatform.tester,
);
final Map<Object?, Object?> smcBinManifest = await extractAssetManifestSmcBinFromBundle(
@@ -219,7 +219,7 @@
await bundle.build(
packageConfigPath: '.dart_tool/package_config.json',
flutterProject: FlutterProject.fromDirectoryTest(fs.currentDirectory),
- targetPlatform: const TargetPlatform(.tester, .unknown),
+ targetPlatform: TargetPlatform.tester,
);
final expectedManifest = <String, List<Map<String, Object>>>{
@@ -287,7 +287,7 @@
await bundle.build(
packageConfigPath: '.dart_tool/package_config.json',
flutterProject: FlutterProject.fromDirectoryTest(fs.currentDirectory),
- targetPlatform: const TargetPlatform(.tester, .unknown),
+ targetPlatform: TargetPlatform.tester,
);
final expectedAssetManifest = <String, List<Map<String, Object>>>{
diff --git a/packages/flutter_tools/test/general.shard/asset_test.dart b/packages/flutter_tools/test/general.shard/asset_test.dart
index 28f7505..eb0e666 100644
--- a/packages/flutter_tools/test/general.shard/asset_test.dart
+++ b/packages/flutter_tools/test/general.shard/asset_test.dart
@@ -96,7 +96,7 @@
packageConfigPath: packageConfigPath,
manifestPath: manifestPath,
flutterProject: FlutterProject.fromDirectoryTest(fileSystem.directory('main')),
- targetPlatform: const TargetPlatform(.tester, .unknown),
+ targetPlatform: TargetPlatform.tester,
);
expect(assetBundle.entries, contains('FontManifest.json'));
@@ -255,7 +255,7 @@
packageConfigPath: packageConfigPath,
manifestPath: manifestPath,
flutterProject: FlutterProject.fromDirectoryTest(fileSystem.directory('main')),
- targetPlatform: const TargetPlatform(.tester, .unknown),
+ targetPlatform: TargetPlatform.tester,
);
expect(assetBundle.entries, contains('FontManifest.json'));
@@ -300,7 +300,7 @@
manifestPath: manifestPath, // file doesn't exist
packageConfigPath: packageConfigPath,
flutterProject: FlutterProject.fromDirectoryTest(fileSystem.file(manifestPath).parent),
- targetPlatform: const TargetPlatform(.tester, .unknown),
+ targetPlatform: TargetPlatform.tester,
);
expect(assetBundle.wasBuiltOnce(), true);
@@ -343,7 +343,7 @@
await assetBundle.build(
packageConfigPath: '.dart_tool/package_config.json',
- targetPlatform: const TargetPlatform(.android, .armv7),
+ targetPlatform: TargetPlatform.android_arm,
flutterProject: FlutterProject.fromDirectoryTest(fileSystem.currentDirectory),
);
@@ -387,7 +387,7 @@
await assetBundle.build(
packageConfigPath: '.dart_tool/package_config.json',
- targetPlatform: const TargetPlatform(.web, .unknown),
+ targetPlatform: TargetPlatform.web_javascript,
flutterProject: FlutterProject.fromDirectoryTest(fileSystem.currentDirectory),
);
@@ -416,7 +416,7 @@
final int result = await assetBundle.build(
packageConfigPath: '.dart_tool/package_config.json',
flutterProject: FlutterProject.fromDirectoryTest(fileSystem.currentDirectory),
- targetPlatform: const TargetPlatform(.tester, .unknown),
+ targetPlatform: TargetPlatform.tester,
);
expect(result, isNot(0));
expect(
@@ -446,7 +446,7 @@
final int result = await assetBundle.build(
packageConfigPath: '.dart_tool/package_config.json',
flutterProject: FlutterProject.fromDirectoryTest(fileSystem.currentDirectory),
- targetPlatform: const TargetPlatform(.tester, .unknown),
+ targetPlatform: TargetPlatform.tester,
);
expect(result, isNot(0));
expect(
diff --git a/packages/flutter_tools/test/general.shard/base/build_test.dart b/packages/flutter_tools/test/general.shard/base/build_test.dart
index bb47b42..2f88ba4 100644
--- a/packages/flutter_tools/test/general.shard/base/build_test.dart
+++ b/packages/flutter_tools/test/general.shard/base/build_test.dart
@@ -43,7 +43,7 @@
command: <String>[
artifacts.getArtifactPath(
Artifact.genSnapshot,
- platform: const TargetPlatform(.android, .x64),
+ platform: TargetPlatform.android_x64,
mode: BuildMode.release,
),
'--additional_arg',
@@ -52,7 +52,7 @@
);
final int result = await genSnapshot.run(
- snapshotType: SnapshotType(const TargetPlatform(.android, .x64), BuildMode.release),
+ snapshotType: SnapshotType(TargetPlatform.android_x64, BuildMode.release),
additionalArgs: <String>['--additional_arg'],
);
expect(result, 0);
@@ -61,7 +61,7 @@
testWithoutContext('iOS arm64', () async {
final String genSnapshotPath = artifacts.getArtifactPath(
Artifact.genSnapshotArm64,
- platform: const TargetPlatform(.ios, .arm64),
+ platform: TargetPlatform.ios,
mode: BuildMode.release,
);
processManager.addCommand(
@@ -69,7 +69,8 @@
);
final int result = await genSnapshot.run(
- snapshotType: SnapshotType(const TargetPlatform(.ios, .arm64), BuildMode.release),
+ snapshotType: SnapshotType(TargetPlatform.ios, BuildMode.release),
+ cpuArch: CpuArch.arm64,
additionalArgs: <String>['--additional_arg'],
);
expect(result, 0);
@@ -81,7 +82,7 @@
command: <String>[
artifacts.getArtifactPath(
Artifact.genSnapshot,
- platform: const TargetPlatform(.android, .x64),
+ platform: TargetPlatform.android_x64,
mode: BuildMode.release,
),
'--strip',
@@ -91,7 +92,7 @@
);
final int result = await genSnapshot.run(
- snapshotType: SnapshotType(const TargetPlatform(.android, .x64), BuildMode.release),
+ snapshotType: SnapshotType(TargetPlatform.android_x64, BuildMode.release),
additionalArgs: <String>['--strip'],
);
@@ -128,7 +129,8 @@
expect(
await snapshotter.build(
- platform: const TargetPlatform(.ios, .arm64),
+ platform: TargetPlatform.ios,
+ cpuArch: CpuArch.arm64,
sdkRoot: 'path/to/sdk',
buildMode: BuildMode.debug,
mainPath: 'main.dill',
@@ -144,7 +146,7 @@
expect(
await snapshotter.build(
- platform: const TargetPlatform(.android, .armv7),
+ platform: TargetPlatform.android_arm,
buildMode: BuildMode.debug,
mainPath: 'main.dill',
outputPath: outputPath,
@@ -159,7 +161,7 @@
expect(
await snapshotter.build(
- platform: const TargetPlatform(.android, .arm64),
+ platform: TargetPlatform.android_arm64,
buildMode: BuildMode.debug,
mainPath: 'main.dill',
outputPath: outputPath,
@@ -174,7 +176,7 @@
final String debugPath = fileSystem.path.join('foo', 'app.ios-arm64.symbols');
final String genSnapshotPath = artifacts.getArtifactPath(
Artifact.genSnapshotArm64,
- platform: const TargetPlatform(.ios, .arm64),
+ platform: TargetPlatform.ios,
mode: BuildMode.profile,
);
processManager.addCommands(<FakeCommand>[
@@ -218,10 +220,11 @@
]);
final int genSnapshotExitCode = await snapshotter.build(
- platform: const TargetPlatform(.ios, .arm64),
+ platform: TargetPlatform.ios,
buildMode: BuildMode.profile,
mainPath: 'main.dill',
outputPath: outputPath,
+ cpuArch: CpuArch.arm64,
sdkRoot: 'path/to/sdk',
splitDebugInfo: 'foo',
dartObfuscation: false,
@@ -235,7 +238,7 @@
final String outputPath = fileSystem.path.join('build', 'foo');
final String genSnapshotPath = artifacts.getArtifactPath(
Artifact.genSnapshotArm64,
- platform: const TargetPlatform(.ios, .arm64),
+ platform: TargetPlatform.ios,
mode: BuildMode.profile,
);
processManager.addCommands(<FakeCommand>[
@@ -277,10 +280,11 @@
]);
final int genSnapshotExitCode = await snapshotter.build(
- platform: const TargetPlatform(.ios, .arm64),
+ platform: TargetPlatform.ios,
buildMode: BuildMode.profile,
mainPath: 'main.dill',
outputPath: outputPath,
+ cpuArch: CpuArch.arm64,
sdkRoot: 'path/to/sdk',
dartObfuscation: true,
);
@@ -293,7 +297,7 @@
final String outputPath = fileSystem.path.join('build', 'foo');
final String genSnapshotPath = artifacts.getArtifactPath(
Artifact.genSnapshotArm64,
- platform: const TargetPlatform(.ios, .arm64),
+ platform: TargetPlatform.ios,
mode: BuildMode.release,
);
processManager.addCommands(<FakeCommand>[
@@ -334,10 +338,11 @@
]);
final int genSnapshotExitCode = await snapshotter.build(
- platform: const TargetPlatform(.ios, .arm64),
+ platform: TargetPlatform.ios,
buildMode: BuildMode.release,
mainPath: 'main.dill',
outputPath: outputPath,
+ cpuArch: CpuArch.arm64,
sdkRoot: 'path/to/sdk',
dartObfuscation: false,
);
@@ -353,7 +358,7 @@
command: <String>[
artifacts.getArtifactPath(
Artifact.genSnapshot,
- platform: const TargetPlatform(.android, .armv7),
+ platform: TargetPlatform.android_arm,
mode: BuildMode.release,
),
'--deterministic',
@@ -367,7 +372,7 @@
);
final int genSnapshotExitCode = await snapshotter.build(
- platform: const TargetPlatform(.android, .armv7),
+ platform: TargetPlatform.android_arm,
buildMode: BuildMode.release,
mainPath: 'main.dill',
outputPath: outputPath,
@@ -386,7 +391,7 @@
command: <String>[
artifacts.getArtifactPath(
Artifact.genSnapshot,
- platform: const TargetPlatform(.android, .armv7),
+ platform: TargetPlatform.android_arm,
mode: BuildMode.release,
),
'--deterministic',
@@ -403,7 +408,7 @@
);
final int genSnapshotExitCode = await snapshotter.build(
- platform: const TargetPlatform(.android, .armv7),
+ platform: TargetPlatform.android_arm,
buildMode: BuildMode.release,
mainPath: 'main.dill',
outputPath: outputPath,
@@ -422,7 +427,7 @@
command: <String>[
artifacts.getArtifactPath(
Artifact.genSnapshot,
- platform: const TargetPlatform(.android, .armv7),
+ platform: TargetPlatform.android_arm,
mode: BuildMode.release,
),
'--deterministic',
@@ -437,7 +442,7 @@
);
final int genSnapshotExitCode = await snapshotter.build(
- platform: const TargetPlatform(.android, .armv7),
+ platform: TargetPlatform.android_arm,
buildMode: BuildMode.release,
mainPath: 'main.dill',
outputPath: outputPath,
@@ -457,7 +462,7 @@
command: <String>[
artifacts.getArtifactPath(
Artifact.genSnapshot,
- platform: const TargetPlatform(.android, .armv7),
+ platform: TargetPlatform.android_arm,
mode: BuildMode.release,
),
'--deterministic',
@@ -471,7 +476,7 @@
);
final int genSnapshotExitCode = await snapshotter.build(
- platform: const TargetPlatform(.android, .armv7),
+ platform: TargetPlatform.android_arm,
buildMode: BuildMode.release,
mainPath: 'main.dill',
outputPath: outputPath,
@@ -491,7 +496,7 @@
command: <String>[
artifacts.getArtifactPath(
Artifact.genSnapshot,
- platform: const TargetPlatform(.android, .arm64),
+ platform: TargetPlatform.android_arm64,
mode: BuildMode.release,
),
'--deterministic',
@@ -503,7 +508,7 @@
);
final int genSnapshotExitCode = await snapshotter.build(
- platform: const TargetPlatform(.android, .arm64),
+ platform: TargetPlatform.android_arm64,
buildMode: BuildMode.release,
mainPath: 'main.dill',
outputPath: outputPath,
@@ -521,7 +526,7 @@
command: <String>[
artifacts.getArtifactPath(
Artifact.genSnapshot,
- platform: const TargetPlatform(.android, .arm64),
+ platform: TargetPlatform.android_arm64,
mode: BuildMode.release,
),
'--deterministic',
@@ -533,7 +538,7 @@
);
final int genSnapshotExitCode = await snapshotter.build(
- platform: const TargetPlatform(.android, .arm64),
+ platform: TargetPlatform.android_arm64,
buildMode: BuildMode.release,
mainPath: 'main.dill',
outputPath: outputPath,
diff --git a/packages/flutter_tools/test/general.shard/build_info_test.dart b/packages/flutter_tools/test/general.shard/build_info_test.dart
index ad6ffe5..57fcd7f 100644
--- a/packages/flutter_tools/test/general.shard/build_info_test.dart
+++ b/packages/flutter_tools/test/general.shard/build_info_test.dart
@@ -21,47 +21,51 @@
group('Validate build number', () {
testWithoutContext('CFBundleVersion for iOS', () async {
- String? buildName = validatedBuildNumberForPlatform(PlatformType.ios, 'xyz', logger);
+ String? buildName = validatedBuildNumberForPlatform(TargetPlatform.ios, 'xyz', logger);
expect(buildName, isNull);
- buildName = validatedBuildNumberForPlatform(PlatformType.ios, '0.0.1', logger);
+ buildName = validatedBuildNumberForPlatform(TargetPlatform.ios, '0.0.1', logger);
expect(buildName, '0.0.1');
- buildName = validatedBuildNumberForPlatform(PlatformType.ios, '123.xyz', logger);
+ buildName = validatedBuildNumberForPlatform(TargetPlatform.ios, '123.xyz', logger);
expect(buildName, '123');
- buildName = validatedBuildNumberForPlatform(PlatformType.ios, '123.456.xyz', logger);
+ buildName = validatedBuildNumberForPlatform(TargetPlatform.ios, '123.456.xyz', logger);
expect(buildName, '123.456');
});
testWithoutContext('versionCode for Android', () async {
String? buildName = validatedBuildNumberForPlatform(
- PlatformType.android,
+ TargetPlatform.android_arm,
'123.abc+-',
logger,
);
expect(buildName, '123');
- buildName = validatedBuildNumberForPlatform(PlatformType.android, 'abc', logger);
+ buildName = validatedBuildNumberForPlatform(TargetPlatform.android_arm, 'abc', logger);
expect(buildName, '1');
});
});
group('Validate build name', () {
testWithoutContext('CFBundleShortVersionString for iOS', () async {
- String? buildName = validatedBuildNameForPlatform(PlatformType.ios, 'xyz', logger);
+ String? buildName = validatedBuildNameForPlatform(TargetPlatform.ios, 'xyz', logger);
expect(buildName, isNull);
- buildName = validatedBuildNameForPlatform(PlatformType.ios, '0.0.1', logger);
+ buildName = validatedBuildNameForPlatform(TargetPlatform.ios, '0.0.1', logger);
expect(buildName, '0.0.1');
- buildName = validatedBuildNameForPlatform(PlatformType.ios, '123.456.xyz', logger);
+ buildName = validatedBuildNameForPlatform(TargetPlatform.ios, '123.456.xyz', logger);
expect(logger.traceText, contains('Invalid build-name'));
expect(buildName, '123.456.0');
- buildName = validatedBuildNameForPlatform(PlatformType.ios, '123.xyz', logger);
+ buildName = validatedBuildNameForPlatform(TargetPlatform.ios, '123.xyz', logger);
expect(buildName, '123.0.0');
});
testWithoutContext('versionName for Android', () async {
- String? buildName = validatedBuildNameForPlatform(PlatformType.android, '123.abc+-', logger);
+ String? buildName = validatedBuildNameForPlatform(
+ TargetPlatform.android_arm,
+ '123.abc+-',
+ logger,
+ );
expect(buildName, '123.abc+-');
- buildName = validatedBuildNameForPlatform(PlatformType.android, 'abc+-', logger);
+ buildName = validatedBuildNameForPlatform(TargetPlatform.android_arm, 'abc+-', logger);
expect(buildName, 'abc+-');
});
@@ -102,25 +106,11 @@
expect(CpuArch.x64.darwinArchName, 'x86_64');
});
- testWithoutContext('getName derives the canonical name from the platform and arch', () {
- // iOS and macOS include the CPU architecture in their name (e.g.
- // `ios-arm64`, `darwin-x64`), falling back to the bare platform name when
- // the architecture is unknown.
- expect(const TargetPlatform(.ios, .arm64).getName(), 'ios-arm64');
- expect(const TargetPlatform(.ios, .x64).getName(), 'ios-x64');
- expect(const TargetPlatform(.ios, .unknown).getName(), 'ios');
- expect(const TargetPlatform(.macos, .arm64).getName(), 'darwin-arm64');
- expect(const TargetPlatform(.macos, .x64).getName(), 'darwin-x64');
- expect(const TargetPlatform(.macos, .unknown).getName(), 'darwin');
- // Desktop platforms follow the `<platform>-<arch>` convention.
- expect(const TargetPlatform(.linux, .x64).getName(), 'linux-x64');
- expect(const TargetPlatform(.linux, .arm64).getName(), 'linux-arm64');
- expect(const TargetPlatform(.windows, .arm64).getName(), 'windows-arm64');
- // Android has its own per-arch names.
- expect(const TargetPlatform(.android, .armv7).getName(), 'android-arm');
- expect(const TargetPlatform(.android, .arm64).getName(), 'android-arm64');
- expect(const TargetPlatform(.android, .x64).getName(), 'android-x64');
- expect(const TargetPlatform(.android, .unknown).getName(), 'android');
+ testWithoutContext('getNameForTargetPlatform on Darwin arches', () {
+ expect(TargetPlatform.ios.getName(cpuArch: CpuArch.arm64), 'ios-arm64');
+ expect(TargetPlatform.ios.getName(cpuArch: CpuArch.armv7), 'ios-armv7');
+ expect(TargetPlatform.ios.getName(cpuArch: CpuArch.x64), 'ios-x86_64');
+ expect(TargetPlatform.android.getName(), isNot(contains('ios')));
});
testUsingContext(
diff --git a/packages/flutter_tools/test/general.shard/build_system/source_test.dart b/packages/flutter_tools/test/general.shard/build_system/source_test.dart
index 0b162ab..653b04b 100644
--- a/packages/flutter_tools/test/general.shard/build_system/source_test.dart
+++ b/packages/flutter_tools/test/general.shard/build_system/source_test.dart
@@ -111,7 +111,7 @@
globals.fs.file(path).createSync(recursive: true);
const fizzSource = Source.artifact(
Artifact.windowsDesktopPath,
- platform: TargetPlatform(.windows, .x64),
+ platform: TargetPlatform.windows_x64,
);
fizzSource.accept(visitor);
@@ -277,7 +277,7 @@
const fizzSource = Source.artifact(
Artifact.windowsDesktopPath,
- platform: TargetPlatform(.windows, .x64),
+ platform: TargetPlatform.windows_x64,
);
fizzSource.accept(visitor);
diff --git a/packages/flutter_tools/test/general.shard/build_system/targets/android_test.dart b/packages/flutter_tools/test/general.shard/build_system/targets/android_test.dart
index eb9190b..9ccb733 100644
--- a/packages/flutter_tools/test/general.shard/build_system/targets/android_test.dart
+++ b/packages/flutter_tools/test/general.shard/build_system/targets/android_test.dart
@@ -174,7 +174,7 @@
command: <String>[
artifacts.getArtifactPath(
Artifact.genSnapshot,
- platform: const TargetPlatform(.android, .arm64),
+ platform: TargetPlatform.android_arm64,
mode: BuildMode.release,
),
'--deterministic',
@@ -187,7 +187,7 @@
environment.buildDir.createSync(recursive: true);
environment.buildDir.childFile('app.dill').createSync();
environment.buildDir.childFile('native_assets.json').createSync();
- const androidAot = AndroidAot(TargetPlatform(.android, .arm64), BuildMode.release);
+ const androidAot = AndroidAot(TargetPlatform.android_arm64, BuildMode.release);
await androidAot.build(environment);
@@ -210,7 +210,7 @@
command: <String>[
artifacts.getArtifactPath(
Artifact.genSnapshot,
- platform: const TargetPlatform(.android, .arm64),
+ platform: TargetPlatform.android_arm64,
mode: BuildMode.release,
),
'--deterministic',
@@ -225,7 +225,7 @@
environment.buildDir.createSync(recursive: true);
environment.buildDir.childFile('app.dill').createSync();
environment.buildDir.childFile('native_assets.json').createSync();
- const androidAot = AndroidAot(TargetPlatform(.android, .arm64), BuildMode.release);
+ const androidAot = AndroidAot(TargetPlatform.android_arm64, BuildMode.release);
await androidAot.build(environment);
@@ -252,7 +252,7 @@
command: <String>[
artifacts.getArtifactPath(
Artifact.genSnapshot,
- platform: const TargetPlatform(.android, .arm64),
+ platform: TargetPlatform.android_arm64,
mode: BuildMode.release,
),
'--deterministic',
@@ -269,7 +269,7 @@
environment.buildDir.childFile('app.dill').createSync();
environment.buildDir.childFile('native_assets.json').createSync();
- await const AndroidAot(TargetPlatform(.android, .arm64), BuildMode.release).build(environment);
+ await const AndroidAot(TargetPlatform.android_arm64, BuildMode.release).build(environment);
});
testUsingContext(
@@ -294,7 +294,7 @@
command: <String>[
artifacts.getArtifactPath(
Artifact.genSnapshot,
- platform: const TargetPlatform(.android, .arm64),
+ platform: TargetPlatform.android_arm64,
mode: BuildMode.release,
),
'--deterministic',
@@ -311,10 +311,7 @@
environment.buildDir.childFile('app.dill').createSync();
environment.buildDir.childFile('native_assets.json').createSync();
- await const AndroidAot(
- TargetPlatform(.android, .arm64),
- BuildMode.release,
- ).build(environment);
+ await const AndroidAot(TargetPlatform.android_arm64, BuildMode.release).build(environment);
},
);
@@ -329,7 +326,7 @@
logger: logger,
);
environment.buildDir.createSync(recursive: true);
- const androidAot = AndroidAot(TargetPlatform(.android, .arm64), BuildMode.release);
+ const androidAot = AndroidAot(TargetPlatform.android_arm64, BuildMode.release);
const androidAotBundle = AndroidAotBundle(androidAot);
// Create required files.
environment.buildDir
diff --git a/packages/flutter_tools/test/general.shard/build_system/targets/assets_test.dart b/packages/flutter_tools/test/general.shard/build_system/targets/assets_test.dart
index fb23a80..427cde4 100644
--- a/packages/flutter_tools/test/general.shard/build_system/targets/assets_test.dart
+++ b/packages/flutter_tools/test/general.shard/build_system/targets/assets_test.dart
@@ -844,9 +844,9 @@
testUsingContext(
platform,
() async {
- final targetPlatform = platform == 'android'
- ? const TargetPlatform(.ios, .arm64)
- : const TargetPlatform(.android, .unknown);
+ final TargetPlatform targetPlatform = platform == 'android'
+ ? TargetPlatform.ios
+ : TargetPlatform.android;
final bool didInclude = await setupAndBuildPlatformAsset(platform, targetPlatform);
expect(
diff --git a/packages/flutter_tools/test/general.shard/build_system/targets/common_test.dart b/packages/flutter_tools/test/general.shard/build_system/targets/common_test.dart
index 9fef520..64f7722 100644
--- a/packages/flutter_tools/test/general.shard/build_system/targets/common_test.dart
+++ b/packages/flutter_tools/test/general.shard/build_system/targets/common_test.dart
@@ -49,7 +49,7 @@
fileSystem.currentDirectory,
defines: <String, String>{
kBuildMode: BuildMode.profile.cliName,
- kTargetPlatform: const TargetPlatform(.android, .armv7).getName(),
+ kTargetPlatform: TargetPlatform.android_arm.getName(),
},
inputs: <String, String>{},
artifacts: artifacts,
@@ -62,7 +62,7 @@
fileSystem.currentDirectory,
defines: <String, String>{
kBuildMode: BuildMode.profile.cliName,
- kTargetPlatform: const TargetPlatform(.ios, .arm64).getName(),
+ kTargetPlatform: TargetPlatform.ios.getName(),
},
inputs: <String, String>{},
artifacts: artifacts,
@@ -88,7 +88,7 @@
final String build = androidEnvironment.buildDir.path;
final String flutterPatchedSdkPath = artifacts.getArtifactPath(
Artifact.flutterPatchedSdkPath,
- platform: const TargetPlatform(.android, .armv7),
+ platform: TargetPlatform.android_arm,
mode: BuildMode.profile,
);
processManager.addCommands(<FakeCommand>[
@@ -130,7 +130,7 @@
final String build = androidEnvironment.buildDir.path;
final String flutterPatchedSdkPath = artifacts.getArtifactPath(
Artifact.flutterPatchedSdkPath,
- platform: const TargetPlatform(.android, .armv7),
+ platform: TargetPlatform.android_arm,
mode: BuildMode.profile,
);
processManager.addCommands(<FakeCommand>[
@@ -175,7 +175,7 @@
final String build = androidEnvironment.buildDir.path;
final String flutterPatchedSdkPath = artifacts.getArtifactPath(
Artifact.flutterPatchedSdkPath,
- platform: const TargetPlatform(.android, .armv7),
+ platform: TargetPlatform.android_arm,
mode: BuildMode.profile,
);
processManager.addCommands(<FakeCommand>[
@@ -220,7 +220,7 @@
final String build = androidEnvironment.buildDir.path;
final String flutterPatchedSdkPath = artifacts.getArtifactPath(
Artifact.flutterPatchedSdkPath,
- platform: const TargetPlatform(.android, .armv7),
+ platform: TargetPlatform.android_arm,
mode: BuildMode.profile,
);
processManager.addCommands(<FakeCommand>[
@@ -266,7 +266,7 @@
final String build = androidEnvironment.buildDir.path;
final String flutterPatchedSdkPath = artifacts.getArtifactPath(
Artifact.flutterPatchedSdkPath,
- platform: const TargetPlatform(.android, .armv7),
+ platform: TargetPlatform.android_arm,
mode: BuildMode.profile,
);
processManager.addCommands(<FakeCommand>[
@@ -314,7 +314,7 @@
final String build = androidEnvironment.buildDir.path;
final String flutterPatchedSdkPath = artifacts.getArtifactPath(
Artifact.flutterPatchedSdkPath,
- platform: const TargetPlatform(.android, .armv7),
+ platform: TargetPlatform.android_arm,
mode: BuildMode.debug,
);
processManager.addCommands(<FakeCommand>[
@@ -362,7 +362,7 @@
final String build = androidEnvironment.buildDir.path;
final String flutterPatchedSdkPath = artifacts.getArtifactPath(
Artifact.flutterPatchedSdkPath,
- platform: const TargetPlatform(.macos, .x64),
+ platform: TargetPlatform.darwin,
mode: BuildMode.debug,
);
processManager.addCommands(<FakeCommand>[
@@ -393,7 +393,7 @@
await const KernelSnapshot().build(
androidEnvironment
- ..defines[kTargetPlatform] = const TargetPlatform(.macos, .x64).getName()
+ ..defines[kTargetPlatform] = TargetPlatform.darwin.getName()
..defines[kBuildMode] = BuildMode.debug.cliName
..defines[kTrackWidgetCreation] = 'false',
);
@@ -411,7 +411,7 @@
final String build = androidEnvironment.buildDir.path;
final String flutterPatchedSdkPath = artifacts.getArtifactPath(
Artifact.flutterPatchedSdkPath,
- platform: const TargetPlatform(.android, .unknown),
+ platform: TargetPlatform.android,
mode: BuildMode.debug,
);
processManager.addCommands(<FakeCommand>[
@@ -453,7 +453,7 @@
final String build = iosEnvironment.buildDir.path;
final String flutterPatchedSdkPath = artifacts.getArtifactPath(
Artifact.flutterPatchedSdkPath,
- platform: const TargetPlatform(.ios, .arm64),
+ platform: TargetPlatform.ios,
mode: BuildMode.debug,
);
fileSystem.directory('/ios/Runner.xcodeproj').createSync(recursive: true);
@@ -487,7 +487,7 @@
await const KernelSnapshot().build(
iosEnvironment
- ..defines[kTargetPlatform] = const TargetPlatform(.ios, .arm64).getName()
+ ..defines[kTargetPlatform] = TargetPlatform.ios.getName()
..defines[kBuildMode] = BuildMode.debug.cliName
..defines[kFlavor] = 'strawberry'
..defines[kXcodeConfiguration] = 'Debug-chocolate'
@@ -511,7 +511,7 @@
final String build = iosEnvironment.buildDir.path;
final String flutterPatchedSdkPath = artifacts.getArtifactPath(
Artifact.flutterPatchedSdkPath,
- platform: const TargetPlatform(.macos, .x64),
+ platform: TargetPlatform.darwin,
mode: BuildMode.debug,
);
fileSystem.directory('/macos/Runner.xcodeproj').createSync(recursive: true);
@@ -544,7 +544,7 @@
await const KernelSnapshot().build(
iosEnvironment
- ..defines[kTargetPlatform] = const TargetPlatform(.macos, .x64).getName()
+ ..defines[kTargetPlatform] = TargetPlatform.darwin.getName()
..defines[kBuildMode] = BuildMode.debug.cliName
..defines[kFlavor] = 'strawberry'
..defines[kXcodeConfiguration] = 'Debug-chocolate'
@@ -568,7 +568,7 @@
final String build = iosEnvironment.buildDir.path;
final String flutterPatchedSdkPath = artifacts.getArtifactPath(
Artifact.flutterPatchedSdkPath,
- platform: const TargetPlatform(.macos, .x64),
+ platform: TargetPlatform.darwin,
mode: BuildMode.debug,
);
processManager.addCommands(<FakeCommand>[
@@ -600,7 +600,7 @@
await const KernelSnapshot().build(
iosEnvironment
- ..defines[kTargetPlatform] = const TargetPlatform(.macos, .x64).getName()
+ ..defines[kTargetPlatform] = TargetPlatform.darwin.getName()
..defines[kBuildMode] = BuildMode.debug.cliName
..defines[kDartDefines] = base64Encode(utf8.encode('FLUTTER_APP_FLAVOR=vanilla'))
..defines[kFlavor] = 'strawberry'
@@ -624,7 +624,7 @@
fileSystem.currentDirectory,
defines: <String, String>{
kBuildMode: BuildMode.debug.cliName,
- kTargetPlatform: const TargetPlatform(.android, .armv7).getName(),
+ kTargetPlatform: TargetPlatform.android_arm.getName(),
},
processManager: processManager,
artifacts: artifacts,
@@ -634,7 +634,7 @@
final String build = testEnvironment.buildDir.path;
final String flutterPatchedSdkPath = artifacts.getArtifactPath(
Artifact.flutterPatchedSdkPath,
- platform: const TargetPlatform(.android, .armv7),
+ platform: TargetPlatform.android_arm,
mode: BuildMode.debug,
);
processManager.addCommands(<FakeCommand>[
@@ -678,7 +678,7 @@
command: <String>[
artifacts.getArtifactPath(
Artifact.genSnapshot,
- platform: const TargetPlatform(.android, .armv7),
+ platform: TargetPlatform.android_arm,
mode: BuildMode.profile,
),
'--deterministic',
@@ -693,7 +693,7 @@
androidEnvironment.buildDir.childFile('app.dill').createSync(recursive: true);
androidEnvironment.buildDir.childFile('native_assets.json').createSync();
- await const AotElfProfile(TargetPlatform(.android, .armv7)).build(androidEnvironment);
+ await const AotElfProfile(TargetPlatform.android_arm).build(androidEnvironment);
expect(processManager, hasNoRemainingExpectations);
});
@@ -706,7 +706,7 @@
command: <String>[
artifacts.getArtifactPath(
Artifact.genSnapshot,
- platform: const TargetPlatform(.android, .armv7),
+ platform: TargetPlatform.android_arm,
mode: BuildMode.profile,
),
'--deterministic',
@@ -723,7 +723,7 @@
androidEnvironment.buildDir.childFile('app.dill').createSync(recursive: true);
androidEnvironment.buildDir.childFile('native_assets.json').createSync();
- await const AotElfRelease(TargetPlatform(.android, .armv7)).build(androidEnvironment);
+ await const AotElfRelease(TargetPlatform.android_arm).build(androidEnvironment);
expect(processManager, hasNoRemainingExpectations);
});
@@ -732,7 +732,7 @@
androidEnvironment.defines.remove(kBuildMode);
expect(
- const AotElfProfile(TargetPlatform(.android, .armv7)).build(androidEnvironment),
+ const AotElfProfile(TargetPlatform.android_arm).build(androidEnvironment),
throwsA(isA<MissingDefineException>()),
);
});
@@ -741,7 +741,7 @@
androidEnvironment.defines.remove(kTargetPlatform);
expect(
- const AotElfProfile(TargetPlatform(.android, .armv7)).build(androidEnvironment),
+ const AotElfProfile(TargetPlatform.android_arm).build(androidEnvironment),
throwsA(isA<MissingDefineException>()),
);
});
@@ -803,7 +803,7 @@
FakeCommand(
command: <String>[
// This path is not known by the cache due to the iOS gen_snapshot split.
- 'Artifact.genSnapshotArm64.ios.profile',
+ 'Artifact.genSnapshotArm64.TargetPlatform.ios.profile',
'--deterministic',
'--write-v8-snapshot-profile-to=code_size_1/snapshot.arm64.json',
'--trace-precompiler-to=code_size_1/trace.arm64.json',
@@ -867,7 +867,7 @@
command: <String>[
artifacts.getArtifactPath(
Artifact.genSnapshot,
- platform: const TargetPlatform(.android, .armv7),
+ platform: TargetPlatform.android_arm,
mode: BuildMode.profile,
),
'--deterministic',
@@ -883,7 +883,7 @@
),
]);
- await const AotElfRelease(TargetPlatform(.android, .armv7)).build(androidEnvironment);
+ await const AotElfRelease(TargetPlatform.android_arm).build(androidEnvironment);
expect(processManager, hasNoRemainingExpectations);
});
diff --git a/packages/flutter_tools/test/general.shard/build_system/targets/deferred_components_test.dart b/packages/flutter_tools/test/general.shard/build_system/targets/deferred_components_test.dart
index 83e2981..151319c 100644
--- a/packages/flutter_tools/test/general.shard/build_system/targets/deferred_components_test.dart
+++ b/packages/flutter_tools/test/general.shard/build_system/targets/deferred_components_test.dart
@@ -38,7 +38,7 @@
logger: logger,
);
environment.buildDir.createSync(recursive: true);
- const androidAot = AndroidAot(TargetPlatform(.android, .arm64), BuildMode.release);
+ const androidAot = AndroidAot(TargetPlatform.android_arm64, BuildMode.release);
const androidAotBundle = AndroidAotBundle(androidAot);
final androidDefBundle = AndroidAotDeferredComponentsBundle(androidAotBundle);
final validatorTarget = DeferredComponentsGenSnapshotValidatorTarget(
@@ -72,7 +72,7 @@
logger: logger,
);
environment.buildDir.createSync(recursive: true);
- const androidAot = AndroidAot(TargetPlatform(.android, .arm64), BuildMode.release);
+ const androidAot = AndroidAot(TargetPlatform.android_arm64, BuildMode.release);
const androidAotBundle = AndroidAotBundle(androidAot);
final androidDefBundle = AndroidAotDeferredComponentsBundle(androidAotBundle);
final validatorTarget = DeferredComponentsGenSnapshotValidatorTarget(
@@ -105,7 +105,7 @@
logger: logger,
);
environment.buildDir.createSync(recursive: true);
- const androidAot = AndroidAot(TargetPlatform(.android, .arm64), BuildMode.release);
+ const androidAot = AndroidAot(TargetPlatform.android_arm64, BuildMode.release);
const androidAotBundle = AndroidAotBundle(androidAot);
final androidDefBundle = AndroidAotDeferredComponentsBundle(androidAotBundle);
final validatorTarget = DeferredComponentsGenSnapshotValidatorTarget(
diff --git a/packages/flutter_tools/test/general.shard/build_system/targets/icon_tree_shaker_test.dart b/packages/flutter_tools/test/general.shard/build_system/targets/icon_tree_shaker_test.dart
index cde0c70..72aeb07 100644
--- a/packages/flutter_tools/test/general.shard/build_system/targets/icon_tree_shaker_test.dart
+++ b/packages/flutter_tools/test/general.shard/build_system/targets/icon_tree_shaker_test.dart
@@ -128,7 +128,7 @@
processManager: processManager,
fileSystem: fileSystem,
artifacts: artifacts,
- targetPlatform: const TargetPlatform(.android, .unknown),
+ targetPlatform: TargetPlatform.android,
);
expect(
@@ -160,7 +160,7 @@
processManager: processManager,
fileSystem: fileSystem,
artifacts: artifacts,
- targetPlatform: const TargetPlatform(.android, .unknown),
+ targetPlatform: TargetPlatform.android,
);
expect(logger.errorText, isEmpty);
@@ -181,7 +181,7 @@
processManager: processManager,
fileSystem: fileSystem,
artifacts: artifacts,
- targetPlatform: const TargetPlatform(.android, .unknown),
+ targetPlatform: TargetPlatform.android,
);
expect(logger.errorText, isEmpty);
@@ -202,7 +202,7 @@
processManager: processManager,
fileSystem: fileSystem,
artifacts: artifacts,
- targetPlatform: const TargetPlatform(.android, .unknown),
+ targetPlatform: TargetPlatform.android,
);
expect(
@@ -230,7 +230,7 @@
processManager: processManager,
fileSystem: fileSystem,
artifacts: artifacts,
- targetPlatform: const TargetPlatform(.android, .unknown),
+ targetPlatform: TargetPlatform.android,
);
final stdinSink = CompleterIOSink();
addConstFinderInvocation(appDill.path, stdout: validConstFinderResult);
@@ -280,7 +280,7 @@
processManager: processManager,
fileSystem: fileSystem,
artifacts: artifacts,
- targetPlatform: const TargetPlatform(.android, .unknown),
+ targetPlatform: TargetPlatform.android,
);
final stdinSink = CompleterIOSink();
@@ -312,7 +312,7 @@
processManager: processManager,
fileSystem: fileSystem,
artifacts: artifacts,
- targetPlatform: const TargetPlatform(.android, .unknown),
+ targetPlatform: TargetPlatform.android,
);
final stdinSink = CompleterIOSink();
@@ -330,8 +330,8 @@
});
for (final platform in <TargetPlatform>[
- const TargetPlatform(.android, .armv7),
- const TargetPlatform(.web, .unknown),
+ TargetPlatform.android_arm,
+ TargetPlatform.web_javascript,
]) {
testWithoutContext('Non-constant instances $platform', () async {
final Environment environment = createEnvironment(<String, String>{
@@ -382,7 +382,7 @@
processManager: processManager,
fileSystem: fileSystem,
artifacts: artifacts,
- targetPlatform: const TargetPlatform(.android, .arm64),
+ targetPlatform: TargetPlatform.android_arm64,
);
addConstFinderInvocation(
@@ -425,7 +425,7 @@
processManager: processManager,
fileSystem: fileSystem,
artifacts: artifacts,
- targetPlatform: const TargetPlatform(.web, .unknown),
+ targetPlatform: TargetPlatform.web_javascript,
);
addConstFinderInvocation(
@@ -469,7 +469,7 @@
processManager: processManager,
fileSystem: fileSystem,
artifacts: artifacts,
- targetPlatform: const TargetPlatform(.android, .unknown),
+ targetPlatform: TargetPlatform.android,
);
final stdinSink = CompleterIOSink();
@@ -501,7 +501,7 @@
processManager: processManager,
fileSystem: fileSystem,
artifacts: artifacts,
- targetPlatform: const TargetPlatform(.android, .unknown),
+ targetPlatform: TargetPlatform.android,
);
final stdinSink = CompleterIOSink(throwOnAdd: true);
@@ -535,7 +535,7 @@
processManager: processManager,
fileSystem: fileSystem,
artifacts: artifacts,
- targetPlatform: const TargetPlatform(.android, .unknown),
+ targetPlatform: TargetPlatform.android,
);
addConstFinderInvocation(appDill.path, stdout: validConstFinderResult);
@@ -568,7 +568,7 @@
processManager: processManager,
fileSystem: fileSystem,
artifacts: artifacts,
- targetPlatform: const TargetPlatform(.android, .unknown),
+ targetPlatform: TargetPlatform.android,
);
addConstFinderInvocation(appDill.path, stdout: emptyConstFinderResult);
@@ -611,7 +611,7 @@
processManager: processManager,
fileSystem: fileSystem,
artifacts: artifacts,
- targetPlatform: const TargetPlatform(.android, .unknown),
+ targetPlatform: TargetPlatform.android,
);
addConstFinderInvocation(appDill.path, stdout: emptyConstFinderResult);
@@ -652,7 +652,7 @@
processManager: processManager,
fileSystem: fileSystem,
artifacts: artifacts,
- targetPlatform: const TargetPlatform(.android, .unknown),
+ targetPlatform: TargetPlatform.android,
);
addConstFinderInvocation(appDill.path, exitCode: -1);
diff --git a/packages/flutter_tools/test/general.shard/build_system/targets/ios_test.dart b/packages/flutter_tools/test/general.shard/build_system/targets/ios_test.dart
index 3736b6f..bd5dc8e 100644
--- a/packages/flutter_tools/test/general.shard/build_system/targets/ios_test.dart
+++ b/packages/flutter_tools/test/general.shard/build_system/targets/ios_test.dart
@@ -862,7 +862,7 @@
'--filter',
'- .DS_Store/',
'--chmod=Du=rwx,Dgo=rx,Fu=rw,Fgo=r',
- 'Artifact.flutterFramework.ios.debug.EnvironmentType.physical',
+ 'Artifact.flutterFramework.TargetPlatform.ios.debug.EnvironmentType.physical',
outputDir.path,
],
);
@@ -875,7 +875,7 @@
'--filter',
'- .DS_Store/',
'--chmod=Du=rwx,Dgo=rx,Fu=rw,Fgo=r',
- 'Artifact.flutterFrameworkDsym.ios.debug.EnvironmentType.physical',
+ 'Artifact.flutterFrameworkDsym.TargetPlatform.ios.debug.EnvironmentType.physical',
outputDir.path,
],
);
@@ -888,7 +888,7 @@
'--filter',
'- .DS_Store/',
'--chmod=Du=rwx,Dgo=rx,Fu=rw,Fgo=r',
- 'Artifact.flutterFrameworkDsym.ios.debug.EnvironmentType.physical',
+ 'Artifact.flutterFrameworkDsym.TargetPlatform.ios.debug.EnvironmentType.physical',
outputDir.path,
],
exitCode: 1,
@@ -932,7 +932,7 @@
'--filter',
'- .DS_Store/',
'--chmod=Du=rwx,Dgo=rx,Fu=rw,Fgo=r',
- 'Artifact.flutterFramework.ios.debug.EnvironmentType.simulator',
+ 'Artifact.flutterFramework.TargetPlatform.ios.debug.EnvironmentType.simulator',
outputDir.path,
],
onRun: (_) => binary.createSync(recursive: true),
@@ -979,7 +979,7 @@
final Directory dSYM = fileSystem.directory(
artifacts.getArtifactPath(
Artifact.flutterFrameworkDsym,
- platform: const TargetPlatform(.ios, .arm64),
+ platform: TargetPlatform.ios,
mode: BuildMode.debug,
environmentType: EnvironmentType.physical,
),
@@ -1337,7 +1337,7 @@
final Directory dSYM = fileSystem.directory(
artifacts.getArtifactPath(
Artifact.flutterFrameworkDsym,
- platform: const TargetPlatform(.ios, .arm64),
+ platform: TargetPlatform.ios,
mode: BuildMode.debug,
environmentType: EnvironmentType.physical,
),
diff --git a/packages/flutter_tools/test/general.shard/build_system/targets/linux_test.dart b/packages/flutter_tools/test/general.shard/build_system/targets/linux_test.dart
index 61d907d..5f3dbf7 100644
--- a/packages/flutter_tools/test/general.shard/build_system/targets/linux_test.dart
+++ b/packages/flutter_tools/test/general.shard/build_system/targets/linux_test.dart
@@ -38,7 +38,7 @@
);
testEnvironment.buildDir.createSync(recursive: true);
- await const UnpackLinux(TargetPlatform(.linux, .x64)).build(testEnvironment);
+ await const UnpackLinux(TargetPlatform.linux_x64).build(testEnvironment);
expect(fileSystem.file('linux/flutter/ephemeral/libflutter_linux_gtk.so'), exists);
expect(fileSystem.file('linux/flutter/ephemeral/unrelated-stuff'), isNot(exists));
@@ -46,12 +46,12 @@
// Check if the target files are copied correctly.
final String headersPathForX64 = artifacts.getArtifactPath(
Artifact.linuxHeaders,
- platform: const TargetPlatform(.linux, .x64),
+ platform: TargetPlatform.linux_x64,
mode: BuildMode.debug,
);
final String headersPathForArm64 = artifacts.getArtifactPath(
Artifact.linuxHeaders,
- platform: const TargetPlatform(.linux, .arm64),
+ platform: TargetPlatform.linux_arm64,
mode: BuildMode.debug,
);
expect(fileSystem.file('linux/flutter/ephemeral/$headersPathForX64/foo.h'), exists);
@@ -59,11 +59,11 @@
final String icuDataPathForX64 = artifacts.getArtifactPath(
Artifact.icuData,
- platform: const TargetPlatform(.linux, .x64),
+ platform: TargetPlatform.linux_x64,
);
final String icuDataPathForArm64 = artifacts.getArtifactPath(
Artifact.icuData,
- platform: const TargetPlatform(.linux, .arm64),
+ platform: TargetPlatform.linux_arm64,
);
expect(fileSystem.file('linux/flutter/ephemeral/$icuDataPathForX64'), exists);
expect(fileSystem.file('linux/flutter/ephemeral/$icuDataPathForArm64'), isNot(exists));
@@ -89,7 +89,7 @@
);
testEnvironment.buildDir.createSync(recursive: true);
- await const UnpackLinux(TargetPlatform(.linux, .arm64)).build(testEnvironment);
+ await const UnpackLinux(TargetPlatform.linux_arm64).build(testEnvironment);
expect(fileSystem.file('linux/flutter/ephemeral/libflutter_linux_gtk.so'), exists);
expect(fileSystem.file('linux/flutter/ephemeral/unrelated-stuff'), isNot(exists));
@@ -97,12 +97,12 @@
// Check if the target files are copied correctly.
final String headersPathForX64 = artifacts.getArtifactPath(
Artifact.linuxHeaders,
- platform: const TargetPlatform(.linux, .x64),
+ platform: TargetPlatform.linux_x64,
mode: BuildMode.debug,
);
final String headersPathForArm64 = artifacts.getArtifactPath(
Artifact.linuxHeaders,
- platform: const TargetPlatform(.linux, .arm64),
+ platform: TargetPlatform.linux_arm64,
mode: BuildMode.debug,
);
expect(fileSystem.file('linux/flutter/ephemeral/$headersPathForX64/foo.h'), isNot(exists));
@@ -110,11 +110,11 @@
final String icuDataPathForX64 = artifacts.getArtifactPath(
Artifact.icuData,
- platform: const TargetPlatform(.linux, .x64),
+ platform: TargetPlatform.linux_x64,
);
final String icuDataPathForArm64 = artifacts.getArtifactPath(
Artifact.icuData,
- platform: const TargetPlatform(.linux, .arm64),
+ platform: TargetPlatform.linux_arm64,
);
expect(fileSystem.file('linux/flutter/ephemeral/$icuDataPathForX64'), isNot(exists));
expect(fileSystem.file('linux/flutter/ephemeral/$icuDataPathForArm64'), exists);
@@ -147,7 +147,7 @@
testEnvironment.buildDir.childFile('app.dill').createSync();
testEnvironment.buildDir.childFile('native_assets.json').createSync();
- await const DebugBundleLinuxAssets(TargetPlatform(.linux, .x64)).build(testEnvironment);
+ await const DebugBundleLinuxAssets(TargetPlatform.linux_x64).build(testEnvironment);
final Directory output = testEnvironment.outputDir.childDirectory('flutter_assets');
@@ -203,7 +203,7 @@
flavorFileSystem.file('assets/strawberry/ice-cream.png').createSync(recursive: true);
writePackageConfigFiles(directory: flavorFileSystem.currentDirectory, mainLibName: 'example');
- await const DebugBundleLinuxAssets(TargetPlatform(.linux, .x64)).build(environment);
+ await const DebugBundleLinuxAssets(TargetPlatform.linux_x64).build(environment);
final Uint8List assetManifestData = environment.outputDir
.childDirectory('flutter_assets')
@@ -225,11 +225,11 @@
testWithoutContext("DebugBundleLinuxAssets' name depends on target platforms", () async {
expect(
- const DebugBundleLinuxAssets(TargetPlatform(.linux, .x64)).name,
+ const DebugBundleLinuxAssets(TargetPlatform.linux_x64).name,
'debug_bundle_linux-x64_assets',
);
expect(
- const DebugBundleLinuxAssets(TargetPlatform(.linux, .arm64)).name,
+ const DebugBundleLinuxAssets(TargetPlatform.linux_arm64).name,
'debug_bundle_linux-arm64_assets',
);
});
@@ -252,10 +252,8 @@
testEnvironment.buildDir.childFile('app.so').createSync();
testEnvironment.buildDir.childFile('native_assets.json').createSync();
- await const LinuxAotBundle(
- AotElfProfile(TargetPlatform(.linux, .x64)),
- ).build(testEnvironment);
- await const ProfileBundleLinuxAssets(TargetPlatform(.linux, .x64)).build(testEnvironment);
+ await const LinuxAotBundle(AotElfProfile(TargetPlatform.linux_x64)).build(testEnvironment);
+ await const ProfileBundleLinuxAssets(TargetPlatform.linux_x64).build(testEnvironment);
final Directory libDir = testEnvironment.outputDir.childDirectory('lib');
final Directory assetsDir = testEnvironment.outputDir.childDirectory('flutter_assets');
@@ -272,11 +270,11 @@
testWithoutContext("ProfileBundleLinuxAssets' name depends on target platforms", () async {
expect(
- const ProfileBundleLinuxAssets(TargetPlatform(.linux, .x64)).name,
+ const ProfileBundleLinuxAssets(TargetPlatform.linux_x64).name,
'profile_bundle_linux-x64_assets',
);
expect(
- const ProfileBundleLinuxAssets(TargetPlatform(.linux, .arm64)).name,
+ const ProfileBundleLinuxAssets(TargetPlatform.linux_arm64).name,
'profile_bundle_linux-arm64_assets',
);
});
@@ -299,10 +297,8 @@
testEnvironment.buildDir.childFile('app.so').createSync();
testEnvironment.buildDir.childFile('native_assets.json').createSync();
- await const LinuxAotBundle(
- AotElfRelease(TargetPlatform(.linux, .x64)),
- ).build(testEnvironment);
- await const ReleaseBundleLinuxAssets(TargetPlatform(.linux, .x64)).build(testEnvironment);
+ await const LinuxAotBundle(AotElfRelease(TargetPlatform.linux_x64)).build(testEnvironment);
+ await const ReleaseBundleLinuxAssets(TargetPlatform.linux_x64).build(testEnvironment);
final Directory libDir = testEnvironment.outputDir.childDirectory('lib');
final Directory assetsDir = testEnvironment.outputDir.childDirectory('flutter_assets');
@@ -319,11 +315,11 @@
testWithoutContext("ReleaseBundleLinuxAssets' name depends on target platforms", () async {
expect(
- const ReleaseBundleLinuxAssets(TargetPlatform(.linux, .x64)).name,
+ const ReleaseBundleLinuxAssets(TargetPlatform.linux_x64).name,
'release_bundle_linux-x64_assets',
);
expect(
- const ReleaseBundleLinuxAssets(TargetPlatform(.linux, .arm64)).name,
+ const ReleaseBundleLinuxAssets(TargetPlatform.linux_arm64).name,
'release_bundle_linux-arm64_assets',
);
});
@@ -332,12 +328,12 @@
void setUpCacheDirectory(FileSystem fileSystem, Artifacts artifacts) {
final String desktopPathForX64 = artifacts.getArtifactPath(
Artifact.linuxDesktopPath,
- platform: const TargetPlatform(.linux, .x64),
+ platform: TargetPlatform.linux_x64,
mode: BuildMode.debug,
);
final String desktopPathForArm64 = artifacts.getArtifactPath(
Artifact.linuxDesktopPath,
- platform: const TargetPlatform(.linux, .arm64),
+ platform: TargetPlatform.linux_arm64,
mode: BuildMode.debug,
);
fileSystem.file('$desktopPathForX64/unrelated-stuff').createSync(recursive: true);
@@ -347,29 +343,22 @@
final String headersPathForX64 = artifacts.getArtifactPath(
Artifact.linuxHeaders,
- platform: const TargetPlatform(.linux, .x64),
+ platform: TargetPlatform.linux_x64,
mode: BuildMode.debug,
);
final String headersPathForArm64 = artifacts.getArtifactPath(
Artifact.linuxHeaders,
- platform: const TargetPlatform(.linux, .arm64),
+ platform: TargetPlatform.linux_arm64,
mode: BuildMode.debug,
);
fileSystem.file('$headersPathForX64/foo.h').createSync(recursive: true);
fileSystem.file('$headersPathForArm64/foo.h').createSync(recursive: true);
fileSystem
- .file(
- artifacts.getArtifactPath(
- Artifact.icuData,
- platform: const TargetPlatform(.linux, .x64),
- ),
- )
+ .file(artifacts.getArtifactPath(Artifact.icuData, platform: TargetPlatform.linux_x64))
.createSync();
fileSystem
- .file(
- artifacts.getArtifactPath(Artifact.icuData, platform: const TargetPlatform(.linux, .arm64)),
- )
+ .file(artifacts.getArtifactPath(Artifact.icuData, platform: TargetPlatform.linux_arm64))
.createSync();
fileSystem
diff --git a/packages/flutter_tools/test/general.shard/build_system/targets/macos_test.dart b/packages/flutter_tools/test/general.shard/build_system/targets/macos_test.dart
index 95fe7b8..a580bb3 100644
--- a/packages/flutter_tools/test/general.shard/build_system/targets/macos_test.dart
+++ b/packages/flutter_tools/test/general.shard/build_system/targets/macos_test.dart
@@ -101,7 +101,7 @@
.directory(
artifacts.getArtifactPath(
Artifact.flutterMacOSFrameworkDsym,
- platform: const TargetPlatform(.macos, .x64),
+ platform: TargetPlatform.darwin,
mode: BuildMode.release,
),
)
@@ -125,7 +125,7 @@
'--filter',
'- .DS_Store/',
'--chmod=Du=rwx,Dgo=rx,Fu=rw,Fgo=r',
- 'Artifact.flutterMacOSFrameworkDsym.darwin-x64.release',
+ 'Artifact.flutterMacOSFrameworkDsym.TargetPlatform.darwin.release',
environment.outputDir.path,
],
);
@@ -358,7 +358,7 @@
'--filter',
'- .DS_Store/',
'--chmod=Du=rwx,Dgo=rx,Fu=rw,Fgo=r',
- 'Artifact.flutterMacOSFrameworkDsym.darwin-x64.release',
+ 'Artifact.flutterMacOSFrameworkDsym.TargetPlatform.darwin.release',
environment.outputDir.path,
],
exitCode: 1,
@@ -421,7 +421,7 @@
.file(
artifacts.getArtifactPath(
Artifact.vmSnapshotData,
- platform: const TargetPlatform(.macos, .x64),
+ platform: TargetPlatform.darwin,
mode: BuildMode.debug,
),
)
@@ -430,7 +430,7 @@
.file(
artifacts.getArtifactPath(
Artifact.isolateSnapshotData,
- platform: const TargetPlatform(.macos, .x64),
+ platform: TargetPlatform.darwin,
mode: BuildMode.debug,
),
)
@@ -482,7 +482,7 @@
.file(
artifacts.getArtifactPath(
Artifact.vmSnapshotData,
- platform: const TargetPlatform(.macos, .x64),
+ platform: TargetPlatform.darwin,
mode: BuildMode.debug,
),
)
@@ -491,7 +491,7 @@
.file(
artifacts.getArtifactPath(
Artifact.isolateSnapshotData,
- platform: const TargetPlatform(.macos, .x64),
+ platform: TargetPlatform.darwin,
mode: BuildMode.debug,
),
)
@@ -813,7 +813,7 @@
processManager.addCommands(<FakeCommand>[
FakeCommand(
command: <String>[
- 'Artifact.genSnapshotArm64.darwin-x64.release',
+ 'Artifact.genSnapshotArm64.TargetPlatform.darwin.release',
'--deterministic',
'--snapshot_kind=app-aot-macho-dylib',
'--macho=${environment.buildDir.childFile('arm64/App.framework/App').path}',
@@ -826,7 +826,7 @@
),
FakeCommand(
command: <String>[
- 'Artifact.genSnapshotX64.darwin-x64.release',
+ 'Artifact.genSnapshotX64.TargetPlatform.darwin.release',
'--deterministic',
'--snapshot_kind=app-aot-macho-dylib',
'--macho=${environment.buildDir.childFile('x86_64/App.framework/App').path}',
diff --git a/packages/flutter_tools/test/general.shard/build_system/targets/shader_compiler_test.dart b/packages/flutter_tools/test/general.shard/build_system/targets/shader_compiler_test.dart
index 7187c93..94dda58 100644
--- a/packages/flutter_tools/test/general.shard/build_system/targets/shader_compiler_test.dart
+++ b/packages/flutter_tools/test/general.shard/build_system/targets/shader_compiler_test.dart
@@ -74,7 +74,7 @@
await shaderCompiler.compileShader(
input: fileSystem.file(fragPath),
outputPath: outputPath,
- targetPlatform: const TargetPlatform(.web, .unknown),
+ targetPlatform: TargetPlatform.web_javascript,
),
true,
);
@@ -114,7 +114,7 @@
await shaderCompiler.compileShader(
input: fileSystem.file(fragPath),
outputPath: outputPath,
- targetPlatform: const TargetPlatform(.ios, .arm64),
+ targetPlatform: TargetPlatform.ios,
),
true,
);
@@ -155,7 +155,7 @@
await shaderCompiler.compileShader(
input: fileSystem.file(fragPath),
outputPath: outputPath,
- targetPlatform: const TargetPlatform(.android, .unknown),
+ targetPlatform: TargetPlatform.android,
),
true,
);
@@ -194,7 +194,7 @@
await shaderCompiler.compileShader(
input: fileSystem.file(notFragPath),
outputPath: outputPath,
- targetPlatform: const TargetPlatform(.web, .unknown),
+ targetPlatform: TargetPlatform.web_javascript,
),
true,
);
@@ -233,7 +233,7 @@
await shaderCompiler.compileShader(
input: fileSystem.file(notFragPath),
outputPath: outputPath,
- targetPlatform: const TargetPlatform(.web, .unknown),
+ targetPlatform: TargetPlatform.web_javascript,
);
fail('unreachable');
} on ShaderCompilerException catch (e) {
@@ -289,7 +289,7 @@
random: math.Random(0),
);
- developmentShaderCompiler.configureCompiler(const TargetPlatform(.android, .unknown));
+ developmentShaderCompiler.configureCompiler(TargetPlatform.android);
final DevFSContent? content = await developmentShaderCompiler.recompileShader(
DevFSFileContent(fileSystem.file(fragPath)),
@@ -340,7 +340,7 @@
random: math.Random(0),
);
- developmentShaderCompiler.configureCompiler(const TargetPlatform(.tester, .unknown));
+ developmentShaderCompiler.configureCompiler(TargetPlatform.tester);
final DevFSContent? content = await developmentShaderCompiler.recompileShader(
DevFSFileContent(fileSystem.file(fragPath)),
@@ -391,7 +391,7 @@
random: math.Random(0),
);
- developmentShaderCompiler.configureCompiler(const TargetPlatform(.android, .unknown));
+ developmentShaderCompiler.configureCompiler(TargetPlatform.android);
final DevFSContent? content = await developmentShaderCompiler.recompileShader(
DevFSFileContent(fileSystem.file(fragPath)),
@@ -442,7 +442,7 @@
random: math.Random(0),
);
- developmentShaderCompiler.configureCompiler(const TargetPlatform(.tester, .unknown));
+ developmentShaderCompiler.configureCompiler(TargetPlatform.tester);
final DevFSContent? content = await developmentShaderCompiler.recompileShader(
DevFSFileContent(fileSystem.file(fragPath)),
@@ -493,7 +493,7 @@
random: math.Random(0),
);
- developmentShaderCompiler.configureCompiler(const TargetPlatform(.android, .unknown));
+ developmentShaderCompiler.configureCompiler(TargetPlatform.android);
final DevFSContent? content = await developmentShaderCompiler.recompileShader(
DevFSFileContent(fileSystem.file(fragPath)),
@@ -542,7 +542,7 @@
random: math.Random(0),
);
- developmentShaderCompiler.configureCompiler(const TargetPlatform(.web, .unknown));
+ developmentShaderCompiler.configureCompiler(TargetPlatform.web_javascript);
final DevFSContent? content = await developmentShaderCompiler.recompileShader(
DevFSFileContent(fileSystem.file(fragPath)),
@@ -601,7 +601,7 @@
random: math.Random(0),
);
- developmentShaderCompiler.configureCompiler(const TargetPlatform(.android, .unknown));
+ developmentShaderCompiler.configureCompiler(TargetPlatform.android);
final shaderContent = DevFSFileContent(fileSystem.file(fragPath));
@@ -659,7 +659,7 @@
random: math.Random(0),
);
- developmentShaderCompiler.configureCompiler(const TargetPlatform(.android, .unknown));
+ developmentShaderCompiler.configureCompiler(TargetPlatform.android);
final shaderContent = DevFSFileContent(fileSystem.file(fragPath));
@@ -715,7 +715,7 @@
random: math.Random(0),
);
- developmentShaderCompiler.configureCompiler(const TargetPlatform(.android, .unknown));
+ developmentShaderCompiler.configureCompiler(TargetPlatform.android);
final shaderContent = DevFSFileContent(fileSystem.file(fragPath));
@@ -770,7 +770,7 @@
random: math.Random(0),
);
- developmentShaderCompiler.configureCompiler(const TargetPlatform(.android, .unknown));
+ developmentShaderCompiler.configureCompiler(TargetPlatform.android);
final shaderContent = DevFSByteContent(Uint8List.fromList(<int>[1, 2, 3, 4]));
@@ -820,7 +820,7 @@
shaderCompiler.compileShader(
input: fileSystem.file(fragPath),
outputPath: outputPath,
- targetPlatform: const TargetPlatform(.ios, .arm64),
+ targetPlatform: TargetPlatform.ios,
),
throwsToolExit(message: 'Impeller shader compiler was blocked by security policy.'),
);
@@ -867,7 +867,7 @@
shaderCompiler.compileShader(
input: fileSystem.file(fragPath),
outputPath: outputPath,
- targetPlatform: const TargetPlatform(.ios, .arm64),
+ targetPlatform: TargetPlatform.ios,
),
throwsToolExit(message: 'Impeller shader compiler was blocked by security policy.'),
);
@@ -913,7 +913,7 @@
final bool success = await shaderCompiler.compileShader(
input: fileSystem.file(fragPath),
outputPath: outputPath,
- targetPlatform: const TargetPlatform(.ios, .arm64),
+ targetPlatform: TargetPlatform.ios,
fatal: false,
);
@@ -952,7 +952,7 @@
shaderCompiler.compileShader(
input: fileSystem.file(fragPath),
outputPath: outputPath,
- targetPlatform: const TargetPlatform(.ios, .arm64),
+ targetPlatform: TargetPlatform.ios,
),
throwsA(
isA<ProcessException>().having(
@@ -1012,7 +1012,7 @@
final bool success1 = await shaderCompiler.compileShader(
input: fileSystem.file(fragPath),
outputPath: outputPath,
- targetPlatform: const TargetPlatform(.ios, .arm64),
+ targetPlatform: TargetPlatform.ios,
fatal: false,
);
expect(success1, false);
@@ -1026,7 +1026,7 @@
final bool success2 = await shaderCompiler.compileShader(
input: fileSystem.file(fragPath),
outputPath: outputPath,
- targetPlatform: const TargetPlatform(.ios, .arm64),
+ targetPlatform: TargetPlatform.ios,
fatal: false,
);
expect(success2, false);
diff --git a/packages/flutter_tools/test/general.shard/build_system/targets/web_dry_run_test.dart b/packages/flutter_tools/test/general.shard/build_system/targets/web_dry_run_test.dart
index d24e604..10f1740 100644
--- a/packages/flutter_tools/test/general.shard/build_system/targets/web_dry_run_test.dart
+++ b/packages/flutter_tools/test/general.shard/build_system/targets/web_dry_run_test.dart
@@ -83,7 +83,7 @@
fakeFlutterVersion: FakeFlutterVersion(),
);
commandArgs = [
- 'Artifact.engineDartBinary.web-javascript',
+ 'Artifact.engineDartBinary.TargetPlatform.web_javascript',
'compile',
'wasm',
'--packages=/.dart_tool/package_config.json',
diff --git a/packages/flutter_tools/test/general.shard/build_system/targets/web_test.dart b/packages/flutter_tools/test/general.shard/build_system/targets/web_test.dart
index c648e33..a51af6e 100644
--- a/packages/flutter_tools/test/general.shard/build_system/targets/web_test.dart
+++ b/packages/flutter_tools/test/general.shard/build_system/targets/web_test.dart
@@ -28,7 +28,7 @@
import '../../../src/throwing_pub.dart';
const _kDart2jsLinuxArgs = <String>[
- 'Artifact.engineDartBinary.web-javascript',
+ 'Artifact.engineDartBinary.TargetPlatform.web_javascript',
'compile',
'js',
'--platform-binaries=HostArtifact.webPlatformKernelFolder',
@@ -44,7 +44,7 @@
];
const _kDart2WasmLinuxArgs = <String>[
- 'Artifact.engineDartBinary.web-javascript',
+ 'Artifact.engineDartBinary.TargetPlatform.web_javascript',
'compile',
'wasm',
'--packages=/.dart_tool/package_config.json',
diff --git a/packages/flutter_tools/test/general.shard/build_system/targets/windows_test.dart b/packages/flutter_tools/test/general.shard/build_system/targets/windows_test.dart
index a234514..4a41adc 100644
--- a/packages/flutter_tools/test/general.shard/build_system/targets/windows_test.dart
+++ b/packages/flutter_tools/test/general.shard/build_system/targets/windows_test.dart
@@ -38,17 +38,17 @@
final String windowsDesktopPath = artifacts.getArtifactPath(
Artifact.windowsDesktopPath,
- platform: const TargetPlatform(.windows, .x64),
+ platform: TargetPlatform.windows_x64,
mode: BuildMode.debug,
);
final String windowsCppClientWrapper = artifacts.getArtifactPath(
Artifact.windowsCppClientWrapper,
- platform: const TargetPlatform(.windows, .x64),
+ platform: TargetPlatform.windows_x64,
mode: BuildMode.debug,
);
final String icuData = artifacts.getArtifactPath(
Artifact.icuData,
- platform: const TargetPlatform(.windows, .x64),
+ platform: TargetPlatform.windows_x64,
);
final requiredFiles = <String>[
'$windowsDesktopPath\\flutter_export.h',
@@ -70,7 +70,7 @@
}
fileSystem.directory('windows').createSync();
- await const UnpackWindows(TargetPlatform(.windows, .x64)).build(environment);
+ await const UnpackWindows(TargetPlatform.windows_x64).build(environment);
// Output files are copied correctly.
expect(fileSystem.file(r'C:\windows\flutter\ephemeral\flutter_export.h'), exists);
@@ -165,7 +165,7 @@
environment.buildDir.childFile('app.dill').createSync(recursive: true);
environment.buildDir.childFile('native_assets.json').createSync(recursive: true);
- await const DebugBundleWindowsAssets(TargetPlatform(.windows, .x64)).build(environment);
+ await const DebugBundleWindowsAssets(TargetPlatform.windows_x64).build(environment);
// Depfile is created and dill is copied.
expect(environment.buildDir.childFile('flutter_assets.d'), exists);
@@ -214,7 +214,7 @@
flavorFileSystem.file('assets/strawberry/ice-cream.png').createSync(recursive: true);
writePackageConfigFiles(directory: flavorFileSystem.currentDirectory, mainLibName: 'example');
- await const DebugBundleWindowsAssets(TargetPlatform(.windows, .x64)).build(environment);
+ await const DebugBundleWindowsAssets(TargetPlatform.windows_x64).build(environment);
final Uint8List assetManifestData = environment.outputDir
.childDirectory('flutter_assets')
@@ -249,10 +249,8 @@
environment.buildDir.childFile('app.so').createSync(recursive: true);
environment.buildDir.childFile('native_assets.json').createSync(recursive: true);
- await const WindowsAotBundle(
- AotElfProfile(TargetPlatform(.windows, .x64)),
- ).build(environment);
- await const ProfileBundleWindowsAssets(TargetPlatform(.windows, .x64)).build(environment);
+ await const WindowsAotBundle(AotElfProfile(TargetPlatform.windows_x64)).build(environment);
+ await const ProfileBundleWindowsAssets(TargetPlatform.windows_x64).build(environment);
// Depfile is created and so is copied.
expect(environment.buildDir.childFile('flutter_assets.d'), exists);
@@ -280,10 +278,8 @@
environment.buildDir.childFile('app.so').createSync(recursive: true);
environment.buildDir.childFile('native_assets.json').createSync(recursive: true);
- await const WindowsAotBundle(
- AotElfRelease(TargetPlatform(.windows, .x64)),
- ).build(environment);
- await const ReleaseBundleWindowsAssets(TargetPlatform(.windows, .x64)).build(environment);
+ await const WindowsAotBundle(AotElfRelease(TargetPlatform.windows_x64)).build(environment);
+ await const ReleaseBundleWindowsAssets(TargetPlatform.windows_x64).build(environment);
// Depfile is created and so is copied.
expect(environment.buildDir.childFile('flutter_assets.d'), exists);
diff --git a/packages/flutter_tools/test/general.shard/bundle_builder_test.dart b/packages/flutter_tools/test/general.shard/bundle_builder_test.dart
index d824a84..c7e0cdd 100644
--- a/packages/flutter_tools/test/general.shard/bundle_builder_test.dart
+++ b/packages/flutter_tools/test/general.shard/bundle_builder_test.dart
@@ -44,7 +44,7 @@
});
await BundleBuilder().build(
- platform: const TargetPlatform(.ios, .arm64),
+ platform: TargetPlatform.ios,
buildInfo: BuildInfo.debug,
project: FlutterProject.fromDirectoryTest(globals.fs.currentDirectory),
mainPath: globals.fs.path.join('lib', 'main.dart'),
@@ -119,7 +119,7 @@
await writeBundle(
bundleDir,
bundle.entries,
- targetPlatform: const TargetPlatform(.tester, .unknown),
+ targetPlatform: TargetPlatform.tester,
impellerStatus: ImpellerStatus.platformDefault,
processManager: processManager,
fileSystem: fileSystem,
@@ -140,7 +140,7 @@
() {
expect(
() => BundleBuilder().build(
- platform: const TargetPlatform(.ios, .arm64),
+ platform: TargetPlatform.ios,
buildInfo: BuildInfo.debug,
project: FlutterProject.fromDirectoryTest(globals.fs.currentDirectory),
mainPath: 'lib/main.dart',
@@ -177,7 +177,7 @@
});
await BundleBuilder().build(
- platform: const TargetPlatform(.ios, .arm64),
+ platform: TargetPlatform.ios,
buildInfo: const BuildInfo(
BuildMode.debug,
null,
@@ -200,7 +200,7 @@
expect(env, isNotNull);
expect(env!.defines[kBuildMode], 'debug');
- expect(env!.defines[kTargetPlatform], 'ios-arm64');
+ expect(env!.defines[kTargetPlatform], 'ios');
expect(env!.defines[kTargetFile], mainPath);
expect(env!.defines[kTrackWidgetCreation], 'true');
expect(env!.defines[kFrontendServerStarterPath], 'path/to/frontend_server_starter.dart');
@@ -312,7 +312,7 @@
}
});
await BundleBuilder().build(
- platform: const TargetPlatform(.ios, .arm64),
+ platform: TargetPlatform.ios,
buildInfo: BuildInfo.release,
project: FlutterProject.fromDirectoryTest(globals.fs.currentDirectory),
mainPath: globals.fs.path.join('lib', 'main.dart'),
diff --git a/packages/flutter_tools/test/general.shard/cold_test.dart b/packages/flutter_tools/test/general.shard/cold_test.dart
index 566a415..b64e4c1 100644
--- a/packages/flutter_tools/test/general.shard/cold_test.dart
+++ b/packages/flutter_tools/test/general.shard/cold_test.dart
@@ -209,7 +209,7 @@
String get displayName => name;
@override
- Future<TargetPlatform> get targetPlatform async => const TargetPlatform(.tester, .unknown);
+ Future<TargetPlatform> get targetPlatform async => TargetPlatform.tester;
@override
DartDevelopmentService get dds => FakeDartDevelopmentService();
@@ -259,7 +259,7 @@
required this.exception,
required ResidentCompiler generator,
}) : super(
- targetPlatform: const TargetPlatform(.unsupported, .unknown),
+ targetPlatform: .unsupported,
device,
buildInfo: BuildInfo.debug,
generator: generator,
diff --git a/packages/flutter_tools/test/general.shard/compile_expression_test.dart b/packages/flutter_tools/test/general.shard/compile_expression_test.dart
index b2827c8..2cfece7 100644
--- a/packages/flutter_tools/test/general.shard/compile_expression_test.dart
+++ b/packages/flutter_tools/test/general.shard/compile_expression_test.dart
@@ -36,7 +36,7 @@
fileSystem = MemoryFileSystem.test()
..file(Artifact.flutterPatchedSdkPath.toString()).createSync();
generator = const ResidentCompilerFactory().create(
- targetPlatform: const TargetPlatform(.tester, .unknown),
+ targetPlatform: .tester,
buildInfo: BuildInfo.debug,
artifacts: Artifacts.test(fileSystem: fileSystem),
processManager: processManager,
diff --git a/packages/flutter_tools/test/general.shard/compile_test.dart b/packages/flutter_tools/test/general.shard/compile_test.dart
index 00dc4df..0be1221 100644
--- a/packages/flutter_tools/test/general.shard/compile_test.dart
+++ b/packages/flutter_tools/test/general.shard/compile_test.dart
@@ -163,7 +163,7 @@
// Initializing the compiler with includeUnsupportedPlatformLibraryStubs for targets other
// than DDC is not currently supported as it's limited for use with the widget previewer.
for (final TargetPlatform target in TargetPlatform.values.where(
- (e) => e != const TargetPlatform(.web, .unknown),
+ (e) => e != .web_javascript,
)) {
try {
const ResidentCompilerFactory().create(
@@ -190,7 +190,7 @@
// Initializing the compiler with includeUnsupportedPlatformLibraryStubs for DDC is
// supported.
const ResidentCompilerFactory().create(
- targetPlatform: const TargetPlatform(.web, .unknown),
+ targetPlatform: .web_javascript,
buildInfo: BuildInfo.debug.copyWith(includeUnsupportedPlatformLibraryStubs: true),
logger: BufferLogger.test(),
processManager: FakeProcessManager.any(),
@@ -210,8 +210,8 @@
final processManager = FakeProcessManager.list([
FakeCommand(
command: const <String>[
- 'Artifact.engineDartAotRuntime.web-javascript',
- 'Artifact.frontendServerSnapshotForEngineDartSdk.web-javascript',
+ 'Artifact.engineDartAotRuntime.TargetPlatform.web_javascript',
+ 'Artifact.frontendServerSnapshotForEngineDartSdk.TargetPlatform.web_javascript',
'--sdk-root',
'sdkroot/',
'--incremental',
@@ -285,8 +285,8 @@
final processManager = FakeProcessManager.list([
FakeCommand(
command: const <String>[
- 'Artifact.engineDartAotRuntime.web-javascript',
- 'Artifact.frontendServerSnapshotForEngineDartSdk.web-javascript',
+ 'Artifact.engineDartAotRuntime.TargetPlatform.web_javascript',
+ 'Artifact.frontendServerSnapshotForEngineDartSdk.TargetPlatform.web_javascript',
'--sdk-root',
'sdkroot/',
'--incremental',
diff --git a/packages/flutter_tools/test/general.shard/custom_devices/custom_device_test.dart b/packages/flutter_tools/test/general.shard/custom_devices/custom_device_test.dart
index c86b705..51790a1 100644
--- a/packages/flutter_tools/test/general.shard/custom_devices/custom_device_test.dart
+++ b/packages/flutter_tools/test/general.shard/custom_devices/custom_device_test.dart
@@ -118,7 +118,7 @@
expect(device.name, 'testlabel');
expect(device.platformType, PlatformType.custom);
expect(await device.sdkNameAndVersion, 'testsdknameandversion');
- expect(await device.targetPlatform, const TargetPlatform(.linux, .arm64));
+ expect(await device.targetPlatform, TargetPlatform.linux_arm64);
expect(await device.installApp(linuxApp), true);
expect(await device.uninstallApp(linuxApp), true);
expect(await device.isLatestBuildInstalled(linuxApp), false);
@@ -537,7 +537,7 @@
final runDebugCompleter = Completer<void>();
final CustomDeviceConfig config = testConfig.copyWith(
- platform: const TargetPlatform(.linux, .arm64),
+ platform: TargetPlatform.linux_arm64,
postBuildCommand: const <String>[
'testpostbuild',
r'--buildMode=${buildMode}',
@@ -675,12 +675,12 @@
testWithoutContext('CustomDevice returns correct target platform', () async {
final device = CustomDevice(
- config: testConfig.copyWith(platform: const TargetPlatform(.linux, .x64)),
+ config: testConfig.copyWith(platform: TargetPlatform.linux_x64),
logger: BufferLogger.test(),
processManager: FakeProcessManager.empty(),
);
- expect(await device.targetPlatform, const TargetPlatform(.linux, .x64));
+ expect(await device.targetPlatform, TargetPlatform.linux_x64);
});
testWithoutContext(
diff --git a/packages/flutter_tools/test/general.shard/darwin_test.dart b/packages/flutter_tools/test/general.shard/darwin_test.dart
index 738658e..c2cc60c 100644
--- a/packages/flutter_tools/test/general.shard/darwin_test.dart
+++ b/packages/flutter_tools/test/general.shard/darwin_test.dart
@@ -28,13 +28,10 @@
});
testWithoutContext('fromTargetPlatform', () {
expect(
- FlutterDarwinPlatform.fromTargetPlatform(const TargetPlatform(.ios, .arm64)),
+ FlutterDarwinPlatform.fromTargetPlatform(TargetPlatform.ios),
FlutterDarwinPlatform.ios,
);
- expect(
- FlutterDarwinPlatform.fromTargetPlatform(const TargetPlatform(.android, .unknown)),
- null,
- );
+ expect(FlutterDarwinPlatform.fromTargetPlatform(TargetPlatform.android), null);
});
testWithoutContext('fromName', () {
expect(FlutterDarwinPlatform.fromName('ios'), FlutterDarwinPlatform.ios);
@@ -58,13 +55,10 @@
});
testWithoutContext('fromTargetPlatform', () {
expect(
- FlutterDarwinPlatform.fromTargetPlatform(const TargetPlatform(.macos, .x64)),
+ FlutterDarwinPlatform.fromTargetPlatform(TargetPlatform.darwin),
FlutterDarwinPlatform.macos,
);
- expect(
- FlutterDarwinPlatform.fromTargetPlatform(const TargetPlatform(.android, .unknown)),
- null,
- );
+ expect(FlutterDarwinPlatform.fromTargetPlatform(TargetPlatform.android), null);
});
testWithoutContext('fromName', () {
expect(FlutterDarwinPlatform.fromName('macos'), FlutterDarwinPlatform.macos);
diff --git a/packages/flutter_tools/test/general.shard/desktop_device_test.dart b/packages/flutter_tools/test/general.shard/desktop_device_test.dart
index a7b9d29..382c941 100644
--- a/packages/flutter_tools/test/general.shard/desktop_device_test.dart
+++ b/packages/flutter_tools/test/general.shard/desktop_device_test.dart
@@ -467,7 +467,7 @@
String get name => 'dummy';
@override
- Future<TargetPlatform> get targetPlatform async => const TargetPlatform(.tester, .unknown);
+ Future<TargetPlatform> get targetPlatform async => TargetPlatform.tester;
@override
Future<CpuArch> get cpuArch async => CpuArch.unknown;
@@ -517,7 +517,7 @@
String get name => 'dummy';
@override
- Future<TargetPlatform> get targetPlatform async => const TargetPlatform(.tester, .unknown);
+ Future<TargetPlatform> get targetPlatform async => TargetPlatform.tester;
@override
Future<bool> isSupported() async => true;
diff --git a/packages/flutter_tools/test/general.shard/device_test.dart b/packages/flutter_tools/test/general.shard/device_test.dart
index ced11f0..a99a17d 100644
--- a/packages/flutter_tools/test/general.shard/device_test.dart
+++ b/packages/flutter_tools/test/general.shard/device_test.dart
@@ -288,9 +288,9 @@
isSupportedForProject: false,
);
final webDevice = FakeDevice('webby', 'webby')
- ..targetPlatform = Future<TargetPlatform>.value(const TargetPlatform(.web, .unknown));
+ ..targetPlatform = Future<TargetPlatform>.value(TargetPlatform.web_javascript);
final fuchsiaDevice = FakeDevice('fuchsiay', 'fuchsiay')
- ..targetPlatform = Future<TargetPlatform>.value(const TargetPlatform(.fuchsia, .x64));
+ ..targetPlatform = Future<TargetPlatform>.value(TargetPlatform.fuchsia_x64);
final unconnectedDevice = FakeDevice('ephemeralTwo', 'ephemeralTwo', isConnected: false);
final wirelessDevice = FakeDevice(
'ephemeralTwo',
diff --git a/packages/flutter_tools/test/general.shard/drive/drive_service_test.dart b/packages/flutter_tools/test/general.shard/drive/drive_service_test.dart
index 14fd778..594773b 100644
--- a/packages/flutter_tools/test/general.shard/drive/drive_service_test.dart
+++ b/packages/flutter_tools/test/general.shard/drive/drive_service_test.dart
@@ -535,7 +535,7 @@
final DartDevelopmentService dds = FakeDartDevelopmentService();
@override
- Future<TargetPlatform> get targetPlatform async => const TargetPlatform(.android, .armv7);
+ Future<TargetPlatform> get targetPlatform async => TargetPlatform.android_arm;
@override
Future<DeviceLogReader> getLogReader({
diff --git a/packages/flutter_tools/test/general.shard/drive/web_driver_service_test.dart b/packages/flutter_tools/test/general.shard/drive/web_driver_service_test.dart
index cc47482..60a6a7f 100644
--- a/packages/flutter_tools/test/general.shard/drive/web_driver_service_test.dart
+++ b/packages/flutter_tools/test/general.shard/drive/web_driver_service_test.dart
@@ -451,5 +451,5 @@
final PlatformType platformType = PlatformType.web;
@override
- Future<TargetPlatform> get targetPlatform async => const TargetPlatform(.android, .armv7);
+ Future<TargetPlatform> get targetPlatform async => TargetPlatform.android_arm;
}
diff --git a/packages/flutter_tools/test/general.shard/emulator_test.dart b/packages/flutter_tools/test/general.shard/emulator_test.dart
index b3076fa..5d56a74 100644
--- a/packages/flutter_tools/test/general.shard/emulator_test.dart
+++ b/packages/flutter_tools/test/general.shard/emulator_test.dart
@@ -8,7 +8,6 @@
import 'package:flutter_tools/src/android/android_workflow.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/device.dart';
import 'package:flutter_tools/src/emulator.dart';
import 'package:flutter_tools/src/ios/ios_emulators.dart';
diff --git a/packages/flutter_tools/test/general.shard/flutter_platform_test.dart b/packages/flutter_tools/test/general.shard/flutter_platform_test.dart
index 8f06e8a..5a3e16f 100644
--- a/packages/flutter_tools/test/general.shard/flutter_platform_test.dart
+++ b/packages/flutter_tools/test/general.shard/flutter_platform_test.dart
@@ -539,8 +539,7 @@
Future<void> dispose() => Future<void>.value();
@override
- Future<TargetPlatform> get targetPlatform =>
- Future<TargetPlatform>.value(const TargetPlatform(.android, .unknown));
+ Future<TargetPlatform> get targetPlatform => Future<TargetPlatform>.value(TargetPlatform.android);
@override
Future<bool> stopApp(ApplicationPackage? app, {String? userIdentifier}) async {
@@ -569,8 +568,7 @@
Future<void> dispose() async {}
@override
- Future<TargetPlatform> get targetPlatform =>
- Future<TargetPlatform>.value(const TargetPlatform(.android, .unknown));
+ Future<TargetPlatform> get targetPlatform => Future<TargetPlatform>.value(TargetPlatform.android);
@override
Future<bool> stopApp(ApplicationPackage? app, {String? userIdentifier}) async => true;
diff --git a/packages/flutter_tools/test/general.shard/hot_shared.dart b/packages/flutter_tools/test/general.shard/hot_shared.dart
index 2eb84d4..76a8498 100644
--- a/packages/flutter_tools/test/general.shard/hot_shared.dart
+++ b/packages/flutter_tools/test/general.shard/hot_shared.dart
@@ -42,7 +42,7 @@
}
class FakeDevice extends Fake implements Device {
- FakeDevice({TargetPlatform targetPlatform = const TargetPlatform(.tester, .unknown)})
+ FakeDevice({TargetPlatform targetPlatform = TargetPlatform.tester})
: _targetPlatform = targetPlatform;
final TargetPlatform _targetPlatform;
@@ -148,7 +148,7 @@
required ResidentCompiler generator,
}) : super(
device,
- targetPlatform: const TargetPlatform(.unsupported, .unknown),
+ targetPlatform: TargetPlatform.unsupported,
buildInfo: BuildInfo.debug,
generator: generator,
developmentShaderCompiler: const FakeShaderCompiler(),
diff --git a/packages/flutter_tools/test/general.shard/hot_test.dart b/packages/flutter_tools/test/general.shard/hot_test.dart
index 92c9a79..fb1c673 100644
--- a/packages/flutter_tools/test/general.shard/hot_test.dart
+++ b/packages/flutter_tools/test/general.shard/hot_test.dart
@@ -250,7 +250,7 @@
final devices = <FlutterDevice>[
FlutterDevice(
device,
- targetPlatform: const TargetPlatform(.unsupported, .unknown),
+ targetPlatform: .unsupported,
generator: residentCompiler,
buildInfo: BuildInfo.debug,
developmentShaderCompiler: const FakeShaderCompiler(),
@@ -281,7 +281,7 @@
final devices = <FlutterDevice>[
FlutterDevice(
device,
- targetPlatform: const TargetPlatform(.unsupported, .unknown),
+ targetPlatform: .unsupported,
generator: residentCompiler,
buildInfo: BuildInfo.debug,
developmentShaderCompiler: const FakeShaderCompiler(),
diff --git a/packages/flutter_tools/test/general.shard/integration_test_device_test.dart b/packages/flutter_tools/test/general.shard/integration_test_device_test.dart
index 730bc75..aedfe1e 100644
--- a/packages/flutter_tools/test/general.shard/integration_test_device_test.dart
+++ b/packages/flutter_tools/test/general.shard/integration_test_device_test.dart
@@ -123,7 +123,7 @@
isA<TestDeviceException>().having(
(Exception e) => e.toString(),
'description',
- contains('No application found for android-arm'),
+ contains('No application found for TargetPlatform.android_arm'),
),
),
);
diff --git a/packages/flutter_tools/test/general.shard/isolated/android/native_assets_test.dart b/packages/flutter_tools/test/general.shard/isolated/android/native_assets_test.dart
index 9f95438..879276c 100644
--- a/packages/flutter_tools/test/general.shard/isolated/android/native_assets_test.dart
+++ b/packages/flutter_tools/test/general.shard/isolated/android/native_assets_test.dart
@@ -93,7 +93,7 @@
};
final DartHooksResult result = await runFlutterSpecificHooks(
environmentDefines: environmentDefines,
- targetPlatform: const TargetPlatform(.android, .arm64),
+ targetPlatform: TargetPlatform.android_arm64,
projectUri: projectUri,
fileSystem: fileSystem,
buildRunner: buildRunner,
@@ -104,7 +104,7 @@
await installCodeAssets(
dartHookResult: result,
environmentDefines: environmentDefines,
- targetPlatform: const TargetPlatform(.android, .arm64),
+ targetPlatform: TargetPlatform.android_arm64,
projectUri: projectUri,
fileSystem: fileSystem,
nativeAssetsFileUri: nonFlutterTesterAssetUri,
@@ -142,7 +142,7 @@
kBuildMode: BuildMode.debug.cliName,
kMinSdkVersion: minSdkVersion,
},
- targetPlatform: const TargetPlatform(.android, .x64),
+ targetPlatform: TargetPlatform.android_x64,
projectUri: projectUri,
fileSystem: fileSystem,
buildRunner: _BuildRunnerWithoutNdk(),
@@ -170,7 +170,7 @@
kBuildMode: BuildMode.debug.cliName,
kMinSdkVersion: minSdkVersion,
},
- targetPlatform: const TargetPlatform(.android, .arm64),
+ targetPlatform: TargetPlatform.android_arm64,
projectUri: projectUri,
fileSystem: fileSystem,
buildRunner: _BuildRunnerWithoutNdk(packagesWithNativeAssetsResult: <String>['bar']),
diff --git a/packages/flutter_tools/test/general.shard/isolated/build_system/targets/native_assets_test.dart b/packages/flutter_tools/test/general.shard/isolated/build_system/targets/native_assets_test.dart
index bce7fc6..e305e9a 100644
--- a/packages/flutter_tools/test/general.shard/isolated/build_system/targets/native_assets_test.dart
+++ b/packages/flutter_tools/test/general.shard/isolated/build_system/targets/native_assets_test.dart
@@ -39,7 +39,7 @@
fileSystem.currentDirectory,
defines: <String, String>{
kBuildMode: BuildMode.profile.cliName,
- kTargetPlatform: const TargetPlatform(.ios, .arm64).getName(),
+ kTargetPlatform: TargetPlatform.ios.getName(),
kIosArchs: 'arm64',
kSdkRoot: 'path/to/iPhoneOS.sdk',
},
@@ -53,7 +53,7 @@
fileSystem.currentDirectory,
defines: <String, String>{
kBuildMode: BuildMode.profile.cliName,
- kTargetPlatform: const TargetPlatform(.android, .unknown).getName(),
+ kTargetPlatform: TargetPlatform.android.getName(),
kAndroidArchs: CpuArch.arm64.androidPlatformName,
},
inputs: <String, String>{},
diff --git a/packages/flutter_tools/test/general.shard/isolated/data_assets_test.dart b/packages/flutter_tools/test/general.shard/isolated/data_assets_test.dart
index b3b3ebe..1467271 100644
--- a/packages/flutter_tools/test/general.shard/isolated/data_assets_test.dart
+++ b/packages/flutter_tools/test/general.shard/isolated/data_assets_test.dart
@@ -58,7 +58,7 @@
expect(
() => runFlutterSpecificHooks(
environmentDefines: <String, String>{kBuildMode: BuildMode.debug.cliName},
- targetPlatform: const TargetPlatform(.windows, .x64),
+ targetPlatform: TargetPlatform.windows_x64,
projectUri: projectUri,
fileSystem: fileSystem,
buildRunner: FakeFlutterNativeAssetsBuildRunner(
@@ -100,7 +100,7 @@
expect(
() async => runFlutterSpecificHooks(
environmentDefines: <String, String>{kBuildMode: buildMode.cliName},
- targetPlatform: const TargetPlatform(.linux, .x64),
+ targetPlatform: TargetPlatform.linux_x64,
projectUri: projectUri,
buildCodeAssets: const BuildCodeAssetsOptions(appBuildDirectory: null),
buildDataAssets: true,
diff --git a/packages/flutter_tools/test/general.shard/isolated/ios/native_assets_test.dart b/packages/flutter_tools/test/general.shard/isolated/ios/native_assets_test.dart
index 169eb2c..4152781 100644
--- a/packages/flutter_tools/test/general.shard/isolated/ios/native_assets_test.dart
+++ b/packages/flutter_tools/test/general.shard/isolated/ios/native_assets_test.dart
@@ -257,7 +257,7 @@
};
final DartHooksResult dartHookResult = await runFlutterSpecificHooks(
environmentDefines: environmentDefines,
- targetPlatform: const TargetPlatform(.ios, .arm64),
+ targetPlatform: TargetPlatform.ios,
projectUri: projectUri,
fileSystem: fileSystem,
buildRunner: buildRunner,
@@ -268,7 +268,7 @@
await installCodeAssets(
dartHookResult: dartHookResult,
environmentDefines: environmentDefines,
- targetPlatform: const TargetPlatform(.ios, .arm64),
+ targetPlatform: TargetPlatform.ios,
projectUri: projectUri,
fileSystem: fileSystem,
nativeAssetsFileUri: nonFlutterTesterAssetUri,
diff --git a/packages/flutter_tools/test/general.shard/isolated/linux/native_assets_test.dart b/packages/flutter_tools/test/general.shard/isolated/linux/native_assets_test.dart
index d83d1d3..3cfb0a8 100644
--- a/packages/flutter_tools/test/general.shard/isolated/linux/native_assets_test.dart
+++ b/packages/flutter_tools/test/general.shard/isolated/linux/native_assets_test.dart
@@ -59,7 +59,7 @@
await runFlutterSpecificHooks(
environmentDefines: <String, String>{kBuildMode: BuildMode.debug.cliName},
- targetPlatform: const TargetPlatform(.linux, .x64),
+ targetPlatform: TargetPlatform.linux_x64,
projectUri: projectUri,
fileSystem: fileSystem,
buildRunner: _BuildRunnerWithoutClang(),
@@ -296,8 +296,10 @@
'cCompilerConfigLinux FileSystemException on resolveSymbolicLinks and throwIfNotFound: false',
overrides: <Type, Generator>{
ProcessManager: () => FakeProcessManager.empty(),
- FileSystem: () =>
- _ThrowingResolveFileSystem(fileSystem, '${environment.outputDir.path}/mock_clang++'),
+ FileSystem: () => _ThrowingResolveFileSystem(
+ fileSystem,
+ '${environment.outputDir.path}/mock_clang++',
+ ),
},
() async {
if (!const LocalPlatform().isLinux) {
@@ -325,8 +327,10 @@
'cCompilerConfigLinux FileSystemException on resolveSymbolicLinks and throwIfNotFound: true',
overrides: <Type, Generator>{
ProcessManager: () => FakeProcessManager.empty(),
- FileSystem: () =>
- _ThrowingResolveFileSystem(fileSystem, '${environment.outputDir.path}/mock_clang++'),
+ FileSystem: () => _ThrowingResolveFileSystem(
+ fileSystem,
+ '${environment.outputDir.path}/mock_clang++',
+ ),
},
() async {
if (!const LocalPlatform().isLinux) {
diff --git a/packages/flutter_tools/test/general.shard/isolated/macos/native_assets_test.dart b/packages/flutter_tools/test/general.shard/isolated/macos/native_assets_test.dart
index 001b578..13a6c10 100644
--- a/packages/flutter_tools/test/general.shard/isolated/macos/native_assets_test.dart
+++ b/packages/flutter_tools/test/general.shard/isolated/macos/native_assets_test.dart
@@ -284,7 +284,7 @@
}
if (flutterTester && !const LocalPlatform().isMacOS) {
// The [runFlutterSpecificDartBuild] will - when given
- // `TargetPlatform(.tester, .unknown)` - enable `flutter test` mode. That means if
+ // `TargetPlatform.tester` - enable `flutter test` mode. That means if
// this test is run on linux, it's going to do a linux build.
// Though this test is mac-specific, so we skip that.
//
@@ -333,9 +333,9 @@
kBuildMode: buildMode.cliName,
kDarwinArchs: 'arm64 x86_64',
};
- final targetPlatform = flutterTester
- ? const TargetPlatform(.tester, .unknown)
- : const TargetPlatform(.macos, .x64);
+ final TargetPlatform targetPlatform = flutterTester
+ ? TargetPlatform.tester
+ : TargetPlatform.darwin;
final DartHooksResult dartHookResult = await runFlutterSpecificHooks(
environmentDefines: environmentDefines,
targetPlatform: targetPlatform,
diff --git a/packages/flutter_tools/test/general.shard/isolated/native_assets_test.dart b/packages/flutter_tools/test/general.shard/isolated/native_assets_test.dart
index 3011dcf..6926e7e 100644
--- a/packages/flutter_tools/test/general.shard/isolated/native_assets_test.dart
+++ b/packages/flutter_tools/test/general.shard/isolated/native_assets_test.dart
@@ -72,7 +72,7 @@
];
final DartHooksResult dartHookResult = await runFlutterSpecificHooks(
environmentDefines: environmentDefines,
- targetPlatform: const TargetPlatform(.linux, .x64),
+ targetPlatform: TargetPlatform.linux_x64,
projectUri: projectUri,
fileSystem: fileSystem,
buildRunner: FakeFlutterNativeAssetsBuildRunner(
@@ -87,7 +87,7 @@
await installCodeAssets(
dartHookResult: dartHookResult,
environmentDefines: environmentDefines,
- targetPlatform: const TargetPlatform(.windows, .x64),
+ targetPlatform: TargetPlatform.windows_x64,
projectUri: projectUri,
fileSystem: fileSystem,
nativeAssetsFileUri: nonFlutterTesterAssetUri,
@@ -111,7 +111,7 @@
expect(
() => runFlutterSpecificHooks(
environmentDefines: <String, String>{kBuildMode: BuildMode.debug.cliName},
- targetPlatform: const TargetPlatform(.windows, .x64),
+ targetPlatform: TargetPlatform.windows_x64,
projectUri: projectUri,
fileSystem: fileSystem,
buildRunner: FakeFlutterNativeAssetsBuildRunner(
@@ -140,7 +140,7 @@
final environmentDefines = <String, String>{kBuildMode: BuildMode.debug.cliName};
final DartHooksResult dartHookResult = await runFlutterSpecificHooks(
environmentDefines: environmentDefines,
- targetPlatform: const TargetPlatform(.windows, .x64),
+ targetPlatform: TargetPlatform.windows_x64,
projectUri: projectUri,
fileSystem: fileSystem,
buildRunner: FakeFlutterNativeAssetsBuildRunner(
@@ -154,7 +154,7 @@
await installCodeAssets(
dartHookResult: dartHookResult,
environmentDefines: environmentDefines,
- targetPlatform: const TargetPlatform(.windows, .x64),
+ targetPlatform: TargetPlatform.windows_x64,
projectUri: projectUri,
fileSystem: fileSystem,
nativeAssetsFileUri: nonFlutterTesterAssetUri,
@@ -178,7 +178,7 @@
expect(
() => runFlutterSpecificHooks(
environmentDefines: <String, String>{kBuildMode: BuildMode.debug.cliName},
- targetPlatform: const TargetPlatform(.linux, .x64),
+ targetPlatform: TargetPlatform.linux_x64,
projectUri: projectUri,
fileSystem: fileSystem,
buildRunner: FakeFlutterNativeAssetsBuildRunner(
@@ -217,7 +217,7 @@
// Release mode means the dart build has linking enabled.
kBuildMode: BuildMode.release.cliName,
},
- targetPlatform: const TargetPlatform(.linux, .x64),
+ targetPlatform: TargetPlatform.linux_x64,
projectUri: projectUri,
fileSystem: fileSystem,
buildRunner: FakeFlutterNativeAssetsBuildRunner(
@@ -267,7 +267,7 @@
expect(
() => runFlutterSpecificHooks(
environmentDefines: <String, String>{kBuildMode: BuildMode.release.cliName},
- targetPlatform: const TargetPlatform(.linux, .x64),
+ targetPlatform: TargetPlatform.linux_x64,
projectUri: projectUri,
fileSystem: fileSystem,
buildRunner: FakeFlutterNativeAssetsBuildRunner(
@@ -338,7 +338,7 @@
await runFlutterSpecificHooks(
environmentDefines: {},
- targetPlatform: const TargetPlatform(.tester, .unknown),
+ targetPlatform: TargetPlatform.tester,
projectUri: projectUri,
fileSystem: fileSystem,
buildRunner: target,
@@ -381,7 +381,7 @@
await runFlutterSpecificHooks(
environmentDefines: {kBuildMode: 'release'},
- targetPlatform: const TargetPlatform(.linux, .arm64),
+ targetPlatform: TargetPlatform.linux_arm64,
projectUri: projectUri,
fileSystem: fileSystem,
buildRunner: target,
diff --git a/packages/flutter_tools/test/general.shard/isolated/resident_runner_test.dart b/packages/flutter_tools/test/general.shard/isolated/resident_runner_test.dart
index d027aeb..e00f52c 100644
--- a/packages/flutter_tools/test/general.shard/isolated/resident_runner_test.dart
+++ b/packages/flutter_tools/test/general.shard/isolated/resident_runner_test.dart
@@ -36,17 +36,14 @@
testUsingContext(
'use the nativeAssetsYamlFile when provided',
() => testbed.run(() async {
- final device = FakeDevice(
- targetPlatform: const TargetPlatform(.macos, .x64),
- sdkNameAndVersion: 'Macos',
- );
+ final device = FakeDevice(targetPlatform: TargetPlatform.darwin, sdkNameAndVersion: 'Macos');
final residentCompiler = FakeResidentCompiler();
final flutterDevice = FakeFlutterDevice()
..testUri = testUri
..vmServiceHost = (() => fakeVmServiceHost)
..device = device
..fakeDevFS = devFS
- ..targetPlatform = const TargetPlatform(.macos, .x64)
+ ..targetPlatform = TargetPlatform.darwin
..generator = residentCompiler;
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[listViews, listViews]);
diff --git a/packages/flutter_tools/test/general.shard/isolated/windows/native_assets_test.dart b/packages/flutter_tools/test/general.shard/isolated/windows/native_assets_test.dart
index aca9461..0ee3f47 100644
--- a/packages/flutter_tools/test/general.shard/isolated/windows/native_assets_test.dart
+++ b/packages/flutter_tools/test/general.shard/isolated/windows/native_assets_test.dart
@@ -99,9 +99,9 @@
: FakeFlutterNativeAssetsBuilderResult.fromAssets(codeAssets: codeAssets),
);
final environmentDefines = <String, String>{kBuildMode: buildMode.cliName};
- final targetPlatform = flutterTester
- ? const TargetPlatform(.tester, .unknown)
- : const TargetPlatform(.windows, .x64);
+ final TargetPlatform targetPlatform = flutterTester
+ ? TargetPlatform.tester
+ : TargetPlatform.windows_x64;
final DartHooksResult dartHookResult = await runFlutterSpecificHooks(
environmentDefines: environmentDefines,
targetPlatform: targetPlatform,
diff --git a/packages/flutter_tools/test/general.shard/linux/linux_device_test.dart b/packages/flutter_tools/test/general.shard/linux/linux_device_test.dart
index 8afcf50..34bbb38 100644
--- a/packages/flutter_tools/test/general.shard/linux/linux_device_test.dart
+++ b/packages/flutter_tools/test/general.shard/linux/linux_device_test.dart
@@ -31,7 +31,7 @@
);
final linuxApp = PrebuiltLinuxApp(executable: 'foo');
- expect(await device.targetPlatform, const TargetPlatform(.linux, .x64));
+ expect(await device.targetPlatform, TargetPlatform.linux_x64);
expect(device.name, 'Linux');
expect(await device.installApp(linuxApp), true);
expect(await device.uninstallApp(linuxApp), true);
@@ -53,7 +53,7 @@
fileSystem: MemoryFileSystem.test(),
operatingSystemUtils: FakeOperatingSystemUtils(hostPlatform: HostPlatform.linux_arm64),
);
- expect(await deviceArm64Host.targetPlatform, const TargetPlatform(.linux, .arm64));
+ expect(await deviceArm64Host.targetPlatform, TargetPlatform.linux_arm64);
});
testWithoutContext('LinuxDevice: no devices listed if platform unsupported', () async {
diff --git a/packages/flutter_tools/test/general.shard/macos/macos_device_test.dart b/packages/flutter_tools/test/general.shard/macos/macos_device_test.dart
index f814d49..428cc4f 100644
--- a/packages/flutter_tools/test/general.shard/macos/macos_device_test.dart
+++ b/packages/flutter_tools/test/general.shard/macos/macos_device_test.dart
@@ -35,7 +35,7 @@
);
final package = FakeMacOSApp();
- expect(await device.targetPlatform, const TargetPlatform(.macos, .x64));
+ expect(await device.targetPlatform, TargetPlatform.darwin);
expect(device.name, 'macOS');
expect(await device.installApp(package), true);
expect(await device.uninstallApp(package), true);
diff --git a/packages/flutter_tools/test/general.shard/macos/macos_ipad_device_test.dart b/packages/flutter_tools/test/general.shard/macos/macos_ipad_device_test.dart
index 7d3843a..55266b3 100644
--- a/packages/flutter_tools/test/general.shard/macos/macos_ipad_device_test.dart
+++ b/packages/flutter_tools/test/general.shard/macos/macos_ipad_device_test.dart
@@ -122,7 +122,7 @@
expect(await device.isLocalEmulator, isFalse);
expect(device.name, 'Mac Designed for iPad');
expect(device.portForwarder, isNot(isNull));
- expect(await device.targetPlatform, const TargetPlatform(.macos, .arm64));
+ expect(await device.targetPlatform, TargetPlatform.darwin);
expect(await device.installApp(FakeApplicationPackage()), isTrue);
expect(await device.isAppInstalled(FakeApplicationPackage()), isTrue);
diff --git a/packages/flutter_tools/test/general.shard/mdns_discovery_test.dart b/packages/flutter_tools/test/general.shard/mdns_discovery_test.dart
index 6ab59fd..fb55e67 100644
--- a/packages/flutter_tools/test/general.shard/mdns_discovery_test.dart
+++ b/packages/flutter_tools/test/general.shard/mdns_discovery_test.dart
@@ -1282,7 +1282,7 @@
final String name;
@override
- Future<TargetPlatform> get targetPlatform async => const TargetPlatform(.ios, .arm64);
+ Future<TargetPlatform> get targetPlatform async => TargetPlatform.ios;
@override
Future<bool> isSupported() async => true;
diff --git a/packages/flutter_tools/test/general.shard/resident_runner_helpers.dart b/packages/flutter_tools/test/general.shard/resident_runner_helpers.dart
index d9cfae7..21aa7c7 100644
--- a/packages/flutter_tools/test/general.shard/resident_runner_helpers.dart
+++ b/packages/flutter_tools/test/general.shard/resident_runner_helpers.dart
@@ -177,7 +177,7 @@
: _vmServiceUris = vmServiceUris,
super(
generator: FakeResidentCompiler(),
- targetPlatform: const TargetPlatform(.unsupported, .unknown),
+ targetPlatform: .unsupported,
buildInfo: BuildInfo.debug,
developmentShaderCompiler: const FakeShaderCompiler(),
);
@@ -220,7 +220,7 @@
DevelopmentShaderCompiler get developmentShaderCompiler => const FakeShaderCompiler();
@override
- TargetPlatform targetPlatform = const TargetPlatform(.android, .unknown);
+ TargetPlatform targetPlatform = TargetPlatform.android;
@override
Stream<Uri?> get vmServiceUris => Stream<Uri?>.value(testUri);
@@ -310,7 +310,7 @@
ResidentCompiler residentCompiler,
this.fakeDevFS,
) : super(
- targetPlatform: const TargetPlatform(.unsupported, .unknown),
+ targetPlatform: .unsupported,
buildInfo: buildInfo,
generator: residentCompiler,
developmentShaderCompiler: const FakeShaderCompiler(),
@@ -389,7 +389,7 @@
class FakeDevice extends Fake implements Device {
FakeDevice({
String sdkNameAndVersion = 'Android',
- TargetPlatform targetPlatform = const TargetPlatform(.android, .armv7),
+ TargetPlatform targetPlatform = TargetPlatform.android_arm,
bool isLocalEmulator = false,
this.supportsHotRestart = true,
this.supportsScreenshot = true,
@@ -416,9 +416,8 @@
bool supportsFlutterExit;
@override
- PlatformType get platformType => _targetPlatform == const TargetPlatform(.web, .unknown)
- ? PlatformType.web
- : PlatformType.android;
+ PlatformType get platformType =>
+ _targetPlatform == TargetPlatform.web_javascript ? PlatformType.web : PlatformType.android;
@override
Future<String> get sdkNameAndVersion async => _sdkNameAndVersion;
diff --git a/packages/flutter_tools/test/general.shard/resident_runner_test.dart b/packages/flutter_tools/test/general.shard/resident_runner_test.dart
index 17458c7..1564f47 100644
--- a/packages/flutter_tools/test/general.shard/resident_runner_test.dart
+++ b/packages/flutter_tools/test/general.shard/resident_runner_test.dart
@@ -240,7 +240,7 @@
contains(
Event.hotRunnerInfo(
label: 'exception',
- targetPlatform: const TargetPlatform(.android, .armv7).getName(),
+ targetPlatform: TargetPlatform.android_arm.getName(),
sdkName: 'Android',
emulator: false,
fullRestart: false,
@@ -308,7 +308,7 @@
contains(
Event.hotRunnerInfo(
label: 'reload-barred',
- targetPlatform: const TargetPlatform(.android, .armv7).getName(),
+ targetPlatform: TargetPlatform.android_arm.getName(),
sdkName: 'Android',
emulator: false,
fullRestart: false,
@@ -361,7 +361,7 @@
contains(
Event.hotRunnerInfo(
label: 'exception',
- targetPlatform: const TargetPlatform(.android, .armv7).getName(),
+ targetPlatform: TargetPlatform.android_arm.getName(),
sdkName: 'Android',
emulator: false,
fullRestart: false,
@@ -579,7 +579,7 @@
final Event event = fakeAnalytics.sentEvents.first;
expect(event.eventName.label, 'hot_runner_info');
expect(event.eventData['label'], 'reload');
- expect(event.eventData['targetPlatform'], const TargetPlatform(.android, .armv7).getName());
+ expect(event.eventData['targetPlatform'], TargetPlatform.android_arm.getName());
}),
);
@@ -725,10 +725,7 @@
expect(hotRunnerInfoEvents, hasLength(1));
final Event newEvent = hotRunnerInfoEvents.first;
expect(newEvent.eventData['label'], 'restart');
- expect(
- newEvent.eventData['targetPlatform'],
- const TargetPlatform(.android, .armv7).getName(),
- );
+ expect(newEvent.eventData['targetPlatform'], TargetPlatform.android_arm.getName());
}),
);
@@ -946,7 +943,7 @@
contains(
Event.hotRunnerInfo(
label: 'exception',
- targetPlatform: const TargetPlatform(.android, .armv7).getName(),
+ targetPlatform: TargetPlatform.android_arm.getName(),
sdkName: 'Android',
emulator: false,
fullRestart: true,
@@ -1313,7 +1310,7 @@
'ResidentRunner printHelpDetails hides v on web in profile mode',
() => testbed.run(() async {
final FlutterDevice flutterDevice = await FlutterDevice.create(
- FakeDevice(targetPlatform: const TargetPlatform(.web, .unknown)),
+ FakeDevice(targetPlatform: TargetPlatform.web_javascript),
target: 'lib/main.dart',
buildInfo: BuildInfo.profile,
platform: FakePlatform(),
@@ -1688,7 +1685,7 @@
'FlutterDevice uses dartdevc configuration when targeting web',
() async {
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[]);
- final device = FakeDevice(targetPlatform: const TargetPlatform(.web, .unknown));
+ final device = FakeDevice(targetPlatform: TargetPlatform.web_javascript);
final residentCompiler =
(await FlutterDevice.create(
device,
@@ -1739,7 +1736,7 @@
'FlutterDevice uses dartdevc configuration when targeting web with null-safety autodetected',
() async {
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[]);
- final device = FakeDevice(targetPlatform: const TargetPlatform(.web, .unknown));
+ final device = FakeDevice(targetPlatform: TargetPlatform.web_javascript);
final residentCompiler =
(await FlutterDevice.create(
@@ -2124,7 +2121,7 @@
final webFlutterDevice = FakeFlutterDevice()
..vmServiceHost = (() => fakeVmServiceHost)
..fakeDevFS = devFS
- ..targetPlatform = const TargetPlatform(.web, .unknown);
+ ..targetPlatform = TargetPlatform.web_javascript;
fakeVmServiceHost = FakeVmServiceHost(
requests: <VmServiceExpectation>[
listViews,
@@ -2237,17 +2234,14 @@
testUsingContext(
'use the nativeAssetsYamlFile when provided',
() => testbed.run(() async {
- final device = FakeDevice(
- targetPlatform: const TargetPlatform(.macos, .x64),
- sdkNameAndVersion: 'Macos',
- );
+ final device = FakeDevice(targetPlatform: TargetPlatform.darwin, sdkNameAndVersion: 'Macos');
final residentCompiler = FakeResidentCompiler();
final flutterDevice = FakeFlutterDevice()
..testUri = testUri
..vmServiceHost = (() => fakeVmServiceHost)
..device = device
..fakeDevFS = devFS
- ..targetPlatform = const TargetPlatform(.macos, .x64)
+ ..targetPlatform = TargetPlatform.darwin
..generator = residentCompiler;
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[listViews, listViews]);
@@ -2335,7 +2329,7 @@
testUsingContext(
'correctly caches Web Device compilation',
() => testbed.run(() {
- flutterDevice.targetPlatform = const TargetPlatform(.web, .unknown);
+ flutterDevice.targetPlatform = TargetPlatform.web_javascript;
residentRunner.testCacheInitialDillCompilation();
final String expectedPath = getDefaultCachedKernelPath(
@@ -2355,7 +2349,7 @@
testUsingContext(
'correctly caches Fuchsia Device compilation',
() => testbed.run(() {
- flutterDevice.targetPlatform = const TargetPlatform(.fuchsia, .arm64);
+ flutterDevice.targetPlatform = TargetPlatform.fuchsia_arm64;
residentRunner.testCacheInitialDillCompilation();
final String expectedPath = getDefaultCachedKernelPath(
@@ -2375,7 +2369,7 @@
testUsingContext(
'correctly caches Android Device compilation',
() => testbed.run(() {
- flutterDevice.targetPlatform = const TargetPlatform(.android, .armv7);
+ flutterDevice.targetPlatform = TargetPlatform.android_arm;
residentRunner.testCacheInitialDillCompilation();
final String expectedPath = getDefaultCachedKernelPath(
diff --git a/packages/flutter_tools/test/general.shard/resident_web_runner_test.dart b/packages/flutter_tools/test/general.shard/resident_web_runner_test.dart
index 9843e5d..754492f 100644
--- a/packages/flutter_tools/test/general.shard/resident_web_runner_test.dart
+++ b/packages/flutter_tools/test/general.shard/resident_web_runner_test.dart
@@ -2508,7 +2508,7 @@
Exception? reportError;
@override
- TargetPlatform get targetPlatform => const TargetPlatform(.web, .unknown);
+ TargetPlatform get targetPlatform => TargetPlatform.web_javascript;
@override
ResidentCompiler? generator;
diff --git a/packages/flutter_tools/test/general.shard/runner/target_devices_test.dart b/packages/flutter_tools/test/general.shard/runner/target_devices_test.dart
index 399774e..0d2919b 100644
--- a/packages/flutter_tools/test/general.shard/runner/target_devices_test.dart
+++ b/packages/flutter_tools/test/general.shard/runner/target_devices_test.dart
@@ -3110,7 +3110,7 @@
this.isConnected = true,
this.connectionInterface = DeviceConnectionInterface.attached,
this.platformType = PlatformType.android,
- TargetPlatform deviceTargetPlatform = const TargetPlatform(.android, .unknown),
+ TargetPlatform deviceTargetPlatform = TargetPlatform.android,
}) : id = deviceId ?? 'xxx',
name = deviceName ?? 'test',
_isSupported = deviceSupported,
@@ -3126,7 +3126,7 @@
this.isConnected = true,
this.connectionInterface = DeviceConnectionInterface.wireless,
this.platformType = PlatformType.android,
- TargetPlatform deviceTargetPlatform = const TargetPlatform(.android, .unknown),
+ TargetPlatform deviceTargetPlatform = TargetPlatform.android,
}) : id = deviceId ?? 'xxx',
name = deviceName ?? 'test',
_isSupported = deviceSupported,
@@ -3142,7 +3142,7 @@
this.isConnected = true,
this.connectionInterface = DeviceConnectionInterface.attached,
this.platformType = PlatformType.fuchsia,
- TargetPlatform deviceTargetPlatform = const TargetPlatform(.fuchsia, .arm64),
+ TargetPlatform deviceTargetPlatform = TargetPlatform.fuchsia_arm64,
}) : id = deviceId ?? 'xxx',
name = deviceName ?? 'test',
_isSupported = deviceSupported,
@@ -3204,7 +3204,7 @@
Category? get category => Category.mobile;
@override
- Future<String> get targetPlatformDisplayName async => (await targetPlatform).devicePlatformName;
+ Future<String> get targetPlatformDisplayName async => (await targetPlatform).getName();
}
class FakeIOSDevice extends Fake implements IOSDevice {
@@ -3314,7 +3314,7 @@
Future<String> get targetPlatformDisplayName async => 'ios';
@override
- Future<TargetPlatform> get targetPlatform async => const TargetPlatform(.tester, .unknown);
+ Future<TargetPlatform> get targetPlatform async => TargetPlatform.tester;
}
class FakeTerminal extends Fake implements AnsiTerminal {
diff --git a/packages/flutter_tools/test/general.shard/terminal_handler_test.dart b/packages/flutter_tools/test/general.shard/terminal_handler_test.dart
index dd5af7d..addc878 100644
--- a/packages/flutter_tools/test/general.shard/terminal_handler_test.dart
+++ b/packages/flutter_tools/test/general.shard/terminal_handler_test.dart
@@ -1293,7 +1293,7 @@
final residentRunner = FakeResidentRunner(
FlutterDevice(
FakeDevice(),
- targetPlatform: const TargetPlatform(.unsupported, .unknown),
+ targetPlatform: .unsupported,
buildInfo: BuildInfo.debug,
generator: FakeResidentCompiler(),
developmentShaderCompiler: const FakeShaderCompiler(),
@@ -1674,9 +1674,7 @@
),
generator: FakeResidentCompiler(),
developmentShaderCompiler: const FakeShaderCompiler(),
- targetPlatform: web
- ? const TargetPlatform(.web, .unknown)
- : const TargetPlatform(.android, .armv7),
+ targetPlatform: web ? TargetPlatform.web_javascript : TargetPlatform.android_arm,
);
device.vmService = nullVmService ? null : FakeVmServiceHost(requests: requests).vmService;
final residentRunner = FakeResidentRunner(device, testLogger, localFileSystem)
diff --git a/packages/flutter_tools/test/general.shard/test/web_test_compiler_test.dart b/packages/flutter_tools/test/general.shard/test/web_test_compiler_test.dart
index b857420..5b23d99 100644
--- a/packages/flutter_tools/test/general.shard/test/web_test_compiler_test.dart
+++ b/packages/flutter_tools/test/general.shard/test/web_test_compiler_test.dart
@@ -37,8 +37,8 @@
final processManager = FakeProcessManager.list(<FakeCommand>[
const FakeCommand(
command: <Pattern>[
- 'Artifact.engineDartAotRuntime.web-javascript',
- 'Artifact.frontendServerSnapshotForEngineDartSdk.web-javascript',
+ 'Artifact.engineDartAotRuntime.TargetPlatform.web_javascript',
+ 'Artifact.frontendServerSnapshotForEngineDartSdk.TargetPlatform.web_javascript',
'--sdk-root',
'HostArtifact.flutterWebSdk/',
'--incremental',
@@ -118,7 +118,7 @@
final processManager = FakeProcessManager.list(<FakeCommand>[
const FakeCommand(
command: <Pattern>[
- 'Artifact.engineDartBinary.web-javascript',
+ 'Artifact.engineDartBinary.TargetPlatform.web_javascript',
'compile',
'wasm',
'--packages=.dart_tool/package_config.json',
diff --git a/packages/flutter_tools/test/general.shard/tester/flutter_tester_test.dart b/packages/flutter_tools/test/general.shard/tester/flutter_tester_test.dart
index ec32edf..b030429 100644
--- a/packages/flutter_tools/test/general.shard/tester/flutter_tester_test.dart
+++ b/packages/flutter_tools/test/general.shard/tester/flutter_tester_test.dart
@@ -111,7 +111,7 @@
expect(await device.isLocalEmulator, isFalse);
expect(device.name, 'Flutter test device');
expect(device.portForwarder, isNot(isNull));
- expect(await device.targetPlatform, const TargetPlatform(.tester, .unknown));
+ expect(await device.targetPlatform, TargetPlatform.tester);
expect(await device.installApp(FakeApplicationPackage()), isTrue);
expect(await device.isAppInstalled(FakeApplicationPackage()), isFalse);
diff --git a/packages/flutter_tools/test/general.shard/windows/build_windows_flavor_test.dart b/packages/flutter_tools/test/general.shard/windows/build_windows_flavor_test.dart
index 38c8556..dd740d4 100644
--- a/packages/flutter_tools/test/general.shard/windows/build_windows_flavor_test.dart
+++ b/packages/flutter_tools/test/general.shard/windows/build_windows_flavor_test.dart
@@ -72,7 +72,7 @@
FakeCommand cmakeGenerationCommand({
String? flavor,
- TargetPlatform targetPlatform = const TargetPlatform(.windows, .x64),
+ TargetPlatform targetPlatform = TargetPlatform.windows_x64,
}) {
final String buildDir = flavor != null && flavor.isNotEmpty
? r'C:\build\windows\x64\' + flavor
@@ -93,7 +93,10 @@
);
}
- FakeCommand buildCommand(String buildMode, {String? flavor}) {
+ FakeCommand buildCommand(
+ String buildMode, {
+ String? flavor,
+ }) {
final String buildDir = flavor != null && flavor.isNotEmpty
? r'C:\build\windows\x64\' + flavor
: r'C:\build\windows\x64';
@@ -134,7 +137,7 @@
'returns legacy path when no flavor',
() {
expect(
- getWindowsBuildDirectory(const TargetPlatform(.windows, .x64)),
+ getWindowsBuildDirectory(TargetPlatform.windows_x64),
endsWith(fileSystem.path.join('windows', 'x64')),
);
},
@@ -148,7 +151,7 @@
'inserts flavor segment when flavor is set',
() {
expect(
- getWindowsBuildDirectory(const TargetPlatform(.windows, .x64), 'apple'),
+ getWindowsBuildDirectory(TargetPlatform.windows_x64, 'apple'),
endsWith(fileSystem.path.join('windows', 'x64', 'apple')),
);
},
diff --git a/packages/flutter_tools/test/general.shard/windows/windows_device_test.dart b/packages/flutter_tools/test/general.shard/windows/windows_device_test.dart
index e089d1b..45558a0 100644
--- a/packages/flutter_tools/test/general.shard/windows/windows_device_test.dart
+++ b/packages/flutter_tools/test/general.shard/windows/windows_device_test.dart
@@ -24,7 +24,7 @@
final File dummyFile = MemoryFileSystem.test().file('dummy');
final windowsApp = PrebuiltWindowsApp(executable: 'foo', applicationPackage: dummyFile);
- expect(await windowsDevice.targetPlatform, const TargetPlatform(.windows, .x64));
+ expect(await windowsDevice.targetPlatform, TargetPlatform.windows_x64);
expect(windowsDevice.name, 'Windows');
expect(await windowsDevice.installApp(windowsApp), true);
expect(await windowsDevice.uninstallApp(windowsApp), true);
diff --git a/packages/flutter_tools/test/integration.shard/shader_compiler_test.dart b/packages/flutter_tools/test/integration.shard/shader_compiler_test.dart
index 2d8960f..8028f93 100644
--- a/packages/flutter_tools/test/integration.shard/shader_compiler_test.dart
+++ b/packages/flutter_tools/test/integration.shard/shader_compiler_test.dart
@@ -32,9 +32,9 @@
outputPath: tmpDir.childFile('test_shader.frag.out').path,
targetPlatform: targetSkslOnly
// web_javascript compiles to sksl only.
- ? const TargetPlatform(.web, .unknown)
+ ? TargetPlatform.web_javascript
// tester compiles to sksl and runtime-stage-vulkan
- : const TargetPlatform(.tester, .unknown),
+ : TargetPlatform.tester,
);
}
@@ -66,7 +66,7 @@
final bool compileResult = await shaderCompiler.compileShader(
input: globals.fs.file(inkSparklePath),
outputPath: inkSparkleOutputPath,
- targetPlatform: const TargetPlatform(.tester, .unknown),
+ targetPlatform: TargetPlatform.tester,
);
final File resultFile = globals.fs.file(inkSparkleOutputPath);
diff --git a/packages/flutter_tools/test/integration.shard/web_plugin_registrant_test.dart b/packages/flutter_tools/test/integration.shard/web_plugin_registrant_test.dart
index aeaed75..13cf672 100644
--- a/packages/flutter_tools/test/integration.shard/web_plugin_registrant_test.dart
+++ b/packages/flutter_tools/test/integration.shard/web_plugin_registrant_test.dart
@@ -372,7 +372,7 @@
final ProcessResult exec = await Process.run(
globals.artifacts!.getArtifactPath(
Artifact.engineDartBinary,
- platform: const TargetPlatform(.web, .unknown),
+ platform: TargetPlatform.web_javascript,
),
args,
workingDirectory: target is Directory ? target.path : target.dirname,
@@ -400,7 +400,7 @@
final args = <String>[
globals.artifacts!.getArtifactPath(
Artifact.engineDartBinary,
- platform: const TargetPlatform(.web, .unknown),
+ platform: TargetPlatform.web_javascript,
),
flutterToolsSnapshotPath,
...flutterCommandArgs,
diff --git a/packages/flutter_tools/test/src/fake_devices.dart b/packages/flutter_tools/test/src/fake_devices.dart
index 8a264f8..4745aa6 100644
--- a/packages/flutter_tools/test/src/fake_devices.dart
+++ b/packages/flutter_tools/test/src/fake_devices.dart
@@ -37,7 +37,7 @@
),
FakeDeviceJsonData(
FakeDevice('webby', 'webby')
- ..targetPlatform = Future<TargetPlatform>.value(const TargetPlatform(.web, .unknown))
+ ..targetPlatform = Future<TargetPlatform>.value(TargetPlatform.web_javascript)
..cpuArch = Future<CpuArch>.value(CpuArch.unknown)
..sdkNameAndVersion = Future<String>.value('Web SDK (1.2.4)'),
<String, Object>{
@@ -90,7 +90,7 @@
type: PlatformType.ios,
connectionInterface: DeviceConnectionInterface.wireless,
)
- ..targetPlatform = Future<TargetPlatform>.value(const TargetPlatform(.ios, .arm64))
+ ..targetPlatform = Future<TargetPlatform>.value(TargetPlatform.ios)
..cpuArch = Future<CpuArch>.value(CpuArch.arm64)
..sdkNameAndVersion = Future<String>.value('iOS 16'),
<String, Object>{
@@ -167,9 +167,7 @@
Future<void> dispose() async {}
@override
- Future<TargetPlatform> targetPlatform = Future<TargetPlatform>.value(
- const TargetPlatform(.android, .armv7),
- );
+ Future<TargetPlatform> targetPlatform = Future<TargetPlatform>.value(TargetPlatform.android_arm);
@override
Future<CpuArch> cpuArch = Future<CpuArch>.value(CpuArch.armv7);