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_* rules does not expand location make variables #12482

Closed
erenon opened this issue Nov 14, 2020 · 0 comments
Closed

cc_* rules does not expand location make variables #12482

erenon opened this issue Nov 14, 2020 · 0 comments
Labels
P3 We're not considering working on this, but happy to review a PR. (No assignee) team-Rules-CPP Issues for C++ rules type: support / not a bug (process)

Comments

@erenon
Copy link
Contributor

erenon commented Nov 14, 2020

Description of the problem / feature request:

The documentation says:

defines: List of defines to add to the compile line. Subject to "Make" variable substitution and Bourne shell tokenization.

It seems substitution of $(location label), $(execpath label), $(rootpath label) and their plural form does not work.

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

cc_library(
    name = "makevar",
    srcs = ["foo.h"],
    data = ["foo.h"],
    defines = ['FOO="$(location foo.h)"'],
)
$ bazel aquery makevar:makevar
... in defines attribute of cc_library rule //makevar:makevar: $(location) not defined

What operating system are you running Bazel on?

Linux.

What's the output of bazel info release?

release 3.7.0

Have you found anything relevant by searching the web?

CcCommon.java:

for (String define : ruleContext.getExpander().list(attr)) {

No labelMap is passed to the expander, and it isn't enriched using withExecLocations either. I suspect the expander simply doesn't know about the labels it is supposed to resolve.

@oquenchil oquenchil added P4 This is either out of scope or we don't have bandwidth to review a PR. (No assignee) type: support / not a bug (process) team-Rules-CPP Issues for C++ rules P3 We're not considering working on this, but happy to review a PR. (No assignee) and removed P4 This is either out of scope or we don't have bandwidth to review a PR. (No assignee) labels Nov 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P3 We're not considering working on this, but happy to review a PR. (No assignee) team-Rules-CPP Issues for C++ rules type: support / not a bug (process)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants