Introduce build profiles

Open
#12,120 0 comments 14 reactions 0 assignees View on GitHub

Maintainers usually reply within 3 days

Nobody has claimed this yet.

Assessment

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

Research direction

Start by tracing the cabal-install build command and the Cabal library's handling of distDir and optimization state. Compare the proposed --profile=dev flow with the linked Cargo build profiles and review the profiling and interpreter-specific concerns in #6873 and #3565. Done would require an agreed profile design, profile selection, artifact separation, bundled options, and the legacy-mode warning.

Written by the indexing model from the issue text.

Description

attention: pr-welcome cabal-install: cmd/build recompilation type: enhancement

Currently, the Cabal library keeps track of whether a package is built with or without optimisations, which avoids optimised and unoptimised builds overwriting eachother's build artifacts. This allows for a reasonable development workflow that interleaves quick unoptimised builds while iterating with occasional slower optimised builds.

However, this is very fragile, as it doesn't cover things like profiling (see #6873) or interpreter-specific options (#3565).

I suggest introducing build profiles, like Cargo build profiles. One would invoke cabal-install with a command like

> cabal build --profile=dev

One core principle of this feature is that it would be a concept that only cabal-install knows about. Based on the selected profile, cabal-install would pass the appropriate flags to the Cabal library (e.g. setting the distDir) to avoid builds trampling over eachother. This would have many advantages:

  • There would be a single source of truth for where the artifacts live, decided by cabal-install. Cabal just puts things where it is told. This makes it easier for tools such as stack, as they wouldn't need to know internal details about where Cabal places build artifacts.
  • The idea plainly makes sense as a per-project concept, not a per-package concept.

Like the Cargo feature, it would allow bundling options, e.g. a development profile could include additional +debug flags to various libraries to enable assertions etc.

Introducing build profiles would also provide a way to change the defaults. Users that do not use build profiles are in "legacy mode" and get a warning about it.

Dominant language
Haskell
Stars
1.8k
Forks
766
Avg merge
5d 21h
Merged PRs (30d)
27

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from haskell/cabal

All issues in haskell/cabal

Similar issues

More Haskell issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.