Use more deterministic distdir path in haskell_cabal_* #1648
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.
Addresses indeterministic interface generation as reported in #1600.
Use a path for distdir in the
haskell_cabal_*
rules that is based on the package name and deterministic unless there is a collision with an already existing file or directory.The distdir path enters flags that are passed to GHC and thereby enters the 'flag hash' field of the generated interface files. If the distdir path is indeterministic, then the interface file will also be indeterministic.
With this PR a build of the
hspec
Cabal library and its dependencies has been found to be bit-reproducible by building it twice without caching and comparing the outputs.Notably, there is still an issue with non-deterministic builds if a
haskell_cabal_*
target has a C library dependency that was built by Bazel. In that case the absolute path to the sandbox execroot, which can change between builds, enters the include and library search path flags. Cabal forces us to provide these paths as absolute paths, see haskell/cabal#1317 and haskell/cabal#694. Meaning, the generated interface files ofhaskell_cabal_library
targets with Bazel built C library dependencies remain indeterministic.