Replace copy genrules with copy_file - #30122
Closed
dzbarsky wants to merge 0 commit into
Closed
Conversation
dzbarsky
marked this pull request as ready for review
July 21, 2026 12:57
dzbarsky
force-pushed
the
codex/replace-copy-genrules
branch
from
July 21, 2026 13:03
83c9b66 to
69f9ae8
Compare
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.
Summary
Replace copy-only
genruletargets withbazel_skylibcopy_filetargets for:.exealiasesEach target permits symlinking, so
copy_filecreates a declared symlink action instead of invoking an ambientcpexecutable through a shell. This PR contains no third-party patch or dependency update.This focused change is extracted from #30121 for independent review.
Motivation
The existing
genruletargets assume the execution environment providescpand a compatible shell. That assumption fails when Bazel runs on Windows while actions execute remotely on Linux. The dedicatedcopy_filerule also states the operation directly and removes repeated command strings.Build API Changes
No.
Validation
buildifier -mode=check src/BUILD src/main/java/com/google/devtools/build/lib/bazel/rules/BUILD src/main/java/net/starlark/java/eval/BUILD src/main/native/BUILDbazel aqueryconfirmed the expectedSymlinkorExecutableSymlinkaction, input, and output for all nine generated targetsbazel build --jobs=2 //src/main/java/com/google/devtools/build/lib/bazel/rules:builtins_bzl_zip //src/main/java/net/starlark/java/eval:cpu_profiler_jni_darwin //src/main/native:copy_link_jni_header //src/main/native:copy_link_jni_md_header //src/main/native:mac-compatRelease Notes
RELNOTES: None