bazelbuild / bazelbuild/bazel

Allow rules_cc to include headers with any file extension

Open
#10,552 12 comments 11 reactions 1 assignee Claimed by @pzembrod View on GitHub
not stale P2 team-Rules-CPP type: feature request
Dominant language
Java
Stars
25.8k
Forks
4.6k
Avg merge
2d 20h
Merged PRs (30d)
72

Description

### 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?

https://github.com/bazelbuild/bazel/issues/164

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.