Skip to content

Commit ac15e06

Browse files
msjarrettcopybara-github
authored andcommitted
Mark Fuchsia OS as a gRPC small client for binary size optimization. Add an opt-out flag --//:exclude_small_client.
Most of the Fuchsia-powered devices I'm aware of are heavily storage-constrained, and I know some Fuchsia package using gRPC use the existing build flags to strip features. This will make it the default, similar to Android and iOS. PiperOrigin-RevId: 792674233
1 parent b90dc2f commit ac15e06

File tree

1 file changed

+29
-5
lines changed

1 file changed

+29
-5
lines changed

BUILD

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,16 @@ config_setting(
5858
flag_values = {":small_client": "true"},
5959
)
6060

61+
bool_flag(
62+
name = "exclude_small_client",
63+
build_setting_default = False,
64+
)
65+
66+
config_setting(
67+
name = "not_exclude_small_client_flag", # Negative so it can be used with match_all.
68+
flag_values = {":exclude_small_client": "false"},
69+
)
70+
6171
config_setting(
6272
name = "grpc_no_ares",
6373
values = {"define": "grpc_no_ares=true"},
@@ -137,15 +147,29 @@ config_setting(
137147
constraint_values = ["@platforms//os:fuchsia"],
138148
)
139149

140-
# Automatically disable certain deps for space-constrained clients where
141-
# optional features may not be needed and binary size is more important.
142-
# This includes mobile clients, and builds which request it explicitly.
150+
# Opt-ins for small clients, before the opt-out flag is applied.
143151
selects.config_setting_group(
144-
name = "grpc_small_clients",
152+
name = "grpc_small_clients_enable",
145153
match_any = [
146-
":small_client_flag", # --//:small_client
154+
":small_client_flag",
147155
":android",
148156
":ios",
157+
":fuchsia",
158+
],
159+
visibility = ["//visibility:private"],
160+
)
161+
162+
# Automatically disable certain deps for space-constrained clients where
163+
# optional features may not be needed and binary size is more important.
164+
# This includes Android, iOS, Fuchsia, and builds which request it explicitly with
165+
# --//:small_client.
166+
#
167+
# A build can opt out of this behavior by setting --//:exclude_small_client.
168+
selects.config_setting_group(
169+
name = "grpc_small_clients",
170+
match_all = [
171+
":grpc_small_clients_enable",
172+
":not_exclude_small_client_flag",
149173
],
150174
)
151175

0 commit comments

Comments
 (0)