tool: replace top-level functions with enum properties (#126167)
This commit is contained in:
parent
201f7311f7
commit
f9d455134a
@ -119,7 +119,7 @@ Iterable<String> _apkFilesFor(AndroidBuildInfo androidBuildInfo) {
|
|||||||
final String flavorString = productFlavor.isEmpty ? '' : '-$productFlavor';
|
final String flavorString = productFlavor.isEmpty ? '' : '-$productFlavor';
|
||||||
if (androidBuildInfo.splitPerAbi) {
|
if (androidBuildInfo.splitPerAbi) {
|
||||||
return androidBuildInfo.targetArchs.map<String>((AndroidArch arch) {
|
return androidBuildInfo.targetArchs.map<String>((AndroidArch arch) {
|
||||||
final String abi = getNameForAndroidArch(arch);
|
final String abi = arch.archName;
|
||||||
return 'app$flavorString-$abi-$buildType.apk';
|
return 'app$flavorString-$abi-$buildType.apk';
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -347,7 +347,7 @@ class AndroidGradleBuilder implements AndroidBuilder {
|
|||||||
} else if (androidBuildInfo.targetArchs.isNotEmpty) {
|
} else if (androidBuildInfo.targetArchs.isNotEmpty) {
|
||||||
final String targetPlatforms = androidBuildInfo
|
final String targetPlatforms = androidBuildInfo
|
||||||
.targetArchs
|
.targetArchs
|
||||||
.map(getPlatformNameForAndroidArch).join(',');
|
.map((AndroidArch e) => e.platformName).join(',');
|
||||||
command.add('-Ptarget-platform=$targetPlatforms');
|
command.add('-Ptarget-platform=$targetPlatforms');
|
||||||
}
|
}
|
||||||
command.add('-Ptarget=$target');
|
command.add('-Ptarget=$target');
|
||||||
@ -560,7 +560,7 @@ class AndroidGradleBuilder implements AndroidBuilder {
|
|||||||
logger: _logger,
|
logger: _logger,
|
||||||
flutterUsage: _usage,
|
flutterUsage: _usage,
|
||||||
);
|
);
|
||||||
final String archName = getNameForAndroidArch(androidBuildInfo.targetArchs.single);
|
final String archName = androidBuildInfo.targetArchs.single.archName;
|
||||||
final BuildInfo buildInfo = androidBuildInfo.buildInfo;
|
final BuildInfo buildInfo = androidBuildInfo.buildInfo;
|
||||||
final File aotSnapshot = _fileSystem.directory(buildInfo.codeSizeDirectory)
|
final File aotSnapshot = _fileSystem.directory(buildInfo.codeSizeDirectory)
|
||||||
.childFile('snapshot.$archName.json');
|
.childFile('snapshot.$archName.json');
|
||||||
@ -688,7 +688,7 @@ class AndroidGradleBuilder implements AndroidBuilder {
|
|||||||
localEngineInfo.engineOutPath)}');
|
localEngineInfo.engineOutPath)}');
|
||||||
} else if (androidBuildInfo.targetArchs.isNotEmpty) {
|
} else if (androidBuildInfo.targetArchs.isNotEmpty) {
|
||||||
final String targetPlatforms = androidBuildInfo.targetArchs
|
final String targetPlatforms = androidBuildInfo.targetArchs
|
||||||
.map(getPlatformNameForAndroidArch).join(',');
|
.map((AndroidArch e) => e.platformName).join(',');
|
||||||
command.add('-Ptarget-platform=$targetPlatforms');
|
command.add('-Ptarget-platform=$targetPlatforms');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -939,7 +939,7 @@ Iterable<String> listApkPaths(
|
|||||||
for (AndroidArch androidArch in androidBuildInfo.targetArchs)
|
for (AndroidArch androidArch in androidBuildInfo.targetArchs)
|
||||||
<String>[
|
<String>[
|
||||||
'app',
|
'app',
|
||||||
getNameForAndroidArch(androidArch),
|
androidArch.archName,
|
||||||
...apkPartialName,
|
...apkPartialName,
|
||||||
].join('-'),
|
].join('-'),
|
||||||
];
|
];
|
||||||
|
@ -583,7 +583,7 @@ class CachedArtifacts implements Artifacts {
|
|||||||
final String root = _fileSystem.path.join(
|
final String root = _fileSystem.path.join(
|
||||||
_cache.getArtifactDirectory('flutter_runner').path,
|
_cache.getArtifactDirectory('flutter_runner').path,
|
||||||
'flutter',
|
'flutter',
|
||||||
fuchsiaArchForTargetPlatform(platform),
|
platform.fuchsiaArchForTargetPlatform,
|
||||||
mode.isRelease ? 'release' : mode.toString(),
|
mode.isRelease ? 'release' : mode.toString(),
|
||||||
);
|
);
|
||||||
final String runtime = mode.isJit ? 'jit' : 'aot';
|
final String runtime = mode.isJit ? 'jit' : 'aot';
|
||||||
|
@ -69,7 +69,7 @@ class GenSnapshot {
|
|||||||
// one for the target architecture in question.
|
// one for the target architecture in question.
|
||||||
if (snapshotType.platform == TargetPlatform.ios ||
|
if (snapshotType.platform == TargetPlatform.ios ||
|
||||||
snapshotType.platform == TargetPlatform.darwin) {
|
snapshotType.platform == TargetPlatform.darwin) {
|
||||||
snapshotterPath += '_${getDartNameForDarwinArch(darwinArch!)}';
|
snapshotterPath += '_${darwinArch!.dartName}';
|
||||||
}
|
}
|
||||||
|
|
||||||
return _processUtils.stream(
|
return _processUtils.stream(
|
||||||
@ -259,7 +259,7 @@ class AOTSnapshotter {
|
|||||||
required bool stripAfterBuild,
|
required bool stripAfterBuild,
|
||||||
required bool extractAppleDebugSymbols
|
required bool extractAppleDebugSymbols
|
||||||
}) async {
|
}) async {
|
||||||
final String targetArch = getNameForDarwinArch(appleArch);
|
final String targetArch = appleArch.name;
|
||||||
if (!quiet) {
|
if (!quiet) {
|
||||||
_logger.printStatus('Building App.framework for $targetArch...');
|
_logger.printStatus('Building App.framework for $targetArch...');
|
||||||
}
|
}
|
||||||
|
@ -607,7 +607,17 @@ enum HostPlatform {
|
|||||||
darwin_arm64,
|
darwin_arm64,
|
||||||
linux_x64,
|
linux_x64,
|
||||||
linux_arm64,
|
linux_arm64,
|
||||||
windows_x64,
|
windows_x64;
|
||||||
|
|
||||||
|
String get platformName {
|
||||||
|
return switch (this) {
|
||||||
|
HostPlatform.darwin_x64 => 'x64',
|
||||||
|
HostPlatform.darwin_arm64 => 'arm64',
|
||||||
|
HostPlatform.linux_x64 => 'x64',
|
||||||
|
HostPlatform.linux_arm64 => 'arm64',
|
||||||
|
HostPlatform.windows_x64 => 'x64'
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String getNameForHostPlatform(HostPlatform platform) {
|
String getNameForHostPlatform(HostPlatform platform) {
|
||||||
|
@ -545,7 +545,51 @@ enum TargetPlatform {
|
|||||||
android_arm,
|
android_arm,
|
||||||
android_arm64,
|
android_arm64,
|
||||||
android_x64,
|
android_x64,
|
||||||
android_x86,
|
android_x86;
|
||||||
|
|
||||||
|
String get fuchsiaArchForTargetPlatform {
|
||||||
|
switch (this) {
|
||||||
|
case TargetPlatform.fuchsia_arm64:
|
||||||
|
return 'arm64';
|
||||||
|
case TargetPlatform.fuchsia_x64:
|
||||||
|
return 'x64';
|
||||||
|
case TargetPlatform.android:
|
||||||
|
case TargetPlatform.android_arm:
|
||||||
|
case TargetPlatform.android_arm64:
|
||||||
|
case TargetPlatform.android_x64:
|
||||||
|
case TargetPlatform.android_x86:
|
||||||
|
case TargetPlatform.darwin:
|
||||||
|
case TargetPlatform.ios:
|
||||||
|
case TargetPlatform.linux_arm64:
|
||||||
|
case TargetPlatform.linux_x64:
|
||||||
|
case TargetPlatform.tester:
|
||||||
|
case TargetPlatform.web_javascript:
|
||||||
|
case TargetPlatform.windows_x64:
|
||||||
|
throw UnsupportedError('Unexpected Fuchsia platform $this');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String get simpleName {
|
||||||
|
switch (this) {
|
||||||
|
case TargetPlatform.linux_x64:
|
||||||
|
case TargetPlatform.darwin:
|
||||||
|
case TargetPlatform.windows_x64:
|
||||||
|
return 'x64';
|
||||||
|
case TargetPlatform.linux_arm64:
|
||||||
|
return 'arm64';
|
||||||
|
case TargetPlatform.android:
|
||||||
|
case TargetPlatform.android_arm:
|
||||||
|
case TargetPlatform.android_arm64:
|
||||||
|
case TargetPlatform.android_x64:
|
||||||
|
case TargetPlatform.android_x86:
|
||||||
|
case TargetPlatform.fuchsia_arm64:
|
||||||
|
case TargetPlatform.fuchsia_x64:
|
||||||
|
case TargetPlatform.ios:
|
||||||
|
case TargetPlatform.tester:
|
||||||
|
case TargetPlatform.web_javascript:
|
||||||
|
throw UnsupportedError('Unexpected target platform $this');
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// iOS and macOS target device architecture.
|
/// iOS and macOS target device architecture.
|
||||||
@ -554,7 +598,21 @@ enum TargetPlatform {
|
|||||||
enum DarwinArch {
|
enum DarwinArch {
|
||||||
armv7, // Deprecated. Used to display 32-bit unsupported devices.
|
armv7, // Deprecated. Used to display 32-bit unsupported devices.
|
||||||
arm64,
|
arm64,
|
||||||
x86_64,
|
x86_64;
|
||||||
|
|
||||||
|
/// Returns the Dart SDK's name for the specified target architecture.
|
||||||
|
///
|
||||||
|
/// When building for Darwin platforms, the tool invokes architecture-specific
|
||||||
|
/// variants of `gen_snapshot`, one for each target architecture. The output
|
||||||
|
/// instructions are then built into architecture-specific binaries, which are
|
||||||
|
/// merged into a universal binary using the `lipo` tool.
|
||||||
|
String get dartName {
|
||||||
|
return switch (this) {
|
||||||
|
DarwinArch.armv7 => 'armv7',
|
||||||
|
DarwinArch.arm64 => 'arm64',
|
||||||
|
DarwinArch.x86_64 => 'x64'
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(zanderso): replace all android TargetPlatform usage with AndroidArch.
|
// TODO(zanderso): replace all android TargetPlatform usage with AndroidArch.
|
||||||
@ -562,7 +620,25 @@ enum AndroidArch {
|
|||||||
armeabi_v7a,
|
armeabi_v7a,
|
||||||
arm64_v8a,
|
arm64_v8a,
|
||||||
x86,
|
x86,
|
||||||
x86_64,
|
x86_64;
|
||||||
|
|
||||||
|
String get archName {
|
||||||
|
return switch (this) {
|
||||||
|
AndroidArch.armeabi_v7a => 'armeabi-v7a',
|
||||||
|
AndroidArch.arm64_v8a => 'arm64-v8a',
|
||||||
|
AndroidArch.x86_64 => 'x86_64',
|
||||||
|
AndroidArch.x86 => 'x86'
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
String get platformName {
|
||||||
|
return switch (this) {
|
||||||
|
AndroidArch.armeabi_v7a => 'android-arm',
|
||||||
|
AndroidArch.arm64_v8a => 'android-arm64',
|
||||||
|
AndroidArch.x86_64 => 'android-x64',
|
||||||
|
AndroidArch.x86 => 'android-x86'
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The default set of iOS device architectures to build for.
|
/// The default set of iOS device architectures to build for.
|
||||||
@ -607,36 +683,6 @@ List<DarwinArch> defaultMacOSArchsForEnvironment(Artifacts artifacts) {
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns the Dart SDK's name for the specified target architecture.
|
|
||||||
//
|
|
||||||
// When building for Darwin platforms, the tool invokes architecture-specific
|
|
||||||
// variants of `gen_snapshot`, one for each target architecture. The output
|
|
||||||
// instructions are then built into architecture-specific binaries, which are
|
|
||||||
// merged into a universal binary using the `lipo` tool.
|
|
||||||
String getDartNameForDarwinArch(DarwinArch arch) {
|
|
||||||
return switch (arch) {
|
|
||||||
DarwinArch.armv7 => 'armv7',
|
|
||||||
DarwinArch.arm64 => 'arm64',
|
|
||||||
DarwinArch.x86_64 => 'x64'
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
// Returns Apple's name for the specified target architecture.
|
|
||||||
//
|
|
||||||
// When invoking Apple tools such as `xcodebuild` or `lipo`, the tool often
|
|
||||||
// passes one or more target architectures as parameters. The names returned by
|
|
||||||
// this function reflect Apple's name for the specified architecture.
|
|
||||||
//
|
|
||||||
// For consistency with developer expectations, Flutter outputs also use these
|
|
||||||
// architecture names in its build products for Darwin target platforms.
|
|
||||||
String getNameForDarwinArch(DarwinArch arch) {
|
|
||||||
return switch (arch) {
|
|
||||||
DarwinArch.armv7 => 'armv7',
|
|
||||||
DarwinArch.arm64 => 'arm64',
|
|
||||||
DarwinArch.x86_64 => 'x86_64'
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
DarwinArch getIOSArchForName(String arch) {
|
DarwinArch getIOSArchForName(String arch) {
|
||||||
switch (arch) {
|
switch (arch) {
|
||||||
case 'armv7':
|
case 'armv7':
|
||||||
@ -674,12 +720,12 @@ String getNameForTargetPlatform(TargetPlatform platform, {DarwinArch? darwinArch
|
|||||||
return 'android-x86';
|
return 'android-x86';
|
||||||
case TargetPlatform.ios:
|
case TargetPlatform.ios:
|
||||||
if (darwinArch != null) {
|
if (darwinArch != null) {
|
||||||
return 'ios-${getNameForDarwinArch(darwinArch)}';
|
return 'ios-${darwinArch.name}';
|
||||||
}
|
}
|
||||||
return 'ios';
|
return 'ios';
|
||||||
case TargetPlatform.darwin:
|
case TargetPlatform.darwin:
|
||||||
if (darwinArch != null) {
|
if (darwinArch != null) {
|
||||||
return 'darwin-${getNameForDarwinArch(darwinArch)}';
|
return 'darwin-${darwinArch.name}';
|
||||||
}
|
}
|
||||||
return 'darwin';
|
return 'darwin';
|
||||||
case TargetPlatform.linux_x64:
|
case TargetPlatform.linux_x64:
|
||||||
@ -751,46 +797,6 @@ AndroidArch getAndroidArchForName(String platform) {
|
|||||||
throw Exception('Unsupported Android arch name "$platform"');
|
throw Exception('Unsupported Android arch name "$platform"');
|
||||||
}
|
}
|
||||||
|
|
||||||
String getNameForAndroidArch(AndroidArch arch) {
|
|
||||||
return switch (arch) {
|
|
||||||
AndroidArch.armeabi_v7a => 'armeabi-v7a',
|
|
||||||
AndroidArch.arm64_v8a => 'arm64-v8a',
|
|
||||||
AndroidArch.x86_64 => 'x86_64',
|
|
||||||
AndroidArch.x86 => 'x86'
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
String getPlatformNameForAndroidArch(AndroidArch arch) {
|
|
||||||
return switch (arch) {
|
|
||||||
AndroidArch.armeabi_v7a => 'android-arm',
|
|
||||||
AndroidArch.arm64_v8a => 'android-arm64',
|
|
||||||
AndroidArch.x86_64 => 'android-x64',
|
|
||||||
AndroidArch.x86 => 'android-x86'
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
String fuchsiaArchForTargetPlatform(TargetPlatform targetPlatform) {
|
|
||||||
switch (targetPlatform) {
|
|
||||||
case TargetPlatform.fuchsia_arm64:
|
|
||||||
return 'arm64';
|
|
||||||
case TargetPlatform.fuchsia_x64:
|
|
||||||
return 'x64';
|
|
||||||
case TargetPlatform.android:
|
|
||||||
case TargetPlatform.android_arm:
|
|
||||||
case TargetPlatform.android_arm64:
|
|
||||||
case TargetPlatform.android_x64:
|
|
||||||
case TargetPlatform.android_x86:
|
|
||||||
case TargetPlatform.darwin:
|
|
||||||
case TargetPlatform.ios:
|
|
||||||
case TargetPlatform.linux_arm64:
|
|
||||||
case TargetPlatform.linux_x64:
|
|
||||||
case TargetPlatform.tester:
|
|
||||||
case TargetPlatform.web_javascript:
|
|
||||||
case TargetPlatform.windows_x64:
|
|
||||||
throw UnsupportedError('Unexpected Fuchsia platform $targetPlatform');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
HostPlatform getCurrentHostPlatform() {
|
HostPlatform getCurrentHostPlatform() {
|
||||||
if (globals.platform.isMacOS) {
|
if (globals.platform.isMacOS) {
|
||||||
return HostPlatform.darwin_x64;
|
return HostPlatform.darwin_x64;
|
||||||
@ -862,7 +868,7 @@ String getWebBuildDirectory([bool isWasm = false]) {
|
|||||||
String getLinuxBuildDirectory([TargetPlatform? targetPlatform]) {
|
String getLinuxBuildDirectory([TargetPlatform? targetPlatform]) {
|
||||||
final String arch = (targetPlatform == null) ?
|
final String arch = (targetPlatform == null) ?
|
||||||
_getCurrentHostPlatformArchName() :
|
_getCurrentHostPlatformArchName() :
|
||||||
getNameForTargetPlatformArch(targetPlatform);
|
targetPlatform.simpleName;
|
||||||
final String subDirs = 'linux/$arch';
|
final String subDirs = 'linux/$arch';
|
||||||
return globals.fs.path.join(getBuildDirectory(), subDirs);
|
return globals.fs.path.join(getBuildDirectory(), subDirs);
|
||||||
}
|
}
|
||||||
@ -1019,39 +1025,7 @@ enum NullSafetyMode {
|
|||||||
|
|
||||||
String _getCurrentHostPlatformArchName() {
|
String _getCurrentHostPlatformArchName() {
|
||||||
final HostPlatform hostPlatform = getCurrentHostPlatform();
|
final HostPlatform hostPlatform = getCurrentHostPlatform();
|
||||||
return getNameForHostPlatformArch(hostPlatform);
|
return hostPlatform.platformName;
|
||||||
}
|
|
||||||
|
|
||||||
String getNameForTargetPlatformArch(TargetPlatform platform) {
|
|
||||||
switch (platform) {
|
|
||||||
case TargetPlatform.linux_x64:
|
|
||||||
case TargetPlatform.darwin:
|
|
||||||
case TargetPlatform.windows_x64:
|
|
||||||
return 'x64';
|
|
||||||
case TargetPlatform.linux_arm64:
|
|
||||||
return 'arm64';
|
|
||||||
case TargetPlatform.android:
|
|
||||||
case TargetPlatform.android_arm:
|
|
||||||
case TargetPlatform.android_arm64:
|
|
||||||
case TargetPlatform.android_x64:
|
|
||||||
case TargetPlatform.android_x86:
|
|
||||||
case TargetPlatform.fuchsia_arm64:
|
|
||||||
case TargetPlatform.fuchsia_x64:
|
|
||||||
case TargetPlatform.ios:
|
|
||||||
case TargetPlatform.tester:
|
|
||||||
case TargetPlatform.web_javascript:
|
|
||||||
throw UnsupportedError('Unexpected target platform $platform');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
String getNameForHostPlatformArch(HostPlatform platform) {
|
|
||||||
return switch (platform) {
|
|
||||||
HostPlatform.darwin_x64 => 'x64',
|
|
||||||
HostPlatform.darwin_arm64 => 'arm64',
|
|
||||||
HostPlatform.linux_x64 => 'x64',
|
|
||||||
HostPlatform.linux_arm64 => 'arm64',
|
|
||||||
HostPlatform.windows_x64 => 'x64'
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
String? _uncapitalize(String? s) {
|
String? _uncapitalize(String? s) {
|
||||||
|
@ -158,8 +158,7 @@ class AndroidAot extends AotElfBase {
|
|||||||
|
|
||||||
/// The name of the produced Android ABI.
|
/// The name of the produced Android ABI.
|
||||||
String get _androidAbiName {
|
String get _androidAbiName {
|
||||||
return getNameForAndroidArch(
|
return getAndroidArchForName(getNameForTargetPlatform(targetPlatform)).archName;
|
||||||
getAndroidArchForName(getNameForTargetPlatform(targetPlatform)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -286,8 +285,7 @@ class AndroidAotBundle extends Target {
|
|||||||
|
|
||||||
/// The name of the produced Android ABI.
|
/// The name of the produced Android ABI.
|
||||||
String get _androidAbiName {
|
String get _androidAbiName {
|
||||||
return getNameForAndroidArch(
|
return getAndroidArchForName(getNameForTargetPlatform(dependency.targetPlatform)).archName;
|
||||||
getAndroidArchForName(getNameForTargetPlatform(dependency.targetPlatform)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -373,8 +371,7 @@ class AndroidAotDeferredComponentsBundle extends Target {
|
|||||||
|
|
||||||
/// The name of the produced Android ABI.
|
/// The name of the produced Android ABI.
|
||||||
String get _androidAbiName {
|
String get _androidAbiName {
|
||||||
return getNameForAndroidArch(
|
return getAndroidArchForName(getNameForTargetPlatform(dependency.targetPlatform)).archName;
|
||||||
getAndroidArchForName(getNameForTargetPlatform(dependency.targetPlatform)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -407,7 +407,7 @@ abstract final class Lipo {
|
|||||||
environment.fileSystem.directory(resultPath).parent.createSync(recursive: true);
|
environment.fileSystem.directory(resultPath).parent.createSync(recursive: true);
|
||||||
|
|
||||||
Iterable<String> inputPaths = darwinArchs.map(
|
Iterable<String> inputPaths = darwinArchs.map(
|
||||||
(DarwinArch iosArch) => environment.fileSystem.path.join(inputDir, getNameForDarwinArch(iosArch), relativePath)
|
(DarwinArch iosArch) => environment.fileSystem.path.join(inputDir, iosArch.name, relativePath)
|
||||||
);
|
);
|
||||||
if (skipMissingInputs) {
|
if (skipMissingInputs) {
|
||||||
inputPaths = inputPaths.where(environment.fileSystem.isFileSync);
|
inputPaths = inputPaths.where(environment.fileSystem.isFileSync);
|
||||||
|
@ -41,7 +41,7 @@ class DeferredComponentsGenSnapshotValidatorTarget extends Target {
|
|||||||
for (final AndroidAotDeferredComponentsBundle target in deferredComponentsDependencies) {
|
for (final AndroidAotDeferredComponentsBundle target in deferredComponentsDependencies) {
|
||||||
if (deferredComponentsTargets.contains(target.name)) {
|
if (deferredComponentsTargets.contains(target.name)) {
|
||||||
abis.add(
|
abis.add(
|
||||||
getNameForAndroidArch(getAndroidArchForName(getNameForTargetPlatform(target.dependency.targetPlatform)))
|
getAndroidArchForName(getNameForTargetPlatform(target.dependency.targetPlatform)).archName
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -88,10 +88,10 @@ abstract class AotAssemblyBase extends Target {
|
|||||||
if (codeSizeDirectory != null) {
|
if (codeSizeDirectory != null) {
|
||||||
final File codeSizeFile = environment.fileSystem
|
final File codeSizeFile = environment.fileSystem
|
||||||
.directory(codeSizeDirectory)
|
.directory(codeSizeDirectory)
|
||||||
.childFile('snapshot.${getNameForDarwinArch(darwinArch)}.json');
|
.childFile('snapshot.${darwinArch.name}.json');
|
||||||
final File precompilerTraceFile = environment.fileSystem
|
final File precompilerTraceFile = environment.fileSystem
|
||||||
.directory(codeSizeDirectory)
|
.directory(codeSizeDirectory)
|
||||||
.childFile('trace.${getNameForDarwinArch(darwinArch)}.json');
|
.childFile('trace.${darwinArch.name}.json');
|
||||||
archExtraGenSnapshotOptions.add('--write-v8-snapshot-profile-to=${codeSizeFile.path}');
|
archExtraGenSnapshotOptions.add('--write-v8-snapshot-profile-to=${codeSizeFile.path}');
|
||||||
archExtraGenSnapshotOptions.add('--trace-precompiler-to=${precompilerTraceFile.path}');
|
archExtraGenSnapshotOptions.add('--trace-precompiler-to=${precompilerTraceFile.path}');
|
||||||
}
|
}
|
||||||
@ -99,7 +99,7 @@ abstract class AotAssemblyBase extends Target {
|
|||||||
platform: targetPlatform,
|
platform: targetPlatform,
|
||||||
buildMode: buildMode,
|
buildMode: buildMode,
|
||||||
mainPath: environment.buildDir.childFile('app.dill').path,
|
mainPath: environment.buildDir.childFile('app.dill').path,
|
||||||
outputPath: environment.fileSystem.path.join(buildOutputPath, getNameForDarwinArch(darwinArch)),
|
outputPath: environment.fileSystem.path.join(buildOutputPath, darwinArch.name),
|
||||||
darwinArch: darwinArch,
|
darwinArch: darwinArch,
|
||||||
sdkRoot: sdkRoot,
|
sdkRoot: sdkRoot,
|
||||||
quiet: true,
|
quiet: true,
|
||||||
|
@ -191,7 +191,7 @@ class DebugMacOSFramework extends Target {
|
|||||||
?? <DarwinArch>[DarwinArch.x86_64, DarwinArch.arm64];
|
?? <DarwinArch>[DarwinArch.x86_64, DarwinArch.arm64];
|
||||||
|
|
||||||
final Iterable<String> darwinArchArguments =
|
final Iterable<String> darwinArchArguments =
|
||||||
darwinArchs.expand((DarwinArch arch) => <String>['-arch', getNameForDarwinArch(arch)]);
|
darwinArchs.expand((DarwinArch arch) => <String>['-arch', arch.name]);
|
||||||
|
|
||||||
outputFile.createSync(recursive: true);
|
outputFile.createSync(recursive: true);
|
||||||
final File debugApp = environment.buildDir.childFile('debug_app.cc')
|
final File debugApp = environment.buildDir.childFile('debug_app.cc')
|
||||||
@ -277,10 +277,10 @@ class CompileMacOSFramework extends Target {
|
|||||||
if (codeSizeDirectory != null) {
|
if (codeSizeDirectory != null) {
|
||||||
final File codeSizeFile = environment.fileSystem
|
final File codeSizeFile = environment.fileSystem
|
||||||
.directory(codeSizeDirectory)
|
.directory(codeSizeDirectory)
|
||||||
.childFile('snapshot.${getNameForDarwinArch(darwinArch)}.json');
|
.childFile('snapshot.${darwinArch.name}.json');
|
||||||
final File precompilerTraceFile = environment.fileSystem
|
final File precompilerTraceFile = environment.fileSystem
|
||||||
.directory(codeSizeDirectory)
|
.directory(codeSizeDirectory)
|
||||||
.childFile('trace.${getNameForDarwinArch(darwinArch)}.json');
|
.childFile('trace.${darwinArch.name}.json');
|
||||||
extraGenSnapshotOptions.add('--write-v8-snapshot-profile-to=${codeSizeFile.path}');
|
extraGenSnapshotOptions.add('--write-v8-snapshot-profile-to=${codeSizeFile.path}');
|
||||||
extraGenSnapshotOptions.add('--trace-precompiler-to=${precompilerTraceFile.path}');
|
extraGenSnapshotOptions.add('--trace-precompiler-to=${precompilerTraceFile.path}');
|
||||||
}
|
}
|
||||||
@ -288,7 +288,7 @@ class CompileMacOSFramework extends Target {
|
|||||||
pending.add(snapshotter.build(
|
pending.add(snapshotter.build(
|
||||||
buildMode: buildMode,
|
buildMode: buildMode,
|
||||||
mainPath: environment.buildDir.childFile('app.dill').path,
|
mainPath: environment.buildDir.childFile('app.dill').path,
|
||||||
outputPath: environment.fileSystem.path.join(buildOutputPath, getNameForDarwinArch(darwinArch)),
|
outputPath: environment.fileSystem.path.join(buildOutputPath, darwinArch.name),
|
||||||
platform: TargetPlatform.darwin,
|
platform: TargetPlatform.darwin,
|
||||||
darwinArch: darwinArch,
|
darwinArch: darwinArch,
|
||||||
splitDebugInfo: splitDebugInfo,
|
splitDebugInfo: splitDebugInfo,
|
||||||
|
@ -19,7 +19,6 @@ import 'base/os.dart' show OperatingSystemUtils;
|
|||||||
import 'base/platform.dart';
|
import 'base/platform.dart';
|
||||||
import 'base/terminal.dart';
|
import 'base/terminal.dart';
|
||||||
import 'base/user_messages.dart';
|
import 'base/user_messages.dart';
|
||||||
import 'build_info.dart';
|
|
||||||
import 'convert.dart';
|
import 'convert.dart';
|
||||||
import 'features.dart';
|
import 'features.dart';
|
||||||
|
|
||||||
@ -537,7 +536,7 @@ class Cache {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String getHostPlatformArchName() {
|
String getHostPlatformArchName() {
|
||||||
return getNameForHostPlatformArch(_osUtils.hostPlatform);
|
return _osUtils.hostPlatform.platformName;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Return a directory in the cache dir. For `pkg`, this will return `bin/cache/pkg`.
|
/// Return a directory in the cache dir. For `pkg`, this will return `bin/cache/pkg`.
|
||||||
|
@ -673,7 +673,7 @@ abstract class _BuildIOSSubCommand extends BuildSubCommand {
|
|||||||
appFilenamePattern: 'App'
|
appFilenamePattern: 'App'
|
||||||
);
|
);
|
||||||
// Only support 64bit iOS code size analysis.
|
// Only support 64bit iOS code size analysis.
|
||||||
final String arch = getNameForDarwinArch(DarwinArch.arm64);
|
final String arch = DarwinArch.arm64.name;
|
||||||
final File aotSnapshot = globals.fs.directory(buildInfo.codeSizeDirectory)
|
final File aotSnapshot = globals.fs.directory(buildInfo.codeSizeDirectory)
|
||||||
.childFile('snapshot.$arch.json');
|
.childFile('snapshot.$arch.json');
|
||||||
final File precompilerTrace = globals.fs.directory(buildInfo.codeSizeDirectory)
|
final File precompilerTrace = globals.fs.directory(buildInfo.codeSizeDirectory)
|
||||||
|
@ -428,7 +428,7 @@ end
|
|||||||
kTargetFile: targetFile,
|
kTargetFile: targetFile,
|
||||||
kTargetPlatform: getNameForTargetPlatform(TargetPlatform.ios),
|
kTargetPlatform: getNameForTargetPlatform(TargetPlatform.ios),
|
||||||
kIosArchs: defaultIOSArchsForEnvironment(sdkType, globals.artifacts!)
|
kIosArchs: defaultIOSArchsForEnvironment(sdkType, globals.artifacts!)
|
||||||
.map(getNameForDarwinArch)
|
.map((DarwinArch e) => e.name)
|
||||||
.join(' '),
|
.join(' '),
|
||||||
kSdkRoot: await globals.xcode!.sdkLocation(sdkType),
|
kSdkRoot: await globals.xcode!.sdkLocation(sdkType),
|
||||||
...buildInfo.toBuildSystemEnvironment(),
|
...buildInfo.toBuildSystemEnvironment(),
|
||||||
|
@ -62,8 +62,8 @@ class BuildLinuxCommand extends BuildSubCommand {
|
|||||||
final TargetPlatform targetPlatform =
|
final TargetPlatform targetPlatform =
|
||||||
getTargetPlatformForName(stringArg('target-platform')!);
|
getTargetPlatformForName(stringArg('target-platform')!);
|
||||||
final bool needCrossBuild =
|
final bool needCrossBuild =
|
||||||
getNameForHostPlatformArch(_operatingSystemUtils.hostPlatform)
|
_operatingSystemUtils.hostPlatform.platformName
|
||||||
!= getNameForTargetPlatformArch(targetPlatform);
|
!= targetPlatform.simpleName;
|
||||||
|
|
||||||
if (!featureFlags.isLinuxEnabled) {
|
if (!featureFlags.isLinuxEnabled) {
|
||||||
throwToolExit('"build linux" is not currently supported. To enable, run "flutter config --enable-linux-desktop".');
|
throwToolExit('"build linux" is not currently supported. To enable, run "flutter config --enable-linux-desktop".');
|
||||||
|
@ -195,7 +195,7 @@ end
|
|||||||
kTargetFile: targetFile,
|
kTargetFile: targetFile,
|
||||||
kTargetPlatform: getNameForTargetPlatform(TargetPlatform.darwin),
|
kTargetPlatform: getNameForTargetPlatform(TargetPlatform.darwin),
|
||||||
kDarwinArchs: defaultMacOSArchsForEnvironment(globals.artifacts!)
|
kDarwinArchs: defaultMacOSArchsForEnvironment(globals.artifacts!)
|
||||||
.map(getNameForDarwinArch)
|
.map((DarwinArch e) => e.name)
|
||||||
.join(' '),
|
.join(' '),
|
||||||
...buildInfo.toBuildSystemEnvironment(),
|
...buildInfo.toBuildSystemEnvironment(),
|
||||||
},
|
},
|
||||||
|
@ -296,7 +296,7 @@ Future<XcodeBuildResult> buildXcodeProject({
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (activeArch != null) {
|
if (activeArch != null) {
|
||||||
final String activeArchName = getNameForDarwinArch(activeArch);
|
final String activeArchName = activeArch.name;
|
||||||
buildCommands.add('ONLY_ACTIVE_ARCH=YES');
|
buildCommands.add('ONLY_ACTIVE_ARCH=YES');
|
||||||
// Setting ARCHS to $activeArchName will break the build if a watchOS companion app exists,
|
// Setting ARCHS to $activeArchName will break the build if a watchOS companion app exists,
|
||||||
// as it cannot be build for the architecture of the Flutter app.
|
// as it cannot be build for the architecture of the Flutter app.
|
||||||
|
@ -141,7 +141,7 @@ Future<void> buildMacOS({
|
|||||||
throwToolExit('Build process failed');
|
throwToolExit('Build process failed');
|
||||||
}
|
}
|
||||||
if (buildInfo.codeSizeDirectory != null && sizeAnalyzer != null) {
|
if (buildInfo.codeSizeDirectory != null && sizeAnalyzer != null) {
|
||||||
final String arch = getNameForDarwinArch(DarwinArch.x86_64);
|
final String arch = DarwinArch.x86_64.name;
|
||||||
final File aotSnapshot = globals.fs.directory(buildInfo.codeSizeDirectory)
|
final File aotSnapshot = globals.fs.directory(buildInfo.codeSizeDirectory)
|
||||||
.childFile('snapshot.$arch.json');
|
.childFile('snapshot.$arch.json');
|
||||||
final File precompilerTrace = globals.fs.directory(buildInfo.codeSizeDirectory)
|
final File precompilerTrace = globals.fs.directory(buildInfo.codeSizeDirectory)
|
||||||
|
@ -632,7 +632,7 @@ class XCDevice {
|
|||||||
}
|
}
|
||||||
_logger.printWarning(
|
_logger.printWarning(
|
||||||
'Unknown architecture $architecture, defaulting to '
|
'Unknown architecture $architecture, defaulting to '
|
||||||
'${getNameForDarwinArch(cpuArchitecture)}',
|
'${cpuArchitecture.name}',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -56,8 +56,7 @@ void main() {
|
|||||||
TargetPlatform.android_x64,
|
TargetPlatform.android_x64,
|
||||||
]) {
|
]) {
|
||||||
testWithoutContext('AndroidDevice.startApp allows release builds on $targetPlatform', () async {
|
testWithoutContext('AndroidDevice.startApp allows release builds on $targetPlatform', () async {
|
||||||
final String arch = getNameForAndroidArch(
|
final String arch = getAndroidArchForName(getNameForTargetPlatform(targetPlatform)).archName;
|
||||||
getAndroidArchForName(getNameForTargetPlatform(targetPlatform)));
|
|
||||||
final AndroidDevice device = AndroidDevice('1234', modelID: 'TestModel',
|
final AndroidDevice device = AndroidDevice('1234', modelID: 'TestModel',
|
||||||
fileSystem: fileSystem,
|
fileSystem: fileSystem,
|
||||||
processManager: processManager,
|
processManager: processManager,
|
||||||
|
@ -83,15 +83,15 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
testWithoutContext('getDartNameForDarwinArch returns name used in Dart SDK', () {
|
testWithoutContext('getDartNameForDarwinArch returns name used in Dart SDK', () {
|
||||||
expect(getDartNameForDarwinArch(DarwinArch.armv7), 'armv7');
|
expect(DarwinArch.armv7.dartName, 'armv7');
|
||||||
expect(getDartNameForDarwinArch(DarwinArch.arm64), 'arm64');
|
expect(DarwinArch.arm64.dartName, 'arm64');
|
||||||
expect(getDartNameForDarwinArch(DarwinArch.x86_64), 'x64');
|
expect(DarwinArch.x86_64.dartName, 'x64');
|
||||||
});
|
});
|
||||||
|
|
||||||
testWithoutContext('getNameForDarwinArch returns Apple names', () {
|
testWithoutContext('getNameForDarwinArch returns Apple names', () {
|
||||||
expect(getNameForDarwinArch(DarwinArch.armv7), 'armv7');
|
expect(DarwinArch.armv7.name, 'armv7');
|
||||||
expect(getNameForDarwinArch(DarwinArch.arm64), 'arm64');
|
expect(DarwinArch.arm64.name, 'arm64');
|
||||||
expect(getNameForDarwinArch(DarwinArch.x86_64), 'x86_64');
|
expect(DarwinArch.x86_64.name, 'x86_64');
|
||||||
});
|
});
|
||||||
|
|
||||||
testWithoutContext('getNameForTargetPlatform on Darwin arches', () {
|
testWithoutContext('getNameForTargetPlatform on Darwin arches', () {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user