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

stack_snapshot get invalidated too often #1096

Closed
thufschmitt opened this issue Sep 12, 2019 · 5 comments
Closed

stack_snapshot get invalidated too often #1096

thufschmitt opened this issue Sep 12, 2019 · 5 comments

Comments

@thufschmitt
Copy link
Contributor

Describe the bug

Dependencies built with stack_packages or haskell_cabal_package gets
invalidated at least each time the PATH changes due to the use of
use_default_shell_env.

To Reproduce

From the examples directory:

# Build a random cabal package
nix-shell --pure --run "bazel build @stackage//:random"
# Rebuild it again and see that it's cached
nix-shell --pure --run "bazel build @stackage//:random"
# Add `hello` to the `buildInputs` list in `shell.nix`
# Rebuild the random package and see that it isn't cached anymore
nix-shell --pure --run "bazel build @stackage//:random"

Expected behavior

A change in the environment shouldn't trigger a cache miss.

Environment

  • OS name + version: nixos unstable
  • Bazel version: 0.28.0 (from the example's shell.nix)
  • Version of the rules: latest master (79e2c53)
thufschmitt pushed a commit that referenced this issue Sep 12, 2019
Solves #1096 by not needing access to the standard unix tools
(and also make it easier to maintain)
thufschmitt pushed a commit that referenced this issue Sep 18, 2019
Solves #1096 by not needing access to the standard unix tools
(and also make it easier to maintain)
@mboes
Copy link
Member

mboes commented Sep 23, 2019

Did you mean stack_snapshot?

@thufschmitt
Copy link
Contributor Author

Did you mean stack_snapshot?

Oh yes, sorry, I'll update the title

@thufschmitt thufschmitt changed the title stack_packages get invalidated too often stack_snapsot get invalidated too often Sep 25, 2019
@thufschmitt thufschmitt changed the title stack_snapsot get invalidated too often stack_snapshot get invalidated too often Sep 25, 2019
@mboes
Copy link
Member

mboes commented Sep 25, 2019

each time the PATH changes due to the use of use_default_shell_env.

This is a side-effect of not having a shell toolchain. Cabal assumes quite a bit from the environment (in terms of available commands).

aherrmann pushed a commit that referenced this issue Sep 27, 2019
Solves #1096 by not needing access to the standard unix tools
(and also make it easier to maintain)
aherrmann pushed a commit that referenced this issue Oct 9, 2019
Solves #1096 by not needing access to the standard unix tools
(and also make it easier to maintain)
aherrmann pushed a commit that referenced this issue Oct 10, 2019
Solves #1096 by not needing access to the standard unix tools
(and also make it easier to maintain)
aherrmann pushed a commit that referenced this issue Oct 11, 2019
Solves #1096 by not needing access to the standard unix tools
(and also make it easier to maintain)
aherrmann pushed a commit that referenced this issue Oct 15, 2019
Solves #1096 by not needing access to the standard unix tools
(and also make it easier to maintain)
aherrmann pushed a commit that referenced this issue Oct 22, 2019
Solves #1096 by not needing access to the standard unix tools
(and also make it easier to maintain)
jwiegley pushed a commit that referenced this issue Oct 23, 2019
Solves #1096 by not needing access to the standard unix tools
(and also make it easier to maintain)
@jkachmar
Copy link
Contributor

Should #1097 and #1117 (which have since been merged) automatically address the problem, and should this issue be closed accordingly?

Or is there a need for some sort of regression test to make sure stack_snapshot dependencies are always cached?

@aherrmann
Copy link
Member

This should be fixed now. I've verified that the following does not cause a rebuild, while it did before those PRs were merged.

$ nix-shell --pure --run 'bazel build @stackage//:void'
$ nix-shell --pure --run 'PATH=foo:$PATH bazel build @stackage//:void'

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

No branches or pull requests

4 participants