mirror of
https://github.com/rust-lang/cargo.git
synced 2025-10-01 11:30:39 +00:00
Add links
to cargo metadata
.
This is needed for creating registry index entries.
This commit is contained in:
parent
e593efc9cb
commit
53de08a57d
@ -71,6 +71,7 @@ struct SerializedPackage<'a> {
|
|||||||
readme: Option<&'a str>,
|
readme: Option<&'a str>,
|
||||||
repository: Option<&'a str>,
|
repository: Option<&'a str>,
|
||||||
edition: &'a str,
|
edition: &'a str,
|
||||||
|
links: Option<&'a str>,
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
metabuild: Option<&'a Vec<String>>,
|
metabuild: Option<&'a Vec<String>>,
|
||||||
}
|
}
|
||||||
@ -120,6 +121,7 @@ impl ser::Serialize for Package {
|
|||||||
readme,
|
readme,
|
||||||
repository,
|
repository,
|
||||||
edition: &self.manifest.edition().to_string(),
|
edition: &self.manifest.edition().to_string(),
|
||||||
|
links: self.manifest.links(),
|
||||||
metabuild: self.manifest.metabuild(),
|
metabuild: self.manifest.metabuild(),
|
||||||
}
|
}
|
||||||
.serialize(s)
|
.serialize(s)
|
||||||
|
@ -170,7 +170,11 @@ The output has the following format:
|
|||||||
/* The default edition of the package.
|
/* The default edition of the package.
|
||||||
Note that individual targets may have different editions.
|
Note that individual targets may have different editions.
|
||||||
*/
|
*/
|
||||||
"edition": "2018"
|
"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.
|
/* Array of members of the workspace.
|
||||||
|
@ -177,7 +177,11 @@ for a Rust API for reading the metadata.</p>
|
|||||||
/* The default edition of the package.
|
/* The default edition of the package.
|
||||||
Note that individual targets may have different editions.
|
Note that individual targets may have different editions.
|
||||||
*/
|
*/
|
||||||
"edition": "2018"
|
"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.
|
/* Array of members of the workspace.
|
||||||
|
@ -2,12 +2,12 @@
|
|||||||
.\" Title: cargo-metadata
|
.\" Title: cargo-metadata
|
||||||
.\" Author: [see the "AUTHOR(S)" section]
|
.\" Author: [see the "AUTHOR(S)" section]
|
||||||
.\" Generator: Asciidoctor 1.5.8
|
.\" Generator: Asciidoctor 1.5.8
|
||||||
.\" Date: 2018-12-18
|
.\" Date: 2018-12-23
|
||||||
.\" Manual: \ \&
|
.\" Manual: \ \&
|
||||||
.\" Source: \ \&
|
.\" Source: \ \&
|
||||||
.\" Language: English
|
.\" Language: English
|
||||||
.\"
|
.\"
|
||||||
.TH "CARGO\-METADATA" "1" "2018-12-18" "\ \&" "\ \&"
|
.TH "CARGO\-METADATA" "1" "2018-12-23" "\ \&" "\ \&"
|
||||||
.ie \n(.g .ds Aq \(aq
|
.ie \n(.g .ds Aq \(aq
|
||||||
.el .ds Aq '
|
.el .ds Aq '
|
||||||
.ss \n[.ss] 0
|
.ss \n[.ss] 0
|
||||||
@ -191,7 +191,11 @@ The output has the following format:
|
|||||||
/* The default edition of the package.
|
/* The default edition of the package.
|
||||||
Note that individual targets may have different editions.
|
Note that individual targets may have different editions.
|
||||||
*/
|
*/
|
||||||
"edition": "2018"
|
"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.
|
/* Array of members of the workspace.
|
||||||
|
@ -27,6 +27,7 @@ fn cargo_metadata_simple() {
|
|||||||
"edition": "2015",
|
"edition": "2015",
|
||||||
"license": null,
|
"license": null,
|
||||||
"license_file": null,
|
"license_file": null,
|
||||||
|
"links": null,
|
||||||
"description": null,
|
"description": null,
|
||||||
"readme": null,
|
"readme": null,
|
||||||
"repository": null,
|
"repository": null,
|
||||||
@ -116,6 +117,7 @@ crate-type = ["lib", "staticlib"]
|
|||||||
"edition": "2015",
|
"edition": "2015",
|
||||||
"license": null,
|
"license": null,
|
||||||
"license_file": null,
|
"license_file": null,
|
||||||
|
"links": null,
|
||||||
"description": null,
|
"description": null,
|
||||||
"targets": [
|
"targets": [
|
||||||
{
|
{
|
||||||
@ -195,6 +197,7 @@ optional_feat = []
|
|||||||
"edition": "2015",
|
"edition": "2015",
|
||||||
"license": null,
|
"license": null,
|
||||||
"license_file": null,
|
"license_file": null,
|
||||||
|
"links": null,
|
||||||
"description": null,
|
"description": null,
|
||||||
"targets": [
|
"targets": [
|
||||||
{
|
{
|
||||||
@ -287,6 +290,7 @@ fn cargo_metadata_with_deps_and_version() {
|
|||||||
"keywords": [],
|
"keywords": [],
|
||||||
"license": null,
|
"license": null,
|
||||||
"license_file": null,
|
"license_file": null,
|
||||||
|
"links": null,
|
||||||
"manifest_path": "[..]Cargo.toml",
|
"manifest_path": "[..]Cargo.toml",
|
||||||
"metadata": null,
|
"metadata": null,
|
||||||
"name": "baz",
|
"name": "baz",
|
||||||
@ -342,6 +346,7 @@ fn cargo_metadata_with_deps_and_version() {
|
|||||||
"keywords": [],
|
"keywords": [],
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"license_file": null,
|
"license_file": null,
|
||||||
|
"links": null,
|
||||||
"manifest_path": "[..]Cargo.toml",
|
"manifest_path": "[..]Cargo.toml",
|
||||||
"metadata": null,
|
"metadata": null,
|
||||||
"name": "foo",
|
"name": "foo",
|
||||||
@ -374,6 +379,7 @@ fn cargo_metadata_with_deps_and_version() {
|
|||||||
"keywords": [],
|
"keywords": [],
|
||||||
"license": null,
|
"license": null,
|
||||||
"license_file": null,
|
"license_file": null,
|
||||||
|
"links": null,
|
||||||
"manifest_path": "[..]Cargo.toml",
|
"manifest_path": "[..]Cargo.toml",
|
||||||
"metadata": null,
|
"metadata": null,
|
||||||
"name": "foobar",
|
"name": "foobar",
|
||||||
@ -418,6 +424,7 @@ fn cargo_metadata_with_deps_and_version() {
|
|||||||
"keywords": [],
|
"keywords": [],
|
||||||
"license": null,
|
"license": null,
|
||||||
"license_file": null,
|
"license_file": null,
|
||||||
|
"links": null,
|
||||||
"manifest_path": "[..]Cargo.toml",
|
"manifest_path": "[..]Cargo.toml",
|
||||||
"metadata": null,
|
"metadata": null,
|
||||||
"name": "bar",
|
"name": "bar",
|
||||||
@ -533,6 +540,7 @@ name = "ex"
|
|||||||
"keywords": [],
|
"keywords": [],
|
||||||
"license": null,
|
"license": null,
|
||||||
"license_file": null,
|
"license_file": null,
|
||||||
|
"links": null,
|
||||||
"description": null,
|
"description": null,
|
||||||
"edition": "2015",
|
"edition": "2015",
|
||||||
"source": null,
|
"source": null,
|
||||||
@ -615,6 +623,7 @@ crate-type = ["rlib", "dylib"]
|
|||||||
"keywords": [],
|
"keywords": [],
|
||||||
"license": null,
|
"license": null,
|
||||||
"license_file": null,
|
"license_file": null,
|
||||||
|
"links": null,
|
||||||
"description": null,
|
"description": null,
|
||||||
"edition": "2015",
|
"edition": "2015",
|
||||||
"source": null,
|
"source": null,
|
||||||
@ -698,6 +707,7 @@ fn workspace_metadata() {
|
|||||||
"dependencies": [],
|
"dependencies": [],
|
||||||
"license": null,
|
"license": null,
|
||||||
"license_file": null,
|
"license_file": null,
|
||||||
|
"links": null,
|
||||||
"description": null,
|
"description": null,
|
||||||
"edition": "2015",
|
"edition": "2015",
|
||||||
"targets": [
|
"targets": [
|
||||||
@ -728,6 +738,7 @@ fn workspace_metadata() {
|
|||||||
"dependencies": [],
|
"dependencies": [],
|
||||||
"license": null,
|
"license": null,
|
||||||
"license_file": null,
|
"license_file": null,
|
||||||
|
"links": null,
|
||||||
"description": null,
|
"description": null,
|
||||||
"edition": "2015",
|
"edition": "2015",
|
||||||
"targets": [
|
"targets": [
|
||||||
@ -806,6 +817,7 @@ fn workspace_metadata_no_deps() {
|
|||||||
"dependencies": [],
|
"dependencies": [],
|
||||||
"license": null,
|
"license": null,
|
||||||
"license_file": null,
|
"license_file": null,
|
||||||
|
"links": null,
|
||||||
"description": null,
|
"description": null,
|
||||||
"edition": "2015",
|
"edition": "2015",
|
||||||
"targets": [
|
"targets": [
|
||||||
@ -836,6 +848,7 @@ fn workspace_metadata_no_deps() {
|
|||||||
"dependencies": [],
|
"dependencies": [],
|
||||||
"license": null,
|
"license": null,
|
||||||
"license_file": null,
|
"license_file": null,
|
||||||
|
"links": null,
|
||||||
"description": null,
|
"description": null,
|
||||||
"edition": "2015",
|
"edition": "2015",
|
||||||
"targets": [
|
"targets": [
|
||||||
@ -893,6 +906,7 @@ const MANIFEST_OUTPUT: &str = r#"
|
|||||||
"keywords": [],
|
"keywords": [],
|
||||||
"license": null,
|
"license": null,
|
||||||
"license_file": null,
|
"license_file": null,
|
||||||
|
"links": null,
|
||||||
"description": null,
|
"description": null,
|
||||||
"edition": "2015",
|
"edition": "2015",
|
||||||
"targets":[{
|
"targets":[{
|
||||||
@ -1070,6 +1084,7 @@ fn package_metadata() {
|
|||||||
"edition": "2015",
|
"edition": "2015",
|
||||||
"license": null,
|
"license": null,
|
||||||
"license_file": null,
|
"license_file": null,
|
||||||
|
"links": null,
|
||||||
"description": null,
|
"description": null,
|
||||||
"targets": [
|
"targets": [
|
||||||
{
|
{
|
||||||
@ -1137,6 +1152,7 @@ fn cargo_metadata_path_to_cargo_toml_project() {
|
|||||||
"keywords": [],
|
"keywords": [],
|
||||||
"license": null,
|
"license": null,
|
||||||
"license_file": null,
|
"license_file": null,
|
||||||
|
"links": null,
|
||||||
"manifest_path": "[..]Cargo.toml",
|
"manifest_path": "[..]Cargo.toml",
|
||||||
"metadata": null,
|
"metadata": null,
|
||||||
"name": "bar",
|
"name": "bar",
|
||||||
@ -1218,6 +1234,7 @@ fn package_edition_2018() {
|
|||||||
"keywords": [],
|
"keywords": [],
|
||||||
"license": null,
|
"license": null,
|
||||||
"license_file": null,
|
"license_file": null,
|
||||||
|
"links": null,
|
||||||
"manifest_path": "[..]Cargo.toml",
|
"manifest_path": "[..]Cargo.toml",
|
||||||
"metadata": null,
|
"metadata": null,
|
||||||
"name": "foo",
|
"name": "foo",
|
||||||
@ -1303,6 +1320,7 @@ fn target_edition_2018() {
|
|||||||
"keywords": [],
|
"keywords": [],
|
||||||
"license": null,
|
"license": null,
|
||||||
"license_file": null,
|
"license_file": null,
|
||||||
|
"links": null,
|
||||||
"manifest_path": "[..]Cargo.toml",
|
"manifest_path": "[..]Cargo.toml",
|
||||||
"metadata": null,
|
"metadata": null,
|
||||||
"name": "foo",
|
"name": "foo",
|
||||||
@ -1423,6 +1441,7 @@ fn rename_dependency() {
|
|||||||
"keywords": [],
|
"keywords": [],
|
||||||
"license": null,
|
"license": null,
|
||||||
"license_file": null,
|
"license_file": null,
|
||||||
|
"links": null,
|
||||||
"manifest_path": "[..]",
|
"manifest_path": "[..]",
|
||||||
"metadata": null,
|
"metadata": null,
|
||||||
"name": "foo",
|
"name": "foo",
|
||||||
@ -1455,6 +1474,7 @@ fn rename_dependency() {
|
|||||||
"keywords": [],
|
"keywords": [],
|
||||||
"license": null,
|
"license": null,
|
||||||
"license_file": null,
|
"license_file": null,
|
||||||
|
"links": null,
|
||||||
"manifest_path": "[..]",
|
"manifest_path": "[..]",
|
||||||
"metadata": null,
|
"metadata": null,
|
||||||
"name": "bar",
|
"name": "bar",
|
||||||
@ -1487,6 +1507,7 @@ fn rename_dependency() {
|
|||||||
"keywords": [],
|
"keywords": [],
|
||||||
"license": null,
|
"license": null,
|
||||||
"license_file": null,
|
"license_file": null,
|
||||||
|
"links": null,
|
||||||
"manifest_path": "[..]",
|
"manifest_path": "[..]",
|
||||||
"metadata": null,
|
"metadata": null,
|
||||||
"name": "bar",
|
"name": "bar",
|
||||||
@ -1554,3 +1575,90 @@ fn rename_dependency() {
|
|||||||
)
|
)
|
||||||
.run();
|
.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn metadata_links() {
|
||||||
|
let p = project()
|
||||||
|
.file(
|
||||||
|
"Cargo.toml",
|
||||||
|
r#"
|
||||||
|
[project]
|
||||||
|
name = "foo"
|
||||||
|
version = "0.5.0"
|
||||||
|
links = "a"
|
||||||
|
"#,
|
||||||
|
)
|
||||||
|
.file("src/lib.rs", "")
|
||||||
|
.file("build.rs", "fn main() {}")
|
||||||
|
.build();
|
||||||
|
|
||||||
|
p.cargo("metadata")
|
||||||
|
.with_json(r#"
|
||||||
|
{
|
||||||
|
"packages": [
|
||||||
|
{
|
||||||
|
"authors": [],
|
||||||
|
"categories": [],
|
||||||
|
"dependencies": [],
|
||||||
|
"description": null,
|
||||||
|
"edition": "2015",
|
||||||
|
"features": {},
|
||||||
|
"id": "foo 0.5.0 [..]",
|
||||||
|
"keywords": [],
|
||||||
|
"license": null,
|
||||||
|
"license_file": null,
|
||||||
|
"links": "a",
|
||||||
|
"manifest_path": "[..]/foo/Cargo.toml",
|
||||||
|
"metadata": null,
|
||||||
|
"name": "foo",
|
||||||
|
"readme": null,
|
||||||
|
"repository": null,
|
||||||
|
"source": null,
|
||||||
|
"targets": [
|
||||||
|
{
|
||||||
|
"crate_types": [
|
||||||
|
"lib"
|
||||||
|
],
|
||||||
|
"edition": "2015",
|
||||||
|
"kind": [
|
||||||
|
"lib"
|
||||||
|
],
|
||||||
|
"name": "foo",
|
||||||
|
"src_path": "[..]/foo/src/lib.rs"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"crate_types": [
|
||||||
|
"bin"
|
||||||
|
],
|
||||||
|
"edition": "2015",
|
||||||
|
"kind": [
|
||||||
|
"custom-build"
|
||||||
|
],
|
||||||
|
"name": "build-script-build",
|
||||||
|
"src_path": "[..]/foo/build.rs"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"version": "0.5.0"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"resolve": {
|
||||||
|
"nodes": [
|
||||||
|
{
|
||||||
|
"dependencies": [],
|
||||||
|
"deps": [],
|
||||||
|
"features": [],
|
||||||
|
"id": "foo 0.5.0 [..]"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"root": "foo 0.5.0 [..]"
|
||||||
|
},
|
||||||
|
"target_directory": "[..]/foo/target",
|
||||||
|
"version": 1,
|
||||||
|
"workspace_members": [
|
||||||
|
"foo 0.5.0 [..]"
|
||||||
|
],
|
||||||
|
"workspace_root": "[..]/foo"
|
||||||
|
}
|
||||||
|
"#)
|
||||||
|
.run()
|
||||||
|
}
|
||||||
|
@ -14,6 +14,7 @@ static MANIFEST_OUTPUT: &'static str = r#"
|
|||||||
"keywords": [],
|
"keywords": [],
|
||||||
"license": null,
|
"license": null,
|
||||||
"license_file": null,
|
"license_file": null,
|
||||||
|
"links": null,
|
||||||
"description": null,
|
"description": null,
|
||||||
"edition": "2015",
|
"edition": "2015",
|
||||||
"source":null,
|
"source":null,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user