-
Notifications
You must be signed in to change notification settings - Fork 4.4k
[8.6.0] Cherry-pick: Add a target_type argument to ctx.actions.symlink.
#28477
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
base: release-8.6.0
Are you sure you want to change the base?
[8.6.0] Cherry-pick: Add a target_type argument to ctx.actions.symlink.
#28477
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request cherry-picks a commit to add a target_type argument to ctx.actions.symlink. This is a necessary change to support creating symlinks to non-existent targets on Windows correctly. The changes are well-implemented across the Starlark API, the underlying action, and are accompanied by good unit and integration tests. The code looks solid and I don't see any issues.
|
The next release will be 8.6.0, so you have to target that branch. |
ec5bfee to
31e7cda
Compare
|
Rebased |
This is necessary to create the right kind of filesystem object on Windows (junction for directories, symlink for files) when the target does not yet exist. This argument is only allowed in conjunction with `target_path`. For `target_file`, I have a different plan (infer the type from the artifact) which will be implemented separately. Fixes bazelbuild#26701. Progress on bazelbuild#21747. RELNOTES: `ctx.actions.symlink` now accepts a `target_type` argument. PiperOrigin-RevId: 820670309 Change-Id: I2f29adfd074c404a0b15be369a97fcdfb84fbdad
31e7cda to
75f1c55
Compare
target_type argument to ctx.actions.symlink.target_type argument to ctx.actions.symlink.
The original cherry-pick used @TestParameter which requires TestParameterInjector, but Bazel 8.6.0 tests use the standard JUnit4 runner. Split the parameterized test into three separate test methods: - downloadToplevel_unresolvedSymlink_unspecified (no target_type) - downloadToplevel_unresolvedSymlink_file (target_type = file) - downloadToplevel_unresolvedSymlink_directory (target_type = directory) Skip the first two tests on Windows: - unspecified: Windows cannot create dangling symlinks without knowing the target type - file: File symlinks on Windows require Developer Mode or admin privileges Keep the directory test enabled as junctions work without special privileges.
0d970e3 to
f6b29ac
Compare
This cherry-picks commit b9bbda9 to enable the
target_typeargument onctx.actions.symlinkin the 8.x release line.It is needed because some rules broke on windows completely with Bazel 8.* versions like: aspect-build/rules_js#2261
------------------------ Original description----------
This is necessary to create the right kind of filesystem object on Windows (junction for directories, symlink for files) when the target does not yet exist.
This argument is only allowed in conjunction with
target_path. Fortarget_file, I have a different plan (infer the type from the artifact) which will be implemented separately.Fixes #26701.
Progress on #21747.
RELNOTES:
ctx.actions.symlinknow accepts atarget_typeargument.PiperOrigin-RevId: 820670309
Change-Id: I2f29adfd074c404a0b15be369a97fcdfb84fbdad
Commit b9bbda9