Skip to content

extra-source-files outside the package directory don't trigger a rebuild #1982

@mtolly

Description

@mtolly

Steps to reproduce:

Clone https://github.com/mtolly/stack-extra - basically it is a repo with files:

  • stack.yaml
  • extra1
  • stack-extra/stack-extra.cabal
  • stack-extra/extra2
  • stack-extra/src/Main.hs

The cabal package references the two extra files as extra-source-files, and then uses them in Main.hs via file-embed.

Expected:

Modifiying either extra1 or stack-extra/extra2 should trigger a rebuild of the package.

Actual:

╭─mtolly@metal  ~/g/stack-extra  <master>
╰─$ stack --version
Version 1.0.5, Git revision 32406d106f46625e03b8495317abc21abc3a1674 x86_64
╭─mtolly@metal  ~/g/stack-extra  <master>
╰─$ stack build
stack-extra-0.1.0.0: configure
Configuring stack-extra-0.1.0.0...
Warning: 'extra-src-files: ../extra1' is a relative path outside of the source
tree. This will not work when generating a tarball with 'sdist'.
stack-extra-0.1.0.0: build
Preprocessing executable 'stack-extra' for stack-extra-0.1.0.0...
[1 of 1] Compiling Main             ( src/Main.hs, .stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/stack-extra/stack-extra-tmp/Main.o )
Linking .stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/stack-extra/stack-extra ...
stack-extra-0.1.0.0: copy/register
Installing executable(s) in
/Users/mtolly/git/stack-extra/.stack-work/install/x86_64-osx/lts-5.10/7.10.3/bin
╭─mtolly@metal  ~/g/stack-extra  <master>
╰─$ echo changed > extra1
╭─mtolly@metal  ~/g/stack-extra  <master*>
╰─$ stack build
╭─mtolly@metal  ~/g/stack-extra  <master*>
╰─$ echo changed > stack-extra/extra2
╭─mtolly@metal  ~/g/stack-extra  <master*>
╰─$ stack build
stack-extra-0.1.0.0: build
Preprocessing executable 'stack-extra' for stack-extra-0.1.0.0...
[1 of 1] Compiling Main             ( src/Main.hs, .stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/stack-extra/stack-extra-tmp/Main.o ) [extra2 changed]
Linking .stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/stack-extra/stack-extra ...
stack-extra-0.1.0.0: copy/register
Installing executable(s) in
/Users/mtolly/git/stack-extra/.stack-work/install/x86_64-osx/lts-5.10/7.10.3/bin

Here is the verbose output from the 2nd stack build command (the one that doesn't rebuild).

What I assume is the same issue:

╭─mtolly@metal  ~/g/stack-extra  <master*>
╰─$ stack build --file-watch
ExitSuccess
Type help for available commands. Press enter to force a rebuild.
watched
/Users/mtolly/git/stack-extra/stack-extra/extra2
/Users/mtolly/git/stack-extra/stack-extra/src/Main.hs
/Users/mtolly/git/stack-extra/stack-extra/stack-extra.cabal
/Users/mtolly/git/stack-extra/stack.yaml

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions