haskell / haskell/cabal

add facility to have cabal print out the build components/names of a cabal package/project

Open
#7,340 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
Haskell
Stars
1.7k
Forks
750
Avg merge
4d 3h
Merged PRs (30d)
28

Description

currently, theres a lot of cabal commands (like cabal build/test/run) where you can specific a component and only build/test/install?/run that piece, but im not aware of any facilities to expose / enumerate those names for the user?

its discussed in https://cabal.readthedocs.io/en/latest/cabal-commands.html#cabal-v2-build, but it could maybe be made more "automated"

## cabal docs currently

A target can take any of the following forms:

A package target: package, which specifies that all enabled components of a package to be built. By default, test suites and benchmarks are not enabled, unless they are explicitly requested (e.g., via --enable-tests.)

A component target: [package:][ctype:]component, which specifies a specific component (e.g., a library, executable, test suite or benchmark) to be built.

All packages: all, which specifies all packages within the project.

Components of a particular type: package:ctypes, all:ctypes: which specifies all components of the given type. Where valid ctypes are:

libs, libraries,

flibs, foreign-libraries,

exes, executables,

tests,

benches, benchmarks.

A module target: `[package:][ctype:]module`, which specifies that the component of which the given module is a part of will be built.

A filepath target: `[package:][ctype:]filepath`, which specifies that the component of which the given filepath is a part of will be built.

In component targets, package: and ctype: (valid component types are lib, flib, exe, test and bench) can be used to disambiguate when multiple packages define the same component, or the same component name is used in a package (e.g., a package foo defines both an executable and library named foo). We always prefer interpreting a target as a package name rather than as a component name.

Some example targets:
```
$ cabal v2-build lib:foo-pkg # build the library named foo-pkg
$ cabal v2-build foo-pkg:foo-tests # build foo-tests in foo-pkg
$ cabal v2-build src/Lib.s # build the library component to
# which "src/Lib.hs" belongs
$ cabal v2-build app/Main.hs # build the executable component of
# "app/Main.hs"
$ cabal v2-build Lib # build the library component to
# which the module "Lib" belongs

```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.