Skip to content

Better component-based build system #834

Closed
@snoyberg

Description

@snoyberg

There are a number of annoyances with how Cabal works around individual components builds:

  • Reconfiguring rewrites cabal_macros, leading to unnecessary recompiles
  • Copying fails if not all components are built
  • Requiring libraries to be installed if any of the components require them

After a lot of thought, I think the core problem is that the list of components to build should be an argument to ./Setup.hs configure, not ./Setup.hs build. Another way of thinking about that would be: even though a single cabal file contains multiple components, stack wants to treat each of those components as its own package. I think this will solve a lot of problems for us (like the ugly --enable-tests hack I added recently).

I'm considering pushing this forward on the Cabal side (where I- as usual- expect resistance), but wanted feedback from others first if there are downsides to this approach. I've also been thinking about short-term hacks to try to get this working. It's terribly ugly, but the thought that came to mind was to create temporary .cabal files during the build for each component.

If this rambling is too incoherent, please tell me and I can clarify.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions