Skip to content

Conversation

@keith
Copy link
Member

@keith keith commented Jun 18, 2025

Fixes #12424

This reverts commit dfc72d0.

@keith keith requested a review from Copilot June 18, 2025 05:08
@keith
Copy link
Member Author

keith commented Jun 18, 2025

new version of #25749

@github-actions github-actions bot added the awaiting-review PR is awaiting review from an assigned reviewer label Jun 18, 2025
@keith
Copy link
Member Author

keith commented Jun 18, 2025

@pzembrod ptal for a reland 🙏🏻 hopefully the solution of allowing textual_hdrs to not start with strip_include_prefix is acceptable. I don't see another solution that won't break existing code. I can squash these commits once you review

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR reverts a previous change to re-enable applying strip_include_prefix to textual_hdrs. It adds a test case and updates the helper logic to handle textual headers similarly to public headers.

  • Add textual_hdrs test files and BUILD rule
  • Extend _compute_public_headers signature and logic for non-module headers
  • Integrate textual_headers into compilation context (include paths, coverage mapping, declared inputs)

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/main/starlark/tests/.../test_include_textual.cc New C++ test covering strip_include_prefix on textual headers
src/main/starlark/tests/.../not_nested.h New textual header outside nested dir
src/main/starlark/tests/.../nested/lib.h New nested header
src/main/starlark/tests/.../nested/lib.cc Implementation of foo() and its include
src/main/starlark/tests/.../BUILD.builtin_test Add cc_library/cc_test with strip_include_prefix and textual_hdrs
src/main/starlark/builtins_bzl/common/cc/compile/cc_compilation_helper.bzl Update _compute_public_headers signature and logic; wire textual headers into context
Comments suppressed due to low confidence (1)

src/main/starlark/tests/builtins_bzl/cc/basics/test/nested/lib.cc:14

  • When using strip_include_prefix = "nested", the header should be included as #include "lib.h" (or #include "nested/lib.h" before stripping) instead of the full workspace path to match the virtual include layout.
#include "src/main/starlark/tests/builtins_bzl/cc/basics/test/nested/lib.h"

@pzembrod pzembrod assigned pzembrod and unassigned pzembrod Jun 18, 2025
@pzembrod pzembrod self-requested a review June 18, 2025 18:24
@pzembrod
Copy link
Contributor

@pzembrod ptal for a reland 🙏🏻 hopefully the solution of allowing textual_hdrs to not start with strip_include_prefix is acceptable. I don't see another solution that won't break existing code. I can squash these commits once you review

Yes, your reasoning makes sense to me. And I'd actually be okay with leaving the two commits; once they get piped through the import and export mechanism, they will turn into one commit in the end anyway, I think.

@pzembrod pzembrod added awaiting-PR-merge PR has been approved by a reviewer and is ready to be merge internally and removed awaiting-review PR is awaiting review from an assigned reviewer labels Jun 18, 2025
@keith
Copy link
Member Author

keith commented Jun 18, 2025

ok great, any thoughts on #25749 (comment)

@iancha1992
Copy link
Member

@bazel-io fork 8.3.0

@github-actions github-actions bot removed the awaiting-PR-merge PR has been approved by a reviewer and is ready to be merge internally label Jun 26, 2025
bazel-io pushed a commit to bazel-io/bazel that referenced this pull request Jun 26, 2025
Fixes bazelbuild#12424

This reverts commit 35fb97f.

Closes bazelbuild#26327.

PiperOrigin-RevId: 776069042
Change-Id: Iecbcf1db90dc021582c08753517b2d27dd04eb34
copybara-service bot pushed a commit that referenced this pull request Jun 30, 2025
*** Reason for rollback ***

Breakages in the nightly: []

*** Original change description ***

Make strip_include_prefix apply to textual_hdrs

Fixes #12424

This reverts commit 35fb97f.

Closes #26327.

PiperOrigin-RevId: 777467219
Change-Id: I7d62a1e73160450c352a49610f073d4376d011fb
@keith keith reopened this Jun 30, 2025
@github-actions github-actions bot added the awaiting-review PR is awaiting review from an assigned reviewer label Jun 30, 2025
@keith keith force-pushed the ks/make-strip_include_prefix-apply-to-textual_hdrs branch from 5b24d05 to 6b8ed14 Compare June 30, 2025 16:52
@keith
Copy link
Member Author

keith commented Jun 30, 2025

this was reverted again in dfc72d0

@keith
Copy link
Member Author

keith commented Jun 30, 2025

I pushed the fix here 6e4698b (#26327) this seems to break internally at google only, so I don't have a good test case for it

@keith keith requested review from pzembrod and trybka June 30, 2025 17:05
Copy link
Contributor

@trybka trybka left a comment

Choose a reason for hiding this comment

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

LGTM. Tested with some of the internal breakages I was tracking. The added test failed before these fixes, and passes now.

@keith
Copy link
Member Author

keith commented Aug 6, 2025

@iancha1992 hit any blockers?

@iancha1992
Copy link
Member

iancha1992 commented Aug 7, 2025

@iancha1992 hit any blockers?

Hi @keith
@trybka is actually importing this one

@trybka
Copy link
Contributor

trybka commented Aug 20, 2025

Can you rebase this?

I suspect some changes may need to be made after some changes to introduce _ModuleMapInfo provider.

Currently getting :

...
        File "/virtual_builtins_bzl/common/cc/cc_common.bzl", line 673, column 19, in _compile
        File "/virtual_builtins_bzl/common/cc/compile/compile.bzl", line 245, column 112, in compile
        File "/virtual_builtins_bzl/common/cc/compile/cc_compilation_helper.bzl", line 526, column 38, in _init_cc_compilation_context
        File "/virtual_builtins_bzl/common/cc/compile/cc_compilation_helper.bzl", line 325, column 33, in _create_module_map_action
        File "/virtual_builtins_bzl/common/cc/compile/cc_compilation_helper.bzl", line 189, column 26, in _ModuleMapInfo
Error: got unexpected field 'textual_headers' in call to instantiate provider _ModuleMapInfo

@keith keith force-pushed the ks/make-strip_include_prefix-apply-to-textual_hdrs branch from 2a85b83 to 8734d18 Compare August 20, 2025 21:23
@keith
Copy link
Member Author

keith commented Aug 20, 2025

fixed, looks like it was just that thing needing a new field

@keith keith force-pushed the ks/make-strip_include_prefix-apply-to-textual_hdrs branch from 29317f9 to 0bbb178 Compare September 2, 2025 17:37
@keith keith requested review from pzembrod and trybka October 17, 2025 18:25
@keith keith force-pushed the ks/make-strip_include_prefix-apply-to-textual_hdrs branch from 0bbb178 to 28f3f6d Compare November 25, 2025 04:53
@keith
Copy link
Member Author

keith commented Nov 25, 2025

rebased to fix the conflict and add missing rules_cc imports, AFAIUI the tests are only failing because of how this has to mirrored to rules_cc at the same time as the import

@trybka
Copy link
Contributor

trybka commented Nov 25, 2025

is there a separate change for rules_cc as well?

@keith
Copy link
Member Author

keith commented Nov 25, 2025

No but I can make one if that is easier

@keith
Copy link
Member Author

keith commented Nov 27, 2025

created bazelbuild/rules_cc#537 if that's easier

keith added a commit to keith/rules_cc that referenced this pull request Dec 19, 2025
@keith keith force-pushed the ks/make-strip_include_prefix-apply-to-textual_hdrs branch from b366afe to 63fc241 Compare December 19, 2025 21:08
@trybka
Copy link
Contributor

trybka commented Dec 23, 2025

The goal would be to enable it internally soon as well, but to be able to approve this change without blocking on said clean-up.

Are the buildkite failures something we can address in this change, or are they just related to rules_cc version skew?

@keith
Copy link
Member Author

keith commented Dec 23, 2025

Yea it's that it's reading the rules_cc one for the tests which isn't sync'd.

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

Labels

awaiting-PR-merge PR has been approved by a reviewer and is ready to be merge internally team-Rules-CPP Issues for C++ rules

Projects

None yet

Development

Successfully merging this pull request may close these issues.

strip_include_prefix doesn't apply to textual_hdrs

4 participants