Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

[WIP] Rename FlutterMacOS.framework to Flutter.framework and add xcframework #41869

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 14 additions & 9 deletions ci/builders/mac_host_engine.json
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@
"generators": {
"tasks": [
{
"name": "Release-FlutterMacOS.framework",
"name": "Release-macos-Flutter.xcframework",
"parameters": [
"--dst",
"out/release/framework",
Expand All @@ -314,7 +314,7 @@
"script": "flutter/sky/tools/create_macos_framework.py"
},
{
"name": "Debug-FlutterMacOS.framework",
"name": "Debug-macos-Flutter.xcframework",
"parameters": [
"--dst",
"out/debug/framework",
Expand All @@ -327,7 +327,7 @@
"script": "flutter/sky/tools/create_macos_framework.py"
},
{
"name": "Profile-FlutterMacOS.framework",
"name": "Profile-macos-Flutter.xcframework",
"parameters": [
"--dst",
"out/profile/framework",
Expand Down Expand Up @@ -395,18 +395,23 @@
"realm": "production"
},
{
"source": "out/debug/framework/FlutterMacOS.framework.zip",
"destination": "darwin-x64/FlutterMacOS.framework.zip",
"source": "out/release/framework/Flutter.dSYM.zip",
"destination": "darwin-x64-release/Flutter.dSYM.zip",
"realm": "production"
},
{
"source": "out/profile/framework/FlutterMacOS.framework.zip",
"destination": "darwin-x64-profile/FlutterMacOS.framework.zip",
"source": "out/debug/framework/frameworks.zip",
"destination": "darwin-x64/frameworks.zip",
"realm": "production"
},
{
"source": "out/release/framework/FlutterMacOS.framework.zip",
"destination": "darwin-x64-release/FlutterMacOS.framework.zip",
"source": "out/profile/framework/frameworks.zip",
"destination": "darwin-x64-profile/frameworks.zip",
"realm": "production"
},
{
"source": "out/release/framework/frameworks.zip",
"destination": "darwin-x64-release/frameworks.zip",
"realm": "production"
},
{
Expand Down
12 changes: 10 additions & 2 deletions ci/licenses_golden/licenses_flutter
Original file line number Diff line number Diff line change
Expand Up @@ -2625,9 +2625,9 @@ ORIGIN: ../../../flutter/shell/platform/darwin/ios/platform_view_ios.h + ../../.
ORIGIN: ../../../flutter/shell/platform/darwin/ios/platform_view_ios.mm + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/shell/platform/darwin/ios/rendering_api_selection.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/shell/platform/darwin/ios/rendering_api_selection.mm + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/shell/platform/darwin/macos/framework/Headers/Flutter.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/shell/platform/darwin/macos/framework/Headers/FlutterAppDelegate.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/shell/platform/darwin/macos/framework/Headers/FlutterEngine.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/shell/platform/darwin/macos/framework/Headers/FlutterMacOS.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/shell/platform/darwin/macos/framework/Headers/FlutterPlatformViews.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/shell/platform/darwin/macos/framework/Headers/FlutterPluginMacOS.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/shell/platform/darwin/macos/framework/Headers/FlutterPluginRegistrarMacOS.h + ../../../flutter/LICENSE
Expand Down Expand Up @@ -2711,6 +2711,9 @@ ORIGIN: ../../../flutter/shell/platform/darwin/macos/framework/Source/KeyCodeMap
ORIGIN: ../../../flutter/shell/platform/darwin/macos/framework/Source/KeyCodeMap_Internal.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/shell/platform/darwin/macos/framework/Source/TestFlutterPlatformView.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/shell/platform/darwin/macos/framework/Source/TestFlutterPlatformView.mm + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/shell/platform/darwin/macos/wrapper_framework/Headers/FlutterMacOS.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/shell/platform/darwin/macos/wrapper_framework/Source/FlutterReExportTest.m + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/shell/platform/darwin/macos/wrapper_framework/Source/FlutterUmbrellaImportTests.m + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/shell/platform/embedder/embedder.cc + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/shell/platform/embedder/embedder.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/shell/platform/embedder/embedder_engine.cc + ../../../flutter/LICENSE
Expand Down Expand Up @@ -5238,9 +5241,9 @@ FILE: ../../../flutter/shell/platform/darwin/ios/platform_view_ios.h
FILE: ../../../flutter/shell/platform/darwin/ios/platform_view_ios.mm
FILE: ../../../flutter/shell/platform/darwin/ios/rendering_api_selection.h
FILE: ../../../flutter/shell/platform/darwin/ios/rendering_api_selection.mm
FILE: ../../../flutter/shell/platform/darwin/macos/framework/Headers/Flutter.h
FILE: ../../../flutter/shell/platform/darwin/macos/framework/Headers/FlutterAppDelegate.h
FILE: ../../../flutter/shell/platform/darwin/macos/framework/Headers/FlutterEngine.h
FILE: ../../../flutter/shell/platform/darwin/macos/framework/Headers/FlutterMacOS.h
FILE: ../../../flutter/shell/platform/darwin/macos/framework/Headers/FlutterPlatformViews.h
FILE: ../../../flutter/shell/platform/darwin/macos/framework/Headers/FlutterPluginMacOS.h
FILE: ../../../flutter/shell/platform/darwin/macos/framework/Headers/FlutterPluginRegistrarMacOS.h
Expand Down Expand Up @@ -5328,6 +5331,11 @@ FILE: ../../../flutter/shell/platform/darwin/macos/framework/Source/KeyCodeMap_I
FILE: ../../../flutter/shell/platform/darwin/macos/framework/Source/TestFlutterPlatformView.h
FILE: ../../../flutter/shell/platform/darwin/macos/framework/Source/TestFlutterPlatformView.mm
FILE: ../../../flutter/shell/platform/darwin/macos/framework/module.modulemap
FILE: ../../../flutter/shell/platform/darwin/macos/wrapper_framework/Headers/FlutterMacOS.h
FILE: ../../../flutter/shell/platform/darwin/macos/wrapper_framework/Info.plist
FILE: ../../../flutter/shell/platform/darwin/macos/wrapper_framework/Source/FlutterReExportTest.m
FILE: ../../../flutter/shell/platform/darwin/macos/wrapper_framework/Source/FlutterUmbrellaImportTests.m
FILE: ../../../flutter/shell/platform/darwin/macos/wrapper_framework/module.modulemap
FILE: ../../../flutter/shell/platform/embedder/assets/EmbedderInfo.plist
FILE: ../../../flutter/shell/platform/embedder/assets/embedder.modulemap
FILE: ../../../flutter/shell/platform/embedder/embedder.cc
Expand Down
202 changes: 193 additions & 9 deletions shell/platform/darwin/macos/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ shell_gpu_configuration("macos_gpu_configuration") {
}

group("macos") {
deps = [ ":flutter_framework" ]
deps = [
":flutter_framework",
":flutter_mac_framework",
]
if (build_glfw_shell) {
deps += [
":flutter_macos_glfw",
Expand All @@ -29,7 +32,9 @@ group("macos") {
}
}

_flutter_framework_name = "FlutterMacOS"
# Generate Flutter.framework and Flutter.xcframework

_flutter_framework_name = "Flutter"
_flutter_framework_filename = "$_flutter_framework_name.framework"
_flutter_framework_dir = "$root_out_dir/$_flutter_framework_filename"
_framework_binary_subpath = "Versions/A/$_flutter_framework_name"
Expand All @@ -39,7 +44,7 @@ _framework_binary_subpath = "Versions/A/$_flutter_framework_name"
_flutter_framework_headers = [
"framework/Headers/FlutterAppDelegate.h",
"framework/Headers/FlutterEngine.h",
"framework/Headers/FlutterMacOS.h",
"framework/Headers/Flutter.h",
"framework/Headers/FlutterPlatformViews.h",
"framework/Headers/FlutterPluginMacOS.h",
"framework/Headers/FlutterPluginRegistrarMacOS.h",
Expand Down Expand Up @@ -294,14 +299,29 @@ action("_generate_symlinks") {
]
metadata = {
macos_framework_without_entitlement =
[ "FlutterMacOS.framework.zip/Versions/A/FlutterMacOS" ]
[ "Flutter.framework.zip/Versions/A/Flutter" ]
}
}

group("flutter_framework") {
group("universal_flutter_framework") {
visibility = [ ":*" ]
deps = [ ":_generate_symlinks_and_verify_framework_module" ]
}

action("flutter_framework") {
script = "//flutter/sky/tools/create_xcframework.py"
outputs = [ "$root_out_dir/Flutter.xcframework" ]
args = [
"--frameworks",
rebase_path("$_flutter_framework_dir"),
"--name",
"Flutter",
"--location",
rebase_path("$root_out_dir"),
]
deps = [ ":universal_flutter_framework" ]
}

if (build_glfw_shell) {
shared_library("flutter_macos_glfw") {
deps = [ "//flutter/shell/platform/glfw:flutter_glfw" ]
Expand All @@ -312,19 +332,20 @@ if (build_glfw_shell) {

zip_bundle("zip_macos_flutter_framework") {
deps = [
":_generate_mac_symlinks",
":_generate_symlinks",
":macos_framework_without_entitlement_config",
]
prefix = "$full_platform_name-$flutter_runtime_mode/"
if (flutter_runtime_mode == "debug") {
prefix = "$full_platform_name/"
}
output = "${prefix}FlutterMacOS.framework.zip"
output = "${prefix}Flutter.framework.zip"
visibility = [ ":*" ]
files = [
{
source = "$root_out_dir/FlutterMacOS.framework"
destination = "FlutterMacOS.framework"
source = "$root_out_dir/Flutter.framework"
destination = "Flutter.framework"
},
]
}
Expand All @@ -348,9 +369,172 @@ shared_library("_generate_symlinks_and_verify_framework_module") {
"-Xlinker",
"-fatal_warnings",
]
frameworks = [ "FlutterMacOS.framework" ]
frameworks = [ "Flutter.framework" ]

sources = [ "framework/Source/FlutterUmbrellaImportTests.m" ]

deps = [ ":_generate_symlinks" ]
}

# Generate FlutterMacOS.framework and FlutterMacOS.xcframework

_flutter_mac_framework_name = "FlutterMacOS"
_flutter_mac_framework_filename = "$_flutter_mac_framework_name.framework"
_flutter_mac_framework_dir = "$root_out_dir/$_flutter_mac_framework_filename"
_framework_mac_binary_subpath = "Versions/A/$_flutter_mac_framework_name"

# The headers that will be copied to the framework and be accessed from outside
# the Flutter engine source root.
_flutter_mac_framework_headers = [ "wrapper_framework/Headers/FlutterMacOS.h" ]

_flutter_mac_framework_headers_copy_dir =
"$_flutter_mac_framework_dir/Versions/A/Headers"

source_set("flutter_mac_framework_source") {
visibility = [ ":*" ]

sources = _flutter_mac_framework_headers

public_configs = [ "//flutter:config" ]

defines = [
"FLUTTER_FRAMEWORK",
"FLUTTER_ENGINE_NO_PROTOTYPES",
]

cflags_objcc = flutter_cflags_objcc_arc
}

shared_library("flutter_mac_framework_dylib") {
visibility = [ ":*" ]
output_name = "$_flutter_mac_framework_name"

ldflags = [
"-Wl,-install_name,@rpath/$_flutter_mac_framework_filename/$_framework_mac_binary_subpath",
"-fapplication-extension",
]

deps = [ ":flutter_mac_framework_source" ]
}

copy("copy_mac_dylib") {
visibility = [ ":*" ]

sources = [ "$root_out_dir/lib$_flutter_mac_framework_name.dylib" ]
outputs = [ "$_flutter_mac_framework_dir/$_framework_mac_binary_subpath" ]

deps = [ ":flutter_mac_framework_dylib" ]
}

copy("copy_mac_framework_info_plist") {
visibility = [ ":*" ]
sources = [ "wrapper_framework/Info.plist" ]
outputs = [ "$_flutter_mac_framework_dir/Versions/A/Resources/Info.plist" ]
}

copy("copy_mac_framework_module_map") {
visibility = [ ":*" ]
sources = [ "wrapper_framework/module.modulemap" ]
outputs =
[ "$_flutter_mac_framework_dir/Versions/A/Modules/module.modulemap" ]
}

action("copy_mac_framework_headers") {
script = "//flutter/sky/tools/install_framework_headers.py"
visibility = [ ":*" ]
sources = get_path_info(_flutter_mac_framework_headers, "abspath")
outputs = []
foreach(header, sources) {
header_basename = get_path_info(header, "file")
outputs += [ "$_flutter_mac_framework_headers_copy_dir/$header_basename" ]
}
args = [
"--location",
rebase_path("$_flutter_mac_framework_headers_copy_dir"),
"--headers",
] + rebase_path(sources, "", "//")
}

copy("copy_mac_framework_icu") {
visibility = [ ":*" ]
sources = [ "//third_party/icu/flutter/icudtl.dat" ]
outputs = [
"$_flutter_mac_framework_dir/Versions/A/Resources/{{source_file_part}}",
]
}

action("_generate_mac_symlinks") {
visibility = [ ":*" ]
script = "//build/config/mac/package_framework.py"
outputs = [
"$root_build_dir/$_flutter_mac_framework_name.stamp",
"$root_out_dir/$_flutter_mac_framework_filename",
]
args = [
"--framework",
"$_flutter_mac_framework_filename",
"--version",
"A",
"--contents",
"$_flutter_mac_framework_name",
"Resources",
"Headers",
"Modules",
"--stamp",
"$_flutter_mac_framework_name.stamp",
]
deps = [
":copy_license",
":copy_mac_dylib",
":copy_mac_framework_headers",
":copy_mac_framework_icu",
":copy_mac_framework_info_plist",
":copy_mac_framework_module_map",
]
}

shared_library("_generate_mac_symlinks_and_verify_framework_module") {
framework_search_path = rebase_path("$root_out_dir")
visibility = [ ":*" ]
cflags_objc = [ "-F$framework_search_path" ]

ldflags = [
"-F$framework_search_path",
"-fapplication-extension",
"-Xlinker",
"-fatal_warnings",
]
frameworks = [
"Flutter.framework",
"FlutterMacOS.framework",
]

sources = [
"wrapper_framework/Source/FlutterReExportTest.m",
"wrapper_framework/Source/FlutterUmbrellaImportTests.m",
]

deps = [
":_generate_mac_symlinks",
":_generate_symlinks",
]
}

group("universal_mac_flutter_framework") {
visibility = [ ":*" ]
deps = [ ":_generate_mac_symlinks_and_verify_framework_module" ]
}

action("flutter_mac_framework") {
script = "//flutter/sky/tools/create_xcframework.py"
outputs = [ "$root_out_dir/FlutterMacOS.xcframework" ]
args = [
"--frameworks",
rebase_path("$_flutter_mac_framework_dir"),
"--name",
"FlutterMacOS",
"--location",
rebase_path("$root_out_dir"),
]
deps = [ ":universal_mac_flutter_framework" ]
}
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ FLUTTER_DARWIN_EXPORT
* is instantiated in MainFlutterWindow.swift in the Flutter project.
* ```swift
* import Cocoa
* import FlutterMacOS
* import Flutter
*
* class MainFlutterWindow: NSWindow {
* override func awakeFromNib() {
Expand Down
6 changes: 3 additions & 3 deletions shell/platform/darwin/macos/framework/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>FlutterMacOS</string>
<string>Flutter</string>
<key>CFBundleIdentifier</key>
<string>io.flutter.flutter-macos</string>
<string>io.flutter.flutter</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>FlutterMacOS</string>
<string>Flutter</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
// cleanly imported from an Objective-C translation unit. The target that uses this file copies the
// headers to a path that simulates how users would actually import the framework outside of the
// engine source root.
#import <FlutterMacOS/FlutterMacOS.h>
#import <Flutter/Flutter.h>
Loading