Skip to content

Conversation

@Mivr
Copy link

@Mivr Mivr commented Jan 29, 2026

This cherry-picks commit b9bbda9 to enable the target_type argument on ctx.actions.symlink in 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. For target_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.symlink now accepts a target_type argument.
PiperOrigin-RevId: 820670309
Change-Id: I2f29adfd074c404a0b15be369a97fcdfb84fbdad

Commit b9bbda9

@Mivr Mivr requested a review from a team as a code owner January 29, 2026 07:41
@github-actions github-actions bot added team-Configurability platforms, toolchains, cquery, select(), config transitions team-Remote-Exec Issues and PRs for the Execution (Remote) team awaiting-review PR is awaiting review from an assigned reviewer labels Jan 29, 2026
Copy link

@gemini-code-assist gemini-code-assist bot left a 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.

@fmeum
Copy link
Collaborator

fmeum commented Jan 29, 2026

The next release will be 8.6.0, so you have to target that branch.

@Mivr Mivr changed the base branch from release-8.5.1 to release-8.6.0 January 29, 2026 09:35
@Mivr Mivr force-pushed the cherry-pick-symlink-target-type branch from ec5bfee to 31e7cda Compare January 29, 2026 09:40
@Mivr
Copy link
Author

Mivr commented Jan 29, 2026

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
@Mivr Mivr force-pushed the cherry-pick-symlink-target-type branch from 31e7cda to 75f1c55 Compare January 29, 2026 10:04
@iancha1992 iancha1992 changed the title Cherry-pick: Add a target_type argument to ctx.actions.symlink. [8.6.0] Cherry-pick: Add a target_type argument to ctx.actions.symlink. Jan 29, 2026
@iancha1992 iancha1992 added this to the 8.6.0 release blockers milestone Jan 29, 2026
@iancha1992 iancha1992 requested a review from tjgq January 29, 2026 18:17
@iancha1992 iancha1992 removed the team-Configurability platforms, toolchains, cquery, select(), config transitions label Jan 29, 2026
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.
@Mivr Mivr force-pushed the cherry-pick-symlink-target-type branch from 0d970e3 to f6b29ac Compare January 30, 2026 11:32
@iancha1992 iancha1992 removed this from the 8.6.0 release blockers milestone Jan 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting-review PR is awaiting review from an assigned reviewer team-Remote-Exec Issues and PRs for the Execution (Remote) team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants