diff --git a/tools/sdk-lints/Cargo.lock b/tools/sdk-lints/Cargo.lock index e237a7929c..7b69a845b6 100644 --- a/tools/sdk-lints/Cargo.lock +++ b/tools/sdk-lints/Cargo.lock @@ -2,15 +2,6 @@ # It is not intended for manual editing. version = 3 -[[package]] -name = "ansi_term" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" -dependencies = [ - "winapi", -] - [[package]] name = "anyhow" version = "1.0.50" @@ -28,6 +19,12 @@ dependencies = [ "winapi", ] +[[package]] +name = "autocfg" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" + [[package]] name = "bitflags" version = "1.3.2" @@ -47,28 +44,46 @@ dependencies = [ [[package]] name = "clap" -version = "2.33.3" +version = "3.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002" +checksum = "c67e7973e74896f4bba06ca2dcfd28d54f9cb8c035e940a32b88ed48f5f5ecf2" dependencies = [ - "ansi_term", "atty", "bitflags", + "clap_derive", + "indexmap", + "lazy_static", + "os_str_bytes", "strsim", + "termcolor", "textwrap", - "unicode-width", - "vec_map", ] [[package]] -name = "heck" -version = "0.3.3" +name = "clap_derive" +version = "3.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c" +checksum = "a3aab4734e083b809aaf5794e14e756d1c798d2c69c7f7de7a09a2f5214993c1" dependencies = [ - "unicode-segmentation", + "heck", + "proc-macro-error", + "proc-macro2", + "quote", + "syn", ] +[[package]] +name = "hashbrown" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" + +[[package]] +name = "heck" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9" + [[package]] name = "hermit-abi" version = "0.1.19" @@ -78,6 +93,16 @@ dependencies = [ "libc", ] +[[package]] +name = "indexmap" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f647032dfaa1f8b6dc29bd3edb7bbef4861b8b8007ebb118d6db284fd59f6ee" +dependencies = [ + "autocfg", + "hashbrown", +] + [[package]] name = "lazy_static" version = "1.4.0" @@ -86,9 +111,24 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.108" +version = "0.2.121" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8521a1b57e76b1ec69af7599e75e38e7b7fad6610f037db8c79b127201b5d119" +checksum = "efaa7b300f3b5fe8eb6bf21ce3895e1751d9665086af2d64b42f19701015ff4f" + +[[package]] +name = "memchr" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a" + +[[package]] +name = "os_str_bytes" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e22443d1643a904602595ba1cd8f7d896afe56d26712531c5ff73a15b2fbf64" +dependencies = [ + "memchr", +] [[package]] name = "proc-macro-error" @@ -138,9 +178,9 @@ version = "0.1.0" dependencies = [ "anyhow", "cargo_toml", + "clap", "lazy_static", "serde", - "structopt", "toml", ] @@ -166,33 +206,9 @@ dependencies = [ [[package]] name = "strsim" -version = "0.8.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" - -[[package]] -name = "structopt" -version = "0.3.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40b9788f4202aa75c240ecc9c15c65185e6a39ccdeb0fd5d008b98825464c87c" -dependencies = [ - "clap", - "lazy_static", - "structopt-derive", -] - -[[package]] -name = "structopt-derive" -version = "0.4.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcb5ae327f9cc13b68763b5749770cb9e048a99bd9dfdfa58d0cf05d5f64afe0" -dependencies = [ - "heck", - "proc-macro-error", - "proc-macro2", - "quote", - "syn", -] +checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" [[package]] name = "syn" @@ -206,14 +222,20 @@ dependencies = [ ] [[package]] -name = "textwrap" -version = "0.11.0" +name = "termcolor" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" +checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755" dependencies = [ - "unicode-width", + "winapi-util", ] +[[package]] +name = "textwrap" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1141d4d61095b28419e22cb0bbf02755f5e54e0526f97f1e3d1d160e60885fb" + [[package]] name = "toml" version = "0.5.8" @@ -223,35 +245,17 @@ dependencies = [ "serde", ] -[[package]] -name = "unicode-segmentation" -version = "1.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8895849a949e7845e06bd6dc1aa51731a103c42707010a5b591c0038fb73385b" - -[[package]] -name = "unicode-width" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ed742d4ea2bd1176e236172c8429aaf54486e7ac098db29ffe6529e0ce50973" - [[package]] name = "unicode-xid" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3" -[[package]] -name = "vec_map" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" - [[package]] name = "version_check" -version = "0.9.3" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fecdca9a5291cc2b8dcf7dc02453fee791a280f3743cb0905f8822ae463b3fe" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" [[package]] name = "winapi" @@ -269,6 +273,15 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" +[[package]] +name = "winapi-util" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" +dependencies = [ + "winapi", +] + [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" diff --git a/tools/sdk-lints/Cargo.toml b/tools/sdk-lints/Cargo.toml index 81278f844a..f2a837e9be 100644 --- a/tools/sdk-lints/Cargo.toml +++ b/tools/sdk-lints/Cargo.toml @@ -9,7 +9,7 @@ publish = false [dependencies] anyhow = "1" cargo_toml = "0.10.1" +clap = { version = "3.1.7", features = ["derive"]} toml = "0.5.8" -structopt = "0.3.25" serde = { version = "1", features = ["derive"]} lazy_static = "1.4.0" diff --git a/tools/sdk-lints/src/main.rs b/tools/sdk-lints/src/main.rs index 22d5dcf69c..2bf635e5f4 100644 --- a/tools/sdk-lints/src/main.rs +++ b/tools/sdk-lints/src/main.rs @@ -10,12 +10,12 @@ use crate::lint_cargo_toml::{CrateAuthor, CrateLicense, DocsRs}; use crate::readmes::{ReadmesExist, ReadmesHaveFooters}; use crate::todos::TodosHaveContext; use anyhow::{bail, Context, Result}; +use clap::Parser; use lazy_static::lazy_static; use std::env::set_current_dir; use std::path::{Path, PathBuf}; use std::process::Command; use std::{fs, io}; -use structopt::StructOpt; mod anchor; mod changelog; @@ -34,40 +34,40 @@ fn load_repo_root() -> Result { Ok(PathBuf::from(String::from_utf8(output.stdout)?.trim())) } -#[derive(Debug, StructOpt)] +#[derive(Debug, Parser)] enum Args { Check { - #[structopt(long)] + #[clap(long)] all: bool, - #[structopt(long)] + #[clap(long)] readme: bool, - #[structopt(long)] + #[clap(long)] cargo_toml: bool, - #[structopt(long)] + #[clap(long)] docsrs_metadata: bool, - #[structopt(long)] + #[clap(long)] changelog: bool, - #[structopt(long)] + #[clap(long)] license: bool, - #[structopt(long)] + #[clap(long)] todos: bool, }, Fix { - #[structopt(long)] + #[clap(long)] readme: bool, - #[structopt(long)] + #[clap(long)] docsrs_metadata: bool, - #[structopt(long)] + #[clap(long)] all: bool, - #[structopt(long)] + #[clap(long)] dry_run: Option, }, UpdateChangelog { - #[structopt(long)] + #[clap(long)] smithy_version: String, - #[structopt(long)] + #[clap(long)] sdk_version: String, - #[structopt(long)] + #[clap(long)] date: String, }, } @@ -112,7 +112,7 @@ fn ok(errors: Vec) -> anyhow::Result<()> { fn main() -> Result<()> { set_current_dir(repo_root())?; - let opt = Args::from_args(); + let opt = Args::parse(); match opt { Args::Check { all, diff --git a/tools/sdk-versioner/Cargo.lock b/tools/sdk-versioner/Cargo.lock index a69829de4f..b9fefa6c23 100644 --- a/tools/sdk-versioner/Cargo.lock +++ b/tools/sdk-versioner/Cargo.lock @@ -59,17 +59,32 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "clap" -version = "2.34.0" +version = "3.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c" +checksum = "c67e7973e74896f4bba06ca2dcfd28d54f9cb8c035e940a32b88ed48f5f5ecf2" dependencies = [ - "ansi_term", "atty", "bitflags", + "clap_derive", + "indexmap", + "lazy_static", + "os_str_bytes", "strsim", + "termcolor", "textwrap", - "unicode-width", - "vec_map", +] + +[[package]] +name = "clap_derive" +version = "3.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3aab4734e083b809aaf5794e14e756d1c798d2c69c7f7de7a09a2f5214993c1" +dependencies = [ + "heck", + "proc-macro-error", + "proc-macro2", + "quote", + "syn", ] [[package]] @@ -105,12 +120,9 @@ checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" [[package]] name = "heck" -version = "0.3.3" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c" -dependencies = [ - "unicode-segmentation", -] +checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9" [[package]] name = "hermit-abi" @@ -152,6 +164,21 @@ version = "0.2.112" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b03d17f364a3a042d5e5d46b053bbbf82c92c9430c592dd4c064dc6ee997125" +[[package]] +name = "memchr" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a" + +[[package]] +name = "os_str_bytes" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e22443d1643a904602595ba1cd8f7d896afe56d26712531c5ff73a15b2fbf64" +dependencies = [ + "memchr", +] + [[package]] name = "output_vt100" version = "0.1.2" @@ -244,9 +271,9 @@ name = "sdk-versioner" version = "0.1.0" dependencies = [ "anyhow", + "clap", "pretty_assertions", "smithy-rs-tool-common", - "structopt", "tempfile", "toml", ] @@ -268,33 +295,9 @@ dependencies = [ [[package]] name = "strsim" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" - -[[package]] -name = "structopt" -version = "0.3.25" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40b9788f4202aa75c240ecc9c15c65185e6a39ccdeb0fd5d008b98825464c87c" -dependencies = [ - "clap", - "lazy_static", - "structopt-derive", -] - -[[package]] -name = "structopt-derive" -version = "0.4.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcb5ae327f9cc13b68763b5749770cb9e048a99bd9dfdfa58d0cf05d5f64afe0" -dependencies = [ - "heck", - "proc-macro-error", - "proc-macro2", - "quote", - "syn", -] +checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" [[package]] name = "syn" @@ -322,14 +325,20 @@ dependencies = [ ] [[package]] -name = "textwrap" -version = "0.11.0" +name = "termcolor" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" +checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755" dependencies = [ - "unicode-width", + "winapi-util", ] +[[package]] +name = "textwrap" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1141d4d61095b28419e22cb0bbf02755f5e54e0526f97f1e3d1d160e60885fb" + [[package]] name = "toml" version = "0.5.8" @@ -372,30 +381,12 @@ dependencies = [ "lazy_static", ] -[[package]] -name = "unicode-segmentation" -version = "1.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8895849a949e7845e06bd6dc1aa51731a103c42707010a5b591c0038fb73385b" - -[[package]] -name = "unicode-width" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ed742d4ea2bd1176e236172c8429aaf54486e7ac098db29ffe6529e0ce50973" - [[package]] name = "unicode-xid" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3" -[[package]] -name = "vec_map" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" - [[package]] name = "version_check" version = "0.9.4" @@ -418,6 +409,15 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" +[[package]] +name = "winapi-util" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" +dependencies = [ + "winapi", +] + [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" diff --git a/tools/sdk-versioner/Cargo.toml b/tools/sdk-versioner/Cargo.toml index 5618dc5e19..128e700527 100644 --- a/tools/sdk-versioner/Cargo.toml +++ b/tools/sdk-versioner/Cargo.toml @@ -10,7 +10,7 @@ publish = false [dependencies] anyhow = "1.0" -structopt = "0.3" +clap = { version = "3.1.7", features = ["derive"] } toml = { version = "0.5.8", features = ["preserve_order"] } smithy-rs-tool-common = { version = "0.1", path = "../smithy-rs-tool-common" } diff --git a/tools/sdk-versioner/src/main.rs b/tools/sdk-versioner/src/main.rs index 6ed04d3a3a..01aaa1a955 100644 --- a/tools/sdk-versioner/src/main.rs +++ b/tools/sdk-versioner/src/main.rs @@ -4,37 +4,38 @@ */ use anyhow::bail; +use clap::Parser; use smithy_rs_tool_common::package::{PackageCategory, SDK_PREFIX}; use std::ffi::OsStr; use std::fs; use std::path::{Path, PathBuf}; use std::time::Instant; -use structopt::StructOpt; use toml::value::{Table, Value}; -#[derive(StructOpt, Debug)] -#[structopt( +#[derive(Parser, Debug)] +#[clap( name = "sdk-versioner", - about = "CLI tool to recursively update SDK/Smithy crate references in Cargo.toml files" + about = "CLI tool to recursively update SDK/Smithy crate references in Cargo.toml files", + version )] -struct Opt { +struct Args { /// Path(s) to recursively update Cargo.toml files in - #[structopt()] + #[clap()] crate_paths: Vec, /// SDK version to point to - #[structopt(long)] + #[clap(long)] sdk_version: Option, /// Smithy version to point to - #[structopt(long)] + #[clap(long)] smithy_version: Option, /// Path to generated SDK to point to - #[structopt(long)] + #[clap(long)] sdk_path: Option, } -impl Opt { +impl Args { fn validate(self) -> anyhow::Result { if self.crate_paths.is_empty() { bail!("Must provide at least one crate path to recursively update"); @@ -50,7 +51,7 @@ impl Opt { } fn main() -> anyhow::Result<()> { - let opt = Opt::from_args().validate()?; + let opt = Args::parse().validate()?; let start_time = Instant::now(); let mut manifest_paths = Vec::new(); @@ -66,7 +67,7 @@ fn main() -> anyhow::Result<()> { Ok(()) } -fn update_manifest(manifest_path: &Path, opt: &Opt) -> anyhow::Result<()> { +fn update_manifest(manifest_path: &Path, opt: &Args) -> anyhow::Result<()> { println!("Updating {:?}...", manifest_path); let mut metadata: Value = toml::from_slice(&fs::read(manifest_path)?)?; @@ -91,7 +92,7 @@ fn update_manifest(manifest_path: &Path, opt: &Opt) -> anyhow::Result<()> { Ok(()) } -fn update_dependencies(dependencies: &mut Table, opt: &Opt) -> anyhow::Result { +fn update_dependencies(dependencies: &mut Table, opt: &Args) -> anyhow::Result { let mut changed = false; for (key, value) in dependencies.iter_mut() { let category = PackageCategory::from_package_name(key); @@ -117,7 +118,7 @@ fn crate_path_name(name: &str) -> &str { } } -fn update_dependency_value(crate_name: &str, value: &mut Table, opt: &Opt) { +fn update_dependency_value(crate_name: &str, value: &mut Table, opt: &Args) { let is_sdk_crate = matches!( PackageCategory::from_package_name(crate_name), PackageCategory::AwsSdk | PackageCategory::AwsRuntime, @@ -181,7 +182,7 @@ fn discover_manifests(manifests: &mut Vec, path: impl AsRef) -> a #[cfg(test)] mod tests { - use crate::{update_manifest, Opt}; + use crate::{update_manifest, Args}; use pretty_assertions::assert_eq; use toml::Value; @@ -199,7 +200,7 @@ mod tests { "#; #[track_caller] - fn test_with_opt(opt: Opt, expected: &[u8]) { + fn test_with_opt(opt: Args, expected: &[u8]) { let manifest_file = tempfile::NamedTempFile::new().unwrap(); let manifest_path = manifest_file.into_temp_path(); std::fs::write(&manifest_path, TEST_MANIFEST).unwrap(); @@ -215,7 +216,7 @@ mod tests { #[test] fn update_dependencies_with_versions() { test_with_opt( - Opt { + Args { crate_paths: Vec::new(), sdk_path: None, sdk_version: Some("0.5.0".to_string()), @@ -239,7 +240,7 @@ mod tests { #[test] fn update_dependencies_with_paths() { test_with_opt( - Opt { + Args { crate_paths: Vec::new(), sdk_path: Some("/foo/asdf/".into()), sdk_version: None, @@ -263,7 +264,7 @@ mod tests { #[test] fn update_dependencies_with_versions_and_paths() { test_with_opt( - Opt { + Args { crate_paths: Vec::new(), sdk_path: Some("/foo/asdf/".into()), sdk_version: Some("0.5.0".to_string()), diff --git a/tools/smithy-rs-sync/Cargo.lock b/tools/smithy-rs-sync/Cargo.lock index 06694fcfca..c35b10e9f0 100644 --- a/tools/smithy-rs-sync/Cargo.lock +++ b/tools/smithy-rs-sync/Cargo.lock @@ -28,6 +28,17 @@ dependencies = [ "syn", ] +[[package]] +name = "atty" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" +dependencies = [ + "hermit-abi", + "libc", + "winapi", +] + [[package]] name = "autocfg" version = "1.0.1" @@ -57,13 +68,32 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "clap" -version = "2.34.0" +version = "3.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c" +checksum = "c67e7973e74896f4bba06ca2dcfd28d54f9cb8c035e940a32b88ed48f5f5ecf2" dependencies = [ + "atty", "bitflags", + "clap_derive", + "indexmap", + "lazy_static", + "os_str_bytes", + "strsim", + "termcolor", "textwrap", - "unicode-width", +] + +[[package]] +name = "clap_derive" +version = "3.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3aab4734e083b809aaf5794e14e756d1c798d2c69c7f7de7a09a2f5214993c1" +dependencies = [ + "heck", + "proc-macro-error", + "proc-macro2", + "quote", + "syn", ] [[package]] @@ -128,13 +158,25 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" +[[package]] +name = "hashbrown" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" + [[package]] name = "heck" -version = "0.3.3" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9" + +[[package]] +name = "hermit-abi" +version = "0.1.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c" +checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" dependencies = [ - "unicode-segmentation", + "libc", ] [[package]] @@ -148,6 +190,16 @@ dependencies = [ "unicode-normalization", ] +[[package]] +name = "indexmap" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f647032dfaa1f8b6dc29bd3edb7bbef4861b8b8007ebb118d6db284fd59f6ee" +dependencies = [ + "autocfg", + "hashbrown", +] + [[package]] name = "jobserver" version = "0.1.24" @@ -224,6 +276,12 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f" +[[package]] +name = "memchr" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a" + [[package]] name = "openssl-probe" version = "0.1.4" @@ -243,6 +301,15 @@ dependencies = [ "vcpkg", ] +[[package]] +name = "os_str_bytes" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e22443d1643a904602595ba1cd8f7d896afe56d26712531c5ff73a15b2fbf64" +dependencies = [ + "memchr", +] + [[package]] name = "output_vt100" version = "0.1.2" @@ -375,11 +442,11 @@ name = "smithy-rs-sync" version = "0.1.0" dependencies = [ "anyhow", + "clap", "git2", "gitignore", "pretty_assertions", "smithy-rs-tool-common", - "structopt", "tempdir", ] @@ -393,28 +460,10 @@ dependencies = [ ] [[package]] -name = "structopt" -version = "0.3.25" +name = "strsim" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40b9788f4202aa75c240ecc9c15c65185e6a39ccdeb0fd5d008b98825464c87c" -dependencies = [ - "clap", - "lazy_static", - "structopt-derive", -] - -[[package]] -name = "structopt-derive" -version = "0.4.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcb5ae327f9cc13b68763b5749770cb9e048a99bd9dfdfa58d0cf05d5f64afe0" -dependencies = [ - "heck", - "proc-macro-error", - "proc-macro2", - "quote", - "syn", -] +checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" [[package]] name = "syn" @@ -438,14 +487,20 @@ dependencies = [ ] [[package]] -name = "textwrap" -version = "0.11.0" +name = "termcolor" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" +checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755" dependencies = [ - "unicode-width", + "winapi-util", ] +[[package]] +name = "textwrap" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1141d4d61095b28419e22cb0bbf02755f5e54e0526f97f1e3d1d160e60885fb" + [[package]] name = "tinyvec" version = "1.5.1" @@ -508,18 +563,6 @@ dependencies = [ "tinyvec", ] -[[package]] -name = "unicode-segmentation" -version = "1.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8895849a949e7845e06bd6dc1aa51731a103c42707010a5b591c0038fb73385b" - -[[package]] -name = "unicode-width" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ed742d4ea2bd1176e236172c8429aaf54486e7ac098db29ffe6529e0ce50973" - [[package]] name = "unicode-xid" version = "0.2.2" @@ -566,6 +609,15 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" +[[package]] +name = "winapi-util" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" +dependencies = [ + "winapi", +] + [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" diff --git a/tools/smithy-rs-sync/Cargo.toml b/tools/smithy-rs-sync/Cargo.toml index 1d538d2cf4..3511217869 100644 --- a/tools/smithy-rs-sync/Cargo.toml +++ b/tools/smithy-rs-sync/Cargo.toml @@ -12,10 +12,10 @@ authors = ["Zelda Hessler "] [dependencies] anyhow = "1" +clap = { version = "3.1.7", features = ["derive"] } git2 = "0.13" gitignore = "1" smithy-rs-tool-common = { version = "0.1", path = "../smithy-rs-tool-common" } -structopt = { version = "0.3", default-features = false } [dev-dependencies] pretty_assertions = "1" diff --git a/tools/smithy-rs-sync/src/main.rs b/tools/smithy-rs-sync/src/main.rs index 6099c94202..cc48b0aa7d 100644 --- a/tools/smithy-rs-sync/src/main.rs +++ b/tools/smithy-rs-sync/src/main.rs @@ -7,6 +7,7 @@ mod fs; use crate::fs::{delete_all_generated_files_and_folders, find_handwritten_files_and_folders}; use anyhow::{bail, Context, Result}; +use clap::Parser; use git2::{Commit, Oid, Repository, ResetType}; use smithy_rs_tool_common::git::GetLastCommit; use smithy_rs_tool_common::macros::here; @@ -15,26 +16,25 @@ use std::ffi::OsStr; use std::path::{Path, PathBuf}; use std::process::Command; use std::time::Instant; -use structopt::StructOpt; -#[derive(StructOpt, Debug)] -#[structopt(name = "smithy-rs-sync")] +#[derive(Parser, Debug)] +#[clap(name = "smithy-rs-sync")] /// A CLI tool to replay commits from smithy-rs, generate code, and commit that code to aws-rust-sdk. -struct Opt { +struct Args { /// The path to the smithy-rs repo folder. - #[structopt(long, parse(from_os_str))] + #[clap(long, parse(from_os_str))] smithy_rs: PathBuf, /// The path to the aws-sdk-rust folder. - #[structopt(long, parse(from_os_str))] + #[clap(long, parse(from_os_str))] aws_sdk: PathBuf, /// Path to the aws-doc-sdk-examples repository. - #[structopt(long, parse(from_os_str))] + #[clap(long, parse(from_os_str))] sdk_examples: PathBuf, /// The branch in aws-sdk-rust that commits will be mirrored to. - #[structopt(long, default_value = "next")] + #[clap(long, default_value = "next")] branch: String, /// The maximum amount of commits to sync in one run. - #[structopt(long, default_value = "5")] + #[clap(long, default_value = "5")] max_commits_to_sync: usize, } @@ -57,20 +57,14 @@ const COMMIT_HASH_FILENAME: &str = ".smithyrs-githash"; /// --aws-sdk /Users/zhessler/Documents/aws-sdk-rust-test/ /// ``` fn main() -> Result<()> { - let Opt { - smithy_rs, - aws_sdk, - sdk_examples, - branch, - max_commits_to_sync, - } = Opt::from_args(); + let args = Args::parse(); sync_aws_sdk_with_smithy_rs( - &smithy_rs, - &aws_sdk, - &sdk_examples, - &branch, - max_commits_to_sync, + &args.smithy_rs, + &args.aws_sdk, + &args.sdk_examples, + &args.branch, + args.max_commits_to_sync, ) .map_err(|e| e.context("The sync failed")) }