Shorthand for including an output file of a genrule directory as a src #518
Comments
If we were to support this, we'd have to declare each and every output. We have a hacky way we did this internally that basically redefines |
We've discussed this before and we want the syntax to be with brackets like We won't get around implementing it anytime soon though. |
@mikekap, if you want to take a stab at this, I think we've given you a bunch of design direction. If not, that's okay too. :) |
Has anyone made any progress on this? I am having a similar issue where a legacy build system generates a folder of headers that I need to reference. Unfortunately the legacy build system is very complex, and reimplementing it properly in Buck is probably unrealistic, hence the need to "wrap" it. |
Note this is just a UI improvement, it would still be functionally equivalent to creating a genrule for each file, minus the copy. |
@Coneko Thanks for the response. Is there a recommended approach when there are hundreds of files? I don't think it's possible to read the output directory of the |
You need to know the names of the files in advance and write them in the build files. You can do that using a python loop if you wish, but you cannot list files in the output directory. The same limitation exists with the new syntax. |
Yes, that works. For those who stumble on this, try something like:
|
Summary: As discussed in #518 and #560, to compile the output files of a genrule, we need to make a genrule for each output. This could be problematic when the first genrule produces multiple files and their names are not predictable. This PR makes it possible to put such genrule target in the `srcs` and compile the all generated files. Closes #1736 Reviewed By: styurin Pulled By: styurin fbshipit-source-id: e5eb2d8
You can write a genrule that creates a zip file and pass it as an input in |
Have any more plans been made regarding this? Is |
If you have a genrule that creates a directory with several files, it's a bit of a pain to write another
genrule
rule for each (expected) output, just to be able to pass it to *_library (java, python, etc). It would be nice to allow you to somehow specify this in the sources - maybe via flavors (although it is a bit hackish)? e.g.The text was updated successfully, but these errors were encountered: