Skip to content

Commit e274aba

Browse files
committed
Re #6042 Improve documentation of component target syntax
1 parent af114fb commit e274aba

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

doc/build_command.md

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ advantage of the flags is that they compose. See the examples below.
4949
## Components
5050

5151
Every Cabal package is made up of one or more components. It can have an
52-
optional library component, one or more optional executable components, one or
53-
more optional test suite components, and one or more optional benchmark
52+
optional public library component, one or more optional executable components,
53+
one or more optional test suite components, and one or more optional benchmark
5454
components.
5555

5656
Stack allows you to identify a specific component to be built. For example,
@@ -98,8 +98,10 @@ supported syntaxes for targets are:
9898
test suites to run, or to have a faster compilation cycle. There are
9999
multiple ways to refer to a specific component (provided for convenience):
100100

101-
* `packagename:comptype:compname` is the most explicit. The available
102-
comptypes are `exe`, `test`, and `bench`.
101+
* `<package-name>:lib` or `<package-name>:<comp-type>:<comp-name>` (where
102+
the component type, `<comp-type>`, is one of `exe`, `test`, or `bench`)
103+
is the most explicit. The library component type (`lib`) does not have
104+
an associated component name, `<comp-name>`.
103105

104106
!!! note
105107

@@ -108,14 +110,14 @@ supported syntaxes for targets are:
108110
all currently released versions of Cabal. See
109111
[issue#1046](https://github.com/commercialhaskell/stack/issues/1406)
110112

111-
* `packagename:compname` allows you to leave out the component type, as
112-
that will (almost?) always be redundant with the component name. For
113+
* `<package-name>:<comp-name>` allows you to leave out the component type,
114+
as that will often be unique for a given component name. For
113115
example, `stack build mypackage:mytestsuite`.
114116

115-
* `:compname` is a useful shortcut, saying "find the component in all of
116-
the local packages." This will result in an error if multiple packages
117-
have a component with the same name. To continue the above example,
118-
`stack build :mytestsuite`.
117+
* `:<comp-name>` is a useful shortcut, saying "find the component
118+
`<comp-name>` in all of the local packages". This will result in an
119+
error if more than one package has a component with the specified name.
120+
To continue the above example, `stack build :mytestsuite`.
119121

120122
* *directory*, e.g. `stack build foo/bar`, will find all local packages that
121123
exist in the given directory hierarchy and then follow the same procedure as

0 commit comments

Comments
 (0)