You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you change a file listed in extra-source-files, cabal rebuilds the project, but not if you add a file there.
I discovered this when playing with the embedDir function of the file-embed package. It uses template haskell to quote into a Haskell source all files contained in a directory, so when you add a file to this directory, you want a rebuild.
I thought that listing all these files in extra-source-files would do the trick. When adding a new file to the directory, I would add it to extra-source-files, and cabal would be doing a rebuild.
But while cabal correctly triggers a rebuild if I modify any of the files in extra-source-files, it does not seem to care about additions to the list.
I first thought only Stack has this problem, but Cabal does so as well. For reference, here is the Stack companion issue:
I would characterise this experience slightly differently:
Cabal (and Stack) do rebuild when a new file is added to extra-source-files; but
in this use case (use of package file-embed) there is nothing in that to trigger the recompilation of a module that has already been built once (unlike when the content of an existing file changes, and file-embed's use of qAddDependentFile does its job, causing the relevant module to be recompiled).
For most users, having a rebuild also recompile everything (just in case) would likely be suboptimal.
If you change a file listed in
extra-source-files
, cabal rebuilds the project, but not if you add a file there.I discovered this when playing with the
embedDir
function of thefile-embed
package. It uses template haskell to quote into a Haskell source all files contained in a directory, so when you add a file to this directory, you want a rebuild.I thought that listing all these files in
extra-source-files
would do the trick. When adding a new file to the directory, I would add it toextra-source-files
, and cabal would be doing a rebuild.But while cabal correctly triggers a rebuild if I modify any of the files in
extra-source-files
, it does not seem to care about additions to the list.I first thought only Stack has this problem, but Cabal does so as well. For reference, here is the Stack companion issue:
file-embed
: Additions toextra-source-files
don't trigger rebuild of module commercialhaskell/stack#6689To reproduce, play with this little project:
embed-datadir-0.1.tar.gz
cabal run
data/README.md
and again do acabal run
and observe that changes did propagatedata/Bar.md
, also toextra-source-files
, and try acabal run
; observe that no rebuild takes place defying expectationThe text was updated successfully, but these errors were encountered: