forked from google-ai-edge/LiteRT
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPATCH.flatbuffers_windows_no_bash
More file actions
62 lines (61 loc) · 2.18 KB
/
Copy pathPATCH.flatbuffers_windows_no_bash
File metadata and controls
62 lines (61 loc) · 2.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
diff --git a/third_party/flatbuffers/build_defs.bzl b/third_party/flatbuffers/build_defs.bzl
--- a/third_party/flatbuffers/build_defs.bzl
+++ b/third_party/flatbuffers/build_defs.bzl
@@ -73,6 +73,16 @@ def flatbuffer_library_public(
"$$f;",
"done",
])
+ genrule_cmd_bat = " ".join([
+ "for %f in ($(SRCS)) do (",
+ "\"$(location %s)\"" % (flatc_path),
+ " ".join(flatc_args),
+ " ".join(include_paths_cmd),
+ language_flag,
+ output_directory,
+ "%f",
+ ")",
+ ])
native.genrule(
name = name,
srcs = srcs,
@@ -81,6 +91,7 @@ def flatbuffer_library_public(
compatible_with = compatible_with,
tools = includes + [flatc_path],
cmd = genrule_cmd,
+ cmd_bat = genrule_cmd_bat,
message = "Generating flatbuffer files for %s:" % (name),
)
if reflection_name:
@@ -95,6 +106,17 @@ def flatbuffer_library_public(
"$$f;",
"done",
])
+ reflection_genrule_cmd_bat = " ".join([
+ "for %f in ($(SRCS)) do (",
+ "\"$(location %s)\"" % (flatc_path),
+ "-b --schema",
+ " ".join(flatc_args),
+ " ".join(include_paths_cmd),
+ language_flag,
+ output_directory,
+ "%f",
+ ")",
+ ])
reflection_outs = [
(out_prefix + "%s.bfbs") % (s.replace(".fbs", "").split("/")[-1])
for s in srcs
@@ -107,6 +129,7 @@ def flatbuffer_library_public(
compatible_with = compatible_with,
tools = includes + [flatc_path],
cmd = reflection_genrule_cmd,
+ cmd_bat = reflection_genrule_cmd_bat,
message = "Generating flatbuffer reflection binary for %s:" % (name),
)
# TODO(b/114456773): Make bazel rules proper and supported by flatbuffer
@@ -384,6 +407,7 @@ def flatbuffer_py_strip_prefix_srcs(name, srcs = [], strip_prefix = ""):
srcs = [src],
outs = [src.replace(strip_prefix, "")],
cmd = "cp $< $@",
+ cmd_bat = "copy /Y \"$<\" \"$@\" >NUL",
)
def _concat_flatbuffer_py_srcs_impl(ctx):