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
Creating symbolic links to toolchains #605
Comments
If you intend for the I suspect the reason that things go wrong if you do that is because you're trying to use a projected artifact as an output. It's not really clear what the behavior of that is supposed to be to me, I wouldn't be surprised if no one ever really thought about that case. If you switch to something like I would have to dig into this a bit more to confirm though. I also realize that won't work on windows as written too, which is a bit meh. May think about this more |
Isn’t http_archive using a projected artifact as an output? buck2/prelude/http_archive/http_archive.bzl Line 215 in 39d2754
|
I've tried changing the python script to implicitly create the directory (so the --destination arg is passing in just the base folder) and that has the same problem. It seems to be related to the |
@zjturner output of an action, not output of analysis. @AtomicOperation can you confirm, is the python script trying to make the |
I'm trying to make an output dir (base_folder in the snippet above) and a symlink to a folder underneath that (toolchain_folder in the snippet). |
@JakobDegen can you explain this a little more? Isn't the entire point of projecting an artifact to create an output relative to some other output? |
Right, but the typical expectation is that you first declare the artifact, use So concretely, I would expect that the version of the code that works looks something like this:
Note that I'm passing the entire |
Thanks, but unfortunately doing it the way you suggest with the .project() call happening after .as_output() results in the same |
I looked into this some and I can reproduce this. Here's a minimal reproducer:
Just replace the If you run
|
Back from travel. I asked about this, and it would indeed be possible to support projecting through symlinks, at least external symlinks. However, it's a bit of a refactor because you end up with artifacts that aren't really at the place they claim to be. |
I'm trying to set up a rule that will create a symbolic link inside the buck-out folder to a toolchain that is stored elsewhere. I have a package management system that will ensure that the contents inside the symlinked folder won't change. The rule has an attribute which is the toolchain version, and when the rule/script is run with a different version, it will adjust the symlink to the right target path.
The result of the script is to have
out/toolchain_name
be a symlink to the target directory.However, buck is strict about what it considers to be a directory.
If I use declare_output with dir = True, I get something like
Required outputs are missing: Action didn’t produce output of the right type. Expected buck-out/v2/gen/root/folder/toolchain_name to be Directoryreal File.
If I use base_folder.project() (like in the example above) then I get an error like
Find would traverse a leaf at path: buck-out/v2/gen/root/folder/out/include
.It makes sense that buck is trying to stop me from declaring an artifact that's nested below a regular file. Is there any way to convince it to allow this? I'm suspecting that the best thing to do would be to find the place where the "Action didn't produce output of the right type" error is returned and change it to allow symlinks to folders. Any other thoughts?
The text was updated successfully, but these errors were encountered: