Skip to content

docs: Minor clarification of build script metadata. #13436

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions src/doc/src/reference/build-scripts.md
Original file line number Diff line number Diff line change
Expand Up @@ -376,14 +376,16 @@ In other words, it is forbidden to have two packages link to the same native
library. This helps prevent duplicate symbols between crates. Note, however,
that there are [conventions in place](#-sys-packages) to alleviate this.

As mentioned above in the output format, each build script can generate an
arbitrary set of metadata in the form of key-value pairs. This metadata is
passed to the build scripts of **dependent** packages. For example, if the
package `bar` depends on `foo`, then if `foo` generates `key=value` as part of
its build script metadata, then the build script of `bar` will have the
environment variables `DEP_FOO_KEY=value`. See the ["Using another `sys`
crate"][using-another-sys] for an example of
how this can be used.
Build scripts can generate an arbitrary set of metadata in the form of
key-value pairs. This metadata is set with the `cargo::metadata=KEY=VALUE`
instruction.

The metadata is passed to the build scripts of **dependent** packages. For
example, if the package `bar` depends on `foo`, then if `foo` generates
`key=value` as part of its build script metadata, then the build script of
`bar` will have the environment variables `DEP_FOO_KEY=value`. See the ["Using
another `sys` crate"][using-another-sys] for an example of how this can be
used.

Note that metadata is only passed to immediate dependents, not transitive
dependents.
Expand Down