Skip to content

Commit

Permalink
Add filepath and module target syntax to readthedocs
Browse files Browse the repository at this point in the history
  • Loading branch information
fendor committed Mar 30, 2020
1 parent 8a5003d commit 7a95253
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions Cabal/doc/nix-local-build.rst
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,16 @@ A target can take any of the following forms:
- ``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. If the
target is ambiguous, e.g. only ``module`` is specified and the module name
is part of multiple components, then no component will be built.

- A module target: ``[package:][ctype:]filepath``, which specifies that the
component of which the given filepath is a part of will be built. If the
target is ambiguous, e.g. only ``filepath`` is specified and the filepath
is part of multiple components, then no component 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
Expand All @@ -370,9 +380,12 @@ 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

(There is also syntax for specifying module and file targets, but it
doesn't currently do anything.)
$ 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

Beyond a list of targets, ``cabal v2-build`` accepts all the flags that
``cabal v2-configure`` takes. Most of these flags are only taken into
Expand Down

0 comments on commit 7a95253

Please sign in to comment.