Skip to content

Commit 7f2b238

Browse files
Reverts "Add FlutterMacOS.xcframework artifact (#143244)" (#144253)
Reverts flutter/flutter#143244 Initiated by: vashworth Reason for reverting: Increased `flutter_framework_uncompressed_bytes` - see flutter/flutter#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 flutter/flutter#126016.
1 parent 616a026 commit 7f2b238

File tree

11 files changed

+83
-322
lines changed

11 files changed

+83
-322
lines changed

dev/bots/test.dart

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1728,9 +1728,9 @@ List<String> binariesWithEntitlements(String flutterRoot) {
17281728
/// cache.
17291729
List<String> binariesWithoutEntitlements(String flutterRoot) {
17301730
return <String>[
1731-
'artifacts/engine/darwin-x64-profile/FlutterMacOS.xcframework/macos-arm64_x86_64/FlutterMacOS.framework/Versions/A/FlutterMacOS',
1732-
'artifacts/engine/darwin-x64-release/FlutterMacOS.xcframework/macos-arm64_x86_64/FlutterMacOS.framework/Versions/A/FlutterMacOS',
1733-
'artifacts/engine/darwin-x64/FlutterMacOS.xcframework/macos-arm64_x86_64/FlutterMacOS.framework/Versions/A/FlutterMacOS',
1731+
'artifacts/engine/darwin-x64-profile/FlutterMacOS.framework/Versions/A/FlutterMacOS',
1732+
'artifacts/engine/darwin-x64-release/FlutterMacOS.framework/Versions/A/FlutterMacOS',
1733+
'artifacts/engine/darwin-x64/FlutterMacOS.framework/Versions/A/FlutterMacOS',
17341734
'artifacts/engine/darwin-x64/font-subset',
17351735
'artifacts/engine/darwin-x64/impellerc',
17361736
'artifacts/engine/darwin-x64/libpath_ops.dylib',
@@ -1764,9 +1764,6 @@ List<String> signedXcframeworks(String flutterRoot) {
17641764
'artifacts/engine/ios-release/extension_safe/Flutter.xcframework',
17651765
'artifacts/engine/ios/Flutter.xcframework',
17661766
'artifacts/engine/ios/extension_safe/Flutter.xcframework',
1767-
'artifacts/engine/darwin-x64-profile/FlutterMacOS.xcframework',
1768-
'artifacts/engine/darwin-x64-release/FlutterMacOS.xcframework',
1769-
'artifacts/engine/darwin-x64/FlutterMacOS.xcframework',
17701767
]
17711768
.map((String relativePath) => path.join(flutterRoot, 'bin', 'cache', relativePath)).toList();
17721769
}

dev/devicelab/lib/tasks/plugin_tests.dart

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -118,12 +118,6 @@ class PluginTest {
118118
// Currently this test is only implemented for macOS; it can be extended to
119119
// others as needed.
120120
if (buildTarget == 'macos') {
121-
// When using a local engine, podhelper.rb will search for a "macos-"
122-
// directory within the FlutterMacOS.xcframework, so create a dummy one.
123-
Directory(
124-
path.join(buildDir.path, 'FlutterMacOS.xcframework/macos-arm64_x86_64'),
125-
).createSync(recursive: true);
126-
127121
// Clean before regenerating the config to ensure that the pod steps run.
128122
await inDirectory(Directory(app.rootPath), () async {
129123
await evalFlutter('clean');

packages/flutter_tools/bin/podhelper.rb

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,8 @@ def flutter_additional_macos_build_settings(target)
137137
# This podhelper script is at $FLUTTER_ROOT/packages/flutter_tools/bin.
138138
# Add search paths from $FLUTTER_ROOT/bin/cache/artifacts/engine.
139139
artifacts_dir = File.join('..', '..', '..', '..', 'bin', 'cache', 'artifacts', 'engine')
140-
debug_framework_dir = File.expand_path(File.join(artifacts_dir, 'darwin-x64', 'FlutterMacOS.xcframework'), __FILE__)
141-
release_framework_dir = File.expand_path(File.join(artifacts_dir, 'darwin-x64-release', 'FlutterMacOS.xcframework'), __FILE__)
140+
debug_framework_dir = File.expand_path(File.join(artifacts_dir, 'darwin-x64'), __FILE__)
141+
release_framework_dir = File.expand_path(File.join(artifacts_dir, 'darwin-x64-release'), __FILE__)
142142
application_path = File.dirname(defined_in_file.realpath) if respond_to?(:defined_in_file)
143143
# Find the local engine path, if any.
144144
local_engine = application_path.nil? ?
@@ -156,17 +156,9 @@ def flutter_additional_macos_build_settings(target)
156156
# Skip other updates if it does not depend on Flutter (including transitive dependency)
157157
next unless depends_on_flutter(target, 'FlutterMacOS')
158158

159-
if local_engine
160-
configuration_engine_dir = File.expand_path(File.join(local_engine, 'FlutterMacOS.xcframework'), __FILE__)
161-
else
162-
# Profile can't be derived from the CocoaPods build configuration. Use release framework (for linking only).
163-
configuration_engine_dir = (build_configuration.type == :debug ? debug_framework_dir : release_framework_dir)
164-
end
165-
Dir.new(configuration_engine_dir).each_child do |xcframework_file|
166-
if xcframework_file.start_with?('macos-') # Could be macos-arm64_x86_64, macos-arm64, macos-x86_64
167-
build_configuration.build_settings['FRAMEWORK_SEARCH_PATHS'] = "\"#{configuration_engine_dir}/#{xcframework_file}\" $(inherited)"
168-
end
169-
end
159+
# Profile can't be derived from the CocoaPods build configuration. Use release framework (for linking only).
160+
configuration_engine_dir = local_engine || (build_configuration.type == :debug ? debug_framework_dir : release_framework_dir)
161+
build_configuration.build_settings['FRAMEWORK_SEARCH_PATHS'] = "\"#{configuration_engine_dir}\" $(inherited)"
170162

171163
# When deleted, the deployment version will inherit from the higher version derived from the 'Runner' target.
172164
# If the pod only supports a higher version, do not delete to correctly produce an error.

packages/flutter_tools/lib/src/artifacts.dart

Lines changed: 1 addition & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ enum Artifact {
2525
flutterXcframework,
2626
/// The framework directory of the macOS desktop.
2727
flutterMacOSFramework,
28-
flutterMacOSXcframework,
2928
vmSnapshotData,
3029
isolateSnapshotData,
3130
icuData,
@@ -185,8 +184,6 @@ String? _artifactToFileName(Artifact artifact, Platform hostPlatform, [ BuildMod
185184
return 'Flutter.xcframework';
186185
case Artifact.flutterMacOSFramework:
187186
return 'FlutterMacOS.framework';
188-
case Artifact.flutterMacOSXcframework:
189-
return 'FlutterMacOS.xcframework';
190187
case Artifact.vmSnapshotData:
191188
return 'vm_isolate_snapshot.bin';
192189
case Artifact.isolateSnapshotData:
@@ -601,10 +598,6 @@ class CachedArtifacts implements Artifacts {
601598
final String engineDir = _getEngineArtifactsPath(platform, mode)!;
602599
return _fileSystem.path.join(engineDir, _artifactToFileName(artifact, _platform));
603600
}
604-
if (platform != null && artifact == Artifact.flutterMacOSFramework) {
605-
final String engineDir = _getEngineArtifactsPath(platform, mode)!;
606-
return _getMacOSEngineArtifactPath(engineDir, _fileSystem, _platform);
607-
}
608601
return _getHostArtifactPath(artifact, platform ?? _currentHostPlatform(_platform, _operatingSystemUtils), mode);
609602
}
610603

@@ -624,7 +617,6 @@ class CachedArtifacts implements Artifacts {
624617
case Artifact.constFinder:
625618
case Artifact.flutterFramework:
626619
case Artifact.flutterMacOSFramework:
627-
case Artifact.flutterMacOSXcframework:
628620
case Artifact.flutterPatchedSdkPath:
629621
case Artifact.flutterTester:
630622
case Artifact.flutterXcframework:
@@ -665,7 +657,6 @@ class CachedArtifacts implements Artifacts {
665657
case Artifact.frontendServerSnapshotForEngineDartSdk:
666658
case Artifact.constFinder:
667659
case Artifact.flutterMacOSFramework:
668-
case Artifact.flutterMacOSXcframework:
669660
case Artifact.flutterPatchedSdkPath:
670661
case Artifact.flutterTester:
671662
case Artifact.fontSubset:
@@ -714,7 +705,6 @@ class CachedArtifacts implements Artifacts {
714705
case Artifact.constFinder:
715706
case Artifact.flutterFramework:
716707
case Artifact.flutterMacOSFramework:
717-
case Artifact.flutterMacOSXcframework:
718708
case Artifact.flutterTester:
719709
case Artifact.flutterXcframework:
720710
case Artifact.fontSubset:
@@ -781,13 +771,6 @@ class CachedArtifacts implements Artifacts {
781771
case Artifact.engineDartAotRuntime:
782772
return _fileSystem.path.join(_dartSdkPath(_cache), 'bin', _artifactToFileName(artifact, _platform));
783773
case Artifact.flutterMacOSFramework:
784-
String platformDirName = _enginePlatformDirectoryName(platform);
785-
if (mode == BuildMode.profile || mode == BuildMode.release) {
786-
platformDirName = '$platformDirName-${mode!.cliName}';
787-
}
788-
final String engineArtifactsPath = _cache.getArtifactDirectory('engine').path;
789-
return _getMacOSEngineArtifactPath(_fileSystem.path.join(engineArtifactsPath, platformDirName), _fileSystem, _platform);
790-
case Artifact.flutterMacOSXcframework:
791774
case Artifact.linuxDesktopPath:
792775
case Artifact.windowsDesktopPath:
793776
case Artifact.linuxHeaders:
@@ -913,33 +896,6 @@ String _getIosEngineArtifactPath(String engineDirectory,
913896
.path;
914897
}
915898

916-
String _getMacOSEngineArtifactPath(
917-
String engineDirectory,
918-
FileSystem fileSystem,
919-
Platform hostPlatform,
920-
) {
921-
final Directory xcframeworkDirectory = fileSystem
922-
.directory(engineDirectory)
923-
.childDirectory(_artifactToFileName(Artifact.flutterMacOSXcframework, hostPlatform)!);
924-
925-
if (!xcframeworkDirectory.existsSync()) {
926-
throwToolExit('No xcframework found at ${xcframeworkDirectory.path}. Try running "flutter precache --macos".');
927-
}
928-
final Directory? flutterFrameworkSource = xcframeworkDirectory
929-
.listSync()
930-
.whereType<Directory>()
931-
.where((Directory platformDirectory) =>
932-
platformDirectory.basename.startsWith('macos-'))
933-
.firstOrNull;
934-
if (flutterFrameworkSource == null) {
935-
throwToolExit('No macOS frameworks found in ${xcframeworkDirectory.path}');
936-
}
937-
938-
return flutterFrameworkSource
939-
.childDirectory(_artifactToFileName(Artifact.flutterMacOSFramework, hostPlatform)!)
940-
.path;
941-
}
942-
943899
/// Manages the artifacts of a locally built engine.
944900
class CachedLocalEngineArtifacts implements Artifacts {
945901
CachedLocalEngineArtifacts(
@@ -1098,7 +1054,7 @@ class CachedLocalEngineArtifacts implements Artifacts {
10981054
return _fileSystem.path.join(localEngineInfo.targetOutPath, 'gen', 'flutter', 'lib', 'snapshot', artifactFileName);
10991055
case Artifact.icuData:
11001056
case Artifact.flutterXcframework:
1101-
case Artifact.flutterMacOSXcframework:
1057+
case Artifact.flutterMacOSFramework:
11021058
return _fileSystem.path.join(localEngineInfo.targetOutPath, artifactFileName);
11031059
case Artifact.platformKernelDill:
11041060
if (platform == TargetPlatform.fuchsia_x64 || platform == TargetPlatform.fuchsia_arm64) {
@@ -1110,9 +1066,6 @@ class CachedLocalEngineArtifacts implements Artifacts {
11101066
case Artifact.flutterFramework:
11111067
return _getIosEngineArtifactPath(
11121068
localEngineInfo.targetOutPath, environmentType, _fileSystem, _platform);
1113-
case Artifact.flutterMacOSFramework:
1114-
return _getMacOSEngineArtifactPath(
1115-
localEngineInfo.targetOutPath, _fileSystem, _platform);
11161069
case Artifact.flutterPatchedSdkPath:
11171070
// When using local engine always use [BuildMode.debug] regardless of
11181071
// what was specified in [mode] argument because local engine will
@@ -1293,7 +1246,6 @@ class CachedLocalWebSdkArtifacts implements Artifacts {
12931246
case Artifact.flutterFramework:
12941247
case Artifact.flutterXcframework:
12951248
case Artifact.flutterMacOSFramework:
1296-
case Artifact.flutterMacOSXcframework:
12971249
case Artifact.vmSnapshotData:
12981250
case Artifact.isolateSnapshotData:
12991251
case Artifact.icuData:

packages/flutter_tools/lib/src/build_system/targets/macos.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ class ReleaseUnpackMacOS extends UnpackMacOS {
157157
@override
158158
List<Source> get inputs => <Source>[
159159
...super.inputs,
160-
const Source.artifact(Artifact.flutterMacOSXcframework, mode: BuildMode.release),
160+
const Source.artifact(Artifact.flutterMacOSFramework, mode: BuildMode.release),
161161
];
162162
}
163163

@@ -171,7 +171,7 @@ class ProfileUnpackMacOS extends UnpackMacOS {
171171
@override
172172
List<Source> get inputs => <Source>[
173173
...super.inputs,
174-
const Source.artifact(Artifact.flutterMacOSXcframework, mode: BuildMode.profile),
174+
const Source.artifact(Artifact.flutterMacOSFramework, mode: BuildMode.profile),
175175
];
176176
}
177177

@@ -185,7 +185,7 @@ class DebugUnpackMacOS extends UnpackMacOS {
185185
@override
186186
List<Source> get inputs => <Source>[
187187
...super.inputs,
188-
const Source.artifact(Artifact.flutterMacOSXcframework, mode: BuildMode.debug),
188+
const Source.artifact(Artifact.flutterMacOSFramework, mode: BuildMode.debug),
189189
];
190190
}
191191

packages/flutter_tools/lib/src/cache.dart

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -944,6 +944,14 @@ abstract class EngineCachedArtifact extends CachedArtifact {
944944
await artifactUpdater.downloadZipArchive('Downloading $friendlyName tools...', Uri.parse(url + urlPath), dir);
945945

946946
_makeFilesExecutable(dir, operatingSystemUtils);
947+
948+
final File frameworkZip = fileSystem.file(fileSystem.path.join(dir.path, 'FlutterMacOS.framework.zip'));
949+
if (frameworkZip.existsSync()) {
950+
final Directory framework = fileSystem.directory(fileSystem.path.join(dir.path, 'FlutterMacOS.framework'));
951+
ErrorHandlingFileSystem.deleteIfExists(framework, recursive: true);
952+
framework.createSync();
953+
operatingSystemUtils.unzip(frameworkZip, framework);
954+
}
947955
}
948956

949957
final File licenseSource = cache.getLicenseFile();

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

Lines changed: 17 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
import 'package:meta/meta.dart';
66

7-
import '../artifacts.dart';
87
import '../base/common.dart';
98
import '../base/file_system.dart';
109
import '../base/io.dart';
@@ -84,16 +83,13 @@ class BuildMacOSFrameworkCommand extends BuildFrameworkCommand {
8483

8584
if (boolArg('cocoapods')) {
8685
produceFlutterPodspec(buildInfo.mode, modeDirectory, force: boolArg('force'));
87-
} else {
88-
await _produceFlutterFramework(buildInfo, modeDirectory);
8986
}
9087

91-
final Directory buildOutput = modeDirectory.childDirectory('macos');
92-
93-
// Build aot, create App.framework. Make XCFrameworks.
94-
await _produceAppFramework(buildInfo, modeDirectory, buildOutput);
88+
// Build aot, create App.framework and copy FlutterMacOS.framework. Make XCFrameworks.
89+
await _produceAppFramework(buildInfo, modeDirectory);
9590

9691
// Build and copy plugins.
92+
final Directory buildOutput = modeDirectory.childDirectory('macos');
9793
await processPodsIfNeeded(project.macos, getMacOSBuildDirectory(), buildInfo.mode);
9894
if (boolArg('plugins') && hasPlugins(project)) {
9995
await _producePlugins(xcodeBuildConfiguration, buildOutput, modeDirectory);
@@ -204,15 +200,15 @@ end
204200
Future<void> _produceAppFramework(
205201
BuildInfo buildInfo,
206202
Directory outputBuildDirectory,
207-
Directory macosBuildOutput,
208203
) async {
209204
final Status status = globals.logger.startProgress(
210-
' ├─Building App.xcframework...',
205+
' ├─Building App.xcframework and FlutterMacOS.xcframework...',
211206
);
207+
212208
try {
213209
final Environment environment = Environment(
214210
projectDir: globals.fs.currentDirectory,
215-
outputDir: macosBuildOutput,
211+
outputDir: outputBuildDirectory,
216212
buildDir: project.dartTool.childDirectory('flutter_build'),
217213
cacheDir: globals.cache.getRoot(),
218214
flutterRootDir: globals.fs.directory(Cache.flutterRoot),
@@ -255,45 +251,26 @@ end
255251
status.stop();
256252
}
257253

258-
final Directory appFramework = macosBuildOutput.childDirectory('App.framework');
254+
final Directory appFramework = outputBuildDirectory.childDirectory('App.framework');
259255
await BuildFrameworkCommand.produceXCFramework(
260256
<Directory>[appFramework],
261257
'App',
262258
outputBuildDirectory,
263259
globals.processManager,
264260
);
265261
appFramework.deleteSync(recursive: true);
266-
}
267-
268-
Future<void> _produceFlutterFramework(
269-
BuildInfo buildInfo,
270-
Directory modeDirectory,
271-
) async {
272-
final Status status = globals.logger.startProgress(
273-
' ├─Copying FlutterMacOS.xcframework...',
274-
);
275-
final String engineCacheFlutterFrameworkDirectory = globals.artifacts!.getArtifactPath(
276-
Artifact.flutterMacOSXcframework,
277-
platform: TargetPlatform.darwin,
278-
mode: buildInfo.mode,
279-
);
280-
final String flutterFrameworkFileName = globals.fs.path.basename(
281-
engineCacheFlutterFrameworkDirectory,
282-
);
283-
final Directory flutterFrameworkCopy = modeDirectory.childDirectory(
284-
flutterFrameworkFileName,
285-
);
286-
287-
try {
288-
// Copy xcframework engine cache framework to mode directory.
289-
copyDirectory(
290-
globals.fs.directory(engineCacheFlutterFrameworkDirectory),
291-
flutterFrameworkCopy,
292-
followLinks: false,
262+
final Directory flutterFramework = outputBuildDirectory.childDirectory('FlutterMacOS.framework');
263+
264+
// If FlutterMacOS.podspec was generated, do not generate XCFramework.
265+
if (!boolArg('cocoapods')) {
266+
await BuildFrameworkCommand.produceXCFramework(
267+
<Directory>[flutterFramework],
268+
'FlutterMacOS',
269+
outputBuildDirectory,
270+
globals.processManager,
293271
);
294-
} finally {
295-
status.stop();
296272
}
273+
flutterFramework.deleteSync(recursive: true);
297274
}
298275

299276
Future<void> _producePlugins(

packages/flutter_tools/lib/src/flutter_cache.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -858,12 +858,12 @@ List<List<String>> _getWindowsDesktopBinaryDirs(String arch) {
858858
}
859859

860860
const List<List<String>> _macOSDesktopBinaryDirs = <List<String>>[
861-
<String>['darwin-x64', 'darwin-x64/framework.zip'],
861+
<String>['darwin-x64', 'darwin-x64/FlutterMacOS.framework.zip'],
862862
<String>['darwin-x64', 'darwin-x64/gen_snapshot.zip'],
863-
<String>['darwin-x64-profile', 'darwin-x64-profile/framework.zip'],
863+
<String>['darwin-x64-profile', 'darwin-x64-profile/FlutterMacOS.framework.zip'],
864864
<String>['darwin-x64-profile', 'darwin-x64-profile/artifacts.zip'],
865865
<String>['darwin-x64-profile', 'darwin-x64-profile/gen_snapshot.zip'],
866-
<String>['darwin-x64-release', 'darwin-x64-release/framework.zip'],
866+
<String>['darwin-x64-release', 'darwin-x64-release/FlutterMacOS.framework.zip'],
867867
<String>['darwin-x64-release', 'darwin-x64-release/artifacts.zip'],
868868
<String>['darwin-x64-release', 'darwin-x64-release/gen_snapshot.zip'],
869869
];

0 commit comments

Comments
 (0)