-
Notifications
You must be signed in to change notification settings - Fork 174
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
Genrule producing a directory cannot be provided to pkg_zip #517
Comments
Note that the files contained in the dir are not known until the genrule is executed. I.e. the genrule above would be more accurately described thus:
It's actually a webpack output in my case, so there are files with hashes in the file name... therefore unpredictable. I.e.
|
You can't do this with a genrule. Bazel does not preserve unknown outputs of one action and pass them on to dependent actions. If you need to emit an arbitrary tree of files, then you'll need to create a rule that declares a tree artifact. pkg_zip should be able to consume those just fine. |
I've refactored to use a rule an have had two slightly different experiences: Both using a BUILD file similar to this:
First attemptDefine the pre-declared output with Fails to execute with:
Which is the same experience with a Second attemptDefine the name of the output with Declare a 'tree-artifact' directory output with This executes, the output of |
You have to used You can see a sort of example in our rule for generating sample tree artifacts for use in tests. |
Oh, wait. I didn't see the second attempt. That might be roughly right, but it is hard to tell just from your one line snippet. |
Never mind. It is broken. I updated #309 to remind me. |
TY, I'll take a look at #309 and read-up. If I can I'll see if I can contribute some tests and a PR. |
I reached this thread after having a similar problem with pkg_tar. My This used to work in Bazel 5 (I'm compiling a derivative of tensorflow). But recently I upgraded to Bazel 6, using Any suggestions of work around that would work with thx!! |
If it uses mkdir to create the directory, that is unsupported. Since this is a genrule, that is probably the case. |
Thanks @aiuto, that makes sense. Indeed I'm creating a directory manually and copying over the files that I need to package (they are the In the end I did the less complicated thing, which is just to create another |
Trying to add the result of a directory producing genrule fails.
Using release 0.6.0.
Result:
Expected a zip file
unzip -l
:The text was updated successfully, but these errors were encountered: