-
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
Make runfiles incrementally correct with --nobuild_runfile_links
#20695
Conversation
5d04948
to
33790b8
Compare
@tjgq This turned out to be an unexpectedly deep rabbit hole of tangled issues. I added a bunch of new tests and got them to pass, ignoring what I think are flakes. I can definitely try to split this into smaller bits, but some of the fixes cause regressions in isolation. As I'm ultimately trying to fix #20676 by getting rid of |
33790b8
to
b8c9614
Compare
Note: changed |
Sorry, I missed this when reviewing your PR. I think what you describe is quite reasonable. (I'd suggest inverting the meaning of the marker to have it signal that the symlinks have been created; that seems more natural to me, but maybe there are reasons why it has to be the other way round.) |
(Thanks for working on this, though - I set out to fix the incrementality issues with the runfiles flags a while ago, but could never quite find the time/patience to get to the end of it :)) |
Fixes three separate but related issues with
--nobuild_runfile_links
:--enable_runfiles
from on to off did not result in runfiles being cleared due to a missing call toSymlinkTreeHelper#clearRunfilesDirectory
that was only added toSymlinkTreeStrategy
in f84329e.--enable_runfiles
from off to on did not result in runfiles being created since the logic inRunfilesTreeUpdater
would see a copy of the manifest instead of a symlink. This is fixed by additionally checking whether the runfiles directory contains the first runfile on Windows. If runfiles were disabled before, it won't, otherwise it will.--noenable_runfiles
was ignored bybazel run
, with runfiles always being created. This is fixed by usingRunfilesTreeUpdater
instead of custom and incorrect logic.With the fixed behavior, the runfiles tree for tests is now cleared right before the test spawn is executed, which makes the test action unable to create its working directory, the subdirectory of the runfiles directory corresponding to the workspace name. To fix this and also get rid of the inconsistency of having another action write into the runfiles tree, this logic is moved into the
SymlinkTreeHelper
and thus applied to all runfiles trees.Work towards #20676
Fixes #19333