Skip to content

Stack rebuilds project when its location in the file-system is changed #3461

Closed
@vlopezj

Description

@vlopezj

stack will recompile packages when the root of a project is moved. This hinders use cases where, in a CI system, a big project is recompiled each time in a different directory, but one would still like to cache the .stack-work directory to speed-up builds.

A possible solution is to use relative rather than absolute paths for directories that are at the same level or below the stack.yaml file. Keep paths that are specified as absolute in the stack.yaml file as absolute, and ditto for relative paths.

Steps to reproduce

  1. Go into any stack project, remove .stack-work directory.
  2. Run command stack build
  3. Stuff happens.
  4. Run command stack build again.
  5. Nothing happens, because all the work has been done already.
  6. Go to parent directory. Rename the directory containing the stack project to something else.
  7. Go back into the stack project.
  8. Run stack buildagain.

Expected

Nothing happens, because there is no more work to do.

Actual

<project-name>-<project-version>: unregistering (switching from <old-dir-name> to <new-dir-name>)

Afterwards the entire project is recompiled.

Stack version

$ stack --version
Version 1.5.1 x86_64

Installed via stack upgrade.

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