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

Commit 3cf5bfb

Browse files
author
Chris Yang
authored
[mac] Build mac framework with app extension flag (#41011)
[mac] Build mac framework with app extension flag
1 parent 18deec3 commit 3cf5bfb

File tree

4 files changed

+40
-2
lines changed

4 files changed

+40
-2
lines changed

ci/licenses_golden/licenses_flutter

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2677,6 +2677,7 @@ ORIGIN: ../../../flutter/shell/platform/darwin/macos/framework/Source/FlutterTex
26772677
ORIGIN: ../../../flutter/shell/platform/darwin/macos/framework/Source/FlutterTextInputSemanticsObjectTest.mm + ../../../flutter/LICENSE
26782678
ORIGIN: ../../../flutter/shell/platform/darwin/macos/framework/Source/FlutterTextureRegistrar.h + ../../../flutter/LICENSE
26792679
ORIGIN: ../../../flutter/shell/platform/darwin/macos/framework/Source/FlutterTextureRegistrar.mm + ../../../flutter/LICENSE
2680+
ORIGIN: ../../../flutter/shell/platform/darwin/macos/framework/Source/FlutterUmbrellaImportTests.m + ../../../flutter/LICENSE
26802681
ORIGIN: ../../../flutter/shell/platform/darwin/macos/framework/Source/FlutterView.h + ../../../flutter/LICENSE
26812682
ORIGIN: ../../../flutter/shell/platform/darwin/macos/framework/Source/FlutterView.mm + ../../../flutter/LICENSE
26822683
ORIGIN: ../../../flutter/shell/platform/darwin/macos/framework/Source/FlutterViewController.mm + ../../../flutter/LICENSE
@@ -5276,6 +5277,7 @@ FILE: ../../../flutter/shell/platform/darwin/macos/framework/Source/FlutterTextu
52765277
FILE: ../../../flutter/shell/platform/darwin/macos/framework/Source/FlutterTextureRegistrar.mm
52775278
FILE: ../../../flutter/shell/platform/darwin/macos/framework/Source/FlutterThreadSynchronizer.h
52785279
FILE: ../../../flutter/shell/platform/darwin/macos/framework/Source/FlutterThreadSynchronizer.mm
5280+
FILE: ../../../flutter/shell/platform/darwin/macos/framework/Source/FlutterUmbrellaImportTests.m
52795281
FILE: ../../../flutter/shell/platform/darwin/macos/framework/Source/FlutterView.h
52805282
FILE: ../../../flutter/shell/platform/darwin/macos/framework/Source/FlutterView.mm
52815283
FILE: ../../../flutter/shell/platform/darwin/macos/framework/Source/FlutterViewController.mm

common/config.gni

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@ if (is_ios || is_mac) {
6161
"-Werror=overriding-method-mismatch",
6262
"-Werror=undeclared-selector",
6363
]
64+
if (is_mac) {
65+
flutter_cflags_objc += [ "-fapplication-extension" ]
66+
}
67+
6468
flutter_cflags_objcc = flutter_cflags_objc
6569
flutter_cflags_objc_arc = flutter_cflags_objc + [ "-fobjc-arc" ]
6670
flutter_cflags_objcc_arc = flutter_cflags_objc_arc

shell/platform/darwin/macos/BUILD.gn

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,10 @@ shared_library("flutter_framework_dylib") {
149149
visibility = [ ":*" ]
150150
output_name = "$_flutter_framework_name"
151151

152-
ldflags = [ "-Wl,-install_name,@rpath/$_flutter_framework_filename/$_framework_binary_subpath" ]
152+
ldflags = [
153+
"-Wl,-install_name,@rpath/$_flutter_framework_filename/$_framework_binary_subpath",
154+
"-fapplication-extension",
155+
]
153156

154157
deps = [ ":flutter_framework_source" ]
155158
}
@@ -297,7 +300,7 @@ action("_generate_symlinks") {
297300
}
298301

299302
group("flutter_framework") {
300-
deps = [ ":_generate_symlinks" ]
303+
deps = [ ":_generate_symlinks_and_verify_framework_module" ]
301304
}
302305

303306
if (build_glfw_shell) {
@@ -334,3 +337,21 @@ generated_file("macos_framework_without_entitlement_config") {
334337

335338
deps = [ ":_generate_symlinks" ]
336339
}
340+
341+
shared_library("_generate_symlinks_and_verify_framework_module") {
342+
framework_search_path = rebase_path("$root_out_dir")
343+
visibility = [ ":*" ]
344+
cflags_objc = [ "-F$framework_search_path" ]
345+
346+
ldflags = [
347+
"-F$framework_search_path",
348+
"-fapplication-extension",
349+
"-Xlinker",
350+
"-fatal_warnings",
351+
]
352+
frameworks = [ "FlutterMacOS.framework" ]
353+
354+
sources = [ "framework/Source/FlutterUmbrellaImportTests.m" ]
355+
356+
deps = [ ":_generate_symlinks" ]
357+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// Copyright 2013 The Flutter Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
// FLUTTER_NOLINT: https://github.com/flutter/flutter/issues/93360
6+
7+
// The only point of this file is to ensure that the Flutter framework umbrella header can be
8+
// cleanly imported from an Objective-C translation unit. The target that uses this file copies the
9+
// headers to a path that simulates how users would actually import the framework outside of the
10+
// engine source root.
11+
#import <FlutterMacOS/FlutterMacOS.h>

0 commit comments

Comments
 (0)