Skip to content
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

Homepage doc cargo metadata #8744

Merged
merged 4 commits into from
Oct 2, 2020
Merged
Show file tree
Hide file tree
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
6 changes: 6 additions & 0 deletions src/cargo/core/package.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ struct SerializedPackage<'a> {
keywords: &'a [String],
readme: Option<&'a str>,
repository: Option<&'a str>,
homepage: Option<&'a str>,
documentation: Option<&'a str>,
edition: &'a str,
links: Option<&'a str>,
#[serde(skip_serializing_if = "Option::is_none")]
Expand All @@ -118,6 +120,8 @@ impl ser::Serialize for Package {
let keywords = manmeta.keywords.as_ref();
let readme = manmeta.readme.as_deref();
let repository = manmeta.repository.as_deref();
let homepage = manmeta.homepage.as_ref().map(String::as_ref);
let documentation = manmeta.documentation.as_ref().map(String::as_ref);
// Filter out metabuild targets. They are an internal implementation
// detail that is probably not relevant externally. There's also not a
// real path to show in `src_path`, and this avoids changing the format.
Expand Down Expand Up @@ -146,6 +150,8 @@ impl ser::Serialize for Package {
keywords,
readme,
repository,
homepage,
documentation,
edition: &self.manifest().edition().to_string(),
links: self.manifest().links(),
metabuild: self.manifest().metabuild(),
Expand Down
4 changes: 4 additions & 0 deletions src/doc/man/cargo-metadata.md
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,10 @@ The output has the following format:
"readme": "README.md",
/* The repository value from the manifest or null if not specified. */
"repository": "https://github.com/rust-lang/cargo",
/* The homepage value from the manifest or null if not specified. */
"homepage": "https://rust-lang.org",
/* The documentation value from the manifest or null if not specified. */
"documentation": "https://doc.rust-lang.org/stable/std",
/* The default edition of the package.
Note that individual targets may have different editions.
*/
Expand Down
4 changes: 4 additions & 0 deletions src/doc/man/generated_txt/cargo-metadata.txt
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,10 @@ OUTPUT FORMAT
"readme": "README.md",
/* The repository value from the manifest or null if not specified. */
"repository": "https://github.com/rust-lang/cargo",
/* The homepage value from the manifest or null if not specified. */
"homepage": "https://rust-lang.org",
/* The documentation value from the manifest or null if not specified. */
"documentation": "https://doc.rust-lang.org/stable/std",
/* The default edition of the package.
Note that individual targets may have different editions.
*/
Expand Down
4 changes: 4 additions & 0 deletions src/doc/src/commands/cargo-metadata.md
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,10 @@ The output has the following format:
"readme": "README.md",
/* The repository value from the manifest or null if not specified. */
"repository": "https://github.com/rust-lang/cargo",
/* The homepage value from the manifest or null if not specified. */
"homepage": "https://rust-lang.org",
/* The documentation value from the manifest or null if not specified. */
"documentation": "https://doc.rust-lang.org/stable/std",
/* The default edition of the package.
Note that individual targets may have different editions.
*/
Expand Down
12 changes: 8 additions & 4 deletions src/etc/man/cargo-metadata.1
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,10 @@ The output has the following format:
"readme": "README.md",
/* The repository value from the manifest or null if not specified. */
"repository": "https://github.com/rust\-lang/cargo",
/* The homepage value from the manifest or null if not specified. */
"homepage": "https://rust-lang.org",
/* The documentation value from the manifest or null if not specified. */
"documentation": "https://doc.rust-lang.org/stable/std",
/* The default edition of the package.
Note that individual targets may have different editions.
*/
Expand Down Expand Up @@ -329,7 +333,7 @@ Do not activate the \fBdefault\fR feature of the current directory's package.
.RE
.SS "Display Options"
.sp
\fB\-v\fR,
\fB\-v\fR,
\fB\-\-verbose\fR
.RS 4
Use verbose output. May be specified twice for "very verbose" output which
Expand All @@ -338,7 +342,7 @@ May also be specified with the \fBterm.verbose\fR
\fIconfig value\fR <https://doc.rust\-lang.org/cargo/reference/config.html>\&.
.RE
.sp
\fB\-q\fR,
\fB\-q\fR,
\fB\-\-quiet\fR
.RS 4
No output printed to stdout.
Expand Down Expand Up @@ -372,7 +376,7 @@ Path to the \fBCargo.toml\fR file. By default, Cargo searches for the
\fBCargo.toml\fR file in the current directory or any parent directory.
.RE
.sp
\fB\-\-frozen\fR,
\fB\-\-frozen\fR,
\fB\-\-locked\fR
.RS 4
Either of these flags requires that the \fBCargo.lock\fR file is
Expand Down Expand Up @@ -411,7 +415,7 @@ See the \fIrustup documentation\fR <https://rust\-lang.github.io/rustup/override
for more information about how toolchain overrides work.
.RE
.sp
\fB\-h\fR,
\fB\-h\fR,
\fB\-\-help\fR
.RS 4
Prints help information.
Expand Down
24 changes: 24 additions & 0 deletions tests/testsuite/alt_registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,8 @@ fn publish_with_registry_dependency() {
"readme": null,
"readme_file": null,
"repository": null,
"homepage": null,
"documentation": null,
"vers": "0.0.1"
}"#,
"foo-0.0.1.crate",
Expand Down Expand Up @@ -459,6 +461,8 @@ fn publish_to_alt_registry() {
"readme": null,
"readme_file": null,
"repository": null,
"homepage": null,
"documentation": null,
"vers": "0.0.1"
}"#,
"foo-0.0.1.crate",
Expand Down Expand Up @@ -522,6 +526,8 @@ fn publish_with_crates_io_dep() {
"readme": null,
"readme_file": null,
"repository": null,
"homepage": null,
"documentation": null,
"vers": "0.0.1"
}"#,
"foo-0.0.1.crate",
Expand Down Expand Up @@ -814,6 +820,8 @@ fn alt_reg_metadata() {
"keywords": [],
"readme": null,
"repository": null,
"homepage": null,
"documentation": null,
"edition": "2015",
"links": null
}
Expand Down Expand Up @@ -868,6 +876,8 @@ fn alt_reg_metadata() {
"keywords": [],
"readme": null,
"repository": null,
"homepage": null,
"documentation": null,
"edition": "2015",
"links": null
},
Expand All @@ -890,6 +900,8 @@ fn alt_reg_metadata() {
"keywords": [],
"readme": null,
"repository": null,
"homepage": null,
"documentation": null,
"edition": "2015",
"links": null
},
Expand All @@ -912,6 +924,8 @@ fn alt_reg_metadata() {
"keywords": [],
"readme": null,
"repository": null,
"homepage": null,
"documentation": null,
"edition": "2015",
"links": null
},
Expand Down Expand Up @@ -959,6 +973,8 @@ fn alt_reg_metadata() {
"keywords": [],
"readme": null,
"repository": null,
"homepage": null,
"documentation": null,
"edition": "2015",
"links": null
},
Expand Down Expand Up @@ -994,6 +1010,8 @@ fn alt_reg_metadata() {
"keywords": [],
"readme": null,
"repository": null,
"homepage": null,
"documentation": null,
"edition": "2015",
"links": null
}
Expand Down Expand Up @@ -1087,6 +1105,8 @@ fn unknown_registry() {
"keywords": [],
"readme": null,
"repository": null,
"homepage": null,
"documentation": null,
"edition": "2015",
"links": null
},
Expand All @@ -1109,6 +1129,8 @@ fn unknown_registry() {
"keywords": [],
"readme": null,
"repository": null,
"homepage": null,
"documentation": null,
"edition": "2015",
"links": null
},
Expand Down Expand Up @@ -1144,6 +1166,8 @@ fn unknown_registry() {
"keywords": [],
"readme": null,
"repository": null,
"homepage": null,
"documentation": null,
"edition": "2015",
"links": null
}
Expand Down
Loading