Prefix cxx_builtin_include_directories with %workspace%
Copybara Import from https://github.com/bazelbuild/rules_cc/pull/536
BEGIN_PUBLIC
Prefix cxx_builtin_include_directories with %workspace% (#536)
When passing a directory as a sysroot, the files in the sysroot must be
added here. Previously just the raw relative path such as
`external/sysroot/` was set, which bazel still errored on with
undeclared inclusions. By prefixing this with `%workspace%` bazel is
happy.
Since we're always passing some bazel target here, this seems safe.
Closes #536
END_PUBLIC
COPYBARA_INTEGRATE_REVIEW=https://github.com/bazelbuild/rules_cc/pull/536 from keith:ks/prefix-cxx_builtin_include_directories-with-workspace 1f91c4609f5f0ec5d63f5dcf43b673553e500038
PiperOrigin-RevId: 837085143
Change-Id: If6426c020c26a1af51c2d38ca882c954265fb016
diff --git a/cc/toolchains/impl/legacy_converter.bzl b/cc/toolchains/impl/legacy_converter.bzl
index 8f8a460..5e8a144 100644
--- a/cc/toolchains/impl/legacy_converter.bzl
+++ b/cc/toolchains/impl/legacy_converter.bzl
@@ -204,7 +204,7 @@
))
cxx_builtin_include_directories = [
- d.path
+ "%workspace%/" + d.path
for d in toolchain.allowlist_include_directories.to_list()
]
cxx_builtin_include_directories += toolchain.allowlist_absolute_include_directories.to_list()