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

Commit 1e199ce

Browse files
[Fuchsia] Remove the use of //build/ in fuchsia (#51072)
### Motivation of the change: Both dart and flutter are using fairly outdated gn-sdk without properly maintained. Currently @hjfreyer is working on version'ed IDK / SDK libs which requires changes in gn-sdk to use the right version of the libs in fuchsia/sdk/obj/{arch}-api-{level} rather than the one in the fuchsia/sdk/arch. But current implementation does not support choosing the right version. ### Blocking issue: The new gn-sdk (in flutter/tools/fuchsia/gn-sdk) generates multiple BUILD.gn files rather than a large BUILD.gn the previous version created. So most of the build rules need to switch from the old `fidl:{api}` build rule to `fidl/{api}` rule. The same change will happen in the dart/sdk, i.e. http://go/dart-reviews/356924. But since the two repos cannot have one single atomic change, changing either side first will cause flutter to break. E.g. the linkage error caused by duplicated symbols will happen if we change the dart/sdk first, since in flutter, it will still refer to the old build rules in the middle. ### Solutions: Ideally we can create redirect rules in the current `build/fuchsia` buildroot tree to redirect the old rules into the new one, so we can make the change in the flutter first then dart/sdk. But creating the rules is not trivial and will only be used once. So an alternative solution is - pause the dart/sdk -> flutter roll - submit dart/sdk change (http://go/dart-reviews/356924) - update this change to manually bring the dart/sdk change, namely the `dart_revision` in the DEPS file and signatures in the ci/licences. - resume the dart/sdk -> flutter roll. But it requires this change itself to be reviewed first, and I'd like to know your opinion before moving forward. See corresponding dart/sdk change at http://go/dart-reviews/356924. ### //build/fuchsia/ from buildroot should be removed after this change. Bug: [b/40935282](https://issues.chromium.org/issues/40935282?pli=1&authuser=0) FYI: @hjfreyer [C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
1 parent 995d890 commit 1e199ce

File tree

58 files changed

+378
-649
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+378
-649
lines changed

DEPS

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ vars = {
6262
# Dart is: https://github.com/dart-lang/sdk/blob/main/DEPS
6363
# You can use //tools/dart/create_updated_flutter_deps.py to produce
6464
# updated revision list of existing dependencies.
65-
'dart_revision': '70ca2323a702b1326c9c55943186e4e2fc58c3c8',
65+
'dart_revision': '406955fe69503eb11fb16a8405534a979f5eef60',
6666

6767
# WARNING: DO NOT EDIT MANUALLY
6868
# The lines between blank lines above and below are generated by a script. See create_updated_flutter_deps.py
@@ -107,6 +107,12 @@ vars = {
107107
# //flutter/tools/gn.
108108
'mac_sdk_min': '10.14',
109109

110+
# Checkout Fuchsia dependencies only on Linux. This is the umbrella flag which
111+
# controls the behavior of all fuchsia related flags. I.e. any fuchsia related
112+
# logic or condition may not work if this flag is False.
113+
# TODO(zijiehe): Make this condition more strict to only download fuchsia
114+
# dependencies when necessary: b/40935282
115+
'download_fuchsia_deps': 'host_os == "linux"',
110116
# Downloads the fuchsia SDK as listed in fuchsia_sdk_path var. This variable
111117
# is currently only used for the Fuchsia LSC process and is not intended for
112118
# local development.
@@ -261,7 +267,7 @@ vars = {
261267

262268
# The version / instance id of the cipd:chromium/fuchsia/gn-sdk which will be
263269
# used altogether with fuchsia-sdk to generate gn based build rules.
264-
'fuchsia_gn_sdk_version': 'l8zShEOXGGjtLYRulEX5CjT2RemKvUPOT6L-uXy41tMC',
270+
'fuchsia_gn_sdk_version': 'RgErspyYHapUO2SpcW-vo2p8yaRUMUrq0eWjRVPfQjoC',
265271
}
266272

267273
gclient_gn_args_file = 'src/third_party/dart/build/config/gclient_args.gni'
@@ -359,7 +365,7 @@ deps = {
359365
Var('dart_git') + '/args.git@7dc7fe0430709229ccc87c3eaae729aeffe10c56',
360366

361367
'src/third_party/dart/third_party/pkg/async':
362-
Var('dart_git') + '/async.git@1556660ca5159d84bf28239825a25dca58f1fde3',
368+
Var('dart_git') + '/async.git@6cdbc41631054870318ae28baea2c62cf2a91945',
363369

364370
'src/third_party/dart/third_party/pkg/bazel_worker':
365371
Var('dart_git') + '/bazel_worker.git@8619b92baa9959e55b9fc49d2afcd6dda2ec1c10',
@@ -407,7 +413,7 @@ deps = {
407413
Var('dart_git') + '/html.git@327e37a6a4dd46599737ee982f280d73a8f646f7',
408414

409415
'src/third_party/dart/third_party/pkg/http':
410-
Var('dart_git') + '/http.git@8da6e0ea5d67a08f98a14137e0d2bdcb113ae4ba',
416+
Var('dart_git') + '/http.git@8d3c64747f9a6d99b29558b6e612dee83db7cdbb',
411417

412418
'src/third_party/dart/third_party/pkg/http_multi_server':
413419
Var('dart_git') + '/http_multi_server.git@ba9d07f3596b24718ddf45c9e071d40879cca565',
@@ -428,7 +434,7 @@ deps = {
428434
Var('dart_git') + '/logging.git@7a7bd5e31ddfe23e34d37ded82d6d0cd5706862c',
429435

430436
'src/third_party/dart/third_party/pkg/markdown':
431-
Var('dart_git') + '/markdown.git@9c6b1afc3721571af37eaaefe043a6ae7637bd09',
437+
Var('dart_git') + '/markdown.git@1ca51664e7b1b7fe789f6be2668c909ce3aea342',
432438

433439
'src/third_party/dart/third_party/pkg/matcher':
434440
Var('dart_git') + '/matcher.git@d954c8d979579b4b46427b0ea1d9c721117c191e',
@@ -491,7 +497,7 @@ deps = {
491497
Var('dart_git') + '/term_glyph.git@85a4aa6bf25cd6ecaa5c56a1b259b2d95264a439',
492498

493499
'src/third_party/dart/third_party/pkg/test':
494-
Var('dart_git') + '/test.git@ba64bbbaa26f09e139c26f9ad6409995806aac6e',
500+
Var('dart_git') + '/test.git@7724aabe8cd40b376573330f5227a6ec0a47f28e',
495501

496502
'src/third_party/dart/third_party/pkg/test_reflective_loader':
497503
Var('dart_git') + '/test_reflective_loader.git@9862703a3d14848376c8efde271c88022fba91eb',
@@ -1013,7 +1019,7 @@ deps = {
10131019
'version': 'da-siZ7wPDA0Z0wXJOEBxKat7HqQz9B3rXqV8wblgz8C'
10141020
}
10151021
],
1016-
'condition': 'host_os == "linux" and not download_fuchsia_sdk',
1022+
'condition': 'download_fuchsia_deps and not download_fuchsia_sdk',
10171023
'dep_type': 'cipd',
10181024
},
10191025

@@ -1024,7 +1030,7 @@ deps = {
10241030
'version': Var('fuchsia_test_scripts_version'),
10251031
}
10261032
],
1027-
'condition': 'run_fuchsia_emu',
1033+
'condition': 'download_fuchsia_deps',
10281034
'dep_type': 'cipd',
10291035
},
10301036

@@ -1035,6 +1041,7 @@ deps = {
10351041
'version': Var('fuchsia_gn_sdk_version'),
10361042
}
10371043
],
1044+
'condition': 'download_fuchsia_deps',
10381045
'dep_type': 'cipd',
10391046
},
10401047

@@ -1128,7 +1135,7 @@ hooks = [
11281135
{
11291136
'name': 'Download Fuchsia SDK',
11301137
'pattern': '.',
1131-
'condition': 'download_fuchsia_sdk',
1138+
'condition': 'download_fuchsia_deps and download_fuchsia_sdk',
11321139
'action': [
11331140
'python3',
11341141
'src/flutter/tools/download_fuchsia_sdk.py',
@@ -1239,5 +1246,15 @@ hooks = [
12391246
'--as-gclient-hook',
12401247
Var('mac_sdk_min')
12411248
]
1242-
}
1249+
},
1250+
{
1251+
'name': 'Generate Fuchsia GN build rules',
1252+
'pattern': '.',
1253+
'condition': 'download_fuchsia_deps',
1254+
'action': [
1255+
'python3',
1256+
'src/flutter/tools/fuchsia/with_envs.py',
1257+
'src/flutter/tools/fuchsia/test_scripts/gen_build_defs.py',
1258+
],
1259+
},
12431260
]

build/config/fuchsia/gn_configs.gni

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

5-
# TODO(richkadel): added this import and modified the fuchsia_sdk assignment.
6-
# See below.
7-
import("//build/fuchsia/sdk.gni")
8-
declare_args() {
9-
# Path to the fuchsia SDK. This is intended for use in other templates & rules
10-
# to reference the contents of the fuchsia SDK.
11-
fuchsia_sdk = "$fuchsia_sdk_path"
12-
13-
# TODO(richkadel): Since flutter needs build rules from the GN SDK, but also
14-
# requires the Fuchsia _Core_ SDK (for dart libraries, in the core SDK, but
15-
# excluded from the GN SDK), the Fuchsia SDK assumption that the build files
16-
# are in the same SDK directory path as the APIs does not hold true. (And
17-
# there are a couple of other minor tweaks that appear to be needed, at
18-
# this time.) This use case will be discussed with the SDK team, to see if we
19-
# can come up with a cleaner solution.
5+
# This file is copied from
6+
# https://crsrc.org/c/build/config/fuchsia/gn_configs.gni?q=gn_configs.gni
7+
# with some local modifications to match the flutter setup.
208

21-
# Build ID uniquely identifying the Fuchsia IDK. This is exposed as a property so
22-
# it can be used to locate images and packages on GCS and as a marker to indicate the
23-
# "version" of the IDK. If it is empty, then it is most likely that something is fatally wrong.
9+
declare_args() {
10+
# Path to the fuchsia SDK. This is intended for use in other templates &
11+
# rules to reference the contents of the fuchsia SDK.
12+
fuchsia_sdk = "//fuchsia/sdk/$host_os"
13+
14+
# ID uniquely identifying the Fuchsia IDK build. This is exposed as a
15+
# property so it can be used to locate images and packages on GCS and
16+
# as a marker to indicate the "version" of the IDK.
17+
# Defaults to the id found in the manifest.json file of the SDK.
2418
fuchsia_sdk_id = ""
2519
}
2620

27-
declare_args() {
28-
# The SDK manifest file. This is useful to include as a dependency
29-
# for some targets in order to cause a rebuild when the version of the
30-
# SDK is changed.
31-
fuchsia_sdk_manifest_file = "$fuchsia_sdk/meta/manifest.json"
21+
# TODO(zijiehe): Remove the override and move it into declare_args once the one
22+
# in //build/config/sdk.gni being removed. - b/40935282
3223

33-
# fuchsia_tool_dir is use to specify the directory in the SDK to locate tools for the
34-
# host cpu architecture. If the host_cpu is not recognized, then tool dir
35-
# defaults to x64.
36-
fuchsia_tool_dir = "$fuchsia_sdk/tools/x64"
37-
if (host_cpu == "x64" || host_cpu == "arm64") {
38-
fuchsia_tool_dir = "${fuchsia_sdk}/tools/${host_cpu}"
39-
}
24+
# The target API level for this repository. Embedders should override this
25+
# value to specify the API level the packages produced from this repository
26+
# should be targeting, e.g. in their top-level //.gn file. A value of -1
27+
# means that no API level will be passed to the tools that consumes it.
28+
fuchsia_target_api_level = 16
4029

41-
# fuchsia_auto_index_symbols when true adds the ids.txt file generated from a `fuchsia_package`
42-
# to the Fuchsia symbol index used to symbolize logs and to find source when using zxdb.
43-
# The default value is false, in order to be backwards compatibility with existing builds, and
44-
# only makes sense to set to true when building as a developer that will need to symbolize logs
45-
# or use the debugger with locally build code.
46-
fuchsia_auto_index_symbols = false
47-
}
30+
# The SDK manifest file. This is useful to include as a dependency
31+
# for some targets in order to cause a rebuild when the version of the
32+
# SDK is changed.
33+
fuchsia_sdk_manifest_file = "${fuchsia_sdk}/meta/manifest.json"
34+
35+
# fuchsia_tool_dir is used to specify the directory in the SDK to locate
36+
# tools for the host cpu architecture. If the host_cpu is not recognized,
37+
# then tool dir defaults to x64.
38+
fuchsia_tool_dir = "${fuchsia_sdk}/tools/${host_cpu}"
4839

4940
if (fuchsia_sdk_id == "") {
5041
# Note: If we need to expose more than just the id in the future,
@@ -64,3 +55,6 @@ declare_args() {
6455
fuchsia_sdk_readelf_exec = ""
6556
}
6657
}
58+
59+
# third_party/googletest is still using this condition.
60+
using_fuchsia_sdk = true

build/secondary/flutter/third_party/googletest/BUILD.gn

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# found in the LICENSE file.
44

55
if (is_fuchsia) {
6-
import("//build/fuchsia/sdk.gni")
6+
import("//flutter/tools/fuchsia/gn-sdk/src/gn_configs.gni")
77
}
88

99
config("gtest_private_config") {
@@ -34,8 +34,8 @@ static_library("gtest") {
3434
if (is_fuchsia) {
3535
if (using_fuchsia_sdk) {
3636
deps = [
37-
"$fuchsia_sdk_root/pkg:fdio",
38-
"$fuchsia_sdk_root/pkg:zx",
37+
"${fuchsia_sdk}/pkg/fdio",
38+
"${fuchsia_sdk}/pkg/zx",
3939
]
4040
} else {
4141
deps = [

ci/licenses_golden/excluded_files

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,6 @@
330330
../../../flutter/shell/platform/fuchsia/dart_runner/.gitignore
331331
../../../flutter/shell/platform/fuchsia/dart_runner/README.md
332332
../../../flutter/shell/platform/fuchsia/dart_runner/embedder/pubspec.yaml
333-
../../../flutter/shell/platform/fuchsia/dart_runner/fidl/meta.json
334333
../../../flutter/shell/platform/fuchsia/dart_runner/kernel/libraries.json
335334
../../../flutter/shell/platform/fuchsia/dart_runner/kernel/libraries.yaml
336335
../../../flutter/shell/platform/fuchsia/dart_runner/tests

ci/licenses_golden/licenses_dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Signature: c01d057033e277986624c640f663a410
1+
Signature: 6dada66d64680541f83bc84b71ddf2bb
22

33
====================================================================================================
44
LIBRARY: dart
@@ -4751,7 +4751,7 @@ Exhibit B - "Incompatible With Secondary Licenses" Notice
47514751
This Source Code Form is "Incompatible With Secondary Licenses", as
47524752
defined by the Mozilla Public License, v. 2.0.
47534753

4754-
You may obtain a copy of this library's Source Code Form from: https://dart.googlesource.com/sdk/+/d006b668dcb252171d743526e2a2f3ba34f0c48e
4754+
You may obtain a copy of this library's Source Code Form from: https://dart.googlesource.com/sdk/+/406955fe69503eb11fb16a8405534a979f5eef60
47554755
/third_party/fallback_root_certificates/
47564756

47574757
====================================================================================================

display_list/BUILD.gn

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

5-
import("//build/fuchsia/sdk.gni")
65
import("//flutter/common/config.gni")
76
import("//flutter/impeller/tools/impeller.gni")
87
import("//flutter/testing/testing.gni")
98

9+
if (is_fuchsia) {
10+
import("//flutter/tools/fuchsia/gn-sdk/src/gn_configs.gni")
11+
}
12+
1013
config("display_list_config") {
1114
defines = []
1215

@@ -142,8 +145,7 @@ if (enable_unittests) {
142145
# This is needed for //flutter/third_party/googletest for linking zircon
143146
# symbols.
144147
if (is_fuchsia) {
145-
libs =
146-
[ "${fuchsia_sdk_path}/arch/${target_cpu}/sysroot/lib/libzircon.so" ]
148+
libs = [ "${fuchsia_arch_root}/sysroot/lib/libzircon.so" ]
147149
}
148150
}
149151

@@ -174,8 +176,7 @@ if (enable_unittests) {
174176
# This is needed for //flutter/third_party/googletest for linking zircon
175177
# symbols.
176178
if (is_fuchsia) {
177-
libs =
178-
[ "${fuchsia_sdk_path}/arch/${target_cpu}/sysroot/lib/libzircon.so" ]
179+
libs = [ "${fuchsia_arch_root}/sysroot/lib/libzircon.so" ]
179180
}
180181
}
181182

flow/BUILD.gn

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

5-
import("//build/fuchsia/sdk.gni")
65
import("//flutter/common/config.gni")
76
import("//flutter/impeller/tools/impeller.gni")
87
import("//flutter/shell/config.gni")
98
import("//flutter/testing/testing.gni")
109

10+
if (is_fuchsia) {
11+
import("//flutter/tools/fuchsia/gn-sdk/src/gn_configs.gni")
12+
}
13+
1114
source_set("flow") {
1215
sources = [
1316
"compositor_context.cc",

fml/BUILD.gn

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

5-
import("//build/fuchsia/sdk.gni")
65
import("//flutter/common/config.gni")
76
import("//flutter/testing/testing.gni")
87

8+
if (is_fuchsia) {
9+
import("//flutter/tools/fuchsia/gn-sdk/src/gn_configs.gni")
10+
}
11+
912
source_set("fml") {
1013
sources = [
1114
"ascii_trie.cc",
@@ -227,16 +230,16 @@ source_set("fml") {
227230
]
228231

229232
public_deps += [
230-
"$fuchsia_sdk_root/fidl:fuchsia.diagnostics",
231-
"$fuchsia_sdk_root/fidl:fuchsia.logger",
232-
"$fuchsia_sdk_root/pkg:async-cpp",
233-
"$fuchsia_sdk_root/pkg:async-loop-cpp",
234-
"$fuchsia_sdk_root/pkg:async-loop-default",
235-
"$fuchsia_sdk_root/pkg:component_incoming_cpp",
236-
"$fuchsia_sdk_root/pkg:syslog_structured_backend",
237-
"$fuchsia_sdk_root/pkg:trace",
238-
"$fuchsia_sdk_root/pkg:trace-engine",
239-
"$fuchsia_sdk_root/pkg:zx",
233+
"${fuchsia_sdk}/fidl/fuchsia.diagnostics:fuchsia.diagnostics_cpp",
234+
"${fuchsia_sdk}/fidl/fuchsia.logger:fuchsia.logger_cpp",
235+
"${fuchsia_sdk}/pkg/async-cpp",
236+
"${fuchsia_sdk}/pkg/async-loop-cpp",
237+
"${fuchsia_sdk}/pkg/async-loop-default",
238+
"${fuchsia_sdk}/pkg/component_incoming_cpp",
239+
"${fuchsia_sdk}/pkg/syslog_structured_backend",
240+
"${fuchsia_sdk}/pkg/trace",
241+
"${fuchsia_sdk}/pkg/trace-engine",
242+
"${fuchsia_sdk}/pkg/zx",
240243
]
241244
}
242245

@@ -407,14 +410,13 @@ if (enable_unittests) {
407410

408411
if (is_fuchsia) {
409412
deps += [
410-
"$fuchsia_sdk_root/pkg:async-loop-testing",
411-
"$fuchsia_sdk_root/pkg:sys_component_cpp_testing",
413+
"${fuchsia_sdk}/pkg/async-loop-testing",
414+
"${fuchsia_sdk}/pkg/sys_component_cpp_testing",
412415
]
413416

414417
# This is needed for //flutter/third_party/googletest for linking zircon
415418
# symbols.
416-
libs =
417-
[ "${fuchsia_sdk_path}/arch/${target_cpu}/sysroot/lib/libzircon.so" ]
419+
libs = [ "${fuchsia_arch_root}/sysroot/lib/libzircon.so" ]
418420
}
419421
}
420422

lib/snapshot/BUILD.gn

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,16 @@
33
# found in the LICENSE file.
44

55
import("//build/compiled_action.gni")
6-
import("//build/fuchsia/sdk.gni")
76
import("//flutter/build/bin_to_obj.gni")
87
import("//flutter/common/config.gni")
98
import("//flutter/impeller/tools/impeller.gni")
109
import("//flutter/lib/ui/dart_ui.gni")
1110
import("$dart_src/utils/compile_platform.gni")
1211

12+
if (is_fuchsia) {
13+
import("//flutter/tools/fuchsia/gn-sdk/src/gn_configs.gni")
14+
}
15+
1316
# Generates the Dart/Flutter core platform files and tools.
1417
#
1518
# This target generates the platform-specific snapshots and snapshot-related

lib/ui/BUILD.gn

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

5-
import("//build/fuchsia/sdk.gni")
65
import("//flutter/common/config.gni")
76
import("//flutter/impeller/tools/impeller.gni")
87
import("//flutter/shell/config.gni")
98
import("//flutter/testing/testing.gni")
109

10+
if (is_fuchsia) {
11+
import("//flutter/tools/fuchsia/gn-sdk/src/gn_configs.gni")
12+
}
13+
1114
source_set("ui") {
1215
cflags = [
1316
# Dart gives us doubles. Skia and Impeller work in floats.

0 commit comments

Comments
 (0)