mirror of
https://github.com/flutter/flutter
synced 2024-08-24 18:36:03 +00:00
Reverts flutter/flutter#143244 Initiated by: vashworth Reason for reverting: Increased `flutter_framework_uncompressed_bytes` - see https://github.com/flutter/flutter/issues/144251 Original PR Author: vashworth Reviewed By: {jmagman} This change reverts the following previous change: Original Description: Replace `FlutterMacOS.framework` cached artifact with `FlutterMacOS.xcframework`. Also, update usage of `FlutterMacOS.framework` to use `FlutterMacOS.xcframework`. Part of https://github.com/flutter/flutter/issues/126016.
This commit is contained in:
parent
616a0260fe
commit
7f2b238c55
|
@ -1728,9 +1728,9 @@ List<String> binariesWithEntitlements(String flutterRoot) {
|
||||||
/// cache.
|
/// cache.
|
||||||
List<String> binariesWithoutEntitlements(String flutterRoot) {
|
List<String> binariesWithoutEntitlements(String flutterRoot) {
|
||||||
return <String>[
|
return <String>[
|
||||||
'artifacts/engine/darwin-x64-profile/FlutterMacOS.xcframework/macos-arm64_x86_64/FlutterMacOS.framework/Versions/A/FlutterMacOS',
|
'artifacts/engine/darwin-x64-profile/FlutterMacOS.framework/Versions/A/FlutterMacOS',
|
||||||
'artifacts/engine/darwin-x64-release/FlutterMacOS.xcframework/macos-arm64_x86_64/FlutterMacOS.framework/Versions/A/FlutterMacOS',
|
'artifacts/engine/darwin-x64-release/FlutterMacOS.framework/Versions/A/FlutterMacOS',
|
||||||
'artifacts/engine/darwin-x64/FlutterMacOS.xcframework/macos-arm64_x86_64/FlutterMacOS.framework/Versions/A/FlutterMacOS',
|
'artifacts/engine/darwin-x64/FlutterMacOS.framework/Versions/A/FlutterMacOS',
|
||||||
'artifacts/engine/darwin-x64/font-subset',
|
'artifacts/engine/darwin-x64/font-subset',
|
||||||
'artifacts/engine/darwin-x64/impellerc',
|
'artifacts/engine/darwin-x64/impellerc',
|
||||||
'artifacts/engine/darwin-x64/libpath_ops.dylib',
|
'artifacts/engine/darwin-x64/libpath_ops.dylib',
|
||||||
|
@ -1764,9 +1764,6 @@ List<String> signedXcframeworks(String flutterRoot) {
|
||||||
'artifacts/engine/ios-release/extension_safe/Flutter.xcframework',
|
'artifacts/engine/ios-release/extension_safe/Flutter.xcframework',
|
||||||
'artifacts/engine/ios/Flutter.xcframework',
|
'artifacts/engine/ios/Flutter.xcframework',
|
||||||
'artifacts/engine/ios/extension_safe/Flutter.xcframework',
|
'artifacts/engine/ios/extension_safe/Flutter.xcframework',
|
||||||
'artifacts/engine/darwin-x64-profile/FlutterMacOS.xcframework',
|
|
||||||
'artifacts/engine/darwin-x64-release/FlutterMacOS.xcframework',
|
|
||||||
'artifacts/engine/darwin-x64/FlutterMacOS.xcframework',
|
|
||||||
]
|
]
|
||||||
.map((String relativePath) => path.join(flutterRoot, 'bin', 'cache', relativePath)).toList();
|
.map((String relativePath) => path.join(flutterRoot, 'bin', 'cache', relativePath)).toList();
|
||||||
}
|
}
|
||||||
|
|
|
@ -118,12 +118,6 @@ class PluginTest {
|
||||||
// Currently this test is only implemented for macOS; it can be extended to
|
// Currently this test is only implemented for macOS; it can be extended to
|
||||||
// others as needed.
|
// others as needed.
|
||||||
if (buildTarget == 'macos') {
|
if (buildTarget == 'macos') {
|
||||||
// When using a local engine, podhelper.rb will search for a "macos-"
|
|
||||||
// directory within the FlutterMacOS.xcframework, so create a dummy one.
|
|
||||||
Directory(
|
|
||||||
path.join(buildDir.path, 'FlutterMacOS.xcframework/macos-arm64_x86_64'),
|
|
||||||
).createSync(recursive: true);
|
|
||||||
|
|
||||||
// Clean before regenerating the config to ensure that the pod steps run.
|
// Clean before regenerating the config to ensure that the pod steps run.
|
||||||
await inDirectory(Directory(app.rootPath), () async {
|
await inDirectory(Directory(app.rootPath), () async {
|
||||||
await evalFlutter('clean');
|
await evalFlutter('clean');
|
||||||
|
|
|
@ -137,8 +137,8 @@ def flutter_additional_macos_build_settings(target)
|
||||||
# This podhelper script is at $FLUTTER_ROOT/packages/flutter_tools/bin.
|
# This podhelper script is at $FLUTTER_ROOT/packages/flutter_tools/bin.
|
||||||
# Add search paths from $FLUTTER_ROOT/bin/cache/artifacts/engine.
|
# Add search paths from $FLUTTER_ROOT/bin/cache/artifacts/engine.
|
||||||
artifacts_dir = File.join('..', '..', '..', '..', 'bin', 'cache', 'artifacts', 'engine')
|
artifacts_dir = File.join('..', '..', '..', '..', 'bin', 'cache', 'artifacts', 'engine')
|
||||||
debug_framework_dir = File.expand_path(File.join(artifacts_dir, 'darwin-x64', 'FlutterMacOS.xcframework'), __FILE__)
|
debug_framework_dir = File.expand_path(File.join(artifacts_dir, 'darwin-x64'), __FILE__)
|
||||||
release_framework_dir = File.expand_path(File.join(artifacts_dir, 'darwin-x64-release', 'FlutterMacOS.xcframework'), __FILE__)
|
release_framework_dir = File.expand_path(File.join(artifacts_dir, 'darwin-x64-release'), __FILE__)
|
||||||
application_path = File.dirname(defined_in_file.realpath) if respond_to?(:defined_in_file)
|
application_path = File.dirname(defined_in_file.realpath) if respond_to?(:defined_in_file)
|
||||||
# Find the local engine path, if any.
|
# Find the local engine path, if any.
|
||||||
local_engine = application_path.nil? ?
|
local_engine = application_path.nil? ?
|
||||||
|
@ -156,17 +156,9 @@ def flutter_additional_macos_build_settings(target)
|
||||||
# Skip other updates if it does not depend on Flutter (including transitive dependency)
|
# Skip other updates if it does not depend on Flutter (including transitive dependency)
|
||||||
next unless depends_on_flutter(target, 'FlutterMacOS')
|
next unless depends_on_flutter(target, 'FlutterMacOS')
|
||||||
|
|
||||||
if local_engine
|
# Profile can't be derived from the CocoaPods build configuration. Use release framework (for linking only).
|
||||||
configuration_engine_dir = File.expand_path(File.join(local_engine, 'FlutterMacOS.xcframework'), __FILE__)
|
configuration_engine_dir = local_engine || (build_configuration.type == :debug ? debug_framework_dir : release_framework_dir)
|
||||||
else
|
build_configuration.build_settings['FRAMEWORK_SEARCH_PATHS'] = "\"#{configuration_engine_dir}\" $(inherited)"
|
||||||
# Profile can't be derived from the CocoaPods build configuration. Use release framework (for linking only).
|
|
||||||
configuration_engine_dir = (build_configuration.type == :debug ? debug_framework_dir : release_framework_dir)
|
|
||||||
end
|
|
||||||
Dir.new(configuration_engine_dir).each_child do |xcframework_file|
|
|
||||||
if xcframework_file.start_with?('macos-') # Could be macos-arm64_x86_64, macos-arm64, macos-x86_64
|
|
||||||
build_configuration.build_settings['FRAMEWORK_SEARCH_PATHS'] = "\"#{configuration_engine_dir}/#{xcframework_file}\" $(inherited)"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# When deleted, the deployment version will inherit from the higher version derived from the 'Runner' target.
|
# When deleted, the deployment version will inherit from the higher version derived from the 'Runner' target.
|
||||||
# If the pod only supports a higher version, do not delete to correctly produce an error.
|
# If the pod only supports a higher version, do not delete to correctly produce an error.
|
||||||
|
|
|
@ -25,7 +25,6 @@ enum Artifact {
|
||||||
flutterXcframework,
|
flutterXcframework,
|
||||||
/// The framework directory of the macOS desktop.
|
/// The framework directory of the macOS desktop.
|
||||||
flutterMacOSFramework,
|
flutterMacOSFramework,
|
||||||
flutterMacOSXcframework,
|
|
||||||
vmSnapshotData,
|
vmSnapshotData,
|
||||||
isolateSnapshotData,
|
isolateSnapshotData,
|
||||||
icuData,
|
icuData,
|
||||||
|
@ -185,8 +184,6 @@ String? _artifactToFileName(Artifact artifact, Platform hostPlatform, [ BuildMod
|
||||||
return 'Flutter.xcframework';
|
return 'Flutter.xcframework';
|
||||||
case Artifact.flutterMacOSFramework:
|
case Artifact.flutterMacOSFramework:
|
||||||
return 'FlutterMacOS.framework';
|
return 'FlutterMacOS.framework';
|
||||||
case Artifact.flutterMacOSXcframework:
|
|
||||||
return 'FlutterMacOS.xcframework';
|
|
||||||
case Artifact.vmSnapshotData:
|
case Artifact.vmSnapshotData:
|
||||||
return 'vm_isolate_snapshot.bin';
|
return 'vm_isolate_snapshot.bin';
|
||||||
case Artifact.isolateSnapshotData:
|
case Artifact.isolateSnapshotData:
|
||||||
|
@ -601,10 +598,6 @@ class CachedArtifacts implements Artifacts {
|
||||||
final String engineDir = _getEngineArtifactsPath(platform, mode)!;
|
final String engineDir = _getEngineArtifactsPath(platform, mode)!;
|
||||||
return _fileSystem.path.join(engineDir, _artifactToFileName(artifact, _platform));
|
return _fileSystem.path.join(engineDir, _artifactToFileName(artifact, _platform));
|
||||||
}
|
}
|
||||||
if (platform != null && artifact == Artifact.flutterMacOSFramework) {
|
|
||||||
final String engineDir = _getEngineArtifactsPath(platform, mode)!;
|
|
||||||
return _getMacOSEngineArtifactPath(engineDir, _fileSystem, _platform);
|
|
||||||
}
|
|
||||||
return _getHostArtifactPath(artifact, platform ?? _currentHostPlatform(_platform, _operatingSystemUtils), mode);
|
return _getHostArtifactPath(artifact, platform ?? _currentHostPlatform(_platform, _operatingSystemUtils), mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -624,7 +617,6 @@ class CachedArtifacts implements Artifacts {
|
||||||
case Artifact.constFinder:
|
case Artifact.constFinder:
|
||||||
case Artifact.flutterFramework:
|
case Artifact.flutterFramework:
|
||||||
case Artifact.flutterMacOSFramework:
|
case Artifact.flutterMacOSFramework:
|
||||||
case Artifact.flutterMacOSXcframework:
|
|
||||||
case Artifact.flutterPatchedSdkPath:
|
case Artifact.flutterPatchedSdkPath:
|
||||||
case Artifact.flutterTester:
|
case Artifact.flutterTester:
|
||||||
case Artifact.flutterXcframework:
|
case Artifact.flutterXcframework:
|
||||||
|
@ -665,7 +657,6 @@ class CachedArtifacts implements Artifacts {
|
||||||
case Artifact.frontendServerSnapshotForEngineDartSdk:
|
case Artifact.frontendServerSnapshotForEngineDartSdk:
|
||||||
case Artifact.constFinder:
|
case Artifact.constFinder:
|
||||||
case Artifact.flutterMacOSFramework:
|
case Artifact.flutterMacOSFramework:
|
||||||
case Artifact.flutterMacOSXcframework:
|
|
||||||
case Artifact.flutterPatchedSdkPath:
|
case Artifact.flutterPatchedSdkPath:
|
||||||
case Artifact.flutterTester:
|
case Artifact.flutterTester:
|
||||||
case Artifact.fontSubset:
|
case Artifact.fontSubset:
|
||||||
|
@ -714,7 +705,6 @@ class CachedArtifacts implements Artifacts {
|
||||||
case Artifact.constFinder:
|
case Artifact.constFinder:
|
||||||
case Artifact.flutterFramework:
|
case Artifact.flutterFramework:
|
||||||
case Artifact.flutterMacOSFramework:
|
case Artifact.flutterMacOSFramework:
|
||||||
case Artifact.flutterMacOSXcframework:
|
|
||||||
case Artifact.flutterTester:
|
case Artifact.flutterTester:
|
||||||
case Artifact.flutterXcframework:
|
case Artifact.flutterXcframework:
|
||||||
case Artifact.fontSubset:
|
case Artifact.fontSubset:
|
||||||
|
@ -781,13 +771,6 @@ class CachedArtifacts implements Artifacts {
|
||||||
case Artifact.engineDartAotRuntime:
|
case Artifact.engineDartAotRuntime:
|
||||||
return _fileSystem.path.join(_dartSdkPath(_cache), 'bin', _artifactToFileName(artifact, _platform));
|
return _fileSystem.path.join(_dartSdkPath(_cache), 'bin', _artifactToFileName(artifact, _platform));
|
||||||
case Artifact.flutterMacOSFramework:
|
case Artifact.flutterMacOSFramework:
|
||||||
String platformDirName = _enginePlatformDirectoryName(platform);
|
|
||||||
if (mode == BuildMode.profile || mode == BuildMode.release) {
|
|
||||||
platformDirName = '$platformDirName-${mode!.cliName}';
|
|
||||||
}
|
|
||||||
final String engineArtifactsPath = _cache.getArtifactDirectory('engine').path;
|
|
||||||
return _getMacOSEngineArtifactPath(_fileSystem.path.join(engineArtifactsPath, platformDirName), _fileSystem, _platform);
|
|
||||||
case Artifact.flutterMacOSXcframework:
|
|
||||||
case Artifact.linuxDesktopPath:
|
case Artifact.linuxDesktopPath:
|
||||||
case Artifact.windowsDesktopPath:
|
case Artifact.windowsDesktopPath:
|
||||||
case Artifact.linuxHeaders:
|
case Artifact.linuxHeaders:
|
||||||
|
@ -913,33 +896,6 @@ String _getIosEngineArtifactPath(String engineDirectory,
|
||||||
.path;
|
.path;
|
||||||
}
|
}
|
||||||
|
|
||||||
String _getMacOSEngineArtifactPath(
|
|
||||||
String engineDirectory,
|
|
||||||
FileSystem fileSystem,
|
|
||||||
Platform hostPlatform,
|
|
||||||
) {
|
|
||||||
final Directory xcframeworkDirectory = fileSystem
|
|
||||||
.directory(engineDirectory)
|
|
||||||
.childDirectory(_artifactToFileName(Artifact.flutterMacOSXcframework, hostPlatform)!);
|
|
||||||
|
|
||||||
if (!xcframeworkDirectory.existsSync()) {
|
|
||||||
throwToolExit('No xcframework found at ${xcframeworkDirectory.path}. Try running "flutter precache --macos".');
|
|
||||||
}
|
|
||||||
final Directory? flutterFrameworkSource = xcframeworkDirectory
|
|
||||||
.listSync()
|
|
||||||
.whereType<Directory>()
|
|
||||||
.where((Directory platformDirectory) =>
|
|
||||||
platformDirectory.basename.startsWith('macos-'))
|
|
||||||
.firstOrNull;
|
|
||||||
if (flutterFrameworkSource == null) {
|
|
||||||
throwToolExit('No macOS frameworks found in ${xcframeworkDirectory.path}');
|
|
||||||
}
|
|
||||||
|
|
||||||
return flutterFrameworkSource
|
|
||||||
.childDirectory(_artifactToFileName(Artifact.flutterMacOSFramework, hostPlatform)!)
|
|
||||||
.path;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Manages the artifacts of a locally built engine.
|
/// Manages the artifacts of a locally built engine.
|
||||||
class CachedLocalEngineArtifacts implements Artifacts {
|
class CachedLocalEngineArtifacts implements Artifacts {
|
||||||
CachedLocalEngineArtifacts(
|
CachedLocalEngineArtifacts(
|
||||||
|
@ -1098,7 +1054,7 @@ class CachedLocalEngineArtifacts implements Artifacts {
|
||||||
return _fileSystem.path.join(localEngineInfo.targetOutPath, 'gen', 'flutter', 'lib', 'snapshot', artifactFileName);
|
return _fileSystem.path.join(localEngineInfo.targetOutPath, 'gen', 'flutter', 'lib', 'snapshot', artifactFileName);
|
||||||
case Artifact.icuData:
|
case Artifact.icuData:
|
||||||
case Artifact.flutterXcframework:
|
case Artifact.flutterXcframework:
|
||||||
case Artifact.flutterMacOSXcframework:
|
case Artifact.flutterMacOSFramework:
|
||||||
return _fileSystem.path.join(localEngineInfo.targetOutPath, artifactFileName);
|
return _fileSystem.path.join(localEngineInfo.targetOutPath, artifactFileName);
|
||||||
case Artifact.platformKernelDill:
|
case Artifact.platformKernelDill:
|
||||||
if (platform == TargetPlatform.fuchsia_x64 || platform == TargetPlatform.fuchsia_arm64) {
|
if (platform == TargetPlatform.fuchsia_x64 || platform == TargetPlatform.fuchsia_arm64) {
|
||||||
|
@ -1110,9 +1066,6 @@ class CachedLocalEngineArtifacts implements Artifacts {
|
||||||
case Artifact.flutterFramework:
|
case Artifact.flutterFramework:
|
||||||
return _getIosEngineArtifactPath(
|
return _getIosEngineArtifactPath(
|
||||||
localEngineInfo.targetOutPath, environmentType, _fileSystem, _platform);
|
localEngineInfo.targetOutPath, environmentType, _fileSystem, _platform);
|
||||||
case Artifact.flutterMacOSFramework:
|
|
||||||
return _getMacOSEngineArtifactPath(
|
|
||||||
localEngineInfo.targetOutPath, _fileSystem, _platform);
|
|
||||||
case Artifact.flutterPatchedSdkPath:
|
case Artifact.flutterPatchedSdkPath:
|
||||||
// When using local engine always use [BuildMode.debug] regardless of
|
// When using local engine always use [BuildMode.debug] regardless of
|
||||||
// what was specified in [mode] argument because local engine will
|
// what was specified in [mode] argument because local engine will
|
||||||
|
@ -1293,7 +1246,6 @@ class CachedLocalWebSdkArtifacts implements Artifacts {
|
||||||
case Artifact.flutterFramework:
|
case Artifact.flutterFramework:
|
||||||
case Artifact.flutterXcframework:
|
case Artifact.flutterXcframework:
|
||||||
case Artifact.flutterMacOSFramework:
|
case Artifact.flutterMacOSFramework:
|
||||||
case Artifact.flutterMacOSXcframework:
|
|
||||||
case Artifact.vmSnapshotData:
|
case Artifact.vmSnapshotData:
|
||||||
case Artifact.isolateSnapshotData:
|
case Artifact.isolateSnapshotData:
|
||||||
case Artifact.icuData:
|
case Artifact.icuData:
|
||||||
|
|
|
@ -157,7 +157,7 @@ class ReleaseUnpackMacOS extends UnpackMacOS {
|
||||||
@override
|
@override
|
||||||
List<Source> get inputs => <Source>[
|
List<Source> get inputs => <Source>[
|
||||||
...super.inputs,
|
...super.inputs,
|
||||||
const Source.artifact(Artifact.flutterMacOSXcframework, mode: BuildMode.release),
|
const Source.artifact(Artifact.flutterMacOSFramework, mode: BuildMode.release),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -171,7 +171,7 @@ class ProfileUnpackMacOS extends UnpackMacOS {
|
||||||
@override
|
@override
|
||||||
List<Source> get inputs => <Source>[
|
List<Source> get inputs => <Source>[
|
||||||
...super.inputs,
|
...super.inputs,
|
||||||
const Source.artifact(Artifact.flutterMacOSXcframework, mode: BuildMode.profile),
|
const Source.artifact(Artifact.flutterMacOSFramework, mode: BuildMode.profile),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -185,7 +185,7 @@ class DebugUnpackMacOS extends UnpackMacOS {
|
||||||
@override
|
@override
|
||||||
List<Source> get inputs => <Source>[
|
List<Source> get inputs => <Source>[
|
||||||
...super.inputs,
|
...super.inputs,
|
||||||
const Source.artifact(Artifact.flutterMacOSXcframework, mode: BuildMode.debug),
|
const Source.artifact(Artifact.flutterMacOSFramework, mode: BuildMode.debug),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -944,6 +944,14 @@ abstract class EngineCachedArtifact extends CachedArtifact {
|
||||||
await artifactUpdater.downloadZipArchive('Downloading $friendlyName tools...', Uri.parse(url + urlPath), dir);
|
await artifactUpdater.downloadZipArchive('Downloading $friendlyName tools...', Uri.parse(url + urlPath), dir);
|
||||||
|
|
||||||
_makeFilesExecutable(dir, operatingSystemUtils);
|
_makeFilesExecutable(dir, operatingSystemUtils);
|
||||||
|
|
||||||
|
final File frameworkZip = fileSystem.file(fileSystem.path.join(dir.path, 'FlutterMacOS.framework.zip'));
|
||||||
|
if (frameworkZip.existsSync()) {
|
||||||
|
final Directory framework = fileSystem.directory(fileSystem.path.join(dir.path, 'FlutterMacOS.framework'));
|
||||||
|
ErrorHandlingFileSystem.deleteIfExists(framework, recursive: true);
|
||||||
|
framework.createSync();
|
||||||
|
operatingSystemUtils.unzip(frameworkZip, framework);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final File licenseSource = cache.getLicenseFile();
|
final File licenseSource = cache.getLicenseFile();
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
|
|
||||||
import 'package:meta/meta.dart';
|
import 'package:meta/meta.dart';
|
||||||
|
|
||||||
import '../artifacts.dart';
|
|
||||||
import '../base/common.dart';
|
import '../base/common.dart';
|
||||||
import '../base/file_system.dart';
|
import '../base/file_system.dart';
|
||||||
import '../base/io.dart';
|
import '../base/io.dart';
|
||||||
|
@ -84,16 +83,13 @@ class BuildMacOSFrameworkCommand extends BuildFrameworkCommand {
|
||||||
|
|
||||||
if (boolArg('cocoapods')) {
|
if (boolArg('cocoapods')) {
|
||||||
produceFlutterPodspec(buildInfo.mode, modeDirectory, force: boolArg('force'));
|
produceFlutterPodspec(buildInfo.mode, modeDirectory, force: boolArg('force'));
|
||||||
} else {
|
|
||||||
await _produceFlutterFramework(buildInfo, modeDirectory);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
final Directory buildOutput = modeDirectory.childDirectory('macos');
|
// Build aot, create App.framework and copy FlutterMacOS.framework. Make XCFrameworks.
|
||||||
|
await _produceAppFramework(buildInfo, modeDirectory);
|
||||||
// Build aot, create App.framework. Make XCFrameworks.
|
|
||||||
await _produceAppFramework(buildInfo, modeDirectory, buildOutput);
|
|
||||||
|
|
||||||
// Build and copy plugins.
|
// Build and copy plugins.
|
||||||
|
final Directory buildOutput = modeDirectory.childDirectory('macos');
|
||||||
await processPodsIfNeeded(project.macos, getMacOSBuildDirectory(), buildInfo.mode);
|
await processPodsIfNeeded(project.macos, getMacOSBuildDirectory(), buildInfo.mode);
|
||||||
if (boolArg('plugins') && hasPlugins(project)) {
|
if (boolArg('plugins') && hasPlugins(project)) {
|
||||||
await _producePlugins(xcodeBuildConfiguration, buildOutput, modeDirectory);
|
await _producePlugins(xcodeBuildConfiguration, buildOutput, modeDirectory);
|
||||||
|
@ -204,15 +200,15 @@ end
|
||||||
Future<void> _produceAppFramework(
|
Future<void> _produceAppFramework(
|
||||||
BuildInfo buildInfo,
|
BuildInfo buildInfo,
|
||||||
Directory outputBuildDirectory,
|
Directory outputBuildDirectory,
|
||||||
Directory macosBuildOutput,
|
|
||||||
) async {
|
) async {
|
||||||
final Status status = globals.logger.startProgress(
|
final Status status = globals.logger.startProgress(
|
||||||
' ├─Building App.xcframework...',
|
' ├─Building App.xcframework and FlutterMacOS.xcframework...',
|
||||||
);
|
);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
final Environment environment = Environment(
|
final Environment environment = Environment(
|
||||||
projectDir: globals.fs.currentDirectory,
|
projectDir: globals.fs.currentDirectory,
|
||||||
outputDir: macosBuildOutput,
|
outputDir: outputBuildDirectory,
|
||||||
buildDir: project.dartTool.childDirectory('flutter_build'),
|
buildDir: project.dartTool.childDirectory('flutter_build'),
|
||||||
cacheDir: globals.cache.getRoot(),
|
cacheDir: globals.cache.getRoot(),
|
||||||
flutterRootDir: globals.fs.directory(Cache.flutterRoot),
|
flutterRootDir: globals.fs.directory(Cache.flutterRoot),
|
||||||
|
@ -255,7 +251,7 @@ end
|
||||||
status.stop();
|
status.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
final Directory appFramework = macosBuildOutput.childDirectory('App.framework');
|
final Directory appFramework = outputBuildDirectory.childDirectory('App.framework');
|
||||||
await BuildFrameworkCommand.produceXCFramework(
|
await BuildFrameworkCommand.produceXCFramework(
|
||||||
<Directory>[appFramework],
|
<Directory>[appFramework],
|
||||||
'App',
|
'App',
|
||||||
|
@ -263,37 +259,18 @@ end
|
||||||
globals.processManager,
|
globals.processManager,
|
||||||
);
|
);
|
||||||
appFramework.deleteSync(recursive: true);
|
appFramework.deleteSync(recursive: true);
|
||||||
}
|
final Directory flutterFramework = outputBuildDirectory.childDirectory('FlutterMacOS.framework');
|
||||||
|
|
||||||
Future<void> _produceFlutterFramework(
|
// If FlutterMacOS.podspec was generated, do not generate XCFramework.
|
||||||
BuildInfo buildInfo,
|
if (!boolArg('cocoapods')) {
|
||||||
Directory modeDirectory,
|
await BuildFrameworkCommand.produceXCFramework(
|
||||||
) async {
|
<Directory>[flutterFramework],
|
||||||
final Status status = globals.logger.startProgress(
|
'FlutterMacOS',
|
||||||
' ├─Copying FlutterMacOS.xcframework...',
|
outputBuildDirectory,
|
||||||
);
|
globals.processManager,
|
||||||
final String engineCacheFlutterFrameworkDirectory = globals.artifacts!.getArtifactPath(
|
|
||||||
Artifact.flutterMacOSXcframework,
|
|
||||||
platform: TargetPlatform.darwin,
|
|
||||||
mode: buildInfo.mode,
|
|
||||||
);
|
|
||||||
final String flutterFrameworkFileName = globals.fs.path.basename(
|
|
||||||
engineCacheFlutterFrameworkDirectory,
|
|
||||||
);
|
|
||||||
final Directory flutterFrameworkCopy = modeDirectory.childDirectory(
|
|
||||||
flutterFrameworkFileName,
|
|
||||||
);
|
|
||||||
|
|
||||||
try {
|
|
||||||
// Copy xcframework engine cache framework to mode directory.
|
|
||||||
copyDirectory(
|
|
||||||
globals.fs.directory(engineCacheFlutterFrameworkDirectory),
|
|
||||||
flutterFrameworkCopy,
|
|
||||||
followLinks: false,
|
|
||||||
);
|
);
|
||||||
} finally {
|
|
||||||
status.stop();
|
|
||||||
}
|
}
|
||||||
|
flutterFramework.deleteSync(recursive: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _producePlugins(
|
Future<void> _producePlugins(
|
||||||
|
|
|
@ -858,12 +858,12 @@ List<List<String>> _getWindowsDesktopBinaryDirs(String arch) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const List<List<String>> _macOSDesktopBinaryDirs = <List<String>>[
|
const List<List<String>> _macOSDesktopBinaryDirs = <List<String>>[
|
||||||
<String>['darwin-x64', 'darwin-x64/framework.zip'],
|
<String>['darwin-x64', 'darwin-x64/FlutterMacOS.framework.zip'],
|
||||||
<String>['darwin-x64', 'darwin-x64/gen_snapshot.zip'],
|
<String>['darwin-x64', 'darwin-x64/gen_snapshot.zip'],
|
||||||
<String>['darwin-x64-profile', 'darwin-x64-profile/framework.zip'],
|
<String>['darwin-x64-profile', 'darwin-x64-profile/FlutterMacOS.framework.zip'],
|
||||||
<String>['darwin-x64-profile', 'darwin-x64-profile/artifacts.zip'],
|
<String>['darwin-x64-profile', 'darwin-x64-profile/artifacts.zip'],
|
||||||
<String>['darwin-x64-profile', 'darwin-x64-profile/gen_snapshot.zip'],
|
<String>['darwin-x64-profile', 'darwin-x64-profile/gen_snapshot.zip'],
|
||||||
<String>['darwin-x64-release', 'darwin-x64-release/framework.zip'],
|
<String>['darwin-x64-release', 'darwin-x64-release/FlutterMacOS.framework.zip'],
|
||||||
<String>['darwin-x64-release', 'darwin-x64-release/artifacts.zip'],
|
<String>['darwin-x64-release', 'darwin-x64-release/artifacts.zip'],
|
||||||
<String>['darwin-x64-release', 'darwin-x64-release/gen_snapshot.zip'],
|
<String>['darwin-x64-release', 'darwin-x64-release/gen_snapshot.zip'],
|
||||||
];
|
];
|
||||||
|
|
|
@ -93,6 +93,12 @@ void main() {
|
||||||
.childDirectory('Flutter.framework')
|
.childDirectory('Flutter.framework')
|
||||||
.createSync(recursive: true);
|
.createSync(recursive: true);
|
||||||
|
|
||||||
|
// TODO(jmagman): Remove ios-arm64_armv7 checks when armv7 engine artifacts are removed.
|
||||||
|
fileSystem
|
||||||
|
.directory(xcframeworkPath)
|
||||||
|
.childDirectory('ios-arm64_armv7')
|
||||||
|
.childDirectory('Flutter.framework')
|
||||||
|
.createSync(recursive: true);
|
||||||
expect(
|
expect(
|
||||||
artifacts.getArtifactPath(Artifact.flutterFramework,
|
artifacts.getArtifactPath(Artifact.flutterFramework,
|
||||||
platform: TargetPlatform.ios,
|
platform: TargetPlatform.ios,
|
||||||
|
@ -112,9 +118,16 @@ void main() {
|
||||||
'ios-arm64',
|
'ios-arm64',
|
||||||
'Flutter.framework',
|
'Flutter.framework',
|
||||||
);
|
);
|
||||||
|
final String expectedArmv7ReleaseFrameworkArtifact = fileSystem.path.join(
|
||||||
|
xcframeworkPath,
|
||||||
|
'ios-arm64_armv7',
|
||||||
|
'Flutter.framework',
|
||||||
|
);
|
||||||
|
|
||||||
|
// TODO(jmagman): Replace with expect(actualReleaseFrameworkArtifact, expectedArm64ReleaseFrameworkArtifact) when armv7 engine artifacts are removed.
|
||||||
expect(
|
expect(
|
||||||
actualReleaseFrameworkArtifact,
|
actualReleaseFrameworkArtifact,
|
||||||
expectedArm64ReleaseFrameworkArtifact,
|
anyOf(expectedArm64ReleaseFrameworkArtifact, expectedArmv7ReleaseFrameworkArtifact),
|
||||||
);
|
);
|
||||||
expect(
|
expect(
|
||||||
artifacts.getArtifactPath(Artifact.flutterXcframework, platform: TargetPlatform.ios, mode: BuildMode.release),
|
artifacts.getArtifactPath(Artifact.flutterXcframework, platform: TargetPlatform.ios, mode: BuildMode.release),
|
||||||
|
@ -135,87 +148,6 @@ void main() {
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
testWithoutContext('getArtifactPath for FlutterMacOS.framework and FlutterMacOS.xcframework', () {
|
|
||||||
final String xcframeworkPath = fileSystem.path.join(
|
|
||||||
'root',
|
|
||||||
'bin',
|
|
||||||
'cache',
|
|
||||||
'artifacts',
|
|
||||||
'engine',
|
|
||||||
'darwin-x64-release',
|
|
||||||
'FlutterMacOS.xcframework',
|
|
||||||
);
|
|
||||||
final String xcframeworkPathWithUnsetPlatform = fileSystem.path.join(
|
|
||||||
'root',
|
|
||||||
'bin',
|
|
||||||
'cache',
|
|
||||||
'artifacts',
|
|
||||||
'engine',
|
|
||||||
'linux-x64-release',
|
|
||||||
'FlutterMacOS.xcframework',
|
|
||||||
);
|
|
||||||
expect(
|
|
||||||
artifacts.getArtifactPath(
|
|
||||||
Artifact.flutterMacOSXcframework,
|
|
||||||
platform: TargetPlatform.darwin,
|
|
||||||
mode: BuildMode.release,
|
|
||||||
),
|
|
||||||
xcframeworkPath,
|
|
||||||
);
|
|
||||||
expect(
|
|
||||||
artifacts.getArtifactPath(
|
|
||||||
Artifact.flutterMacOSXcframework,
|
|
||||||
mode: BuildMode.release,
|
|
||||||
),
|
|
||||||
xcframeworkPathWithUnsetPlatform,
|
|
||||||
);
|
|
||||||
expect(
|
|
||||||
() => artifacts.getArtifactPath(
|
|
||||||
Artifact.flutterMacOSFramework,
|
|
||||||
platform: TargetPlatform.darwin,
|
|
||||||
mode: BuildMode.release,
|
|
||||||
),
|
|
||||||
throwsToolExit(
|
|
||||||
message:
|
|
||||||
'No xcframework found at $xcframeworkPath.'),
|
|
||||||
);
|
|
||||||
expect(
|
|
||||||
() => artifacts.getArtifactPath(
|
|
||||||
Artifact.flutterMacOSFramework,
|
|
||||||
mode: BuildMode.release,
|
|
||||||
),
|
|
||||||
throwsToolExit(
|
|
||||||
message:
|
|
||||||
'No xcframework found at $xcframeworkPathWithUnsetPlatform.'),
|
|
||||||
);
|
|
||||||
fileSystem.directory(xcframeworkPath).createSync(recursive: true);
|
|
||||||
expect(
|
|
||||||
() => artifacts.getArtifactPath(
|
|
||||||
Artifact.flutterMacOSFramework,
|
|
||||||
platform: TargetPlatform.darwin,
|
|
||||||
mode: BuildMode.release,
|
|
||||||
),
|
|
||||||
throwsToolExit(message: 'No macOS frameworks found in $xcframeworkPath'),
|
|
||||||
);
|
|
||||||
fileSystem
|
|
||||||
.directory(xcframeworkPath)
|
|
||||||
.childDirectory('macos-arm64_x86_64')
|
|
||||||
.childDirectory('FlutterMacOS.framework')
|
|
||||||
.createSync(recursive: true);
|
|
||||||
expect(
|
|
||||||
artifacts.getArtifactPath(
|
|
||||||
Artifact.flutterMacOSFramework,
|
|
||||||
platform: TargetPlatform.darwin,
|
|
||||||
mode: BuildMode.release,
|
|
||||||
),
|
|
||||||
fileSystem.path.join(
|
|
||||||
xcframeworkPath,
|
|
||||||
'macos-arm64_x86_64',
|
|
||||||
'FlutterMacOS.framework',
|
|
||||||
),
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
testWithoutContext('Precompiled web AMD module system artifact paths are correct', () {
|
testWithoutContext('Precompiled web AMD module system artifact paths are correct', () {
|
||||||
expect(
|
expect(
|
||||||
artifacts.getHostArtifact(HostArtifact.webPrecompiledAmdSdk).path,
|
artifacts.getHostArtifact(HostArtifact.webPrecompiledAmdSdk).path,
|
||||||
|
@ -337,92 +269,6 @@ void main() {
|
||||||
operatingSystemUtils: FakeOperatingSystemUtils());
|
operatingSystemUtils: FakeOperatingSystemUtils());
|
||||||
});
|
});
|
||||||
|
|
||||||
testWithoutContext('getArtifactPath for FlutterMacOS.framework and FlutterMacOS.xcframework', () {
|
|
||||||
final String xcframeworkPath = fileSystem.path.join(
|
|
||||||
'/out',
|
|
||||||
'android_debug_unopt',
|
|
||||||
'FlutterMacOS.xcframework',
|
|
||||||
);
|
|
||||||
expect(
|
|
||||||
artifacts.getArtifactPath(
|
|
||||||
Artifact.flutterMacOSXcframework,
|
|
||||||
platform: TargetPlatform.darwin,
|
|
||||||
mode: BuildMode.release,
|
|
||||||
),
|
|
||||||
xcframeworkPath,
|
|
||||||
);
|
|
||||||
expect(
|
|
||||||
artifacts.getArtifactPath(
|
|
||||||
Artifact.flutterMacOSXcframework,
|
|
||||||
mode: BuildMode.release,
|
|
||||||
),
|
|
||||||
xcframeworkPath,
|
|
||||||
);
|
|
||||||
expect(
|
|
||||||
() => artifacts.getArtifactPath(
|
|
||||||
Artifact.flutterMacOSFramework,
|
|
||||||
platform: TargetPlatform.darwin,
|
|
||||||
mode: BuildMode.release,
|
|
||||||
),
|
|
||||||
throwsToolExit(
|
|
||||||
message:
|
|
||||||
'No xcframework found at /out/android_debug_unopt/FlutterMacOS.xcframework'),
|
|
||||||
);
|
|
||||||
expect(
|
|
||||||
() => artifacts.getArtifactPath(
|
|
||||||
Artifact.flutterMacOSFramework,
|
|
||||||
mode: BuildMode.release,
|
|
||||||
),
|
|
||||||
throwsToolExit(
|
|
||||||
message:
|
|
||||||
'No xcframework found at /out/android_debug_unopt/FlutterMacOS.xcframework'),
|
|
||||||
);
|
|
||||||
fileSystem.directory(xcframeworkPath).createSync(recursive: true);
|
|
||||||
expect(
|
|
||||||
() => artifacts.getArtifactPath(
|
|
||||||
Artifact.flutterMacOSFramework,
|
|
||||||
platform: TargetPlatform.darwin,
|
|
||||||
mode: BuildMode.release,
|
|
||||||
),
|
|
||||||
throwsToolExit(
|
|
||||||
message:
|
|
||||||
'No macOS frameworks found in /out/android_debug_unopt/FlutterMacOS.xcframework'),
|
|
||||||
);
|
|
||||||
expect(
|
|
||||||
() => artifacts.getArtifactPath(
|
|
||||||
Artifact.flutterMacOSFramework,
|
|
||||||
mode: BuildMode.release,
|
|
||||||
),
|
|
||||||
throwsToolExit(
|
|
||||||
message:
|
|
||||||
'No macOS frameworks found in /out/android_debug_unopt/FlutterMacOS.xcframework'),
|
|
||||||
);
|
|
||||||
|
|
||||||
fileSystem
|
|
||||||
.directory(xcframeworkPath)
|
|
||||||
.childDirectory('macos-arm64_x86_64')
|
|
||||||
.childDirectory('FlutterMacOS.framework')
|
|
||||||
.createSync(recursive: true);
|
|
||||||
|
|
||||||
expect(
|
|
||||||
artifacts.getArtifactPath(
|
|
||||||
Artifact.flutterMacOSFramework,
|
|
||||||
platform: TargetPlatform.darwin,
|
|
||||||
mode: BuildMode.release,
|
|
||||||
),
|
|
||||||
fileSystem.path
|
|
||||||
.join(xcframeworkPath, 'macos-arm64_x86_64', 'FlutterMacOS.framework'),
|
|
||||||
);
|
|
||||||
expect(
|
|
||||||
artifacts.getArtifactPath(
|
|
||||||
Artifact.flutterMacOSFramework,
|
|
||||||
mode: BuildMode.release,
|
|
||||||
),
|
|
||||||
fileSystem.path
|
|
||||||
.join(xcframeworkPath, 'macos-arm64_x86_64', 'FlutterMacOS.framework'),
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
testWithoutContext('getArtifactPath', () {
|
testWithoutContext('getArtifactPath', () {
|
||||||
final String xcframeworkPath = artifacts.getArtifactPath(
|
final String xcframeworkPath = artifacts.getArtifactPath(
|
||||||
Artifact.flutterXcframework,
|
Artifact.flutterXcframework,
|
||||||
|
@ -465,7 +311,7 @@ void main() {
|
||||||
.createSync(recursive: true);
|
.createSync(recursive: true);
|
||||||
fileSystem
|
fileSystem
|
||||||
.directory(xcframeworkPath)
|
.directory(xcframeworkPath)
|
||||||
.childDirectory('ios-arm64')
|
.childDirectory('ios-arm64_armv7')
|
||||||
.childDirectory('Flutter.framework')
|
.childDirectory('Flutter.framework')
|
||||||
.createSync(recursive: true);
|
.createSync(recursive: true);
|
||||||
fileSystem
|
fileSystem
|
||||||
|
@ -493,7 +339,7 @@ void main() {
|
||||||
environmentType: EnvironmentType.physical,
|
environmentType: EnvironmentType.physical,
|
||||||
),
|
),
|
||||||
fileSystem.path
|
fileSystem.path
|
||||||
.join(xcframeworkPath, 'ios-arm64', 'Flutter.framework'),
|
.join(xcframeworkPath, 'ios-arm64_armv7', 'Flutter.framework'),
|
||||||
);
|
);
|
||||||
expect(
|
expect(
|
||||||
artifacts.getArtifactPath(
|
artifacts.getArtifactPath(
|
||||||
|
|
|
@ -393,6 +393,33 @@ void main() {
|
||||||
expect(operatingSystemUtils.chmods, <List<String>>[<String>['/.tmp_rand0/flutter_cache_test_artifact.rand0/bin_dir', 'a+r,a+x']]);
|
expect(operatingSystemUtils.chmods, <List<String>>[<String>['/.tmp_rand0/flutter_cache_test_artifact.rand0/bin_dir', 'a+r,a+x']]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
testWithoutContext('EngineCachedArtifact removes unzipped FlutterMacOS.framework before replacing', () async {
|
||||||
|
final OperatingSystemUtils operatingSystemUtils = FakeOperatingSystemUtils();
|
||||||
|
final FileSystem fileSystem = MemoryFileSystem.test();
|
||||||
|
final Directory artifactDir = fileSystem.systemTempDirectory.createTempSync('flutter_cache_test_artifact.');
|
||||||
|
final Directory downloadDir = fileSystem.systemTempDirectory.createTempSync('flutter_cache_test_download.');
|
||||||
|
final FakeSecondaryCache cache = FakeSecondaryCache()
|
||||||
|
..artifactDirectory = artifactDir
|
||||||
|
..downloadDir = downloadDir;
|
||||||
|
|
||||||
|
final Directory binDir = artifactDir.childDirectory('bin_dir')..createSync();
|
||||||
|
binDir.childFile('FlutterMacOS.framework.zip').createSync();
|
||||||
|
final Directory unzippedFramework = binDir.childDirectory('FlutterMacOS.framework');
|
||||||
|
final File staleFile = unzippedFramework.childFile('stale_file')..createSync(recursive: true);
|
||||||
|
artifactDir.childFile('unused_url_path').createSync();
|
||||||
|
|
||||||
|
final FakeCachedArtifact artifact = FakeCachedArtifact(
|
||||||
|
cache: cache,
|
||||||
|
binaryDirs: <List<String>>[
|
||||||
|
<String>['bin_dir', 'unused_url_path'],
|
||||||
|
],
|
||||||
|
requiredArtifacts: DevelopmentArtifact.universal,
|
||||||
|
);
|
||||||
|
await artifact.updateInner(FakeArtifactUpdater(), fileSystem, operatingSystemUtils);
|
||||||
|
expect(unzippedFramework, exists);
|
||||||
|
expect(staleFile, isNot(exists));
|
||||||
|
});
|
||||||
|
|
||||||
testWithoutContext('Try to remove without a parent', () async {
|
testWithoutContext('Try to remove without a parent', () async {
|
||||||
final FileSystem fileSystem = MemoryFileSystem.test();
|
final FileSystem fileSystem = MemoryFileSystem.test();
|
||||||
final Directory parent = fileSystem.directory('dir');
|
final Directory parent = fileSystem.directory('dir');
|
||||||
|
|
|
@ -24,38 +24,6 @@ void main() {
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('verify FlutterMacOS.xcframework artifact', () {
|
|
||||||
final String flutterRoot = getFlutterRoot();
|
|
||||||
|
|
||||||
final Directory xcframeworkArtifact = fileSystem.directory(
|
|
||||||
fileSystem.path.join(
|
|
||||||
flutterRoot,
|
|
||||||
'bin',
|
|
||||||
'cache',
|
|
||||||
'artifacts',
|
|
||||||
'engine',
|
|
||||||
'darwin-x64',
|
|
||||||
'FlutterMacOS.xcframework',
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
final Directory tempDir = createResolvedTempDirectorySync('macos_content_validation.');
|
|
||||||
|
|
||||||
// Pre-cache iOS engine Flutter.xcframework artifacts.
|
|
||||||
final ProcessResult result = processManager.runSync(
|
|
||||||
<String>[
|
|
||||||
flutterBin,
|
|
||||||
...getLocalEngineArguments(),
|
|
||||||
'precache',
|
|
||||||
'--macos',
|
|
||||||
],
|
|
||||||
workingDirectory: tempDir.path,
|
|
||||||
);
|
|
||||||
|
|
||||||
expect(result, const ProcessResultMatcher());
|
|
||||||
expect(xcframeworkArtifact.existsSync(), isTrue);
|
|
||||||
});
|
|
||||||
|
|
||||||
for (final String buildMode in <String>['Debug', 'Release']) {
|
for (final String buildMode in <String>['Debug', 'Release']) {
|
||||||
final String buildModeLower = buildMode.toLowerCase();
|
final String buildModeLower = buildMode.toLowerCase();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue