Update the header path prefix scrubbing rule to modify paths other than common.h
PiperOrigin-RevId: 347975503 Change-Id: Ie7675a9c92ce7cd76f4b7b3c4fd343da2a5e8bab
This commit is contained in:
parent
483d6fe292
commit
32434e14fd
@ -31,6 +31,7 @@ strip_common_include_path_prefix(
|
|||||||
name = "strip_common_include_path_core",
|
name = "strip_common_include_path_core",
|
||||||
hdr_labels = [
|
hdr_labels = [
|
||||||
"//tensorflow/lite/c:c_api.h",
|
"//tensorflow/lite/c:c_api.h",
|
||||||
|
"//tensorflow/lite/c:common.h",
|
||||||
"//tensorflow/lite/delegates/xnnpack:xnnpack_delegate.h",
|
"//tensorflow/lite/delegates/xnnpack:xnnpack_delegate.h",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
@ -49,8 +50,9 @@ tflite_ios_static_framework(
|
|||||||
name = "TensorFlowLiteC_framework",
|
name = "TensorFlowLiteC_framework",
|
||||||
hdrs = [
|
hdrs = [
|
||||||
":c_api.h",
|
":c_api.h",
|
||||||
|
":common.h",
|
||||||
":xnnpack_delegate.h",
|
":xnnpack_delegate.h",
|
||||||
"//tensorflow/lite/c:common.h",
|
"//tensorflow/lite/c:c_api_types.h",
|
||||||
],
|
],
|
||||||
allowlist_symbols_file = ":allowlist_TensorFlowLiteC.txt",
|
allowlist_symbols_file = ":allowlist_TensorFlowLiteC.txt",
|
||||||
bundle_name = "TensorFlowLiteC",
|
bundle_name = "TensorFlowLiteC",
|
||||||
|
@ -74,16 +74,16 @@ def tflite_ios_static_framework(
|
|||||||
|
|
||||||
# When the static framework is built with bazel, the all header files are moved
|
# When the static framework is built with bazel, the all header files are moved
|
||||||
# to the "Headers" directory with no header path prefixes. This auxiliary rule
|
# to the "Headers" directory with no header path prefixes. This auxiliary rule
|
||||||
# is used for stripping the path prefix to the "common.h" file included by the
|
# is used for stripping the path prefix of header inclusions paths from the
|
||||||
# "c_api.h" header.
|
# provided headers.
|
||||||
def strip_common_include_path_prefix(name, hdr_labels, prefix = ""):
|
def strip_common_include_path_prefix(name, hdr_labels, prefix = ""):
|
||||||
"""Create modified header files with the common.h include path stripped out.
|
"""Create modified header files with the inclusion path prefixes removed.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
name: The name to be used as a prefix to the generated genrules.
|
name: The name to be used as a prefix to the generated genrules.
|
||||||
hdr_labels: List of header labels to strip out the include path. Each
|
hdr_labels: List of header labels to strip out the include path. Each
|
||||||
label must end with a colon followed by the header file name.
|
label must end with a colon followed by the header file name.
|
||||||
prefix: Optional prefix path to prepend to the common.h inclusion path.
|
prefix: Optional prefix path to prepend to the final inclusion path.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
for hdr_label in hdr_labels:
|
for hdr_label in hdr_labels:
|
||||||
@ -95,7 +95,7 @@ def strip_common_include_path_prefix(name, hdr_labels, prefix = ""):
|
|||||||
srcs = [hdr_label],
|
srcs = [hdr_label],
|
||||||
outs = [hdr_filename],
|
outs = [hdr_filename],
|
||||||
cmd = """
|
cmd = """
|
||||||
sed 's|#include ".*common.h"|#include "{}common.h"|'\
|
sed -E 's|#include ".*/([^/]+\\.h)"|#include "{}\\1"|g'\
|
||||||
"$(location {})"\
|
"$(location {})"\
|
||||||
> "$@"
|
> "$@"
|
||||||
""".format(prefix, hdr_label),
|
""".format(prefix, hdr_label),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user