Skip to content

Commit 588c424

Browse files
committed
Patch Abseil str_format Android build
1 parent b52116c commit 588c424

1 file changed

Lines changed: 18 additions & 3 deletions

File tree

scripts/patch_tfjava.py

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,18 @@ def patch_workspace(path: Path) -> None:
104104
"""
105105

106106

107+
ABSL_EXTENSION_CSTDINT_PATCH_HUNK = """--- ./absl/strings/internal/str_format/extension.h\t2019-09-23 13:20:52.000000000 -0700
108+
+++ ./absl/strings/internal/str_format/extension.h.fixed\t2019-09-23 13:20:48.000000000 -0700
109+
@@ -17,6 +17,7 @@
110+
111+
#include <limits.h>
112+
+#include <cstdint>
113+
#include <cstddef>
114+
#include <cstring>
115+
#include <ostream>
116+
"""
117+
118+
107119
BFLOAT16_CSTDINT_PATCH = """--- a/tensorflow/core/lib/bfloat16/bfloat16.h
108120
+++ b/tensorflow/core/lib/bfloat16/bfloat16.h
109121
@@ -17,6 +17,7 @@
@@ -119,12 +131,15 @@ def patch_workspace(path: Path) -> None:
119131

120132
def write_tensorflow_android_absl_patch(path: Path) -> None:
121133
path.parent.mkdir(parents=True, exist_ok=True)
134+
absl_patch_text = (
135+
ORIGINAL_TENSORFLOW_ABSL_PATCH
136+
+ ANDROID_GRAPHCYCLES_PATCH_HUNK
137+
+ ABSL_EXTENSION_CSTDINT_PATCH_HUNK
138+
)
122139
text = "".join(
123140
difflib.unified_diff(
124141
ORIGINAL_TENSORFLOW_ABSL_PATCH.splitlines(keepends=True),
125-
(ORIGINAL_TENSORFLOW_ABSL_PATCH + ANDROID_GRAPHCYCLES_PATCH_HUNK).splitlines(
126-
keepends=True
127-
),
142+
absl_patch_text.splitlines(keepends=True),
128143
fromfile="a/third_party/com_google_absl_fix_mac_and_nvcc_build.patch",
129144
tofile="b/third_party/com_google_absl_fix_mac_and_nvcc_build.patch",
130145
)

0 commit comments

Comments
 (0)