Include rust-version in publish request

crates.io reads rust-version from the tarball directly, but we can include it in
the publish request for the sake of consistency for third-party registries.
This commit is contained in:
cassaundra 2023-03-24 13:46:59 -07:00
parent 284fd3f0f1
commit 5554889f88
No known key found for this signature in database
GPG Key ID: E8087B0F3D674D9B
10 changed files with 30 additions and 0 deletions

View File

@ -57,6 +57,7 @@ pub struct NewCrate {
pub repository: Option<String>,
pub badges: BTreeMap<String, BTreeMap<String, String>>,
pub links: Option<String>,
pub rust_version: Option<String>,
}
#[derive(Serialize, Deserialize)]

View File

@ -110,6 +110,7 @@ pub struct ManifestMetadata {
pub documentation: Option<String>, // URL
pub badges: BTreeMap<String, BTreeMap<String, String>>,
pub links: Option<String>,
pub rust_version: Option<String>,
}
#[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord)]

View File

@ -345,6 +345,7 @@ fn transmit(
ref categories,
ref badges,
ref links,
ref rust_version,
} = *manifest.metadata();
let readme_content = readme
.as_ref()
@ -398,6 +399,7 @@ fn transmit(
license_file: license_file.clone(),
badges: badges.clone(),
links: links.clone(),
rust_version: rust_version.clone(),
},
tarball,
)

View File

@ -2433,6 +2433,11 @@ impl TomlManifest {
.transpose()?
.unwrap_or_default(),
links: package.links.clone(),
rust_version: package
.rust_version
.clone()
.map(|mw| mw.resolve("rust-version", || inherit()?.rust_version()))
.transpose()?,
};
package.description = metadata
.description

View File

@ -366,6 +366,7 @@ You may press ctrl-c to skip waiting; the crate should be available shortly.
"repository": null,
"homepage": null,
"documentation": null,
"rust_version": null,
"vers": "0.0.1"
}"#,
"foo-0.0.1.crate",
@ -515,6 +516,7 @@ You may press ctrl-c to skip waiting; the crate should be available shortly.
"repository": null,
"homepage": null,
"documentation": null,
"rust_version": null,
"vers": "0.0.1"
}"#,
"foo-0.0.1.crate",
@ -607,6 +609,7 @@ You may press ctrl-c to skip waiting; the crate should be available shortly.
"repository": null,
"homepage": null,
"documentation": null,
"rust_version": null,
"vers": "0.0.1"
}"#,
"foo-0.0.1.crate",

View File

@ -1956,6 +1956,7 @@ You may press ctrl-c [..]
"readme": null,
"readme_file": null,
"repository": "foo",
"rust_version": null,
"vers": "0.1.0"
}
"#,

View File

@ -942,6 +942,7 @@ You may press ctrl-c [..]
"readme": null,
"readme_file": null,
"repository": null,
"rust_version": null,
"vers": "0.1.0"
}
"#,
@ -1057,6 +1058,7 @@ You may press ctrl-c [..]
"readme": null,
"readme_file": null,
"repository": null,
"rust_version": null,
"vers": "0.1.0"
}
"#,

View File

@ -201,6 +201,7 @@ You may press ctrl-c to skip waiting; the crate should be available shortly.
"readme": null,
"readme_file": null,
"repository": "https://github.com/example/example",
"rust_version": "1.60",
"vers": "1.2.3"
}
"#,
@ -376,6 +377,7 @@ You may press ctrl-c to skip waiting; the crate should be available shortly.
"readme": null,
"readme_file": null,
"repository": null,
"rust_version": null,
"vers": "0.2.0"
}
"#,
@ -503,6 +505,7 @@ You may press ctrl-c to skip waiting; the crate should be available shortly.
"readme": null,
"readme_file": null,
"repository": null,
"rust_version": null,
"vers": "0.2.0"
}
"#,
@ -734,6 +737,7 @@ You may press ctrl-c to skip waiting; the crate should be available shortly.
"readme": "README.md",
"readme_file": "../README.md",
"repository": "https://github.com/example/example",
"rust_version": "1.60",
"vers": "1.2.3"
}
"#,
@ -917,6 +921,7 @@ You may press ctrl-c to skip waiting; the crate should be available shortly.
"readme": null,
"readme_file": null,
"repository": null,
"rust_version": null,
"vers": "0.2.0"
}
"#,

View File

@ -25,6 +25,7 @@ const CLEAN_FOO_JSON: &str = r#"
"readme": null,
"readme_file": null,
"repository": "foo",
"rust_version": null,
"vers": "0.0.1"
}
"#;
@ -49,6 +50,7 @@ fn validate_upload_foo() {
"readme": null,
"readme_file": null,
"repository": null,
"rust_version": null,
"vers": "0.0.1"
}
"#,
@ -77,6 +79,7 @@ fn validate_upload_li() {
"readme": null,
"readme_file": null,
"repository": null,
"rust_version": "1.69",
"vers": "0.0.1"
}
"#,
@ -1270,6 +1273,7 @@ You may press ctrl-c [..]
"readme": null,
"readme_file": null,
"repository": null,
"rust_version": null,
"vers": "0.0.1"
}
"#,
@ -1469,6 +1473,7 @@ You may press ctrl-c [..]
"readme": null,
"readme_file": null,
"repository": null,
"rust_version": null,
"vers": "0.1.0"
}
"#,
@ -1581,6 +1586,7 @@ You may press ctrl-c [..]
"readme": null,
"readme_file": null,
"repository": "foo",
"rust_version": null,
"vers": "0.1.0"
}
"#,
@ -2049,6 +2055,7 @@ fn in_package_workspace() {
[package]
name = "li"
version = "0.0.1"
rust-version = "1.69"
description = "li"
license = "MIT"
"#,
@ -2151,6 +2158,7 @@ fn in_package_workspace_with_members_with_features_old() {
[package]
name = "li"
version = "0.0.1"
rust-version = "1.69"
description = "li"
license = "MIT"
"#,
@ -2246,6 +2254,7 @@ fn in_virtual_workspace_with_p() {
[package]
name = "li"
version = "0.0.1"
rust-version = "1.69"
description = "li"
license = "MIT"
"#,

View File

@ -601,6 +601,7 @@ You may press ctrl-c to skip waiting; the crate should be available shortly.
"readme": null,
"readme_file": null,
"repository": null,
"rust_version": null,
"vers": "0.1.0"
}
"#,