cc_library rule should also be able to strip_srcs_prefix #3212
Labels
P4
This is either out of scope or we don't have bandwidth to review a PR. (No assignee)
stale
Issues or PRs that are stale (no activity for 30 days)
team-Rules-CPP
Issues for C++ rules
type: feature request
Please provide the following information. The more we know about your system and use case, the more easily and likely we can help.
Description of the problem / feature request / question:
I automatically generate WORKSPACE rules from github commit hashes and repository links (that way it is not that easily possible to strip extra directories by default from the received tarball). Some libraries (an example is lz4) however put their code into sub-folders.
In general that is nor much of an issue, but https://github.com/lz4/lz4/blob/7bb64ff2b69a9f8367de9ab483cdadf42b4c1b65/lib/lz4hc.c#L74 includes a .c file that I don't really want to expose to users of a BUILD file for lz4. My current solution is to create an additional private "header" to be able to remove the unwanted prefix (https://github.com/MarkusTeufelberger/BBW/blob/c6d0ea14bb039d55f368864a5bb83bcbc112576c/packages/github.com/lz4/lz4/lz4_1_7_5%2B.BUILD#L17).
I would prefer to be able to remove the prefix from files in srcs[...] too, so I could add "lib/lz4.c" in the lz4_hc rule.
If possible, provide a minimal example to reproduce the problem:
See my BBW repo for lz4. (https://github.com/MarkusTeufelberger/BBW/blob/c6d0ea14bb039d55f368864a5bb83bcbc112576c/packages/github.com/lz4/lz4/lz4_1_7_5%2B.BUILD)
Environment info
Linux
Have you found anything relevant by searching the web?
(e.g. StackOverflow answers,
GitHub issues,
email threads on the
bazel-discuss
Google group)https://bazel.build/versions/master/docs/be/c-cpp.html#cc_library.strip_include_prefix already exists, I'd like to see strip_srcs_prefix added.
Anything else, information or logs or outputs that would be helpful?
(If they are large, please upload as attachment or provide link).
Maybe this is a bad idea and how I solved it is actually the correct way (after all, the file is included, similar to a header file in this case) - in that case, please feel free to close this feature request. It just felt really awkward to do it that way.
The text was updated successfully, but these errors were encountered: