-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Multiple genrules should allow outputs with the same name #7311
Comments
Thanks for the report, Simon. This is close to some stuff I"m working on. For many of Bazel's outputs I think we have options. But for something like the above example it isn't quite as simple. For example, what should
do? In others words, genrule What macros are bothering you? |
Apologies for the very slow reply. In the example you gave, I would expect the |
Sure that makes sense. On what criteria would you want to disambiguate for this example? So if I do |
I think it's perfectly valid for bazel to stop the build if there's any ambiguity. In the case you've given, I'd expect bazel to request the user to select which rule they want the output of (obviously, this would mean editing the build file --- I don't envision an interactive process!). That is, the person constructing the build file (or the command line) is responsible for ensuring that the build is unambiguous. From my understanding of bazel, this can be done as we build the action graph. We wouldn't need to perform a full build in order to check this. |
For command line disambiguation, I think select() covers similar territory. But it's an interesting idea to consider. I'd think of this as something like "annotated labels". |
I think the disambiguation piece is interesting, but the important thing is the two outputs with the same file name :) |
So the workaround is to create the genrules in two subpackages? |
I'm closing this because where are reasonable workarounds and implementing it is expensive. There is little chance our team will ever implement it. |
Description of the problem / feature request:
The given build file does not allow bazel to run as it complains about conflicting outputs.
While this is a pathological case, it's easy to reach this point accidentally by invoking macros. It seems like an unnecessary constraint.
Feature requests: what underlying problem are you trying to solve with this feature?
It should be possible for the outputs of different rules (particularly genrules) to have the same name. Buck allows this by creating an output directory named after the rule (
buck-out/gen/one
andbuck-out/gen/two
in this case) rather than the package as bazel does (bazel-genfiles/
in this case).Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
See the build file above.
What operating system are you running Bazel on?
OS X, but this is reproducible everywhere
What's the output of
bazel info release
?release 0.22.0
The text was updated successfully, but these errors were encountered: