[8.6.0] Cherry-pick: Add a target_type argument to ctx.actions.symlink.#28477
Closed
Mivr wants to merge 2 commits intobazelbuild:release-8.6.0from
Closed
[8.6.0] Cherry-pick: Add a target_type argument to ctx.actions.symlink.#28477Mivr wants to merge 2 commits intobazelbuild:release-8.6.0from
target_type argument to ctx.actions.symlink.#28477Mivr wants to merge 2 commits intobazelbuild:release-8.6.0from
Conversation
There was a problem hiding this comment.
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.
Collaborator
|
The next release will be 8.6.0, so you have to target that branch. |
ec5bfee to
31e7cda
Compare
Author
|
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
Contributor
|
Let's go with #28538 instead. |
auto-merge was automatically disabled
February 5, 2026 13:01
Pull request was closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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