Skip to content

Commit

Permalink
Remove deprecated v1 arg format from sdk-versioner (#1456)
Browse files Browse the repository at this point in the history
  • Loading branch information
jdisanti authored Jun 14, 2022
1 parent 4a8da5f commit c3f3730
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 329 deletions.
72 changes: 29 additions & 43 deletions tools/sdk-versioner/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ use std::path::{Path, PathBuf};
use std::time::Instant;
use toml::value::{Table, Value};

// TODO(https://github.com/awslabs/smithy-rs/issues/1433): Remove this v1 impl
mod v1;

#[derive(Parser, Debug)]
#[clap(
name = "sdk-versioner",
Expand Down Expand Up @@ -79,48 +76,37 @@ struct DependencyContext<'a> {
}

fn main() -> Result<()> {
match Args::try_parse() {
Ok(args) => {
let args = args.validate()?;
let dependency_context = match &args {
Args::UsePathDependencies { sdk_path, .. } => DependencyContext {
sdk_path: Some(sdk_path),
versions_manifest: None,
},
Args::UseVersionDependencies { versions_toml, .. } => DependencyContext {
sdk_path: None,
versions_manifest: Some(VersionsManifest::from_file(&versions_toml)?),
},
Args::UsePathAndVersionDependencies {
sdk_path,
versions_toml,
..
} => DependencyContext {
sdk_path: Some(sdk_path),
versions_manifest: Some(VersionsManifest::from_file(&versions_toml)?),
},
};

let start_time = Instant::now();
let mut manifest_paths = Vec::new();
for crate_path in args.crate_paths() {
discover_manifests(&mut manifest_paths, crate_path)?;
}

for manifest_path in manifest_paths {
update_manifest(&manifest_path, &dependency_context)?;
}
let args = Args::parse().validate()?;
let dependency_context = match &args {
Args::UsePathDependencies { sdk_path, .. } => DependencyContext {
sdk_path: Some(sdk_path),
versions_manifest: None,
},
Args::UseVersionDependencies { versions_toml, .. } => DependencyContext {
sdk_path: None,
versions_manifest: Some(VersionsManifest::from_file(&versions_toml)?),
},
Args::UsePathAndVersionDependencies {
sdk_path,
versions_toml,
..
} => DependencyContext {
sdk_path: Some(sdk_path),
versions_manifest: Some(VersionsManifest::from_file(&versions_toml)?),
},
};

let start_time = Instant::now();
let mut manifest_paths = Vec::new();
for crate_path in args.crate_paths() {
discover_manifests(&mut manifest_paths, crate_path)?;
}

println!("Finished in {:?}", start_time.elapsed());
}
Err(err) => {
println!(
"WARN: failed to parse args: {}\nAttempting v1 arg format...",
err
);
v1::main()?;
}
for manifest_path in manifest_paths {
update_manifest(&manifest_path, &dependency_context)?;
}

println!("Finished in {:?}", start_time.elapsed());
Ok(())
}

Expand Down
286 changes: 0 additions & 286 deletions tools/sdk-versioner/src/v1.rs

This file was deleted.

0 comments on commit c3f3730

Please sign in to comment.