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

stack rebuilds sublibraries that are not dependencies of the specified target #6569

Closed
kostmo opened this issue May 4, 2024 · 1 comment
Closed

Comments

@kostmo
Copy link

kostmo commented May 4, 2024

Minimal testcase is here: https://github.com/kostmo/stack-sublibrary-rebuild

I am using stack version 2.15.5.

To reproduce the bug

  1. Build the executable:
    stack build bug-repro:exe:bug-repro-exe
    
  2. Then repeat to ensure all targets are up-to-date.
  3. Insert a newline into src2/Lib2.hs and save
  4. Re-run the above command to build the executable. Observe that files are rebuilt despite that the lib2 sublibrary is not a dependency of bug-repro-exe.

Equivalent cabal test

  1. Build the executable:
    cabal build bug-repro:exe:bug-repro-exe
    
  2. Then repeat to ensure all targets are up-to-date.
  3. Insert a newline into src2/Lib2.hs and save
  4. Re-run the above command to build the executable. Observe nothing is rebuilt; only "Up to date" is printed.

Potentially related issues

@mpilgrem
Copy link
Member

mpilgrem commented May 5, 2024

@kostmo, thanks for reporting and for taking the time to create a minimal example.

What you are experiencing is an example of an long-standing issue/feature request known as 'component-based builds'. The most recent open issue pulling that together is:

but there is a long history before that.

In short, Stack currently approaches building in terms of 'packages (with components)' rather than 'components (of packages)'.

I am going to close this issue - not because it is unimportant but because I am seeking to consolidate matters related to component-based builds under a single 'master' issue.

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