File tree Expand file tree Collapse file tree 5 files changed +28
-0
lines changed Expand file tree Collapse file tree 5 files changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -50,6 +50,7 @@ common_test_args=(
50
50
" --keep_going"
51
51
" --test_output=errors"
52
52
" --features=layering_check"
53
+ " --process_headers_in_dependencies"
53
54
)
54
55
55
56
# Do not run autoconf to configure local CC toolchains.
Original file line number Diff line number Diff line change @@ -348,6 +348,7 @@ def cc_toolchain_config(
348
348
# https://cs.opensource.google/bazel/bazel/+/master:src/main/starlark/builtins_bzl/common/cc/cc_toolchain_provider_helper.bzl;l=75;drc=f0150efd1cca473640269caaf92b5a23c288089d
349
349
# https://cs.opensource.google/bazel/bazel/+/master:src/main/java/com/google/devtools/build/lib/rules/cpp/CcModule.java;l=1257;drc=6743d76f9ecde726d592e88d8914b9db007b1c43
350
350
# https://cs.opensource.google/bazel/bazel/+/refs/tags/7.0.0:tools/cpp/unix_cc_toolchain_config.bzl;l=192,201;drc=044a14cca2747aeff258fc71eaeb153c08cb34d5
351
+ # https://github.com/bazelbuild/rules_cc/blob/fe41fc4ea219c9d3680ee536bba6681f3baf838e/cc/private/toolchain/unix_cc_toolchain_config.bzl#L1887
351
352
# NOTE: Ensure these are listed in toolchain_tools in toolchain/internal/common.bzl.
352
353
tool_paths = {
353
354
"ar" : tools_path_prefix + ("llvm-ar" if not use_libtool else "libtool" ),
@@ -362,6 +363,7 @@ def cc_toolchain_config(
362
363
"objcopy" : tools_path_prefix + "llvm-objcopy" ,
363
364
"objdump" : tools_path_prefix + "llvm-objdump" ,
364
365
"strip" : tools_path_prefix + "llvm-strip" ,
366
+ "parse_headers" : wrapper_bin_prefix + "cc_wrapper.sh" ,
365
367
}
366
368
367
369
# Start-end group linker support:
Original file line number Diff line number Diff line change @@ -82,6 +82,18 @@ if [[ ! -f ${toolchain_path_prefix}bin/clang ]]; then
82
82
exit 5
83
83
fi
84
84
85
+ OUTPUT=
86
+
87
+ function parse_option() {
88
+ local -r opt=" $1 "
89
+ if [[ " ${OUTPUT} " = " 1" ]]; then
90
+ OUTPUT=${opt}
91
+ elif [[ " ${opt} " = " -o" ]]; then
92
+ # output is coming
93
+ OUTPUT=1
94
+ fi
95
+ }
96
+
85
97
function sanitize_option() {
86
98
local -r opt=$1
87
99
if [[ ${opt} == * /cc_wrapper.sh ]]; then
@@ -106,6 +118,7 @@ for ((i = 0; i <= $#; i++)); do
106
118
set -e
107
119
sanitize_option " ${opt} "
108
120
) "
121
+ parse_option " ${opt} "
109
122
echo " ${opt} " >> " ${tmpfile} "
110
123
done < " ${! i: 1} "
111
124
cmd+=(" @${tmpfile} " )
@@ -114,9 +127,15 @@ for ((i = 0; i <= $#; i++)); do
114
127
set -e
115
128
sanitize_option " ${! i} "
116
129
) "
130
+ parse_option " ${opt} "
117
131
cmd+=(" ${opt} " )
118
132
fi
119
133
done
120
134
121
135
# Call the C++ compiler.
122
136
" ${cmd[@]} "
137
+
138
+ # Generate an empty file if header processing succeeded.
139
+ if [[ " ${OUTPUT} " == * .h.processed ]]; then
140
+ echo -n > " ${OUTPUT} "
141
+ fi
Original file line number Diff line number Diff line change @@ -531,6 +531,7 @@ cc_toolchain(
531
531
strip_files = "strip-files-{suffix}",
532
532
toolchain_config = "local-{suffix}",
533
533
module_map = "module-{suffix}",
534
+ supports_header_parsing = True,
534
535
)
535
536
"""
536
537
Original file line number Diff line number Diff line change 183
183
# Call the C++ compiler.
184
184
" ${cmd[@]} "
185
185
186
+ # Generate an empty file if header processing succeeded.
187
+ if [[ " ${OUTPUT} " == * .h.processed ]]; then
188
+ echo -n > " ${OUTPUT} "
189
+ fi
190
+
186
191
function get_library_path() {
187
192
for libdir in ${LIB_DIRS} ; do
188
193
if [[ -f " ${libdir} /lib$1 " .so ]]; then
You can’t perform that action at this time.
0 commit comments