-
Notifications
You must be signed in to change notification settings - Fork 847
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
file-embed
: Additions to extra-source-files
don't trigger rebuild of module
#6689
Comments
This issue might be releated: |
Via Template Haskell we embed the files in `src/data` as `ByteString`s into the Agda binary. They will be dumped into `$AGDA_DIR/share/$VERSION` when Agda starts and this directory does not exist, or via `agda --setup`. The $Agda_datadir becomes obsolete. Agda needs to be recompiled now when a datafile is added or changed. Under Cabal, this is taken care of by their listing in `extra-source-files`, Stack however needs some explicit nudge to recompile (see commercialhaskell/stack#6689).
Via Template Haskell we embed the files in `src/data` as `ByteString`s into the Agda binary. They will be dumped into `$AGDA_DIR/share/$VERSION` when Agda starts and this directory does not exist, or via `agda --setup`. The $Agda_datadir becomes obsolete. Agda needs to be recompiled now when a datafile is added or changed. Under Cabal, this is taken care of by their listing in `extra-source-files`, Stack however needs some explicit nudge to recompile (see commercialhaskell/stack#6689).
Via Template Haskell we embed the files in `src/data` as `ByteString`s into the Agda binary. They will be dumped into `$AGDA_DIR/share/$VERSION` when Agda starts and this directory does not exist, or via `agda --setup`. The $Agda_datadir becomes obsolete. Agda needs to be recompiled now when a datafile is added or changed. Under Cabal, this is taken care of by their listing in `extra-source-files`, Stack however needs some explicit nudge to recompile (see commercialhaskell/stack#6689).
Possibly relevant history:
The Cabal user guide currently documents that both ). |
On Windows 11, I can't reproduce
Also, I can't reproduce§ with package § EDIT: OK, I now see there is a problem when a new file is added to
I am wondering if that is a more general problem with EDIT2: If I understand correctly, pairToExp :: FilePath -> (FilePath, B.ByteString) -> Q Exp
pairToExp _root (path, bs) = do
#if MIN_VERSION_template_haskell(2,7,0)
qAddDependentFile $ _root ++ '/' : path -- <<< This tells GHC to track changes to file contents
#endif
exp' <- bsToExp bs
return $! TupE
#if MIN_VERSION_template_haskell(2,16,0)
$ map Just
#endif
[LitE $ StringL path, exp'] So, if a file is added subsequently: [1] GHC does not know to recompile |
extra-source-files
do not trigger a rebuildfile-embed
: Additions to extra-source-files
don't trigger rebuild of module
@mpilgrem Thanks for the analysis! I see that you flagged this as It seems that changes to Just from a theoretical perspective, I see that you found the respective PR for cabal: So you are likely aware of all of this already; I just wanted to write it down for the sake of clarity. |
@andreasabel, I think Cabal (the tool) (version 3.14.1.0) has identical behaviour to Stack's, given the following experiment (no
That would be consistent with the documentation in the Cabal User Guide, which says only 'partial' rebuilds:
|
Thanks for clarifying this! I think this is a bug in Cabal too, so I reported the issue: |
Ha, I added this piece of documentation myself. But I guess I did not mean anything specific by "partial". I think I wanted to relativize "rebuilds" a bit since I had (and have) no clear model of Cabal's rebuild logic. |
@andreasabel, you asked about my labelling this as an 'upstream issue'. It seems to me that both Stack and Cabal (the tool) are behaving as expected:
It also seems to me that what you are experiencing is a known limitation of My immediate solution would be:
|
Ah thanks. I think have misunderstood what triggering a rebuild can do. So then using |
Oops I have closed this by accident and reopening of an issue is not permitted here. |
@andreasabel, the solution (of sorts) is to add |
Report against Stack-3.3.1 (latest).
I noticed that
Stack
does not seem to honor theextra-source-files
when deciding whether to rebuild a project, in contrast toCabal
which does so.This is relevant when using
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:
I added the second one in a second step. I see the following behavioral difference between
Stack
andCabal
: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
The text was updated successfully, but these errors were encountered: