tweag / rules_sh

Shell rules for Bazel
Apache License 2.0
42 stars 3 forks source link

Add rule to define hermetic POSIX toolchain #34

Closed aherrmann closed 1 year ago

aherrmann commented 2 years ago

depends on #35

This implements a POSIX toolchain based on sh_binaries as part of https://github.com/tweag/rules_sh/issues/19.

The toolchain uses the same toolchain type as the less hermetic version and is intended as an eventual replacement. For the moment it is marked as experimental, because there are more tasks to https://github.com/tweag/rules_sh/issues/19 that need to be closed before it can become a full replacement.

Backwards compatibility plan: In the genrule use-case the hermetic POSIX toolchain can be used in the same way as the less hermetic version. In the custom rule use-case the toolchain provider exposes the same attributes as the less hermetic version for backwards compatibility. However, additional tools inputs must be declared to map the files into the build actions sandbox. If the tools have runfiles requirements, then the same workaround to https://github.com/bazelbuild/bazel/issues/15486 as with sh_binaries is required.

aherrmann commented 2 years ago

Windows put up a bit of a fight, but it's resolved now (see #35). This is ready for review.