Skip to content

Package global build-depends should apply constraints to all components #3404

Closed
@ezyang

Description

@ezyang

A common complaint is that there is no capacity for shared Cabal fields between components, c.f. #1949 and #2832. build-depends in particular is a common complaint, since a common Cabal idiom is to rebuild the same source files as part of multiple components.

I think there is at least a partial solution to this problem: top-level build-depends should be brought back, with the following semantics:

  1. If I write p >= 3 in the top-level build depends, IF we would have solved for a version of p, then we apply the constraint that its version is >=3
  2. Top-level build depends do not affect visibility of packages in components; so you still have to write build-depends: p inside any component that wants to use p.

In effect, we can centralize version bounds in one part of the Cabal file, while having fine granularity for specifying what components need what dependencies (so that the library doesn't need to depend on the package test suite). Of course the old syntax is still supported, so components can add their own bounds (toggled if the component is enabled.)

What do people think about this?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions