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.
Part of https://github.com/tweag/rules_sh/issues/19
The
sh_binaries
rule can bundle Bazel tracked executableFile
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.