Skip to content

feat: declare shorten_virtual_includes as a known toolchain feature#3

Open
Reflexe wants to merge 1 commit into
Dragnalith:mainfrom
Reflexe:upstream/shorten-virtual-includes
Open

feat: declare shorten_virtual_includes as a known toolchain feature#3
Reflexe wants to merge 1 commit into
Dragnalith:mainfrom
Reflexe:upstream/shorten-virtual-includes

Conversation

@Reflexe

@Reflexe Reflexe commented Jun 20, 2026

Copy link
Copy Markdown

rules_cc gates a path-shortening branch on
feature_configuration.is_enabled("shorten_virtual_includes") at https://github.com/bazelbuild/rules_cc/blob/0.2.18/cc/private/compile/cc_compilation_helper.bzl#L421. When set, the if/else at #L127-L130 of the same file replaces the long bazel-out/.../_virtual_includes///... directory emitted by cc_library(strip_include_prefix=...) with a fixed-width hex hash. Without the feature declared in :all_known_features the toggle is silently a no-op, and Windows consumers hit cl.exe D8022 / MAX_PATH on deep include chains (proto-generated code, BCR grpc / protobuf / envoy_api).

Off by default; opt in via --features=shorten_virtual_includes, --host_features=..., or toolchain_set(features=[...]).

rules_cc gates a path-shortening branch on
feature_configuration.is_enabled("shorten_virtual_includes") at
https://github.com/bazelbuild/rules_cc/blob/0.2.18/cc/private/compile/cc_compilation_helper.bzl#L421.
When set, the if/else at #L127-L130 of the same file replaces the long
bazel-out/.../_virtual_includes/<package>/<label>/... directory emitted
by cc_library(strip_include_prefix=...) with a fixed-width hex hash.
Without the feature declared in :all_known_features the toggle is
silently a no-op, and Windows consumers hit cl.exe D8022 / MAX_PATH on
deep include chains (proto-generated code, BCR grpc / protobuf / envoy_api).

Off by default; opt in via --features=shorten_virtual_includes,
--host_features=..., or toolchain_set(features=[...]).
@Reflexe

Reflexe commented Jun 20, 2026

Copy link
Copy Markdown
Author

On a personal note, wanted to thank you a lot for your work on this project, it is very cool!

I am evaluating its usage within my team (at Entra) as an experimental build flavor. Feel free to reach out if I can help with anything.
This is probably the first PRs within many, our project compiles WDK, winrt, winui :)

Thanks a lot again, good luck.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant