Skip to content

Commit 89d4ab5

Browse files
committed
Auto merge of rust-lang#7694 - danielparks:issue-7691-manifest-badges-section, r=ehuss
Clarify manifest format docs for [badges] section Previously the `[badges]` section documentation was mixed in with the `[package]` section. This extracts it out under its own heading. This also pulls the `license` and `license-file` field documentation out of the package metadata code block. It sets the example license to “MIT OR Apache-2.0” since that is the typical licensing scheme for many crates. This includes minor rewrites for clarity and to match the register of the rest of the document. This resolves issue rust-lang#7691.
2 parents d810647 + 80e37c3 commit 89d4ab5

File tree

1 file changed

+51
-39
lines changed

1 file changed

+51
-39
lines changed

src/doc/src/reference/manifest.md

+51-39
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,34 @@ workspace = "path/to/workspace/root"
221221

222222
For more information, see the documentation for the workspace table below.
223223

224+
#### The `license` and `license-file` fields (optional)
225+
226+
The `license` field can be set to an [SPDX 2.1 license
227+
expression][spdx-2.1-license-expressions] for the package. Currently crates.io
228+
will validate the license provided against a whitelist of known license and
229+
exception identifiers from the [SPDX license list 3.6][spdx-license-list-3.6].
230+
Parentheses are not currently supported.
231+
232+
Previously multiple licenses could be separated with a `/`, but that usage is
233+
deprecated. Instead, use a license expression with AND and OR operators to get
234+
more explicit semantics.
235+
236+
```toml
237+
[package]
238+
# ...
239+
license = "MIT OR Apache-2.0"
240+
```
241+
242+
If a package is using a nonstandard license, then the `license-file` field may
243+
be specified in lieu of the `license` field. It must point to a file relative to
244+
this manifest (similar to the `readme` field).
245+
246+
```toml
247+
[package]
248+
# ...
249+
license-file = "..."
250+
```
251+
224252
#### Package metadata
225253

226254
There are a number of optional metadata fields also accepted under the
@@ -255,35 +283,31 @@ keywords = ["...", "..."]
255283
# Categories are a fixed list available at crates.io/category_slugs, and
256284
# they must match exactly.
257285
categories = ["...", "..."]
286+
```
258287

259-
# This is an SPDX 2.1 license expression for this package. Currently
260-
# crates.io will validate the license provided against a whitelist of
261-
# known license and exception identifiers from the SPDX license list
262-
# 3.6. Parentheses are not currently supported.
263-
#
264-
# Multiple licenses can be separated with a `/`, although that usage
265-
# is deprecated. Instead, use a license expression with AND and OR
266-
# operators to get more explicit semantics.
267-
license = "..."
268-
269-
# If a package is using a nonstandard license, then this key may be specified in
270-
# lieu of the above key and must point to a file relative to this manifest
271-
# (similar to the readme key).
272-
license-file = "..."
288+
The [crates.io](https://crates.io) registry will render the description, display
289+
the license, link to the three URLs and categorize by the keywords. These keys
290+
provide useful information to users of the registry and also influence the
291+
search ranking of a crate. It is highly discouraged to omit everything in a
292+
published crate.
293+
294+
### The `[badges]` section
295+
296+
crates.io can display various badges for build status, test coverage, etc. for
297+
each crate. All badges are optional.
298+
299+
- The badges pertaining to build status that are currently available are
300+
Appveyor, CircleCI, Cirrus CI, GitLab, Azure DevOps, Travis CI and Bitbucket
301+
Pipelines.
302+
- Available badges pertaining to code test coverage are Codecov and Coveralls.
303+
- There are also maintenance-related badges based on isitmaintained.com
304+
which state the issue resolution time, percent of open issues, and future
305+
maintenance intentions.
306+
307+
Most badge specifications require a `repository` key. It is expected to be in
308+
`user/repo` format.
273309

274-
# Optional specification of badges to be displayed on crates.io.
275-
#
276-
# - The badges pertaining to build status that are currently available are
277-
# Appveyor, CircleCI, Cirrus CI, GitLab, Azure DevOps, Travis CI and Bitbucket
278-
# Pipelines.
279-
# - Available badges pertaining to code test coverage are Codecov and
280-
# Coveralls.
281-
# - There are also maintenance-related badges based on isitmaintained.com
282-
# which state the issue resolution time, percent of open issues, and future
283-
# maintenance intentions.
284-
#
285-
# If a `repository` key is required, this refers to a repository in
286-
# `user/repo` format.
310+
```toml
287311
[badges]
288312

289313
# Appveyor: `repository` is required. `branch` is optional; default is `master`
@@ -346,17 +370,6 @@ is-it-maintained-open-issues = { repository = "..." }
346370
maintenance = { status = "..." }
347371
```
348372

349-
The [crates.io](https://crates.io) registry will render the description, display
350-
the license, link to the three URLs and categorize by the keywords. These keys
351-
provide useful information to users of the registry and also influence the
352-
search ranking of a crate. It is highly discouraged to omit everything in a
353-
published crate.
354-
355-
SPDX 2.1 license expressions are documented
356-
[here][spdx-2.1-license-expressions]. The current version of the
357-
license list is available [here][spdx-license-list], and version 3.6
358-
is available [here][spdx-license-list-3.6].
359-
360373
#### The `metadata` table (optional)
361374

362375
Cargo by default will warn about unused keys in `Cargo.toml` to assist in
@@ -946,4 +959,3 @@ dependencies][replace] section of the documentation.
946959
[`cargo test`]: ../commands/cargo-test.md
947960
[spdx-2.1-license-expressions]: https://spdx.org/spdx-specification-21-web-version#h.jxpfx0ykyb60
948961
[spdx-license-list-3.6]: https://github.com/spdx/license-list-data/tree/v3.6
949-
[spdx-license-list]: https://spdx.org/licenses/

0 commit comments

Comments
 (0)