Skip to content

Relocatable build tree #12137

Description

@LaurentRDC

Describe the feature request

I often spin up a new worktree, branched off of some main branch, to work on a feature. The process I go through is:

$ # From master
$ git worktree add ../my-feature
$ cd ../my-feature
$ cabal build all

Then I can start to work.

In principle, I should be able to use the build artifacts from my main branch to avoid recompiling on my feature branch. Imagine this workflow:

$ # From master
$ git worktree add ../my-feature
$ # New: copy build artifacts
$ cp -R ./dist-newstyle ../my-feature
$ cd ../my-feature
$ cabal build all

Unfortunately, this results in a full rebuild, implying that the build artifacts in dist-newstyle aren't portable across directories. I'm not sure if this is a happenstance, or a design constraint.

Additional context

The cost of spinning up worktrees can be be substantial. Industrial codebases can take multiple minutes to compile local packages. There's a potential to save on rebuilds by copying build artifacts

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