mirror of https://github.com/bazelbuild/rules_cc
Partially fix MacOS llvm coverage collection
This allows setting GCOV on the command line to overwrite the default setting, which points to /usr/bin/gcov. In order to use this, you also need to disable the gcov coverage feature and enable the llvm coverage feature instead. The full command-line looks like this: GCOV=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/llvm-profdata bazel coverage --features=llvm_coverage_map_format --features=-gcc_coverage_map_format //cpp:test Progress on #10457. Original change by ulfjack RELNOTES: None. PiperOrigin-RevId: 300583709 Change-Id: Ibeda8469db6750fc9fc3bba60e19118a2e482ed8
This commit is contained in:
parent
7fdc27c099
commit
34ca16f4aa
|
@ -142,6 +142,13 @@ def configure_osx_toolchain(repository_ctx, overriden_tools):
|
|||
"https://github.com/bazelbuild/bazel/issues with the following:\n" +
|
||||
error_msg)
|
||||
|
||||
tool_paths = {}
|
||||
gcov_path = repository_ctx.os.environ.get("GCOV")
|
||||
if gcov_path != None:
|
||||
if not gcov_path.startswith("/"):
|
||||
gcov_path = repository_ctx.which(gcov_path)
|
||||
tool_paths["gcov"] = gcov_path
|
||||
|
||||
escaped_include_paths = _get_escaped_xcode_cxx_inc_directories(repository_ctx, cc, xcode_toolchains)
|
||||
write_builtin_include_directory_paths(repository_ctx, cc, escaped_include_paths)
|
||||
escaped_cxx_include_directories = []
|
||||
|
@ -152,7 +159,12 @@ def configure_osx_toolchain(repository_ctx, overriden_tools):
|
|||
repository_ctx.template(
|
||||
"BUILD",
|
||||
paths["@bazel_tools//tools/osx/crosstool:BUILD.tpl"],
|
||||
{"%{cxx_builtin_include_directories}": "\n".join(escaped_cxx_include_directories)},
|
||||
{
|
||||
"%{cxx_builtin_include_directories}": "\n".join(escaped_cxx_include_directories),
|
||||
"%{tool_paths_overrides}": ",\n ".join(
|
||||
['"%s": "%s"' % (k, v) for k, v in tool_paths.items()],
|
||||
),
|
||||
},
|
||||
)
|
||||
else:
|
||||
configure_unix_toolchain(repository_ctx, cpu_value = "darwin", overriden_tools = overriden_tools)
|
||||
|
|
Loading…
Reference in New Issue