@@ -171,6 +171,111 @@ def patch_workspace(path: Path) -> None:
171171"""
172172
173173
174+ TFE_C_API_ANDROID_DEPS_PATCH = """--- a/tensorflow/c/eager/BUILD
175+ +++ b/tensorflow/c/eager/BUILD
176+ @@ -73,20 +73,24 @@
177+ }) + [
178+ "@com_google_absl//absl/memory",
179+ "//tensorflow/core/common_runtime/eager:eager_operation",
180+ - "//tensorflow/core/distributed_runtime/eager:remote_mgr",
181+ - "//tensorflow/core/distributed_runtime/eager:cluster_function_library_runtime",
182+ - "//tensorflow/core/distributed_runtime/eager:eager_client",
183+ - "//tensorflow/core/distributed_runtime/rpc/eager:grpc_eager_client",
184+ - "//tensorflow/core/distributed_runtime/rpc:grpc_channel",
185+ - "//tensorflow/core/distributed_runtime/rpc:grpc_server_lib",
186+ - "//tensorflow/core/distributed_runtime/rpc:grpc_worker_cache",
187+ - "//tensorflow/core/distributed_runtime/rpc:grpc_worker_service",
188+ - "//tensorflow/core/distributed_runtime/rpc:rpc_rendezvous_mgr",
189+ - "//tensorflow/core/distributed_runtime:remote_device",
190+ - "//tensorflow/core/distributed_runtime:server_lib",
191+ - "//tensorflow/core/distributed_runtime:worker_env",
192+ "//tensorflow/core:gpu_runtime",
193+ - ],
194+ + ] + select({
195+ + "//tensorflow:android": [],
196+ + "//conditions:default": [
197+ + "//tensorflow/core/distributed_runtime/eager:remote_mgr",
198+ + "//tensorflow/core/distributed_runtime/eager:cluster_function_library_runtime",
199+ + "//tensorflow/core/distributed_runtime/eager:eager_client",
200+ + "//tensorflow/core/distributed_runtime/rpc/eager:grpc_eager_client",
201+ + "//tensorflow/core/distributed_runtime/rpc:grpc_channel",
202+ + "//tensorflow/core/distributed_runtime/rpc:grpc_server_lib",
203+ + "//tensorflow/core/distributed_runtime/rpc:grpc_worker_cache",
204+ + "//tensorflow/core/distributed_runtime/rpc:grpc_worker_service",
205+ + "//tensorflow/core/distributed_runtime/rpc:rpc_rendezvous_mgr",
206+ + "//tensorflow/core/distributed_runtime:remote_device",
207+ + "//tensorflow/core/distributed_runtime:server_lib",
208+ + "//tensorflow/core/distributed_runtime:worker_env",
209+ + ],
210+ + }),
211+ alwayslink = 1,
212+ )
213+
214+ @@ -254,18 +258,22 @@
215+ "@com_google_absl//absl/memory",
216+ "//tensorflow/c:tf_status_helper",
217+ "//tensorflow/core/common_runtime/eager:eager_operation",
218+ - "//tensorflow/core/distributed_runtime/eager:eager_client",
219+ - "//tensorflow/core/distributed_runtime/rpc/eager:grpc_eager_client",
220+ - "//tensorflow/core/distributed_runtime/rpc:grpc_channel",
221+ - "//tensorflow/core/distributed_runtime/rpc:grpc_server_lib",
222+ - "//tensorflow/core/distributed_runtime/rpc:grpc_worker_cache",
223+ - "//tensorflow/core/distributed_runtime/rpc:grpc_worker_service",
224+ - "//tensorflow/core/distributed_runtime/rpc:rpc_rendezvous_mgr",
225+ - "//tensorflow/core/distributed_runtime:remote_device",
226+ - "//tensorflow/core/distributed_runtime:server_lib",
227+ - "//tensorflow/core/distributed_runtime:worker_env",
228+ "//tensorflow/core:gpu_runtime",
229+ - ],
230+ + ] + select({
231+ + "//tensorflow:android": [],
232+ + "//conditions:default": [
233+ + "//tensorflow/core/distributed_runtime/eager:eager_client",
234+ + "//tensorflow/core/distributed_runtime/rpc/eager:grpc_eager_client",
235+ + "//tensorflow/core/distributed_runtime/rpc:grpc_channel",
236+ + "//tensorflow/core/distributed_runtime/rpc:grpc_server_lib",
237+ + "//tensorflow/core/distributed_runtime/rpc:grpc_worker_cache",
238+ + "//tensorflow/core/distributed_runtime/rpc:grpc_worker_service",
239+ + "//tensorflow/core/distributed_runtime/rpc:rpc_rendezvous_mgr",
240+ + "//tensorflow/core/distributed_runtime:remote_device",
241+ + "//tensorflow/core/distributed_runtime:server_lib",
242+ + "//tensorflow/core/distributed_runtime:worker_env",
243+ + ],
244+ + }),
245+ alwayslink = 1,
246+ )
247+
248+ """
249+
250+
251+ EAGER_CONTEXT_ANDROID_DEPS_PATCH = """--- a/tensorflow/core/common_runtime/eager/BUILD
252+ +++ b/tensorflow/core/common_runtime/eager/BUILD
253+ @@ -55,14 +55,14 @@
254+ ":eager_executor",
255+ ":kernel_and_device",
256+ ":process_function_library_runtime",
257+ - "//tensorflow/core/distributed_runtime/eager:remote_tensor_handle",
258+ - "//tensorflow/core/distributed_runtime:rendezvous_mgr_interface",
259+ - "//tensorflow/core/distributed_runtime:worker_env",
260+ - ] + select({
261+ - "//tensorflow:android": [
262+ - "//tensorflow/core:android_tensorflow_lib_lite",
263+ - ],
264+ - "//conditions:default": [
265+ + ] + select({
266+ + "//tensorflow:android": [
267+ + "//tensorflow/core:android_tensorflow_lib_lite",
268+ + ],
269+ + "//conditions:default": [
270+ + "//tensorflow/core/distributed_runtime/eager:remote_tensor_handle",
271+ + "//tensorflow/core/distributed_runtime:rendezvous_mgr_interface",
272+ + "//tensorflow/core/distributed_runtime:worker_env",
273+ "//tensorflow/core:core_cpu_lib",
274+ "//tensorflow/core:framework",
275+ "//tensorflow/core:framework_internal",
276+ """
277+
278+
174279def write_tensorflow_android_absl_patch (path : Path ) -> None :
175280 path .parent .mkdir (parents = True , exist_ok = True )
176281 absl_patch_text = (
@@ -188,6 +293,8 @@ def write_tensorflow_android_absl_patch(path: Path) -> None:
188293 )
189294 text += BFLOAT16_CSTDINT_PATCH
190295 text += LLVM_ANDROID_CONFIG_PATCH
296+ text += TFE_C_API_ANDROID_DEPS_PATCH
297+ text += EAGER_CONTEXT_ANDROID_DEPS_PATCH
191298 if not text .endswith ("\n " ):
192299 text += "\n "
193300 path .write_text (text , encoding = "utf-8" )
0 commit comments