575 lines
21 KiB
HTML
575 lines
21 KiB
HTML
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<HTML><HEAD><TITLE>Man page of CARGO-METADATA</TITLE>
|
|
</HEAD><BODY>
|
|
<H1>CARGO-METADATA</H1>
|
|
Section: (1)<BR>Updated: 2020-07-04<BR><A HREF="#index">Index</A>
|
|
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<A NAME="lbAB"> </A>
|
|
<H2>NAME</H2>
|
|
|
|
cargo-metadata - Machine-readable metadata about the current package
|
|
<A NAME="lbAC"> </A>
|
|
<H2>SYNOPSIS</H2>
|
|
|
|
<P>
|
|
<B>cargo metadata [</B><I>OPTIONS</I>]
|
|
<A NAME="lbAD"> </A>
|
|
<H2>DESCRIPTION</H2>
|
|
|
|
<P>
|
|
Output JSON to stdout containing information about the workspace members and
|
|
resolved dependencies of the current package.
|
|
<P>
|
|
It is recommended to include the <B>--format-version</B> flag to future-proof
|
|
your code to ensure the output is in the format you are expecting.
|
|
<P>
|
|
See the
|
|
<I>cargo_metadata crate</I> <<A HREF="https://crates.io/crates/cargo_metadata">https://crates.io/crates/cargo_metadata</A>>
|
|
|
|
for a Rust API for reading the metadata.
|
|
<A NAME="lbAE"> </A>
|
|
<H2>OUTPUT FORMAT</H2>
|
|
|
|
<P>
|
|
The output has the following format:
|
|
<P>
|
|
<DL COMPACT><DT id="1"><DD>
|
|
|
|
<PRE>
|
|
{
|
|
/* Array of all packages in the workspace.
|
|
It also includes all feature-enabled dependencies unless --no-deps is used.
|
|
*/
|
|
"packages": [
|
|
{
|
|
/* The name of the package. */
|
|
"name": "my-package",
|
|
/* The version of the package. */
|
|
"version": "0.1.0",
|
|
/* The Package ID, a unique identifier for referring to the package. */
|
|
"id": "my-package 0.1.0 (path+<A HREF="file:///path/to/my-package)">file:///path/to/my-package)</A>",
|
|
/* The license value from the manifest, or null. */
|
|
"license": "MIT/Apache-2.0",
|
|
/* The license-file value from the manifest, or null. */
|
|
"license_file": "LICENSE",
|
|
/* The description value from the manifest, or null. */
|
|
"description": "Package description.",
|
|
/* The source ID of the package. This represents where
|
|
a package is retrieved from.
|
|
This is null for path dependencies and workspace members.
|
|
For other dependencies, it is a string with the format:
|
|
- "registry+URL" for registry-based dependencies.
|
|
Example: "registry+<A HREF="https://github.com/rust-lang/crates.io-index">https://github.com/rust-lang/crates.io-index</A>"
|
|
- "git+URL" for git-based dependencies.
|
|
Example: "git+<A HREF="https://github.com/rust-lang/cargo?rev=5e85ba14aaa20f8133863373404cb0af69eeef2c#5e85ba14aaa20f8133863373404cb0af69eeef2c">https://github.com/rust-lang/cargo?rev=5e85ba14aaa20f8133863373404cb0af69eeef2c#5e85ba14aaa20f8133863373404cb0af69eeef2c</A>"
|
|
*/
|
|
"source": null,
|
|
/* Array of dependencies declared in the package's manifest. */
|
|
"dependencies": [
|
|
{
|
|
/* The name of the dependency. */
|
|
"name": "bitflags",
|
|
/* The source ID of the dependency. May be null, see
|
|
description for the package source.
|
|
*/
|
|
"source": "registry+<A HREF="https://github.com/rust-lang/crates.io-index">https://github.com/rust-lang/crates.io-index</A>",
|
|
/* The version requirement for the dependency.
|
|
Dependencies without a version requirement have a value of "*".
|
|
*/
|
|
"req": "^1.0",
|
|
/* The dependency kind.
|
|
"dev", "build", or null for a normal dependency.
|
|
*/
|
|
"kind": null,
|
|
/* If the dependency is renamed, this is the new name for
|
|
the dependency as a string. null if it is not renamed.
|
|
*/
|
|
"rename": null,
|
|
/* Boolean of whether or not this is an optional dependency. */
|
|
"optional": false,
|
|
/* Boolean of whether or not default features are enabled. */
|
|
"uses_default_features": true,
|
|
/* Array of features enabled. */
|
|
"features": [],
|
|
/* The target platform for the dependency.
|
|
null if not a target dependency.
|
|
*/
|
|
"target": "cfg(windows)",
|
|
/* A string of the URL of the registry this dependency is from.
|
|
If not specified or null, the dependency is from the default
|
|
registry (crates.io).
|
|
*/
|
|
"registry": null
|
|
}
|
|
],
|
|
/* Array of Cargo targets. */
|
|
"targets": [
|
|
{
|
|
/* Array of target kinds.
|
|
- lib targets list the `crate-type` values from the
|
|
manifest such as "lib", "rlib", "dylib",
|
|
"proc-macro", etc. (default ["lib"])
|
|
- binary is ["bin"]
|
|
- example is ["example"]
|
|
- integration test is ["test"]
|
|
- benchmark is ["bench"]
|
|
- build script is ["custom-build"]
|
|
*/
|
|
"kind": [
|
|
"bin"
|
|
],
|
|
/* Array of crate types.
|
|
- lib and example libraries list the `crate-type` values
|
|
from the manifest such as "lib", "rlib", "dylib",
|
|
"proc-macro", etc. (default ["lib"])
|
|
- all other target kinds are ["bin"]
|
|
*/
|
|
"crate_types": [
|
|
"bin"
|
|
],
|
|
/* The name of the target. */
|
|
"name": "my-package",
|
|
/* Absolute path to the root source file of the target. */
|
|
"src_path": "/path/to/my-package/src/main.rs",
|
|
/* The Rust edition of the target.
|
|
Defaults to the package edition.
|
|
*/
|
|
"edition": "2018",
|
|
/* Array of required features.
|
|
This property is not included if no required features are set.
|
|
*/
|
|
"required-features": ["feat1"],
|
|
/* Whether or not this target has doc tests enabled, and
|
|
the target is compatible with doc testing.
|
|
*/
|
|
"doctest": false
|
|
}
|
|
],
|
|
/* Set of features defined for the package.
|
|
Each feature maps to an array of features or dependencies it
|
|
enables.
|
|
*/
|
|
"features": {
|
|
"default": [
|
|
"feat1"
|
|
],
|
|
"feat1": [],
|
|
"feat2": []
|
|
},
|
|
/* Absolute path to this package's manifest. */
|
|
"manifest_path": "/path/to/my-package/Cargo.toml",
|
|
/* Package metadata.
|
|
This is null if no metadata is specified.
|
|
*/
|
|
"metadata": {
|
|
"docs": {
|
|
"rs": {
|
|
"all-features": true
|
|
}
|
|
}
|
|
},
|
|
/* List of registries to which this package may be published.
|
|
Publishing is unrestricted if null, and forbidden if an empty array. */
|
|
"publish": [
|
|
"crates-io"
|
|
],
|
|
/* Array of authors from the manifest.
|
|
Empty array if no authors specified.
|
|
*/
|
|
"authors": [
|
|
"Jane Doe <<A HREF="mailto:user@example.com">user@example.com</A>>"
|
|
],
|
|
/* Array of categories from the manifest. */
|
|
"categories": [
|
|
"command-line-utilities"
|
|
],
|
|
/* Array of keywords from the manifest. */
|
|
"keywords": [
|
|
"cli"
|
|
],
|
|
/* The readme value from the manifest or null if not specified. */
|
|
"readme": "README.md",
|
|
/* The repository value from the manifest or null if not specified. */
|
|
"repository": "<A HREF="https://github.com/rust-lang/cargo">https://github.com/rust-lang/cargo</A>",
|
|
/* The default edition of the package.
|
|
Note that individual targets may have different editions.
|
|
*/
|
|
"edition": "2018",
|
|
/* Optional string that is the name of a native library the package
|
|
is linking to.
|
|
*/
|
|
"links": null,
|
|
}
|
|
],
|
|
/* Array of members of the workspace.
|
|
Each entry is the Package ID for the package.
|
|
*/
|
|
"workspace_members": [
|
|
"my-package 0.1.0 (path+<A HREF="file:///path/to/my-package)">file:///path/to/my-package)</A>",
|
|
],
|
|
// The resolved dependency graph for the entire workspace. The enabled
|
|
// features are based on the enabled features for the "current" package.
|
|
// Inactivated optional dependencies are not listed.
|
|
//
|
|
// This is null if --no-deps is specified.
|
|
//
|
|
// By default, this includes all dependencies for all target platforms.
|
|
// The `--filter-platform` flag may be used to narrow to a specific
|
|
// target triple.
|
|
"resolve": {
|
|
/* Array of nodes within the dependency graph.
|
|
Each node is a package.
|
|
*/
|
|
"nodes": [
|
|
{
|
|
/* The Package ID of this node. */
|
|
"id": "my-package 0.1.0 (path+<A HREF="file:///path/to/my-package)">file:///path/to/my-package)</A>",
|
|
/* The dependencies of this package, an array of Package IDs. */
|
|
"dependencies": [
|
|
"bitflags 1.0.4 (registry+<A HREF="https://github.com/rust-lang/crates.io-index)">https://github.com/rust-lang/crates.io-index)</A>"
|
|
],
|
|
/* The dependencies of this package. This is an alternative to
|
|
"dependencies" which contains additional information. In
|
|
particular, this handles renamed dependencies.
|
|
*/
|
|
"deps": [
|
|
{
|
|
/* The name of the dependency's library target.
|
|
If this is a renamed dependency, this is the new
|
|
name.
|
|
*/
|
|
"name": "bitflags",
|
|
/* The Package ID of the dependency. */
|
|
"pkg": "bitflags 1.0.4 (registry+<A HREF="https://github.com/rust-lang/crates.io-index)">https://github.com/rust-lang/crates.io-index)</A>",
|
|
/* Array of dependency kinds. Added in Cargo 1.40. */
|
|
"dep_kinds": [
|
|
{
|
|
/* The dependency kind.
|
|
"dev", "build", or null for a normal dependency.
|
|
*/
|
|
"kind": null,
|
|
/* The target platform for the dependency.
|
|
null if not a target dependency.
|
|
*/
|
|
"target": "cfg(windows)"
|
|
}
|
|
]
|
|
}
|
|
],
|
|
/* Array of features enabled on this package. */
|
|
"features": [
|
|
"default"
|
|
]
|
|
}
|
|
],
|
|
/* The root package of the workspace.
|
|
This is null if this is a virtual workspace. Otherwise it is
|
|
the Package ID of the root package.
|
|
*/
|
|
"root": "my-package 0.1.0 (path+<A HREF="file:///path/to/my-package)">file:///path/to/my-package)</A>"
|
|
},
|
|
/* The absolute path to the build directory where Cargo places its output. */
|
|
"target_directory": "/path/to/my-package/target",
|
|
/* The version of the schema for this metadata structure.
|
|
This will be changed if incompatible changes are ever made.
|
|
*/
|
|
"version": 1,
|
|
/* The absolute path to the root of the workspace. */
|
|
"workspace_root": "/path/to/my-package"
|
|
/* Workspace metadata.
|
|
This is null if no metadata is specified. */
|
|
"metadata": {
|
|
"docs": {
|
|
"rs": {
|
|
"all-features": true
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</PRE>
|
|
|
|
</DL>
|
|
|
|
|
|
<A NAME="lbAF"> </A>
|
|
<H2>OPTIONS</H2>
|
|
|
|
<A NAME="lbAG"> </A>
|
|
<H3>Output Options</H3>
|
|
|
|
<P>
|
|
<B>--no-deps</B>
|
|
<DL COMPACT><DT id="2"><DD>
|
|
Output information only about the workspace members and don't fetch
|
|
dependencies.
|
|
</DL>
|
|
|
|
<P>
|
|
<B>--format-version</B> <I>VERSION</I>
|
|
<DL COMPACT><DT id="3"><DD>
|
|
Specify the version of the output format to use. Currently <B>1</B> is the only
|
|
possible value.
|
|
</DL>
|
|
|
|
<P>
|
|
<B>--filter-platform</B> <I>TRIPLE</I>
|
|
<DL COMPACT><DT id="4"><DD>
|
|
This filters the <B>resolve</B> output to only include dependencies for the
|
|
given target triple. Without this flag, the resolve includes all targets.
|
|
<P>
|
|
Note that the dependencies listed in the "packages" array still includes all
|
|
dependencies. Each package definition is intended to be an unaltered
|
|
reproduction of the information within <B>Cargo.toml</B>.
|
|
</DL>
|
|
|
|
<A NAME="lbAH"> </A>
|
|
<H3>Feature Selection</H3>
|
|
|
|
<P>
|
|
The feature flags allow you to control the enabled features for the "current"
|
|
package. The "current" package is the package in the current directory, or the
|
|
one specified in <B>--manifest-path</B>. If running in the root of a virtual
|
|
workspace, then the default features are selected for all workspace members,
|
|
or all features if <B>--all-features</B> is specified.
|
|
<P>
|
|
When no feature options are given, the <B>default</B> feature is activated for
|
|
every selected package.
|
|
<P>
|
|
<B>--features</B> <I>FEATURES</I>
|
|
<DL COMPACT><DT id="5"><DD>
|
|
Space or comma separated list of features to activate. These features only
|
|
apply to the current directory's package. Features of direct dependencies
|
|
may be enabled with <B><dep-name>/<feature-name></B> syntax. This flag may be
|
|
specified multiple times, which enables all specified features.
|
|
</DL>
|
|
|
|
<P>
|
|
<B>--all-features</B>
|
|
<DL COMPACT><DT id="6"><DD>
|
|
Activate all available features of all selected packages.
|
|
</DL>
|
|
|
|
<P>
|
|
<B>--no-default-features</B>
|
|
<DL COMPACT><DT id="7"><DD>
|
|
Do not activate the <B>default</B> feature of the current directory's
|
|
package.
|
|
</DL>
|
|
|
|
<A NAME="lbAI"> </A>
|
|
<H3>Display Options</H3>
|
|
|
|
<P>
|
|
<B>-v</B>, <B>--verbose</B>
|
|
<DL COMPACT><DT id="8"><DD>
|
|
Use verbose output. May be specified twice for "very verbose" output which
|
|
includes extra output such as dependency warnings and build script output.
|
|
May also be specified with the <B>term.verbose</B>
|
|
|
|
<I>config value</I> <<A HREF="https://doc.rust-lang.org/cargo/reference/config.html">https://doc.rust-lang.org/cargo/reference/config.html</A>>.
|
|
|
|
</DL>
|
|
|
|
<P>
|
|
<B>-q</B>, <B>--quiet</B>
|
|
<DL COMPACT><DT id="9"><DD>
|
|
No output printed to stdout.
|
|
</DL>
|
|
|
|
<P>
|
|
<B>--color</B> <I>WHEN</I>
|
|
<DL COMPACT><DT id="10"><DD>
|
|
Control when colored output is used. Valid values:
|
|
<P>
|
|
<DL COMPACT><DT id="11"><DD>
|
|
•
|
|
|
|
|
|
<B>auto</B> (default): Automatically detect if color support is available on the
|
|
terminal.
|
|
</DL>
|
|
|
|
<P>
|
|
<DL COMPACT><DT id="12"><DD>
|
|
•
|
|
|
|
|
|
<B>always</B>: Always display colors.
|
|
</DL>
|
|
|
|
<P>
|
|
<DL COMPACT><DT id="13"><DD>
|
|
•
|
|
|
|
|
|
<B>never</B>: Never display colors.
|
|
</DL>
|
|
|
|
<P>
|
|
May also be specified with the <B>term.color</B>
|
|
|
|
<I>config value</I> <<A HREF="https://doc.rust-lang.org/cargo/reference/config.html">https://doc.rust-lang.org/cargo/reference/config.html</A>>.
|
|
|
|
</DL>
|
|
|
|
<A NAME="lbAJ"> </A>
|
|
<H3>Manifest Options</H3>
|
|
|
|
<P>
|
|
<B>--manifest-path</B> <I>PATH</I>
|
|
<DL COMPACT><DT id="14"><DD>
|
|
Path to the <B>Cargo.toml</B> file. By default, Cargo searches for the
|
|
<B>Cargo.toml</B> file in the current directory or any parent directory.
|
|
</DL>
|
|
|
|
<P>
|
|
<B>--frozen</B>, <B>--locked</B>
|
|
<DL COMPACT><DT id="15"><DD>
|
|
Either of these flags requires that the <B>Cargo.lock</B> file is
|
|
up-to-date. If the lock file is missing, or it needs to be updated, Cargo will
|
|
exit with an error. The <B>--frozen</B> flag also prevents Cargo from
|
|
attempting to access the network to determine if it is out-of-date.
|
|
<P>
|
|
These may be used in environments where you want to assert that the
|
|
<B>Cargo.lock</B> file is up-to-date (such as a CI build) or want to avoid network
|
|
access.
|
|
</DL>
|
|
|
|
<P>
|
|
<B>--offline</B>
|
|
<DL COMPACT><DT id="16"><DD>
|
|
Prevents Cargo from accessing the network for any reason. Without this
|
|
flag, Cargo will stop with an error if it needs to access the network and
|
|
the network is not available. With this flag, Cargo will attempt to
|
|
proceed without the network if possible.
|
|
<P>
|
|
Beware that this may result in different dependency resolution than online
|
|
mode. Cargo will restrict itself to crates that are downloaded locally, even
|
|
if there might be a newer version as indicated in the local copy of the index.
|
|
See the <B><A HREF="/cgi-bin/man/man2html?1+cargo-fetch">cargo-fetch</A></B>(1) command to download dependencies before going
|
|
offline.
|
|
<P>
|
|
May also be specified with the <B>net.offline</B>
|
|
<I>config value</I> <<A HREF="https://doc.rust-lang.org/cargo/reference/config.html">https://doc.rust-lang.org/cargo/reference/config.html</A>>.
|
|
|
|
</DL>
|
|
|
|
<A NAME="lbAK"> </A>
|
|
<H3>Common Options</H3>
|
|
|
|
<P>
|
|
<B>+TOOLCHAIN</B>
|
|
<DL COMPACT><DT id="17"><DD>
|
|
If Cargo has been installed with rustup, and the first argument to <B>cargo</B>
|
|
begins with <B>+</B>, it will be interpreted as a rustup toolchain name (such
|
|
as <B>+stable</B> or <B>+nightly</B>).
|
|
See the
|
|
<I>rustup documentation</I> <<A HREF="https://github.com/rust-lang/rustup/">https://github.com/rust-lang/rustup/</A>>
|
|
|
|
for more information about how toolchain overrides work.
|
|
</DL>
|
|
|
|
<P>
|
|
<B>-h</B>, <B>--help</B>
|
|
<DL COMPACT><DT id="18"><DD>
|
|
Prints help information.
|
|
</DL>
|
|
|
|
<P>
|
|
<B>-Z</B> <I>FLAG</I>...
|
|
<DL COMPACT><DT id="19"><DD>
|
|
Unstable (nightly-only) flags to Cargo. Run <B>cargo -Z help</B> for
|
|
details.
|
|
</DL>
|
|
|
|
<A NAME="lbAL"> </A>
|
|
<H2>ENVIRONMENT</H2>
|
|
|
|
<P>
|
|
See
|
|
<I>the reference</I> <<A HREF="https://doc.rust-lang.org/cargo/reference/environment-variables.html">https://doc.rust-lang.org/cargo/reference/environment-variables.html</A>>
|
|
|
|
for
|
|
details on environment variables that Cargo reads.
|
|
<A NAME="lbAM"> </A>
|
|
<H2>EXIT STATUS</H2>
|
|
|
|
<P>
|
|
0
|
|
<DL COMPACT><DT id="20"><DD>
|
|
Cargo succeeded.
|
|
</DL>
|
|
|
|
<P>
|
|
101
|
|
<DL COMPACT><DT id="21"><DD>
|
|
Cargo failed to complete.
|
|
</DL>
|
|
|
|
<A NAME="lbAN"> </A>
|
|
<H2>EXAMPLES</H2>
|
|
|
|
<P>
|
|
<DL COMPACT><DT id="22"><DD>
|
|
1.
|
|
|
|
|
|
Output JSON about the current package:
|
|
<P>
|
|
<DL COMPACT><DT id="23"><DD>
|
|
|
|
<PRE>
|
|
cargo metadata --format-version=1
|
|
</PRE>
|
|
|
|
</DL>
|
|
|
|
|
|
</DL>
|
|
|
|
<A NAME="lbAO"> </A>
|
|
<H2>SEE ALSO</H2>
|
|
|
|
<P>
|
|
<B><A HREF="/cgi-bin/man/man2html?1+cargo">cargo</A></B>(1)
|
|
<P>
|
|
|
|
<HR>
|
|
<A NAME="index"> </A><H2>Index</H2>
|
|
<DL>
|
|
<DT id="24"><A HREF="#lbAB">NAME</A><DD>
|
|
<DT id="25"><A HREF="#lbAC">SYNOPSIS</A><DD>
|
|
<DT id="26"><A HREF="#lbAD">DESCRIPTION</A><DD>
|
|
<DT id="27"><A HREF="#lbAE">OUTPUT FORMAT</A><DD>
|
|
<DT id="28"><A HREF="#lbAF">OPTIONS</A><DD>
|
|
<DL>
|
|
<DT id="29"><A HREF="#lbAG">Output Options</A><DD>
|
|
<DT id="30"><A HREF="#lbAH">Feature Selection</A><DD>
|
|
<DT id="31"><A HREF="#lbAI">Display Options</A><DD>
|
|
<DT id="32"><A HREF="#lbAJ">Manifest Options</A><DD>
|
|
<DT id="33"><A HREF="#lbAK">Common Options</A><DD>
|
|
</DL>
|
|
<DT id="34"><A HREF="#lbAL">ENVIRONMENT</A><DD>
|
|
<DT id="35"><A HREF="#lbAM">EXIT STATUS</A><DD>
|
|
<DT id="36"><A HREF="#lbAN">EXAMPLES</A><DD>
|
|
<DT id="37"><A HREF="#lbAO">SEE ALSO</A><DD>
|
|
</DL>
|
|
<HR>
|
|
This document was created by
|
|
<A HREF="/cgi-bin/man/man2html">man2html</A>,
|
|
using the manual pages.<BR>
|
|
Time: 00:05:08 GMT, March 31, 2021
|
|
</BODY>
|
|
</HTML>
|