Reverts "Enable native compilation for windows-arm64 " (#141809)

Reverts flutter/flutter#137618
Initiated by: Jasguerrero
This change reverts the following previous change:
Original Description:
It's now possible to natively compile a flutter app for
windows-arm64. Cross-compilation is not yet implemented.

Uses arm64 artifacts now available for Dart/Flutter.
Platform detection is based on Abi class, provided by Dart. Depending if
Dart is an arm64 or x64 binary, the Abi is set accordingly.
Initial bootstrap of dart artifacts (update_dart_sdk.ps1) is checking
PROCESSOR_ARCHITECTURE environment variable, which is the way to detect
host architecture on Windows.

This is available only for master channel (on other channels, it
fallbacks to windows-x64).

On windows-x64, it produces an x64 app. On windows-arm64, it produces an
arm64 app.
This commit is contained in:
auto-submit[bot]
2024-01-18 22:48:16 +00:00
committed by GitHub
parent 9d9bd884ea
commit 1901d6fa10
41 changed files with 110 additions and 258 deletions

View File

@@ -234,7 +234,6 @@ class AndroidDevice extends Device {
case TargetPlatform.tester:
case TargetPlatform.web_javascript:
case TargetPlatform.windows_x64:
case TargetPlatform.windows_arm64:
throw UnsupportedError('Invalid target platform for Android');
}
}
@@ -571,7 +570,6 @@ class AndroidDevice extends Device {
case TargetPlatform.linux_x64:
case TargetPlatform.tester:
case TargetPlatform.web_javascript:
case TargetPlatform.windows_arm64:
case TargetPlatform.windows_x64:
_logger.printError('Android platforms are only supported.');
return LaunchResult.failed();

View File

@@ -144,7 +144,6 @@ TargetPlatform? _mapTargetPlatform(TargetPlatform? targetPlatform) {
case TargetPlatform.linux_x64:
case TargetPlatform.linux_arm64:
case TargetPlatform.windows_x64:
case TargetPlatform.windows_arm64:
case TargetPlatform.fuchsia_arm64:
case TargetPlatform.fuchsia_x64:
case TargetPlatform.tester:
@@ -527,7 +526,6 @@ class CachedArtifacts implements Artifacts {
case TargetPlatform.linux_x64:
case TargetPlatform.linux_arm64:
case TargetPlatform.windows_x64:
case TargetPlatform.windows_arm64:
return _getDesktopArtifactPath(artifact, platform, mode);
case TargetPlatform.fuchsia_arm64:
case TargetPlatform.fuchsia_x64:
@@ -745,9 +743,8 @@ class CachedArtifacts implements Artifacts {
final String engineArtifactsPath = _cache.getArtifactDirectory('engine').path;
return _fileSystem.path.join(engineArtifactsPath, platformDirName, _artifactToFileName(artifact, _platform, mode));
case Artifact.windowsCppClientWrapper:
final String platformDirName = _enginePlatformDirectoryName(platform);
final String engineArtifactsPath = _cache.getArtifactDirectory('engine').path;
return _fileSystem.path.join(engineArtifactsPath, platformDirName, _artifactToFileName(artifact, _platform, mode));
return _fileSystem.path.join(engineArtifactsPath, 'windows-x64', _artifactToFileName(artifact, _platform, mode));
case Artifact.skyEnginePath:
final Directory dartPackageDirectory = _cache.getCacheDir('pkg');
return _fileSystem.path.join(dartPackageDirectory.path, _artifactToFileName(artifact, _platform));
@@ -778,7 +775,6 @@ class CachedArtifacts implements Artifacts {
case TargetPlatform.linux_arm64:
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
@@ -817,11 +813,10 @@ TargetPlatform _currentHostPlatform(Platform platform, OperatingSystemUtils oper
}
if (platform.isLinux) {
return operatingSystemUtils.hostPlatform == HostPlatform.linux_x64 ?
TargetPlatform.linux_x64 : TargetPlatform.linux_arm64;
TargetPlatform.linux_x64 : TargetPlatform.linux_arm64;
}
if (platform.isWindows) {
return operatingSystemUtils.hostPlatform == HostPlatform.windows_arm64 ?
TargetPlatform.windows_arm64 : TargetPlatform.windows_x64;
return TargetPlatform.windows_x64;
}
throw UnimplementedError('Host OS not supported.');
}
@@ -1094,8 +1089,6 @@ class CachedLocalEngineArtifacts implements Artifacts {
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:
@@ -1297,8 +1290,6 @@ class CachedLocalWebSdkArtifacts implements Artifacts {
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:

View File

@@ -347,7 +347,6 @@ class AOTSnapshotter {
TargetPlatform.linux_x64,
TargetPlatform.linux_arm64,
TargetPlatform.windows_x64,
TargetPlatform.windows_arm64,
].contains(platform);
}
}

View File

@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'dart:ffi' show Abi;
import 'package:archive/archive.dart';
import 'package:file/file.dart';
import 'package:meta/meta.dart';
@@ -474,17 +472,8 @@ class _WindowsUtils extends OperatingSystemUtils {
required super.processManager,
}) : super._private();
HostPlatform? _hostPlatform;
@override
HostPlatform get hostPlatform {
if (_hostPlatform == null) {
final Abi abi = Abi.current();
_hostPlatform = (abi == Abi.windowsArm64) ? HostPlatform.windows_arm64 :
HostPlatform.windows_x64;
}
return _hostPlatform!;
}
HostPlatform hostPlatform = HostPlatform.windows_x64;
@override
void makeExecutable(File file) {}
@@ -618,8 +607,7 @@ enum HostPlatform {
darwin_arm64,
linux_x64,
linux_arm64,
windows_x64,
windows_arm64;
windows_x64;
String get platformName {
return switch (this) {
@@ -627,8 +615,7 @@ enum HostPlatform {
HostPlatform.darwin_arm64 => 'arm64',
HostPlatform.linux_x64 => 'x64',
HostPlatform.linux_arm64 => 'arm64',
HostPlatform.windows_x64 => 'x64',
HostPlatform.windows_arm64 => 'arm64',
HostPlatform.windows_x64 => 'x64'
};
}
}
@@ -639,7 +626,6 @@ String getNameForHostPlatform(HostPlatform platform) {
HostPlatform.darwin_arm64 => 'darwin-arm64',
HostPlatform.linux_x64 => 'linux-x64',
HostPlatform.linux_arm64 => 'linux-arm64',
HostPlatform.windows_x64 => 'windows-x64',
HostPlatform.windows_arm64 => 'windows-arm64',
HostPlatform.windows_x64 => 'windows-x64'
};
}

View File

@@ -513,7 +513,6 @@ enum TargetPlatform {
linux_x64,
linux_arm64,
windows_x64,
windows_arm64,
fuchsia_arm64,
fuchsia_x64,
tester,
@@ -545,7 +544,6 @@ enum TargetPlatform {
case TargetPlatform.tester:
case TargetPlatform.web_javascript:
case TargetPlatform.windows_x64:
case TargetPlatform.windows_arm64:
throw UnsupportedError('Unexpected Fuchsia platform $this');
}
}
@@ -557,7 +555,6 @@ enum TargetPlatform {
case TargetPlatform.windows_x64:
return 'x64';
case TargetPlatform.linux_arm64:
case TargetPlatform.windows_arm64:
return 'arm64';
case TargetPlatform.android:
case TargetPlatform.android_arm:
@@ -716,8 +713,6 @@ String getNameForTargetPlatform(TargetPlatform platform, {DarwinArch? darwinArch
return 'linux-arm64';
case TargetPlatform.windows_x64:
return 'windows-x64';
case TargetPlatform.windows_arm64:
return 'windows-arm64';
case TargetPlatform.fuchsia_arm64:
return 'fuchsia-arm64';
case TargetPlatform.fuchsia_x64:
@@ -761,8 +756,6 @@ TargetPlatform getTargetPlatformForName(String platform) {
return TargetPlatform.linux_arm64;
case 'windows-x64':
return TargetPlatform.windows_x64;
case 'windows-arm64':
return TargetPlatform.windows_arm64;
case 'web-javascript':
return TargetPlatform.web_javascript;
case 'flutter-tester':

View File

@@ -206,7 +206,6 @@ class KernelSnapshot extends Target {
switch (targetPlatform) {
case TargetPlatform.darwin:
case TargetPlatform.windows_x64:
case TargetPlatform.windows_arm64:
case TargetPlatform.linux_x64:
forceLinkPlatform = true;
case TargetPlatform.android:
@@ -234,7 +233,7 @@ class KernelSnapshot extends Target {
TargetPlatform.darwin => 'macos',
TargetPlatform.ios => 'ios',
TargetPlatform.linux_arm64 || TargetPlatform.linux_x64 => 'linux',
TargetPlatform.windows_arm64 || TargetPlatform.windows_x64 => 'windows',
TargetPlatform.windows_x64 => 'windows',
TargetPlatform.tester || TargetPlatform.web_javascript => null,
};

View File

@@ -104,7 +104,6 @@ class NativeAssets extends Target {
fileSystem,
buildRunner,
);
case TargetPlatform.windows_arm64:
case TargetPlatform.windows_x64:
dependencies = await _buildWindows(
environment,
@@ -355,7 +354,6 @@ class NativeAssets extends Target {
case TargetPlatform.tester:
case TargetPlatform.web_javascript:
case TargetPlatform.windows_x64:
case TargetPlatform.windows_arm64:
throwToolExit('Unsupported Android target platform: $targetPlatform.');
}
}

View File

@@ -69,7 +69,6 @@ class DevelopmentShaderCompiler {
case TargetPlatform.linux_x64:
case TargetPlatform.linux_arm64:
case TargetPlatform.windows_x64:
case TargetPlatform.windows_arm64:
case TargetPlatform.fuchsia_arm64:
case TargetPlatform.fuchsia_x64:
case TargetPlatform.tester:

View File

@@ -31,9 +31,7 @@ const String _kWindowsDepfile = 'windows_engine_sources.d';
/// Copies the Windows desktop embedding files to the copy directory.
class UnpackWindows extends Target {
const UnpackWindows(this.targetPlatform);
final TargetPlatform targetPlatform;
const UnpackWindows();
@override
String get name => 'unpack_windows';
@@ -62,13 +60,13 @@ class UnpackWindows extends Target {
final String engineSourcePath = environment.artifacts
.getArtifactPath(
Artifact.windowsDesktopPath,
platform: targetPlatform,
platform: TargetPlatform.windows_x64,
mode: buildMode,
);
final String clientSourcePath = environment.artifacts
.getArtifactPath(
Artifact.windowsCppClientWrapper,
platform: targetPlatform,
platform: TargetPlatform.windows_x64,
mode: buildMode,
);
final Directory outputDirectory = environment.fileSystem.directory(
@@ -87,7 +85,7 @@ class UnpackWindows extends Target {
clientSourcePaths: <String>[clientSourcePath],
icuDataPath: environment.artifacts.getArtifactPath(
Artifact.icuData,
platform: targetPlatform,
platform: TargetPlatform.windows_x64
)
);
environment.depFileService.writeToFile(
@@ -99,14 +97,12 @@ class UnpackWindows extends Target {
/// Creates a bundle for the Windows desktop target.
abstract class BundleWindowsAssets extends Target {
const BundleWindowsAssets(this.targetPlatform);
final TargetPlatform targetPlatform;
const BundleWindowsAssets();
@override
List<Target> get dependencies => <Target>[
const KernelSnapshot(),
UnpackWindows(targetPlatform),
List<Target> get dependencies => const <Target>[
KernelSnapshot(),
UnpackWindows(),
];
@override
@@ -142,7 +138,7 @@ abstract class BundleWindowsAssets extends Target {
final Depfile depfile = await copyAssets(
environment,
outputDirectory,
targetPlatform: targetPlatform,
targetPlatform: TargetPlatform.windows_x64,
shaderTarget: ShaderTarget.sksl,
);
environment.depFileService.writeToFile(
@@ -191,10 +187,10 @@ class WindowsAotBundle extends Target {
}
class ReleaseBundleWindowsAssets extends BundleWindowsAssets {
const ReleaseBundleWindowsAssets(super.targetPlatform);
const ReleaseBundleWindowsAssets();
@override
String get name => 'release_bundle_${getNameForTargetPlatform(targetPlatform)}_assets';
String get name => 'release_bundle_windows_assets';
@override
List<Source> get outputs => const <Source>[];
@@ -202,15 +198,15 @@ class ReleaseBundleWindowsAssets extends BundleWindowsAssets {
@override
List<Target> get dependencies => <Target>[
...super.dependencies,
WindowsAotBundle(AotElfRelease(targetPlatform)),
const WindowsAotBundle(AotElfRelease(TargetPlatform.windows_x64)),
];
}
class ProfileBundleWindowsAssets extends BundleWindowsAssets {
const ProfileBundleWindowsAssets(super.targetPlatform);
const ProfileBundleWindowsAssets();
@override
String get name => 'profile_bundle_${getNameForTargetPlatform(targetPlatform)}_assets';
String get name => 'profile_bundle_windows_assets';
@override
List<Source> get outputs => const <Source>[];
@@ -218,15 +214,15 @@ class ProfileBundleWindowsAssets extends BundleWindowsAssets {
@override
List<Target> get dependencies => <Target>[
...super.dependencies,
WindowsAotBundle(AotElfProfile(targetPlatform)),
const WindowsAotBundle(AotElfProfile(TargetPlatform.windows_x64)),
];
}
class DebugBundleWindowsAssets extends BundleWindowsAssets {
const DebugBundleWindowsAssets(super.targetPlatform);
const DebugBundleWindowsAssets();
@override
String get name => 'debug_bundle_${getNameForTargetPlatform(targetPlatform)}_assets';
String get name => 'debug_bundle_windows_assets';
@override
List<Source> get inputs => <Source>[

View File

@@ -73,14 +73,10 @@ List<Target> _kDefaultTargets = <Target>[
const ProfileIosApplicationBundle(),
const ReleaseIosApplicationBundle(),
// 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(),
const DebugBundleWindowsAssets(),
const ProfileBundleWindowsAssets(),
const ReleaseBundleWindowsAssets(),
];
/// Assemble provides a low level API to interact with the flutter tool build

View File

@@ -72,11 +72,7 @@ class BuildCommand extends FlutterCommand {
operatingSystemUtils: osUtils,
verboseHelp: verboseHelp
));
_addSubcommand(BuildWindowsCommand(
logger: logger,
operatingSystemUtils: osUtils,
verboseHelp: verboseHelp,
));
_addSubcommand(BuildWindowsCommand(logger: logger, verboseHelp: verboseHelp));
_addSubcommand(BuildPreviewCommand(
artifacts: artifacts,
flutterRoot: Cache.flutterRoot!,

View File

@@ -45,7 +45,6 @@ class BuildBundleCommand extends BuildSubCommand {
'linux-x64',
'linux-arm64',
'windows-x64',
'windows-arm64',
],
help: 'The architecture for which to build the application.',
)
@@ -117,7 +116,6 @@ class BuildBundleCommand extends BuildSubCommand {
throwToolExit('macOS is not a supported target platform.');
}
case TargetPlatform.windows_x64:
case TargetPlatform.windows_arm64:
if (!featureFlags.isWindowsEnabled) {
throwToolExit('Windows is not a supported target platform.');
}

View File

@@ -65,11 +65,9 @@ class BuildPreviewCommand extends BuildSubCommand {
final Directory targetDir = fs.systemTempDirectory.createTempSync('flutter-build-preview');
try {
final FlutterProject flutterProject = await _createProject(targetDir);
// TODO(loic-sharma): Support windows-arm64 preview device, https://github.com/flutter/flutter/issues/139949.
await buildWindows(
flutterProject.windows,
buildInfo,
TargetPlatform.windows_x64,
);
final File previewDevice = targetDir

View File

@@ -6,7 +6,6 @@ import 'package:meta/meta.dart';
import '../base/analyze_size.dart';
import '../base/common.dart';
import '../base/os.dart';
import '../build_info.dart';
import '../cache.dart';
import '../features.dart';
@@ -21,15 +20,11 @@ import 'build.dart';
class BuildWindowsCommand extends BuildSubCommand {
BuildWindowsCommand({
required super.logger,
required OperatingSystemUtils operatingSystemUtils,
bool verboseHelp = false,
}) : _operatingSystemUtils = operatingSystemUtils,
super(verboseHelp: verboseHelp) {
}) : super(verboseHelp: verboseHelp) {
addCommonDesktopBuildOptions(verboseHelp: verboseHelp);
}
final OperatingSystemUtils _operatingSystemUtils;
@override
final String name = 'windows';
@@ -57,16 +52,10 @@ class BuildWindowsCommand extends BuildSubCommand {
if (!globals.platform.isWindows) {
throwToolExit('"build windows" only supported on Windows hosts.');
}
final String defaultTargetPlatform = (_operatingSystemUtils.hostPlatform == HostPlatform.windows_arm64) ?
'windows-arm64' : 'windows-x64';
final TargetPlatform targetPlatform = getTargetPlatformForName(defaultTargetPlatform);
displayNullSafetyMode(buildInfo);
await buildWindows(
flutterProject.windows,
buildInfo,
targetPlatform,
target: targetFile,
visualStudioOverride: visualStudioOverride,
sizeAnalyzer: SizeAnalyzer(

View File

@@ -351,7 +351,6 @@ Future<T> runInContext<T>(
platform: globals.platform,
logger: globals.logger,
processManager: globals.processManager,
osUtils: globals.os,
)
),
WebWorkflow: () => WebWorkflow(

View File

@@ -98,7 +98,6 @@ class FlutterApplicationPackageFactory extends ApplicationPackageFactory {
? LinuxApp.fromLinuxProject(FlutterProject.current().linux)
: LinuxApp.fromPrebuiltApp(applicationBinary);
case TargetPlatform.windows_x64:
case TargetPlatform.windows_arm64:
return applicationBinary == null
? WindowsApp.fromWindowsProject(FlutterProject.current().windows)
: WindowsApp.fromPrebuiltApp(applicationBinary);

View File

@@ -235,18 +235,18 @@ class FlutterSdk extends EngineCachedArtifact {
@override
List<List<String>> getBinaryDirs() {
// Linux and Windows both support arm64 and x64.
// Currently only Linux supports both arm64 and x64.
final String arch = cache.getHostPlatformArchName();
return <List<String>>[
<String>['common', 'flutter_patched_sdk.zip'],
<String>['common', 'flutter_patched_sdk_product.zip'],
if (cache.includeAllPlatforms) ...<List<String>>[
<String>['windows-$arch', 'windows-$arch/artifacts.zip'],
<String>['windows-x64', 'windows-x64/artifacts.zip'],
<String>['linux-$arch', 'linux-$arch/artifacts.zip'],
<String>['darwin-x64', 'darwin-$arch/artifacts.zip'],
]
else if (_platform.isWindows)
<String>['windows-$arch', 'windows-$arch/artifacts.zip']
<String>['windows-x64', 'windows-x64/artifacts.zip']
else if (_platform.isMacOS)
<String>['darwin-x64', 'darwin-$arch/artifacts.zip']
else if (_platform.isLinux)
@@ -304,8 +304,7 @@ class WindowsEngineArtifacts extends EngineCachedArtifact {
@override
List<List<String>> getBinaryDirs() {
if (_platform.isWindows || ignorePlatformFiltering) {
final String arch = cache.getHostPlatformArchName();
return _getWindowsDesktopBinaryDirs(arch);
return _windowsDesktopBinaryDirs;
}
return const <List<String>>[];
}
@@ -740,12 +739,12 @@ class FontSubsetArtifacts extends EngineCachedArtifact {
@override
List<List<String>> getBinaryDirs() {
// Linux and Windows both support arm64 and x64.
// Currently only Linux supports both arm64 and x64.
final String arch = cache.getHostPlatformArchName();
final Map<String, List<String>> artifacts = <String, List<String>> {
'macos': <String>['darwin-x64', 'darwin-$arch/$artifactName.zip'],
'linux': <String>['linux-$arch', 'linux-$arch/$artifactName.zip'],
'windows': <String>['windows-$arch', 'windows-$arch/$artifactName.zip'],
'windows': <String>['windows-x64', 'windows-x64/$artifactName.zip'],
};
if (cache.includeAllPlatforms) {
return artifacts.values.toList();
@@ -847,15 +846,12 @@ class IosUsbArtifacts extends CachedArtifact {
// TODO(zanderso): upload debug desktop artifacts to host-debug and
// remove from existing host folder.
// https://github.com/flutter/flutter/issues/38935
List<List<String>> _getWindowsDesktopBinaryDirs(String arch) {
return <List<String>>[
<String>['windows-$arch', 'windows-$arch-debug/windows-$arch-flutter.zip'],
<String>['windows-$arch', 'windows-$arch/flutter-cpp-client-wrapper.zip'],
<String>['windows-$arch-profile', 'windows-$arch-profile/windows-$arch-flutter.zip'],
<String>['windows-$arch-release', 'windows-$arch-release/windows-$arch-flutter.zip'],
];
}
const List<List<String>> _windowsDesktopBinaryDirs = <List<String>>[
<String>['windows-x64', 'windows-x64-debug/windows-x64-flutter.zip'],
<String>['windows-x64', 'windows-x64/flutter-cpp-client-wrapper.zip'],
<String>['windows-x64-profile', 'windows-x64-profile/windows-x64-flutter.zip'],
<String>['windows-x64-release', 'windows-x64-release/windows-x64-flutter.zip'],
];
const List<List<String>> _macOSDesktopBinaryDirs = <List<String>>[
<String>['darwin-x64', 'darwin-x64/FlutterMacOS.framework.zip'],

View File

@@ -529,7 +529,6 @@ class MDnsVmServiceDiscovery {
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.');
}
}

View File

@@ -379,7 +379,6 @@ Future<Uri?> dryRunNativeAssets({
fileSystem: fileSystem,
buildRunner: buildRunner,
);
case build_info.TargetPlatform.windows_arm64:
case build_info.TargetPlatform.windows_x64:
nativeAssetsYaml = await dryRunNativeAssetsWindows(
projectUri: projectUri,
@@ -442,8 +441,7 @@ Future<Uri?> dryRunNativeAssetsMultipleOSes({
false,
buildRunner,
),
if (targetPlatforms.contains(build_info.TargetPlatform.windows_arm64) ||
targetPlatforms.contains(build_info.TargetPlatform.windows_x64) ||
if (targetPlatforms.contains(build_info.TargetPlatform.windows_x64) ||
(targetPlatforms.contains(build_info.TargetPlatform.tester) && OS.current == OS.windows))
...await dryRunNativeAssetsWindowsInternal(
fileSystem,
@@ -654,8 +652,6 @@ Target _getNativeTarget(build_info.TargetPlatform targetPlatform) {
return Target.linuxArm64;
case build_info.TargetPlatform.windows_x64:
return Target.windowsX64;
case build_info.TargetPlatform.windows_arm64:
return Target.windowsArm64;
case build_info.TargetPlatform.android:
case build_info.TargetPlatform.ios:
case build_info.TargetPlatform.darwin:

View File

@@ -1630,7 +1630,6 @@ Future<String?> getMissingPackageHintForPlatform(TargetPlatform platform) async
case TargetPlatform.tester:
case TargetPlatform.web_javascript:
case TargetPlatform.windows_x64:
case TargetPlatform.windows_arm64:
return null;
}
}

View File

@@ -1953,7 +1953,6 @@ DevelopmentArtifact? artifactFromTargetPlatform(TargetPlatform targetPlatform) {
}
return null;
case TargetPlatform.windows_x64:
case TargetPlatform.windows_arm64:
if (featureFlags.isWindowsEnabled) {
return DevelopmentArtifact.windows;
}

View File

@@ -54,7 +54,6 @@ Future<String?> sharedSkSlWriter(Device device, Map<String, Object?>? data, {
case TargetPlatform.tester:
case TargetPlatform.web_javascript:
case TargetPlatform.windows_x64:
case TargetPlatform.windows_arm64:
break;
}
final Map<String, Object> manifest = <String, Object>{

View File

@@ -10,7 +10,6 @@ import 'package:meta/meta.dart';
import '../artifacts.dart';
import '../base/file_system.dart';
import '../base/os.dart' show HostPlatform;
import '../base/platform.dart';
import '../build_info.dart';
import '../bundle.dart';
@@ -198,15 +197,8 @@ class TestCompiler {
buildRunner: buildRunner,
);
} else if (globals.platform.isWindows) {
final TargetPlatform targetPlatform;
if (globals.os.hostPlatform == HostPlatform.windows_x64) {
targetPlatform = TargetPlatform.windows_x64;
} else {
targetPlatform = TargetPlatform.windows_arm64;
}
(nativeAssetsYaml, _) = await buildNativeAssetsWindows(
buildMode: buildInfo.mode,
targetPlatform: targetPlatform,
projectUri: projectUri,
flutterTester: true,
fileSystem: globals.fs,

View File

@@ -78,7 +78,7 @@ abstract class WindowsApp extends ApplicationPackage {
@override
String get displayName => id;
String executable(BuildMode buildMode, TargetPlatform targetPlatform);
String executable(BuildMode buildMode);
}
class PrebuiltWindowsApp extends WindowsApp implements PrebuiltApplicationPackage {
@@ -91,7 +91,7 @@ class PrebuiltWindowsApp extends WindowsApp implements PrebuiltApplicationPackag
final String _executable;
@override
String executable(BuildMode buildMode, TargetPlatform targetPlatform) => _executable;
String executable(BuildMode buildMode) => _executable;
@override
String get name => _executable;
@@ -108,10 +108,10 @@ class BuildableWindowsApp extends WindowsApp {
final WindowsProject project;
@override
String executable(BuildMode buildMode, TargetPlatform targetPlatform) {
String executable(BuildMode buildMode) {
final String? binaryName = getCmakeExecutableName(project);
return globals.fs.path.join(
getWindowsBuildDirectory(targetPlatform),
getWindowsBuildDirectory(TargetPlatform.windows_x64),
'runner',
sentenceCase(buildMode.cliName),
'$binaryName.exe',

View File

@@ -30,10 +30,7 @@ import 'visual_studio.dart';
const String _kBadCharacters = r"'#!$^&*=|,;<>?";
/// Builds the Windows project using msbuild.
Future<void> buildWindows(
WindowsProject windowsProject,
BuildInfo buildInfo,
TargetPlatform targetPlatform, {
Future<void> buildWindows(WindowsProject windowsProject, BuildInfo buildInfo, {
String? target,
VisualStudio? visualStudioOverride,
SizeAnalyzer? sizeAnalyzer,
@@ -59,6 +56,8 @@ Future<void> buildWindows(
'to learn about adding Windows support to a project.');
}
// TODO(pbo-linaro): Add support for windows-arm64 platform, https://github.com/flutter/flutter/issues/129807
const TargetPlatform targetPlatform = TargetPlatform.windows_x64;
final Directory buildDirectory = globals.fs.directory(globals.fs.path.join(
projectPath,
getWindowsBuildDirectory(targetPlatform),
@@ -84,7 +83,6 @@ Future<void> buildWindows(
platform: globals.platform,
logger: globals.logger,
processManager: globals.processManager,
osUtils: globals.os,
);
final String? cmakePath = visualStudio.cmakePath;
final String? cmakeGenerator = visualStudio.cmakeGenerator;
@@ -101,9 +99,9 @@ Future<void> buildWindows(
await _runCmakeGeneration(
cmakePath: cmakePath,
generator: cmakeGenerator,
targetPlatform: targetPlatform,
buildDir: buildDirectory,
sourceDir: windowsProject.cmakeFile.parent,
targetPlatform: targetPlatform,
);
if (visualStudio.displayVersion == '17.1.0') {
_fixBrokenCmakeGeneration(buildDirectory);
@@ -130,7 +128,7 @@ Future<void> buildWindows(
}
if (buildInfo.codeSizeDirectory != null && sizeAnalyzer != null) {
final String arch = getNameForTargetPlatform(targetPlatform);
final String arch = getNameForTargetPlatform(TargetPlatform.windows_x64);
final File codeSizeFile = globals.fs.directory(buildInfo.codeSizeDirectory)
.childFile('snapshot.$arch.json');
final File precompilerTrace = globals.fs.directory(buildInfo.codeSizeDirectory)
@@ -167,26 +165,23 @@ Future<void> buildWindows(
}
}
String getCmakeWindowsArch(TargetPlatform targetPlatform) {
return switch (targetPlatform) {
TargetPlatform.windows_x64 => 'x64',
TargetPlatform.windows_arm64 => 'ARM64',
_ => throw Exception('Unsupported target platform "$targetPlatform".'),
};
}
Future<void> _runCmakeGeneration({
required String cmakePath,
required String generator,
required TargetPlatform targetPlatform,
required Directory buildDir,
required Directory sourceDir,
required TargetPlatform targetPlatform,
}) async {
if (targetPlatform != TargetPlatform.windows_x64) {
throwToolExit('Windows build supports only x64 target architecture');
}
final Stopwatch sw = Stopwatch()..start();
await buildDir.create(recursive: true);
int result;
const String arch = 'x64';
const String flutterTargetPlatform = 'windows-x64';
try {
result = await globals.processUtils.stream(
<String>[
@@ -198,8 +193,8 @@ Future<void> _runCmakeGeneration({
'-G',
generator,
'-A',
getCmakeWindowsArch(targetPlatform),
'-DFLUTTER_TARGET_PLATFORM=${getNameForTargetPlatform(targetPlatform)}',
arch,
'-DFLUTTER_TARGET_PLATFORM=$flutterTargetPlatform',
],
trace: true,
);

View File

@@ -72,7 +72,6 @@ Future<CCompilerConfig> cCompilerConfigWindows() async {
platform: globals.platform,
logger: globals.logger,
processManager: globals.processManager,
osUtils: globals.os,
);
return CCompilerConfig(

View File

@@ -9,7 +9,6 @@ import '../base/common.dart';
import '../base/file_system.dart';
import '../base/io.dart';
import '../base/logger.dart';
import '../base/os.dart' show HostPlatform, OperatingSystemUtils;
import '../base/platform.dart';
import '../base/process.dart';
import '../base/version.dart';
@@ -22,18 +21,15 @@ class VisualStudio {
required ProcessManager processManager,
required Platform platform,
required Logger logger,
required OperatingSystemUtils osUtils,
}) : _platform = platform,
_fileSystem = fileSystem,
_processUtils = ProcessUtils(processManager: processManager, logger: logger),
_logger = logger,
_osUtils = osUtils;
_logger = logger;
final FileSystem _fileSystem;
final Platform _platform;
final ProcessUtils _processUtils;
final Logger _logger;
final OperatingSystemUtils _osUtils;
/// Matches the description property from the vswhere.exe JSON output.
final RegExp _vswhereDescriptionProperty = RegExp(r'\s*"description"\s*:\s*".*"\s*,?');
@@ -212,8 +208,6 @@ class VisualStudio {
return null;
}
final String arch = _osUtils.hostPlatform == HostPlatform.windows_arm64 ? 'arm64': 'x64';
return _fileSystem.path.joinAll(<String>[
details.installationPath!,
'VC',
@@ -221,8 +215,8 @@ class VisualStudio {
'MSVC',
details.msvcVersion!,
'bin',
'Host$arch',
arch,
'Hostx64',
'x64',
executable,
]);
}
@@ -235,14 +229,12 @@ class VisualStudio {
return null;
}
final String arch = _osUtils.hostPlatform == HostPlatform.windows_arm64 ? 'arm64': '64';
return _fileSystem.path.joinAll(<String>[
details.installationPath!,
'VC',
'Auxiliary',
'Build',
'vcvars$arch.bat',
'vcvars64.bat',
]);
}

View File

@@ -24,8 +24,7 @@ class WindowsDevice extends DesktopDevice {
required Logger logger,
required FileSystem fileSystem,
required OperatingSystemUtils operatingSystemUtils,
}) : _operatingSystemUtils = operatingSystemUtils,
super(
}) : super(
'windows',
platformType: PlatformType.windows,
ephemeral: false,
@@ -35,8 +34,6 @@ class WindowsDevice extends DesktopDevice {
operatingSystemUtils: operatingSystemUtils,
);
final OperatingSystemUtils _operatingSystemUtils;
@override
bool isSupported() => true;
@@ -44,12 +41,7 @@ class WindowsDevice extends DesktopDevice {
String get name => 'Windows';
@override
Future<TargetPlatform> get targetPlatform async => _targetPlatform;
TargetPlatform get _targetPlatform => switch (_operatingSystemUtils.hostPlatform) {
HostPlatform.windows_arm64 => TargetPlatform.windows_arm64,
_ => TargetPlatform.windows_x64,
};
Future<TargetPlatform> get targetPlatform async => TargetPlatform.windows_x64;
@override
bool isSupportedForProject(FlutterProject flutterProject) {
@@ -64,14 +56,13 @@ class WindowsDevice extends DesktopDevice {
await buildWindows(
FlutterProject.current().windows,
buildInfo,
_targetPlatform,
target: mainPath,
);
}
@override
String executablePathForDevice(covariant WindowsApp package, BuildInfo buildInfo) {
return package.executable(buildInfo.mode, _targetPlatform);
return package.executable(buildInfo.mode);
}
}