haskell / haskell/cabal

Relocatable build tree

Open
#12,137 7 comments 11 reactions 0 assignees View on GitHub
attention: pr-welcome type: enhancement
Dominant language
Haskell
Stars
1.7k
Forks
750
Avg merge
4d 3h
Merged PRs (30d)
28

Description

**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:

```shell
$ # 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:

```shell
$ # 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

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the `git worktree add`, `cp -R ./dist-newstyle`, and `cabal build all` workflow described in the issue. Investigate why the copied `dist-newstyle` artifacts are not reused across directories; done means a worktree can use copied artifacts without triggering a full rebuild.

Written by the indexing model from the issue text.

Assessment

Tech stack
git, haskell
Domain
build-system
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.