Skip to content
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

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

Closed
mtolly opened this issue Apr 1, 2016 · 3 comments
Closed

Comments

@mtolly
Copy link
Contributor

mtolly commented Apr 1, 2016

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
@mgsloan mgsloan added this to the P2: Should milestone Apr 1, 2016
@mtolly
Copy link
Contributor Author

mtolly commented May 8, 2016

Looked into this a bit. The problem is the use of parseRelFile. As the path documentation says, parseRelFile does not allow ../. Not really sure how to fix this; I can't figure out any way to read a path with ../ using the path package.

@mgsloan
Copy link
Contributor

mgsloan commented May 15, 2016

Fixed!

@mgsloan mgsloan closed this as completed May 15, 2016
@mtolly
Copy link
Contributor Author

mtolly commented May 16, 2016

Thanks so much, works great! I figured the path-io package had to exist but didn't know where to look for it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants