Skip to content

Commit 347407a

Browse files
justinhorvitzcopybara-github
authored andcommitted
Point virtual includes symlinks to the source root instead of the exec root for bazel. See #20540.
Closes #20540. PiperOrigin-RevId: 599516682 Change-Id: I57ac896c9fe127b428367043015feaaaf7b57339
1 parent b91b2f5 commit 347407a

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

src/main/starlark/builtins_bzl/common/cc/cc_compilation_helper.bzl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
load(":common/cc/cc_common.bzl", "cc_common")
1818
load(":common/cc/cc_helper.bzl", "cc_helper")
19+
load(":common/cc/semantics.bzl", "USE_EXEC_ROOT_FOR_VIRTUAL_INCLUDES_SYMLINKS")
1920
load(":common/paths.bzl", "paths")
2021

2122
cc_internal = _builtins.internal.cc_internal
@@ -120,7 +121,7 @@ def _compute_public_headers(
120121
output = virtual_header,
121122
target_file = original_header,
122123
progress_message = "Symlinking virtual headers for " + label.name,
123-
use_exec_root_for_source = True,
124+
use_exec_root_for_source = USE_EXEC_ROOT_FOR_VIRTUAL_INCLUDES_SYMLINKS,
124125
)
125126
module_map_headers.append(virtual_header)
126127
if config.coverage_enabled:

src/main/starlark/builtins_bzl/common/cc/semantics.bzl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@
1414

1515
"""Semantics for Bazel cc rules"""
1616

17+
# Point virtual includes symlinks to the source root for better IDE integration.
18+
# See https://github.com/bazelbuild/bazel/pull/20540.
19+
# TODO: b/320980684 - Add a test that fails if this is flipped to True.
20+
USE_EXEC_ROOT_FOR_VIRTUAL_INCLUDES_SYMLINKS = False
21+
1722
def _get_proto_aspects():
1823
return []
1924

0 commit comments

Comments
 (0)