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

cc_library rule should also be able to strip_srcs_prefix #3212

Closed
MarkusTeufelberger opened this issue Jun 19, 2017 · 2 comments
Closed

cc_library rule should also be able to strip_srcs_prefix #3212

MarkusTeufelberger opened this issue Jun 19, 2017 · 2 comments
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

Comments

@MarkusTeufelberger
Copy link
Contributor

MarkusTeufelberger commented Jun 19, 2017

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

  • Operating System:
    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.

@hlopko hlopko added category: rules > C++ P3 We're not considering working on this, but happy to review a PR. (No assignee) type: feature request labels Jun 26, 2017
@lberki
Copy link
Contributor

lberki commented Jun 26, 2017

This is another instance of the "I want an include path for my rule only" issue. We should have an attribute for that, but until we do, the best thing I can recommend is copts=["-I..."].

@lberki lberki assigned hlopko and unassigned lberki Jun 26, 2017
@hlopko hlopko added team-Rules-CPP Issues for C++ rules and removed category: rules > C++ labels Oct 11, 2018
@hlopko hlopko removed their assignment Dec 6, 2019
@c-mita c-mita added P4 This is either out of scope or we don't have bandwidth to review a PR. (No assignee) and removed P3 We're not considering working on this, but happy to review a PR. (No assignee) labels Nov 24, 2020
@sgowroji sgowroji added the stale Issues or PRs that are stale (no activity for 30 days) label Feb 3, 2023
@sgowroji
Copy link
Member

Hi there! We're doing a clean up of old issues and will be closing this one. Please reopen if you’d like to discuss anything further. We’ll respond as soon as we have the bandwidth/resources to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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
Projects
None yet
Development

No branches or pull requests

5 participants