Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow rules_cc to include headers with any file extension #10552

Open
finn-ball opened this issue Jan 9, 2020 · 10 comments
Open

Allow rules_cc to include headers with any file extension #10552

finn-ball opened this issue Jan 9, 2020 · 10 comments
Labels
not stale Issues or PRs that are inactive but not considered stale P4 This is either out of scope or we don't have bandwidth to review a PR. (No assignee) team-Rules-CPP Issues for C++ rules type: feature request

Comments

@finn-ball
Copy link
Contributor

finn-ball commented Jan 9, 2020

Description of the problem / feature request:

Custom file extensions for rules_cc

Feature requests: what underlying problem are you trying to solve with this feature?

Importing headers such as foo.bar

Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

I have a cc file which has a non-standard include file extension:

#include "hello-world.foo"

How do you include this in a cc_library?

cc_library(
      name = "foo",
      srcs = ["foo.c"],
      hdrs = ["hello-world.foo"],
  )

This just throws an error:

(expected .cc, .cpp, .cxx, .c++, .C, .c, .h, .hh, .hpp, .ipp, .hxx, .h++, .inc, .inl, .tlh, .tli, .H, .S, .s, .asm, .a, .lib, .pic.a, .lo, .lo.lib, .pic.lo, .so, .dylib, .dll, .o, .obj or .pic.o)

To me this looks like it might be hardcoded and there isn't a way to easily add new file extensions:
https://github.com/bazelbuild/bazel/blob/master/src/main/java/com/google/devtools/build/lib/bazel/rules/cpp/BazelCppRuleClasses.java#L73

What operating system are you running Bazel on?

Arch

What's the output of bazel info release?

release 2.0.0

Have you found anything relevant by searching the web?

#164

@finn-ball finn-ball changed the title Allow cc_library to include headers with custom file extensions Allow rules_cc to include headers with any file extension Jan 9, 2020
@irengrig irengrig added team-Rules-CPP Issues for C++ rules untriaged labels Jan 11, 2020
@oquenchil oquenchil added P2 We'll consider working on this in future. (Assignee optional) type: feature request and removed untriaged labels Feb 18, 2020
@oquenchil
Copy link
Contributor

This keeps being a pain point for users. We should evaluate where our code would break if we just let any header extensions since some logic internally decides one code path or the other based on extension.

@aiuto
Copy link
Contributor

aiuto commented Feb 19, 2020

Or maybe just open it up to anything and if the extension is unrecognized then treat it in the same way we treat a .h file.

@hahaking119
Copy link

I think this problem needs to be solved.
when I use odb library,I also find hdrs attribute of cc_import rule @deps//:odb: '@deps//:odb/include/odb/view-result.txx' does not produce any cc_import hdrs files (expected .h, .hh, .hpp, .ipp, .hxx, .h++, .inc, .inl, .tlh, .tli or .H)

@louchenyao
Copy link

This will fix #6578 once .cuh can be recognized as header files.

@oquenchil oquenchil added the help wanted Someone outside the Bazel team could own this label Aug 12, 2020
@yagehu
Copy link

yagehu commented Aug 24, 2020

I'm building 502.gcc_r benchmark from SPEC2017 suite. It has non-standard header extensions as well. *.def. Modifying source code is not an option for me. How can I work around this?

@oquenchil oquenchil added P4 This is either out of scope or we don't have bandwidth to review a PR. (No assignee) and removed P2 We'll consider working on this in future. (Assignee optional) help wanted Someone outside the Bazel team could own this labels Nov 19, 2020
@jfietz
Copy link

jfietz commented Nov 24, 2020

Another one here. Our product auto-generates some C++ headers and files, and we use extensions to differentiate between auto-generated and handwritten code and headers.

@github-actions
Copy link

Thank you for contributing to the Bazel repository! This issue has been marked as stale since it has not had any activity in the last 2+ years. It will be closed in the next 14 days unless any other activity occurs or one of the following labels is added: "not stale", "awaiting-bazeler". Please reach out to the triage team (@bazelbuild/triage) if you think this issue is still relevant or you are interested in getting the issue resolved.

@github-actions github-actions bot added the stale Issues or PRs that are stale (no activity for 30 days) label Apr 12, 2023
@github-actions
Copy link

This issue has been automatically closed due to inactivity. If you're still interested in pursuing this, please reach out to the triage team (@bazelbuild/triage). Thanks!

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Apr 27, 2023
@fmeum
Copy link
Collaborator

fmeum commented Nov 27, 2023

@bazelbuild/triage please reopen

@iancha1992 iancha1992 reopened this Nov 27, 2023
@iancha1992 iancha1992 added not stale Issues or PRs that are inactive but not considered stale and removed stale Issues or PRs that are stale (no activity for 30 days) labels Nov 27, 2023
@wade-arista
Copy link

I was considering going down the path of a PR that would use something at the level of command line to (effectively) extend the CC_HEADER definition per invocation.

Another thought was to have it declared in the toolchain config.

Is there an appetite for either of these approaches? One more than the other?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
not stale Issues or PRs that are inactive but not considered stale P4 This is either out of scope or we don't have bandwidth to review a PR. (No assignee) team-Rules-CPP Issues for C++ rules type: feature request
Projects
None yet
Development

No branches or pull requests