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

Commit ae2cd64

Browse files
authored
[darwin] Move common targets to common/BUILD.gn (#44335)
Previously, some common Darwin framework targets existed in: //flutter/shell/platform/darwin/BUILD.gn This moves all targets into: //flutter/shell/platform/darwin/common/BUILD.gn The framework_shared target has been renamed framework_common for consistency with the directory name, and flutter_channels_unittests has been renamed framework_common_unittests since it's a reasonable target for adding other tests of common framework code. We also de-duplicate targets with existing targets. * The `flutter_channels` target duplicates the existing `framework_shared` target. * The `common` target already includes the buffer conversions translation units, which are only used by the iOS embedder. No test changes since there are no semantic changes, just a restructuring of build targets. ## Pre-launch Checklist - [X] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [X] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [X] I read and followed the [Flutter Style Guide] and the [C++, Objective-C, Java style guides]. - [X] I listed at least one issue that this PR fixes in the description above. - [ ] I added new tests to check the change I am making or feature I am adding, or Hixie said the PR is test-exempt. See [testing the engine] for instructions on writing and running engine tests. - [X] I updated/added relevant documentation (doc comments with `///`). - [X] I signed the [CLA]. - [X] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/wiki/Tree-hygiene#overview [Tree Hygiene]: https://github.com/flutter/flutter/wiki/Tree-hygiene [Flutter Style Guide]: https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo [C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style [testing the engine]: https://github.com/flutter/flutter/wiki/Testing-the-engine [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/wiki/Tree-hygiene#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/wiki/Chat
1 parent 0342704 commit ae2cd64

File tree

8 files changed

+43
-85
lines changed

8 files changed

+43
-85
lines changed

BUILD.gn

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ group("unittests") {
187187
if (is_mac) {
188188
public_deps += [
189189
"//flutter/impeller/golden_tests:impeller_golden_tests",
190-
"//flutter/shell/platform/darwin:flutter_channels_unittests",
190+
"//flutter/shell/platform/darwin/common:framework_common_unittests",
191191
"//flutter/third_party/spring_animation:spring_animation_unittests",
192192
]
193193
}

shell/platform/darwin/BUILD.gn

Lines changed: 0 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
assert(is_mac || is_ios)
66

77
import("//flutter/shell/platform/config.gni")
8-
import("//flutter/testing/testing.gni")
98

109
group("darwin") {
1110
if (is_ios) {
@@ -18,70 +17,3 @@ group("darwin") {
1817
}
1918
}
2019
}
21-
22-
source_set("flutter_channels") {
23-
cflags_objc = flutter_cflags_objc
24-
cflags_objcc = flutter_cflags_objcc
25-
26-
sources = [
27-
"common/buffer_conversions.h",
28-
"common/buffer_conversions.mm",
29-
]
30-
31-
deps = [ "//flutter/fml" ]
32-
33-
public_deps = [ ":flutter_channels_arc" ]
34-
35-
public_configs = [ "//flutter:config" ]
36-
}
37-
38-
source_set("flutter_channels_arc") {
39-
cflags_objc = flutter_cflags_objc_arc
40-
cflags_objcc = flutter_cflags_objcc_arc
41-
42-
sources = [
43-
"common/framework/Headers/FlutterBinaryMessenger.h",
44-
"common/framework/Headers/FlutterChannels.h",
45-
"common/framework/Headers/FlutterCodecs.h",
46-
"common/framework/Headers/FlutterMacros.h",
47-
"common/framework/Source/FlutterChannels.mm",
48-
"common/framework/Source/FlutterCodecs.mm",
49-
"common/framework/Source/FlutterStandardCodec.mm",
50-
"common/framework/Source/FlutterStandardCodecHelper.cc",
51-
"common/framework/Source/FlutterStandardCodec_Internal.h",
52-
]
53-
54-
public = [
55-
"common/framework/Headers/FlutterBinaryMessenger.h",
56-
"common/framework/Headers/FlutterChannels.h",
57-
"common/framework/Headers/FlutterCodecs.h",
58-
"common/framework/Headers/FlutterMacros.h",
59-
"common/framework/Source/FlutterStandardCodec_Internal.h",
60-
]
61-
62-
public_configs = [ "//flutter:config" ]
63-
64-
deps = [ "//flutter/fml" ]
65-
}
66-
67-
test_fixtures("flutter_channels_fixtures") {
68-
fixtures = []
69-
}
70-
71-
executable("flutter_channels_unittests") {
72-
testonly = true
73-
74-
sources = [
75-
"common/framework/Source/flutter_codecs_unittest.mm",
76-
"common/framework/Source/flutter_standard_codec_unittest.mm",
77-
]
78-
79-
deps = [
80-
":flutter_channels",
81-
":flutter_channels_fixtures",
82-
"//flutter/testing",
83-
"//third_party/dart/runtime:libdart_jit",
84-
]
85-
86-
public_configs = [ "//flutter:config" ]
87-
}

shell/platform/darwin/common/BUILD.gn

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,11 @@
22
# Use of this source code is governed by a BSD-style license that can be
33
# found in the LICENSE file.
44

5+
assert(is_mac || is_ios)
6+
57
import("//flutter/common/config.gni")
6-
import("framework_shared.gni")
8+
import("//flutter/testing/testing.gni")
9+
import("framework_common.gni")
710

811
source_set("common") {
912
cflags_objc = flutter_cflags_objc
@@ -29,7 +32,7 @@ config("framework_relative_headers") {
2932
}
3033

3134
# Framework code shared between iOS and macOS.
32-
source_set("framework_shared") {
35+
source_set("framework_common") {
3336
cflags_objc = flutter_cflags_objc_arc
3437
cflags_objcc = flutter_cflags_objcc_arc
3538

@@ -43,7 +46,7 @@ source_set("framework_shared") {
4346
"framework/Source/FlutterStandardCodec_Internal.h",
4447
]
4548

46-
public = framework_shared_headers
49+
public = framework_common_headers
4750

4851
public += [ "framework/Source/FlutterNSBundleUtils.h" ]
4952

@@ -56,3 +59,26 @@ source_set("framework_shared") {
5659

5760
deps = [ "//flutter/fml" ]
5861
}
62+
63+
test_fixtures("framework_common_fixtures") {
64+
fixtures = []
65+
}
66+
67+
# Unit tests for channels.
68+
executable("framework_common_unittests") {
69+
testonly = true
70+
71+
sources = [
72+
"framework/Source/flutter_codecs_unittest.mm",
73+
"framework/Source/flutter_standard_codec_unittest.mm",
74+
]
75+
76+
deps = [
77+
":framework_common",
78+
":framework_common_fixtures",
79+
"//flutter/testing",
80+
"//third_party/dart/runtime:libdart_jit",
81+
]
82+
83+
public_configs = [ "//flutter:config" ]
84+
}

shell/platform/darwin/common/framework_shared.gni renamed to shell/platform/darwin/common/framework_common.gni

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Use of this source code is governed by a BSD-style license that can be
33
# found in the LICENSE file.
44

5-
framework_shared_headers =
5+
framework_common_headers =
66
get_path_info([
77
"framework/Headers/FlutterMacros.h",
88
"framework/Headers/FlutterBinaryMessenger.h",

shell/platform/darwin/graphics/BUILD.gn

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ source_set("graphics") {
2323
"//flutter/display_list",
2424
"//flutter/fml",
2525
"//flutter/shell/common",
26-
"//flutter/shell/platform/darwin/common:framework_shared",
26+
"//flutter/shell/platform/darwin/common:framework_common",
2727
]
2828

2929
if (impeller_supports_rendering) {

shell/platform/darwin/ios/BUILD.gn

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import("//build/toolchain/clang.gni")
99
import("//flutter/common/config.gni")
1010
import("//flutter/shell/config.gni")
1111
import("//flutter/shell/gpu/gpu.gni")
12-
import("//flutter/shell/platform/darwin/common/framework_shared.gni")
12+
import("//flutter/shell/platform/darwin/common/framework_common.gni")
1313
import("//flutter/testing/testing.gni")
1414

1515
_flutter_framework_dir = "$root_out_dir/Flutter.framework"
@@ -52,7 +52,7 @@ source_set("flutter_framework_source_arc") {
5252
":flutter_framework_source",
5353
"//flutter/fml",
5454
"//flutter/shell/platform/common:common_cpp_input",
55-
"//flutter/shell/platform/darwin/common:framework_shared",
55+
"//flutter/shell/platform/darwin/common:framework_common",
5656
"//third_party/icu",
5757
]
5858
public_configs = [ "//flutter:config" ]
@@ -191,7 +191,7 @@ source_set("flutter_framework_source") {
191191
"//flutter/shell/common",
192192
"//flutter/shell/platform/common:common_cpp_input",
193193
"//flutter/shell/platform/darwin/common",
194-
"//flutter/shell/platform/darwin/common:framework_shared",
194+
"//flutter/shell/platform/darwin/common:framework_common",
195195
"//flutter/shell/platform/embedder:embedder_as_internal_library",
196196
"//flutter/shell/profiling:profiling",
197197
"//flutter/third_party/spring_animation",
@@ -245,7 +245,7 @@ source_set("ios_test_flutter_mrc") {
245245
"//flutter/common:common",
246246
"//flutter/lib/ui:ui",
247247
"//flutter/shell/common:common",
248-
"//flutter/shell/platform/darwin/common:framework_shared",
248+
"//flutter/shell/platform/darwin/common:framework_common",
249249
"//flutter/shell/platform/embedder:embedder_as_internal_library",
250250
"//flutter/third_party/tonic",
251251
"//flutter/third_party/txt",
@@ -311,7 +311,7 @@ shared_library("ios_test_flutter") {
311311
":ios_test_flutter_mrc",
312312
"//flutter/common:common",
313313
"//flutter/lib/ui:ui",
314-
"//flutter/shell/platform/darwin/common:framework_shared",
314+
"//flutter/shell/platform/darwin/common:framework_common",
315315
"//flutter/shell/platform/embedder:embedder_as_internal_library",
316316
"//flutter/shell/platform/embedder:embedder_test_utils",
317317
"//flutter/third_party/spring_animation",
@@ -400,7 +400,7 @@ action("copy_framework_headers") {
400400
script = "//flutter/sky/tools/install_framework_headers.py"
401401
visibility = [ ":*" ]
402402
sources = get_path_info(_flutter_framework_headers, "abspath") +
403-
framework_shared_headers
403+
framework_common_headers
404404
outputs = []
405405
foreach(header, sources) {
406406
header_basename = get_path_info(header, "file")

shell/platform/darwin/macos/BUILD.gn

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ assert(is_mac)
77
import("//build/config/mac/mac_sdk.gni")
88
import("//flutter/build/zip_bundle.gni")
99
import("//flutter/shell/gpu/gpu.gni")
10-
import("//flutter/shell/platform/darwin/common/framework_shared.gni")
10+
import("//flutter/shell/platform/darwin/common/framework_common.gni")
1111
import("//flutter/shell/platform/glfw/config.gni")
1212
import("//flutter/testing/testing.gni")
1313

@@ -121,7 +121,7 @@ source_set("flutter_framework_source") {
121121
"//flutter/shell/platform/common:common_cpp_enums",
122122
"//flutter/shell/platform/common:common_cpp_input",
123123
"//flutter/shell/platform/common:common_cpp_switches",
124-
"//flutter/shell/platform/darwin/common:framework_shared",
124+
"//flutter/shell/platform/darwin/common:framework_common",
125125
"//flutter/shell/platform/darwin/graphics:graphics",
126126
"//flutter/shell/platform/embedder:embedder_as_internal_library",
127127
"//third_party/skia",
@@ -204,7 +204,7 @@ executable("flutter_desktop_darwin_unittests") {
204204
":flutter_framework_source",
205205
"//flutter/shell/platform/common:common_cpp_accessibility",
206206
"//flutter/shell/platform/common:common_cpp_enums",
207-
"//flutter/shell/platform/darwin/common:framework_shared",
207+
"//flutter/shell/platform/darwin/common:framework_common",
208208
"//flutter/shell/platform/darwin/graphics",
209209
"//flutter/shell/platform/embedder:embedder_as_internal_library",
210210
"//flutter/shell/platform/embedder:embedder_test_utils",
@@ -241,7 +241,7 @@ action("copy_framework_headers") {
241241
script = "//flutter/sky/tools/install_framework_headers.py"
242242
visibility = [ ":*" ]
243243
sources = get_path_info(_flutter_framework_headers, "abspath") +
244-
framework_shared_headers
244+
framework_common_headers
245245
outputs = []
246246
foreach(header, sources) {
247247
header_basename = get_path_info(header, "file")

testing/run_tests.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ def make_test(name, flags=None, extra_env=None):
418418
unittests += [
419419
# The accessibility library only supports Mac and Windows.
420420
make_test('accessibility_unittests'),
421-
make_test('flutter_channels_unittests'),
421+
make_test('framework_common_unittests'),
422422
make_test('spring_animation_unittests'),
423423
]
424424

0 commit comments

Comments
 (0)