Skip to content
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

Implement create_shim to create a shim on Windows #26

Merged
merged 2 commits into from
Jul 5, 2022
Merged

Conversation

aherrmann
Copy link
Member

Part of #19

The sh_binaries rule can bundle Bazel tracked executable File
objects as collections of tools. Tools can be imported into Bazel by
download or built by Bazel. However, in some use-cases, users need to
import executales that are installed outside of Bazel from the system.

On Unix systems this can be achieved in a hermetic way by creating a
symbolic link in a repository rule. However, on Windows, symbolic file
links are not generally available and the corresponding repository_ctx
method will create a copy. However, file copies do not generally work,
as executables may expect auxiliary files next to their installation
path.

A shim offers an alternative on Windows. A shim is a small executable,
accompanied by a small data file that points to the destination. It can
be thought of as a custom executable that imitates the functionality of
a symbolic file link.

The `sh_binaries` rule can bundle Bazel tracked executable `File`
objects as collections of tools. Tools can be imported into Bazel by
download or built by Bazel. However, in some use-cases, users need to
import executales that are installed outside of Bazel from the system.

On Unix systems this can be achieved in a hermetic way by creating a
symbolic link in a repository rule. However, on Windows, symbolic file
links are not generally available and the corresponding `repository_ctx`
method will create a copy. However, file copies do not generally work,
as executables may expect auxiliary files next to their installation
path.

A shim offers an alternative on Windows. A shim is a small executable,
accompanied by a small data file that points to the destination. It can
be thought of as a custom executable that imitates the functionality of
a symbolic file link.
@aherrmann aherrmann requested a review from avdv July 4, 2022 11:30
@aherrmann aherrmann requested a review from mboes as a code owner July 4, 2022 11:30
sh/import.bzl Show resolved Hide resolved
@aherrmann aherrmann added the merge-queue merge on green CI label Jul 5, 2022
@mergify mergify bot merged commit ff68531 into master Jul 5, 2022
@mergify mergify bot deleted the create-shim branch July 5, 2022 09:48
@mergify mergify bot removed the merge-queue merge on green CI label Jul 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants