Skip to content

stack build does not rebuild executable without other-modules #2341

Description

@spl

This may be a known issue. If so, I think it could be documented better. I could not find a clear answer in the issue archive to match this, so, at the very least, this issue might help others who encounter the problem.

Steps to reproduce:

  1. Create a .cabal for an executable.
    • Include the hs-source-dirs field mentioning the source directories with the modules.
    • Do not include the other-modules field with the modules listed.
  2. Create a stack from that .cabal.
  3. stack build the first time.
  4. Change a module in the package.
  5. stack build to rebuild.

Expected:

The project rebuilds.

Actual:

The project does not rebuild.

Discussion:

I couldn't figure out why my project wasn't rebuilding. Then, I found that if I include other-modules with a module M and update M, the project would rebuild. If I then change N, a module not listed in other-modules, the project would not rebuild.

Related:

These issues seem to be related:

From my cursory reading, it seems like this issue was supposed to be fixed in:

There seems to be a currently undocumented --force-dirty flag added in 09a9fa4 to deal with this kind of issue.

I believe I did see a warning for unlisted modules (added in 31712d3?), but I wasn't sure what the warning was for. I wasn't even sure what an “unlisted module” was. Why would unlisted modules be a problem? If this issue is the reason for that warning, then the warning text could be improved.

Questions:

If this is a known issue with no fix currently planned, could it be documented better or handled by stack?

  • One option would be to mention it somewhere in the guide. The “Build command” section would be a good place to start with.
  • Another option would be to automate the check with stack and report it.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions