diff --git a/crossbundle/cli/Cargo.toml b/crossbundle/cli/Cargo.toml index b708ea2a..be96c5b1 100644 --- a/crossbundle/cli/Cargo.toml +++ b/crossbundle/cli/Cargo.toml @@ -33,7 +33,7 @@ log = "0.4" fs_extra = "1.2" dirs = "4.0.0" dunce = "1.0" -ureq = "2.4.0" +ureq = { version = "2.4.0", features = ["tls"] } cargo = "0.63.1" cargo-util = "0.2.0" diff --git a/crossbundle/cli/src/commands/install/bundletool.rs b/crossbundle/cli/src/commands/install/bundletool.rs index 49f2b9b1..30cc484e 100644 --- a/crossbundle/cli/src/commands/install/bundletool.rs +++ b/crossbundle/cli/src/commands/install/bundletool.rs @@ -6,8 +6,8 @@ use std::path::PathBuf; #[derive(Parser, Clone, Debug, Default)] pub struct BundletoolInstallCommand { /// Required. Version of download bundletool. For example: - /// --version 1.8.2 - #[clap(long, short, default_value = "1.8.2")] + /// --version 1.11.0 + #[clap(long, short, default_value = "1.11.0")] version: String, /// Path to install bundletool. By default bundletool will be downloaded and saved in home directory #[clap(long, short)] @@ -20,14 +20,15 @@ pub struct BundletoolInstallCommand { impl BundletoolInstallCommand { /// Download and install bundletool to provided or default path pub fn install(&self, config: &Config) -> crate::error::Result<()> { - config.status("Installing bundletool")?; + let home_dir = default_file_path(self.file_name())? + .parent() + .unwrap() + .to_owned(); if !self.force { - for bundletool in - std::fs::read_dir(default_file_path(self.file_name())?.parent().unwrap())? - { + for bundletool in std::fs::read_dir(&home_dir)? { let installed_bundletool = bundletool?.path(); if installed_bundletool.ends_with(self.file_name()) { - config.status("You have installed budletool on your system already")?; + config.status("You have installed budletool on your system already. Use `--force` command to overwrite.")?; return Ok(()); } } @@ -38,9 +39,17 @@ impl BundletoolInstallCommand { let download_url_str = String::from(download_url.to_str().unwrap()); if let Some(install_path) = &self.path { + config.status_message( + format!("{} installing into", self.file_name()), + install_path.to_string_lossy(), + )?; let jar_path = install_path.join(self.file_name()); download_to_file(&download_url_str, &jar_path)?; } else { + config.status_message( + format!("{} installing into", self.file_name()), + home_dir.to_string_lossy(), + )?; let default_jar_path = default_file_path(self.file_name())?; download_to_file(&download_url_str, &default_jar_path)?; }; diff --git a/crossbundle/cli/src/commands/install/command_line_tools.rs b/crossbundle/cli/src/commands/install/command_line_tools.rs index 5c7ab989..45ba043e 100644 --- a/crossbundle/cli/src/commands/install/command_line_tools.rs +++ b/crossbundle/cli/src/commands/install/command_line_tools.rs @@ -12,15 +12,15 @@ pub struct CommandLineToolsInstallCommand { /// Assign path to install command line tools #[clap(long, short)] pub install_path: Option, - /// Remove corrupted zip archive if installation was aborted + /// Force install command line tools even if found or corrupted. #[clap(long, short)] - pub remove_zip: bool, + pub force: bool, } impl CommandLineToolsInstallCommand { /// Download command line tools zip archive and extract it in specified sdk root directory pub fn install(&self, config: &Config) -> crate::error::Result<()> { - if self.remove_zip { + if self.force { remove(vec![default_file_path(self.file_name())?])?; } @@ -33,7 +33,7 @@ impl CommandLineToolsInstallCommand { let file_path = default_file_path(self.file_name())?; config.status_message( - "Downloading command line tools zip archive into", + format!("Downloading {} into", self.file_name()), &file_path.parent().unwrap().to_str().unwrap(), )?; self.download_and_save_file(command_line_tools_download_url, &file_path)?; @@ -62,7 +62,7 @@ impl CommandLineToolsInstallCommand { /// Return command line tools zip archive for defined operating system fn file_name(&self) -> String { - format!("commandlinetools-{}-8092744_latest.zip", OS_TAG) + format!("commandlinetools-{}-8512546_latest.zip", OS_TAG) } /// Check home directory for zip file. If it doesn't exists download zip file and save it in the directory