Skip to content

qAddDependentFile doesn't cause re-compilation without extra-source-files #4360

Closed
@pbrisbin

Description

@pbrisbin

Steps to reproduce

  1. Set up a repro project with stack new --bare repro

  2. Add a file templates/example.hamlet

    <h1>Hi
  3. Update Lib.hs to

    {-# LANGUAGE TemplateHaskell #-}
    
    module Lib
       ( someFunc
       ) where
    
    import Text.Blaze.Html.Renderer.Pretty
    import Text.Hamlet
    
    someFunc :: IO ()
    someFunc = putStrLn $ renderHtml $(shamletFile "templates/example.hamlet")

    (Add the shakespeareand blaze-html dependencies as necessary.)

  4. Start up stack build --file-watch

  5. Modify the contents of templates/example.hamlet

Expected

Modifying templates/example.hamlet should trigger re-compilation.

Actual

It does not. However, if I add

extra-source-files:
  - templates/*

To package.yaml, it works as expected. This should not be necessary as this packaging field is only documented as related to including files in sdist, not as a requirement for qAddDependentFile to work.

Stack version

$ stack --version
Version 1.7.1, Git revision 681c800873816c022739ca7ed14755e85a579565 (5807 commits) x86_64 hpack-0.28.2

Method of installation

https://aur.archlinux.org/packages/stack-static/

Notes

It's definitely an assumption on my part that this boils down to qAddDependentFile. So I apologize if that's not actually the case. Another way to phrase it could be, external files referenced in TemplateHaskell don't cause re-compilation....

I've reproduced this bug with pretty much every file-reading TH function in a standard Yesod app (parseRoutesFile, widgetFile, etc).

I wouldn't have guessed this was Stack's responsibility either, but cocreature in #haskell encouraged me to report this bug here.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions