Skip to content

Conversation

@keith
Copy link
Member

@keith keith commented Dec 19, 2025

This new attribute solves one of the longstanding annoyances with
private include paths for third party projects. Today users often
hardcode -Iexternal/something or come up with some complicated
workarounds with custom rules vending make variables or
implementation_deps

This attribute is named after, and has the same semantics, as defines
vs local_defines. These paths are only used in the context of the rule
that they are on.

Fixes bazelbuild/bazel#16472

This new attribute solves one of the longstanding annoyances with
private include paths for third party projects. Today users often
hardcode `-Iexternal/something` or come up with some complicated
workarounds with custom rules vending make variables or
`implementation_deps`

This attribute is named after, and has the same semantics, as `defines`
vs `local_defines`. These paths are only used in the context of the rule
that they are on.

Fixes bazelbuild/bazel#16472
"includes": "Returns the set of search paths (as strings) for header files referenced " +
"both by angle bracket and quotes. Usually passed with -I.",
"local_includes": "Returns the set of search paths (as strings) for header files referenced " +
"both by angle bracket and quotes. Usually passed with -I.",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a note about propagation, similar to defines/local_defines below.

<code>-I path_to_package/include_entry</code>.
Unlike <a href="#cc_binary.includes">INCLUDES</a>, these flags are added for
this rule and not added to every rule that depends on it.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
this rule and not added to every rule that depends on it.
this target and not added to every target that depends on it.

@fmeum
Copy link
Collaborator

fmeum commented Dec 26, 2025

This also fixes bazelbuild/bazel#24144

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.

Feature Request: local_includes for cc_library, making an easy path for good cross-platform hygiene

2 participants