Skip to content

Disable library building, only build other components #2775

Open
@snoyberg

Description

@snoyberg

(I may be missing something obvious, in which case, please let me know how this should be handled.)

When you specify components, you can get fine-grained control over which executables are built. However, there seems to be no way to control the library component. This has a number of repercussions:

  • No way to build only the library: cabal build will build all components
  • No way to build just an executable/test suite/benchmark without building the library
  • Due to the fact that --enable-tests or --enable-benchmarks can modify the cabal_macros.h file, building your library and then rebuilding with test suites enabled can force the entire library to be recompiled, even though that's not necessary (this may actually be worth opening as a separate bug report).

Backwards compatibility will be a problem for any changes we want to make here. Ideally, I'd have said that lib is its own component, and a command cabal build lib would build only the library, whereas cabal build exe:foo would not build the library. However, the latter would be a breaking change. So perhaps we can add a --no-build-library flag?

(And I've referred to cabal the executable here, but I'd really like to see this in Cabal-the-library.)

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