Skip to content

Commit b2f7fce

Browse files
committed
Re #6114 Update extra-deps documentation
1 parent 76cc98d commit b2f7fce

File tree

1 file changed

+63
-100
lines changed

1 file changed

+63
-100
lines changed

doc/yaml_configuration.md

Lines changed: 63 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -119,137 +119,100 @@ packages:
119119
- .
120120
~~~
121121

122-
_NOTE_ From Stack 1.11, Stack moved over to Pantry for managing extra-deps, and
123-
removed some legacy syntax for specifying dependencies in `packages`. Some
124-
conversion notes are provided below.
125-
126122
The `packages` key specifies a list of packages that are part of your local
127-
project. These are specified via paths to local directories. The paths are
123+
project. These are specified via paths to local directories. A path is
128124
considered relative to the directory containing the `stack.yaml` file. For
129-
example, if your `stack.yaml` is located at `/foo/bar/stack.yaml`, and you have:
125+
example, if the `stack.yaml` is located at `/dir1/dir2/stack.yaml`, and has:
130126

131127
~~~yaml
132128
packages:
133-
- hello
134-
- there/world
129+
- my-package
130+
- dir3/my-other-package
135131
~~~
136132

137-
Your configuration means "I have packages in `/foo/bar/hello` and
138-
`/foo/bar/there/world`.
133+
the configuration means "project packages in directories `/dir1/dir2/my-package`
134+
and `/dir1/dir2/dir3/my-other-package`".
139135

140-
If these packages should be treated as dependencies instead, specify them in
141-
`extra-deps` key, described below.
136+
The `packages` key is optional. The default value, '`.`', means that the
137+
project has a single package located in the current directory.
142138

143-
The `packages` key is _optional_. The default item, '`.`', means that your
144-
project has exactly one package, and it is located in the current directory.
139+
Each specified package directory must have a valid Cabal file or Hpack
140+
`package.yaml` file present. Any subdirectories of the directory are not
141+
searched for Cabal files. A subdirectories has to be specified as an independent
142+
item in the list of packages.
145143

146-
Each package directory specified must have a valid Cabal file or Hpack
147-
`package.yaml` file present. The subdirectories of the directory are not
148-
searched for Cabal files. Subdirectories will have to be specified as
149-
independent items in the list of packages.
144+
A project package is different from a dependency, both a snapshot dependency
145+
(via the [`resolver` or `snapshot`](#resolver-or-snapshot) key) and an
146+
extra-deps dependency (via the [`extra-deps`](#extra-deps) key). For example:
150147

151-
Project packages are different from snapshot dependencies (via `resolver`) and
152-
extra dependencies (via `extra-deps`) in multiple ways, e.g.:
148+
* a project package will be built by default by commanding
149+
[`stack build`](build_command.md) without specific targets. A dependency will
150+
only be built if it is depended upon; and
151+
* test suites and benchmarks may be run for a project package. They are never
152+
run for a dependency.
153153

154-
* Project packages will be built by default with a `stack build` without
155-
specific targets. Dependencies will only be built if they are depended upon.
156-
* Test suites and benchmarks may be run for project packages. They are never run
157-
for extra dependencies.
154+
### extra-deps
158155

159-
__Legacy syntax__ Prior to Stack 1.11, it was possible to specify dependencies
160-
in your `packages` configuration value as well. This support was removed to
161-
simplify the file format. Instead, these values should be moved to `extra-deps`.
162-
As a concrete example, you would convert:
156+
Default: `[]`
163157

164-
~~~yaml
165-
packages:
166-
- .
167-
- location:
168-
git: https://github.com/bitemyapp/esqueleto.git
169-
commit: 08c9b4cdf977d5bcd1baba046a007940c1940758
170-
extra-dep: true
171-
- location:
172-
git: https://github.com/yesodweb/wai.git
173-
commit: 6bf765e000c6fd14e09ebdea6c4c5b1510ff5376
174-
subdirs:
175-
- wai-extra
176-
extra-dep: true
158+
The `extra-deps` key specifies a list of extra dependencies on top of what is
159+
defined in the snapshot (specified by the
160+
[`resolver` or `snapshot`](#resolver-or-snapshot) key). A dependency may come
161+
from either a Pantry package location or a local file path.
177162

178-
extra-deps:
179-
- streaming-commons-0.2.0.0
180-
- time-1.9.1
181-
- yesod-colonnade-1.3.0.1
182-
- yesod-elements-1.1
183-
~~~
163+
A Pantry package location is one or three different kinds of sources:
184164

185-
into
165+
* the package index (Hackage);
166+
* an archive (a tarball or zip file, either local or over HTTP or HTTPS); or
167+
* a Git or Mercurial repository.
186168

187-
~~~yaml
188-
packages:
189-
- .
169+
For further information on the format for specifying a Pantry package location,
170+
see the [Pantry](pantry.md) documentation. For example:
190171

172+
~~~yaml
191173
extra-deps:
192-
- streaming-commons-0.2.0.0
193-
- time-1.9.1
194-
- yesod-colonnade-1.3.0.1
195-
- yesod-elements-1.1
196-
- git: https://github.com/bitemyapp/esqueleto.git
197-
commit: 08c9b4cdf977d5bcd1baba046a007940c1940758
198-
- git: https://github.com/yesodweb/wai.git
199-
commit: 6bf765e000c6fd14e09ebdea6c4c5b1510ff5376
200-
subdirs:
201-
- wai-extra
174+
# The latest revision of a package in the package index (Hackage):
175+
- acme-missiles-0.3
176+
# A specific revision of a package in the package index (Hackage):
177+
- acme-missiles-0.3@rev:0
178+
# An *.tar.gz archive file over HTTPS:
179+
- url: https://github.com/example-user/my-repo/archive/08c9b4cdf977d5bcd1baba046a007940c1940758.tar.gz
180+
subdirs:
181+
- my-package
182+
# A Git repository at a specific commit:
183+
- git: https://github.com/example-user/my-repo.git
184+
commit: 08c9b4cdf977d5bcd1baba046a007940c1940758
185+
# An archive of files at a point in the history of a GitHub repository
186+
# (identified by a specific commit):
187+
- github: example-user/my-repo
188+
commit: 08c9b4cdf977d5bcd1baba046a007940c1940758
189+
subdirs:
190+
- my-package
202191
~~~
203192

204-
And, in fact, the `packages` value could be left off entirely since it's using
205-
the default value.
206-
207-
### extra-deps
208-
209-
Default: `[]`
210-
211-
This key allows you to specify extra dependencies on top of what is defined in
212-
your snapshot (specified by the `resolver` or `snapshot` key mentioned above).
213-
These dependencies may either come from a local file path or a Pantry package
214-
location.
215-
216-
For the local file path case, the same relative path rules as apply to
217-
`packages` apply.
218-
219-
Pantry package locations allow you to include dependencies from three different
220-
kinds of sources:
193+
!!! note
221194

222-
* Hackage
223-
* Archives (tarballs or zip files, either local or over HTTP or HTTPS)
224-
* Git or Mercurial repositories
195+
GHC boot packages are special. An extra-dep with the same package name and
196+
version as a GHC boot package will be ignored.
225197

226-
Here's an example using all of the above:
198+
For a local file path source, the path is considered relative to the directory
199+
containing the `stack.yaml` file. For example, if the `stack.yaml` is located
200+
at `/dir1/dir2/stack.yaml`, and has:
227201

228202
~~~yaml
229203
extra-deps:
230-
- vendor/hashable
231-
- streaming-commons-0.2.0.0
232-
- time-1.9.1
233-
- yesod-colonnade-1.3.0.1
234-
- yesod-elements-1.1
235-
- git: https://github.com/bitemyapp/esqueleto.git
236-
commit: 08c9b4cdf977d5bcd1baba046a007940c1940758
237-
- url: https://github.com/yesodweb/wai/archive/6bf765e000c6fd14e09ebdea6c4c5b1510ff5376.tar.gz
238-
subdirs:
239-
- wai-extra
240-
- github: snoyberg/conduit
241-
commit: 2e3e41de93821bcfe8ec6210aeca21be3f2087bf
242-
subdirs:
243-
- network-conduit-tls
204+
- my-package
205+
- dir3/my-other-package
244206
~~~
245207

246-
For further information on the format for specifying dependencies, see the
247-
[Pantry](pantry.md) documentation.
208+
the configuration means "extra-deps packages in directories
209+
`/dir1/dir2/my-package` and `/dir1/dir2/dir3/my-other-package`".
248210

249211
!!! note
250212

251-
GHC boot packages are special. An extra-dep with the same package name and
252-
version as a GHC boot package will be ignored.
213+
A specified extra-dep that does not have the format of a valid Pantry
214+
package location (for example, a reference to a package on Hackage that
215+
omits the package's version) will be interpreted as a local file path.
253216

254217
### flags
255218

0 commit comments

Comments
 (0)