Skip to content

Commit 890fc8f

Browse files
msjarrettcopybara-github
authored andcommitted
Create a standard config :grpc_small_clients for binary-size sensitive
clients. This includes Android, iOS, and a newly-introduced opt-in flag --//:small_clients. My assumption is that it will be rare for clients to take opt-out features piecemeal - if they are size constrained, they will want every possible opt-out. I've left the existing opt-outs in place for current users, but future features can decide if they need their own flag or not. PiperOrigin-RevId: 789820421
1 parent 5ec3db4 commit 890fc8f

File tree

2 files changed

+36
-32
lines changed

2 files changed

+36
-32
lines changed

BUILD

Lines changed: 34 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,16 @@ exports_files(
4848
visibility = ["//:__subpackages__"],
4949
)
5050

51+
bool_flag(
52+
name = "small_client",
53+
build_setting_default = False,
54+
)
55+
56+
config_setting(
57+
name = "small_client_flag",
58+
flag_values = {":small_client": "true"},
59+
)
60+
5161
config_setting(
5262
name = "grpc_no_ares",
5363
values = {"define": "grpc_no_ares=true"},
@@ -122,53 +132,52 @@ config_setting(
122132
values = {"define": "use_systemd=true"},
123133
)
124134

135+
config_setting(
136+
name = "fuchsia",
137+
constraint_values = ["@platforms//os:fuchsia"],
138+
)
139+
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.
125143
selects.config_setting_group(
126-
name = "grpc_no_xds",
144+
name = "grpc_small_clients",
127145
match_any = [
128-
":grpc_no_xds_define",
129-
# In addition to disabling XDS support when --define=grpc_no_xds=true is
130-
# specified, we also disable it on mobile platforms where it is not
131-
# likely to be needed and where reducing the binary size is more
132-
# important.
146+
":small_client_flag", # --//:small_client
133147
":android",
134148
":ios",
135149
],
136150
)
137151

152+
selects.config_setting_group(
153+
name = "grpc_no_xds",
154+
match_any = [
155+
":grpc_no_xds_define", # --define=grpc_no_xds=true
156+
":grpc_small_clients",
157+
],
158+
)
159+
138160
selects.config_setting_group(
139161
name = "grpc_no_ztrace",
140162
match_any = [
141-
":grpc_no_ztrace_define",
142-
# In addition to disabling ztrace support when --define=grpc_no_ztrace=true is
143-
# specified, we also disable it on mobile platforms where it is not
144-
# likely to be needed and where reducing the binary size is more
145-
# important.
146-
":android",
147-
":ios",
163+
":grpc_no_ztrace_define", # --define=grpc_no_ztrace=true
164+
":grpc_small_clients",
148165
],
149166
)
150167

151168
selects.config_setting_group(
152169
name = "grpc_no_rls",
153170
match_any = [
154-
":grpc_no_rls_flag",
155-
# Disable RLS support on mobile platforms where it is not likely to be
156-
# needed and where reducing the binary size is more important.
157-
":android",
158-
":ios",
171+
":grpc_no_rls_flag", # --//:disable_grpc_rls
172+
":grpc_small_clients",
159173
],
160174
)
161175

162176
selects.config_setting_group(
163177
name = "grpc_experiments_are_final",
164178
match_any = [
165-
":grpc_experiments_are_final_define",
166-
# In addition to disabling experiments when
167-
# --define=grpc_experiments_are_final=true is specified, we also disable
168-
# them on mobile platforms where runtime configuration of experiments is unlikely to be needed and where
169-
# reducing the binary size is more important.
170-
":android",
171-
":ios",
179+
":grpc_experiments_are_final_define", # --define=grpc_experiments_are_final=true
180+
":grpc_small_clients",
172181
],
173182
)
174183

src/core/BUILD

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -79,13 +79,8 @@ config_setting(
7979
selects.config_setting_group(
8080
name = "grpc_no_filter_fusion",
8181
match_any = [
82-
":grpc_no_filter_fusion_define",
83-
# In addition to disabling filter fusion support when
84-
# --define=grpc_no_filter_fusion=true is specified, we also disable it
85-
# on mobile platforms where it is not likely to be needed and where
86-
# reducing the binary size is more important.
87-
"//:android",
88-
"//:ios",
82+
":grpc_no_filter_fusion_define", # --define=grpc_no_filter_fusion=true
83+
"//:grpc_small_clients",
8984
],
9085
)
9186

0 commit comments

Comments
 (0)