commercialhaskell / commercialhaskell/stack

`file-embed`: Additions to `extra-source-files` don't trigger rebuild of module

Open
#6,689 11 comments 0 reactions 0 assignees View on GitHub
component: build resolution: upstream issue
Dominant language
Haskell
Stars
4.1k
Forks
850
Avg merge
10h 37m
Merged PRs (30d)
4

Description

Report against Stack-3.3.1 (latest).
I noticed that `Stack` does not seem to honor the `extra-source-files` when deciding whether to rebuild a project, in contrast to `Cabal` which does so.

This is relevant when using [`file-embed`](https://hackage.haskell.org/package/file-embed) to embed files into the executable. Changes to the embedded files should trigger a recompilation to keep the executable up-to-date.

E.g. I want that these files are always embedded in their latest version:
```
extra-source-files:
data/README.md
data/sub/Foo.md
```
I added the second one in a second step. I see the following behavioral difference between `Stack` and `Cabal`:
```
$ stack run ✔ │ ghc-9.4.8 hs │ 10:06:41
File: README.md
Content: "This is a test of the `file-embed` package,\napplied to the `data-dir` of a Haskell project.\n"

$ cabal run ✔ │ ghc-9.4.8 hs │ 10:14:10
File: README.md
Content: "This is a test of the `file-embed` package,\napplied to the `data-dir` of a Haskell project.\n"
File: sub/Foo.md
Content: "This is a file in a subdirectory.\nIt contains 2 lines.\n"
```

WANT: Changes to the amount and content of the `extra-source-files` should trigger a rebuild.

I attach a reproducer to play with.

[embed-datadir-0.1.tar.gz](https://github.com/user-attachments/files/18904117/embed-datadir-0.1.tar.gz)

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.