commercialhaskell / commercialhaskell/stack

Registering plugin in preprocessor causes dylib invalidation + full rebuild

Open
#5,772 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Haskell
Stars
4.1k
Forks
850
Avg merge
10h 37m
Merged PRs (30d)
4

Description

### General summary/comments

I am using a preprocessor in my test suite that programmatically adds a `{-# OPTIONS_GHC -fplugin=... #-}` pragma. The plugin (which I also define) is a `purePlugin`. When I run `stack test` multiple times without changing anything, I get a full rebuild of the test suite due to a dylib being changed. Diffing the dylib shows just a timestamp changing.

I'm pretty sure this is a stack issue because when diffing the `.stack-work` directory in between runs, I see changes to the `build-cache`, which looks like a stack-owned cache? **Update**: can confirm that this is not an issue with cabal

Possibly related: #5503

### Steps to reproduce

Minimal repro on MacOSX (not sure how it repros on other operating systems): https://github.com/brandonchinn178/stack-minimal-repro-5772

1. `stack purge`
1. `stack test`
2. `stack test` again: should not rebuild
3. Change `test/Spec.hs`
4. `stack test`: rebuilds correctly
5. `stack test` again without changing anything

### Expected

Should not rebuild on the last step

### Actual

Rebuilds the entire test suite because "*.dylib changed"

`--verbose` output: https://gist.github.com/brandonchinn178/9812c522fbf1afa36b3ba3ca96d0771b

### Stack version

```
$ stack --version
Version 2.7.5, Git revision ba147e6f59b2da75b1beb98b1888cce97f7032b1 x86_64 hpack-0.34.4
```

### Method of installation

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.