From 1f71c3571382522e1a58b773d9ed62ba4949427a Mon Sep 17 00:00:00 2001 From: Russell Cohen Date: Wed, 1 Dec 2021 13:01:53 -0500 Subject: [PATCH] Docs licenses (#909) * CR feedback * Correct warning --- aws/rust-runtime/aws-config/Cargo.toml | 2 +- aws/rust-runtime/aws-endpoint/Cargo.toml | 2 +- aws/rust-runtime/aws-http/Cargo.toml | 2 +- aws/rust-runtime/aws-hyper/Cargo.toml | 2 +- aws/rust-runtime/aws-inlineable/Cargo.toml | 2 +- aws/rust-runtime/aws-sig-auth/Cargo.toml | 2 +- aws/rust-runtime/aws-sigv4/Cargo.toml | 2 +- aws/rust-runtime/aws-types/Cargo.toml | 2 +- rust-runtime/aws-smithy-async/Cargo.toml | 2 +- rust-runtime/aws-smithy-client/Cargo.toml | 2 +- .../aws-smithy-eventstream/Cargo.toml | 2 +- .../aws-smithy-http-server/Cargo.toml | 2 +- rust-runtime/aws-smithy-http-tower/Cargo.toml | 2 +- rust-runtime/aws-smithy-http/Cargo.toml | 2 +- rust-runtime/aws-smithy-json/Cargo.toml | 2 +- .../aws-smithy-protocol-test/Cargo.toml | 2 +- rust-runtime/aws-smithy-query/Cargo.toml | 2 +- .../aws-smithy-types-convert/Cargo.toml | 2 +- rust-runtime/aws-smithy-types/Cargo.toml | 2 +- rust-runtime/aws-smithy-xml/Cargo.toml | 2 +- rust-runtime/inlineable/Cargo.toml | 2 +- tools/sdk-lints/src/lint_cargo_toml.rs | 21 +++++++++++-------- 22 files changed, 33 insertions(+), 30 deletions(-) diff --git a/aws/rust-runtime/aws-config/Cargo.toml b/aws/rust-runtime/aws-config/Cargo.toml index 1df47f9d8..2b811882c 100644 --- a/aws/rust-runtime/aws-config/Cargo.toml +++ b/aws/rust-runtime/aws-config/Cargo.toml @@ -74,4 +74,4 @@ aws-smithy-client = { path = "../../sdk/build/aws-sdk/sdk/aws-smithy-client", fe all-features = true targets = ["x86_64-unknown-linux-gnu"] rustdoc-args = ["--cfg", "docsrs"] -# End of doc.rs metadata +# End of docs.rs metadata diff --git a/aws/rust-runtime/aws-endpoint/Cargo.toml b/aws/rust-runtime/aws-endpoint/Cargo.toml index a1a1cfb2e..ac5446817 100644 --- a/aws/rust-runtime/aws-endpoint/Cargo.toml +++ b/aws/rust-runtime/aws-endpoint/Cargo.toml @@ -18,4 +18,4 @@ tracing = "0.1" all-features = true targets = ["x86_64-unknown-linux-gnu"] rustdoc-args = ["--cfg", "docsrs"] -# End of doc.rs metadata +# End of docs.rs metadata diff --git a/aws/rust-runtime/aws-http/Cargo.toml b/aws/rust-runtime/aws-http/Cargo.toml index ae4823881..16b10c949 100644 --- a/aws/rust-runtime/aws-http/Cargo.toml +++ b/aws/rust-runtime/aws-http/Cargo.toml @@ -27,4 +27,4 @@ tracing-subscriber = { version = "0.2.16", features = ["fmt"] } all-features = true targets = ["x86_64-unknown-linux-gnu"] rustdoc-args = ["--cfg", "docsrs"] -# End of doc.rs metadata +# End of docs.rs metadata diff --git a/aws/rust-runtime/aws-hyper/Cargo.toml b/aws/rust-runtime/aws-hyper/Cargo.toml index 97232bc4f..d6f386a66 100644 --- a/aws/rust-runtime/aws-hyper/Cargo.toml +++ b/aws/rust-runtime/aws-hyper/Cargo.toml @@ -46,4 +46,4 @@ name = "e2e_test" all-features = true targets = ["x86_64-unknown-linux-gnu"] rustdoc-args = ["--cfg", "docsrs"] -# End of doc.rs metadata +# End of docs.rs metadata diff --git a/aws/rust-runtime/aws-inlineable/Cargo.toml b/aws/rust-runtime/aws-inlineable/Cargo.toml index 527db7d1c..ee24c69f1 100644 --- a/aws/rust-runtime/aws-inlineable/Cargo.toml +++ b/aws/rust-runtime/aws-inlineable/Cargo.toml @@ -34,4 +34,4 @@ temp-file = "0.1.6" all-features = true targets = ["x86_64-unknown-linux-gnu"] rustdoc-args = ["--cfg", "docsrs"] -# End of doc.rs metadata +# End of docs.rs metadata diff --git a/aws/rust-runtime/aws-sig-auth/Cargo.toml b/aws/rust-runtime/aws-sig-auth/Cargo.toml index da263b136..843a69095 100644 --- a/aws/rust-runtime/aws-sig-auth/Cargo.toml +++ b/aws/rust-runtime/aws-sig-auth/Cargo.toml @@ -30,4 +30,4 @@ tracing-test = "0.1" all-features = true targets = ["x86_64-unknown-linux-gnu"] rustdoc-args = ["--cfg", "docsrs"] -# End of doc.rs metadata +# End of docs.rs metadata diff --git a/aws/rust-runtime/aws-sigv4/Cargo.toml b/aws/rust-runtime/aws-sigv4/Cargo.toml index dde7a1366..ef421c065 100644 --- a/aws/rust-runtime/aws-sigv4/Cargo.toml +++ b/aws/rust-runtime/aws-sigv4/Cargo.toml @@ -37,4 +37,4 @@ time = { version = "0.3.4", features = ["parsing"] } all-features = true targets = ["x86_64-unknown-linux-gnu"] rustdoc-args = ["--cfg", "docsrs"] -# End of doc.rs metadata +# End of docs.rs metadata diff --git a/aws/rust-runtime/aws-types/Cargo.toml b/aws/rust-runtime/aws-types/Cargo.toml index 999b84b0d..1970c1975 100644 --- a/aws/rust-runtime/aws-types/Cargo.toml +++ b/aws/rust-runtime/aws-types/Cargo.toml @@ -28,4 +28,4 @@ rustc_version = "0.4.0" all-features = true targets = ["x86_64-unknown-linux-gnu"] rustdoc-args = ["--cfg", "docsrs"] -# End of doc.rs metadata +# End of docs.rs metadata diff --git a/rust-runtime/aws-smithy-async/Cargo.toml b/rust-runtime/aws-smithy-async/Cargo.toml index 6a0759947..e20e1acab 100644 --- a/rust-runtime/aws-smithy-async/Cargo.toml +++ b/rust-runtime/aws-smithy-async/Cargo.toml @@ -23,4 +23,4 @@ futures-util = "0.3.16" all-features = true targets = ["x86_64-unknown-linux-gnu"] rustdoc-args = ["--cfg", "docsrs"] -# End of doc.rs metadata +# End of docs.rs metadata diff --git a/rust-runtime/aws-smithy-client/Cargo.toml b/rust-runtime/aws-smithy-client/Cargo.toml index 2c8b79fae..11c0c358f 100644 --- a/rust-runtime/aws-smithy-client/Cargo.toml +++ b/rust-runtime/aws-smithy-client/Cargo.toml @@ -47,4 +47,4 @@ serde_json = "1" all-features = true targets = ["x86_64-unknown-linux-gnu"] rustdoc-args = ["--cfg", "docsrs"] -# End of doc.rs metadata +# End of docs.rs metadata diff --git a/rust-runtime/aws-smithy-eventstream/Cargo.toml b/rust-runtime/aws-smithy-eventstream/Cargo.toml index d9ef8e4b2..057c27cac 100644 --- a/rust-runtime/aws-smithy-eventstream/Cargo.toml +++ b/rust-runtime/aws-smithy-eventstream/Cargo.toml @@ -24,4 +24,4 @@ bytes-utils = "0.1" all-features = true targets = ["x86_64-unknown-linux-gnu"] rustdoc-args = ["--cfg", "docsrs"] -# End of doc.rs metadata +# End of docs.rs metadata diff --git a/rust-runtime/aws-smithy-http-server/Cargo.toml b/rust-runtime/aws-smithy-http-server/Cargo.toml index 8d67d157c..42644c5f3 100644 --- a/rust-runtime/aws-smithy-http-server/Cargo.toml +++ b/rust-runtime/aws-smithy-http-server/Cargo.toml @@ -42,4 +42,4 @@ pretty_assertions = "1" all-features = true targets = ["x86_64-unknown-linux-gnu"] rustdoc-args = ["--cfg", "docsrs"] -# End of doc.rs metadata +# End of docs.rs metadata diff --git a/rust-runtime/aws-smithy-http-tower/Cargo.toml b/rust-runtime/aws-smithy-http-tower/Cargo.toml index 9843ab899..8f950cefe 100644 --- a/rust-runtime/aws-smithy-http-tower/Cargo.toml +++ b/rust-runtime/aws-smithy-http-tower/Cargo.toml @@ -24,4 +24,4 @@ tokio = { version = "1", features = ["full"]} all-features = true targets = ["x86_64-unknown-linux-gnu"] rustdoc-args = ["--cfg", "docsrs"] -# End of doc.rs metadata +# End of docs.rs metadata diff --git a/rust-runtime/aws-smithy-http/Cargo.toml b/rust-runtime/aws-smithy-http/Cargo.toml index efe918772..e71a6393b 100644 --- a/rust-runtime/aws-smithy-http/Cargo.toml +++ b/rust-runtime/aws-smithy-http/Cargo.toml @@ -44,4 +44,4 @@ tempfile = "3.2.0" all-features = true targets = ["x86_64-unknown-linux-gnu"] rustdoc-args = ["--cfg", "docsrs"] -# End of doc.rs metadata +# End of docs.rs metadata diff --git a/rust-runtime/aws-smithy-json/Cargo.toml b/rust-runtime/aws-smithy-json/Cargo.toml index b0a398121..44c4edd64 100644 --- a/rust-runtime/aws-smithy-json/Cargo.toml +++ b/rust-runtime/aws-smithy-json/Cargo.toml @@ -18,4 +18,4 @@ serde_json = "1.0" all-features = true targets = ["x86_64-unknown-linux-gnu"] rustdoc-args = ["--cfg", "docsrs"] -# End of doc.rs metadata +# End of docs.rs metadata diff --git a/rust-runtime/aws-smithy-protocol-test/Cargo.toml b/rust-runtime/aws-smithy-protocol-test/Cargo.toml index 47d1503d5..192beba34 100644 --- a/rust-runtime/aws-smithy-protocol-test/Cargo.toml +++ b/rust-runtime/aws-smithy-protocol-test/Cargo.toml @@ -22,4 +22,4 @@ roxmltree = "0.14.1" all-features = true targets = ["x86_64-unknown-linux-gnu"] rustdoc-args = ["--cfg", "docsrs"] -# End of doc.rs metadata +# End of docs.rs metadata diff --git a/rust-runtime/aws-smithy-query/Cargo.toml b/rust-runtime/aws-smithy-query/Cargo.toml index fbbb44845..f4e1b5dfb 100644 --- a/rust-runtime/aws-smithy-query/Cargo.toml +++ b/rust-runtime/aws-smithy-query/Cargo.toml @@ -15,4 +15,4 @@ urlencoding = "1.3" all-features = true targets = ["x86_64-unknown-linux-gnu"] rustdoc-args = ["--cfg", "docsrs"] -# End of doc.rs metadata +# End of docs.rs metadata diff --git a/rust-runtime/aws-smithy-types-convert/Cargo.toml b/rust-runtime/aws-smithy-types-convert/Cargo.toml index 0490f5ce0..6332999ee 100644 --- a/rust-runtime/aws-smithy-types-convert/Cargo.toml +++ b/rust-runtime/aws-smithy-types-convert/Cargo.toml @@ -21,4 +21,4 @@ time = { version = "0.3.4", optional = true } all-features = true targets = ["x86_64-unknown-linux-gnu"] rustdoc-args = ["--cfg", "docsrs"] -# End of doc.rs metadata +# End of docs.rs metadata diff --git a/rust-runtime/aws-smithy-types/Cargo.toml b/rust-runtime/aws-smithy-types/Cargo.toml index 1fbd70494..2e4f88127 100644 --- a/rust-runtime/aws-smithy-types/Cargo.toml +++ b/rust-runtime/aws-smithy-types/Cargo.toml @@ -24,4 +24,4 @@ serde_json = "1" all-features = true targets = ["x86_64-unknown-linux-gnu"] rustdoc-args = ["--cfg", "docsrs"] -# End of doc.rs metadata +# End of docs.rs metadata diff --git a/rust-runtime/aws-smithy-xml/Cargo.toml b/rust-runtime/aws-smithy-xml/Cargo.toml index 93d2c7849..73c20c096 100644 --- a/rust-runtime/aws-smithy-xml/Cargo.toml +++ b/rust-runtime/aws-smithy-xml/Cargo.toml @@ -20,4 +20,4 @@ proptest = "1" all-features = true targets = ["x86_64-unknown-linux-gnu"] rustdoc-args = ["--cfg", "docsrs"] -# End of doc.rs metadata +# End of docs.rs metadata diff --git a/rust-runtime/inlineable/Cargo.toml b/rust-runtime/inlineable/Cargo.toml index 41524a40e..ca211698f 100644 --- a/rust-runtime/inlineable/Cargo.toml +++ b/rust-runtime/inlineable/Cargo.toml @@ -27,4 +27,4 @@ regex = "1" all-features = true targets = ["x86_64-unknown-linux-gnu"] rustdoc-args = ["--cfg", "docsrs"] -# End of doc.rs metadata +# End of docs.rs metadata diff --git a/tools/sdk-lints/src/lint_cargo_toml.rs b/tools/sdk-lints/src/lint_cargo_toml.rs index 07aa54101..09b2b8dde 100644 --- a/tools/sdk-lints/src/lint_cargo_toml.rs +++ b/tools/sdk-lints/src/lint_cargo_toml.rs @@ -39,7 +39,8 @@ struct Metadata { rustdoc_args: Vec, } -const RUST_TEAM: &str = "AWS Rust SDK Team "; +const RUST_SDK_TEAM: &str = "AWS Rust SDK Team "; +const SERVER_TEAM: &str = "Smithy Rust Server "; const SERVER_CRATES: &[&str] = &["aws-smithy-http-server"]; /// Check crate licensing @@ -78,23 +79,25 @@ pub(crate) fn check_crate_author(path: impl AsRef) -> Result<()> { Some(package) => package, None => bail!("missing `[package]` section"), }; - if SERVER_CRATES.contains(&package.name.as_str()) { - return Ok(()); - } - if !package.authors.iter().any(|s| s == RUST_TEAM) { + let expected_author = if SERVER_CRATES.contains(&package.name.as_str()) { + SERVER_TEAM + } else { + RUST_SDK_TEAM + }; + if !package.authors.iter().any(|s| s == expected_author) { bail!( "missing `{}` in package author list ({:?})", - RUST_TEAM, + expected_author, package.authors ) } Ok(()) } -/// Check docsrs for a Cargo.toml +/// Check Cargo.toml for a valid docs.rs metadata section /// /// This function validates: -/// - it is valid TOMl +/// - it is valid TOML /// - it contains a package.metadata.docs.rs section /// - All of the standard docs.rs settings are respected pub(crate) fn check_docs_rs(path: impl AsRef) -> Result<()> { @@ -134,7 +137,7 @@ pub(crate) fn fix_docs_rs(path: impl AsRef) -> Result { let mut cargo_toml = read_to_string(path.as_ref()).context("failed to read Cargo.toml")?; let updated = replace_anchor( &mut cargo_toml, - &("[package.metadata.docs.rs]", "# End of doc.rs metadata"), + &("[package.metadata.docs.rs]", "# End of docs.rs metadata"), DEFAULT_DOCS_RS_SECTION, )?; if updated { -- GitLab