Skip to content

Commit 7c9f0da

Browse files
committed
build: force savedmodel loader deps on android
1 parent 5ec3d0d commit 7c9f0da

1 file changed

Lines changed: 26 additions & 33 deletions

File tree

scripts/patch_tfjava.py

Lines changed: 26 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1315,61 +1315,54 @@ def patch_workspace(path: Path) -> None:
13151315
# TF_LoadSessionFromSavedModel() once the mobile guard above is removed.
13161316
SAVED_MODEL_ANDROID_LOADER_PATCH = """--- a/tensorflow/cc/saved_model/BUILD
13171317
+++ b/tensorflow/cc/saved_model/BUILD
1318-
@@ -6,6 +6,7 @@
1319-
"if_android",
1320-
"if_ios",
1321-
"if_mobile",
1322-
+ "if_not_android",
1323-
"if_not_mobile",
1324-
"tf_cc_test",
1325-
)
1326-
@@ -44,12 +45,15 @@
1318+
@@ -44,13 +44,12 @@ cc_library(
13271319
name = "reader",
13281320
srcs = ["reader.cc"],
13291321
hdrs = ["reader.h"],
13301322
- deps = [":constants"] + if_not_mobile([
1331-
+ deps = [":constants"] + if_not_android(if_not_mobile([
1332-
# TODO(b/111634734): :lib and :protos_all contain dependencies that
1333-
# cannot be built on mobile platforms. Instead, include the appropriate
1334-
# tf_lib depending on the build platform.
1323+
- # TODO(b/111634734): :lib and :protos_all contain dependencies that
1324+
- # cannot be built on mobile platforms. Instead, include the appropriate
1325+
- # tf_lib depending on the build platform.
1326+
+ deps = [
1327+
+ ":constants",
1328+
+ # Android JNI build needs the full loader graph available here.
13351329
"//tensorflow/core:lib",
13361330
"//tensorflow/core:protos_all_cc",
1337-
+ ])) + if_android([
1338-
+ "//tensorflow/core:lib",
1339-
+ "//tensorflow/core:protos_all_cc",
1340-
]),
1331+
- ]),
1332+
+ ],
13411333
)
13421334
1343-
@@ -94,7 +98,11 @@
1335+
tf_cc_test(
1336+
@@ -94,11 +93,11 @@ cc_library(
13441337
hdrs = ["loader.h"],
13451338
deps = if_static([
13461339
":loader_lite_impl",
13471340
- ]) + if_not_mobile([
1348-
+ ]) + if_not_android(if_not_mobile([
1349-
+ "//tensorflow/core:core_cpu",
1350-
+ "//tensorflow/core:lib",
1351-
+ "//tensorflow/core:protos_all_cc",
1352-
+ ])) + if_android([
1341+
+ ]) + [
13531342
"//tensorflow/core:core_cpu",
13541343
"//tensorflow/core:lib",
13551344
"//tensorflow/core:protos_all_cc",
1356-
@@ -108,7 +116,14 @@
1345+
- ]),
1346+
+ ],
1347+
)
1348+
1349+
cc_library(
1350+
@@ -108,14 +107,13 @@ cc_library(
13571351
deps = [
13581352
":constants",
13591353
":reader",
13601354
- ] + if_not_mobile([
1361-
+ ] + if_not_android(if_not_mobile([
1362-
+ "//tensorflow/core:core_cpu",
1363-
+ "//tensorflow/core:framework",
1364-
+ "//tensorflow/core:lib",
1365-
+ "//tensorflow/core:lib_internal",
1366-
+ "//tensorflow/core:protos_all_cc",
1367-
+ "//tensorflow/core/util/tensor_bundle:naming",
1368-
+ ])) + if_android([
13691355
"//tensorflow/core:core_cpu",
13701356
"//tensorflow/core:framework",
13711357
"//tensorflow/core:lib",
1372-
"""
1358+
"//tensorflow/core:lib_internal",
1359+
"//tensorflow/core:protos_all_cc",
1360+
"//tensorflow/core/util/tensor_bundle:naming",
1361+
- ]),
1362+
+ ],
1363+
alwayslink = 1,
1364+
)
1365+
"""
13731366

13741367

13751368
# Keep upstream tensorflow_framework deps on Android so loader_lite_impl stays

0 commit comments

Comments
 (0)