diff --git a/CHANGELOG.md b/CHANGELOG.md index 8b746c76..a57298ec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - Add a flag to skip Xtensa Rust version parsing (#352) +- Add warn message when failed to detect Xtensa Rust (#357) ### Changed - Update dependencies diff --git a/src/env.rs b/src/env.rs index 9d381b50..84bdb6e1 100644 --- a/src/env.rs +++ b/src/env.rs @@ -87,11 +87,11 @@ pub fn export_environment(export_file: &Path) -> Result<(), Error> { if cfg!(windows) { set_environment_variable("PATH", &env::var("PATH").unwrap())?; warn!( - "{} Your environments variables have been updated! Shell may need to be restarted for changes to be effective.", + "{} Your environments variables have been updated! Shell may need to be restarted for changes to be effective", emoji::INFO ); warn!( - "{} A file was created at '{}' showing the injected environment variables.", + "{} A file was created at '{}' showing the injected environment variables", emoji::INFO, export_file.display() ); @@ -99,12 +99,12 @@ pub fn export_environment(export_file: &Path) -> Result<(), Error> { #[cfg(unix)] if cfg!(unix) { warn!( - "{} Please, set up the environment variables by running: '. {}'", + "{} Please, set up the environment variables by running: ' {}'", emoji::INFO, export_file.display() ); warn!( - "{} This step must be done every time you open a new terminal.", + "{} This step must be done every time you open a new terminal", emoji::WARN ); } diff --git a/src/error.rs b/src/error.rs index 4636bec6..657fb356 100644 --- a/src/error.rs +++ b/src/error.rs @@ -9,19 +9,19 @@ pub enum Error { CreateDirectory(String), #[diagnostic(code(espup::toolchain::rust::query_github))] - #[error("{} Failed to query GitHub API.", emoji::ERROR)] + #[error("{} Failed to query GitHub API", emoji::ERROR)] GithubQuery, #[diagnostic(code(espup::toolchain::rust::install_riscv_target))] #[error( - "{} Failed to Install RISC-V targets for '{0}' toolchain.", + "{} Failed to Install RISC-V targets for '{0}' toolchain", emoji::ERROR )] InstallRiscvTarget(String), #[diagnostic(code(espup::ivalid_destination))] #[error( - "{} Invalid export file destination: '{0}'. Please, use an absolute or releative path (including the file and its extension).", + "{} Invalid export file destination: '{0}'. Please, use an absolute or releative path (including the file and its extension)", emoji::ERROR )] InvalidDestination(String), @@ -44,7 +44,7 @@ pub enum Error { MissingRust, #[diagnostic(code(espup::remove_directory))] - #[error("{} Failed to remove '{0}'.", emoji::ERROR)] + #[error("{} Failed to remove '{0}'", emoji::ERROR)] RemoveDirectory(String), #[error(transparent)] @@ -55,11 +55,11 @@ pub enum Error { RustupDetection(String), #[diagnostic(code(espup::toolchain::rust::serialize_json))] - #[error("{} Failed to serialize json from string.", emoji::ERROR)] + #[error("{} Failed to serialize json from string", emoji::ERROR)] SerializeJson, #[diagnostic(code(espup::toolchain::rust::uninstall_riscv_target))] - #[error("{} Failed to uninstall RISC-V target.", emoji::ERROR)] + #[error("{} Failed to uninstall RISC-V target", emoji::ERROR)] UninstallRiscvTarget, #[diagnostic(code(espup::toolchain::unsupported_file_extension))] diff --git a/src/lib.rs b/src/lib.rs index 4f6db2eb..41ce7db4 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -34,7 +34,7 @@ pub mod update { if let Some(version) = informer.check_version().ok().flatten() { warn!( - "{} A new version of {name} ('{version}') is available.", + "{} A new version of {name} ('{version}') is available", emoji::WARN ); } diff --git a/src/toolchain/gcc.rs b/src/toolchain/gcc.rs index 73eb35e9..4e25cfd3 100644 --- a/src/toolchain/gcc.rs +++ b/src/toolchain/gcc.rs @@ -74,7 +74,7 @@ impl Installable for Gcc { debug!("{} GCC path: {}", emoji::DEBUG, self.path.display()); if self.path.exists() { warn!( - "{} Previous installation of GCC exists in: '{}'. Reusing this installation.", + "{} Previous installation of GCC exists in: '{}'. Reusing this installation", emoji::WARN, &self.path.display() ); diff --git a/src/toolchain/llvm.rs b/src/toolchain/llvm.rs index d117b461..d3ee661b 100644 --- a/src/toolchain/llvm.rs +++ b/src/toolchain/llvm.rs @@ -151,7 +151,7 @@ impl Installable for Llvm { if Path::new(&self.path).exists() { warn!( - "{} Previous installation of LLVM exists in: '{}'. Reusing this installation.", + "{} Previous installation of LLVM exists in: '{}'. Reusing this installation", emoji::WARN, self.path.to_str().unwrap() ); diff --git a/src/toolchain/mod.rs b/src/toolchain/mod.rs index b2151eb7..fa98f35c 100644 --- a/src/toolchain/mod.rs +++ b/src/toolchain/mod.rs @@ -54,7 +54,7 @@ pub async fn download_file( let file_path = format!("{output_directory}/{file_name}"); if Path::new(&file_path).exists() { warn!( - "{} File '{}' already exists, deleting it before download.", + "{} File '{}' already exists, deleting it before download", emoji::WARN, file_path ); @@ -271,7 +271,7 @@ pub fn github_query(url: &str) -> Result { ); headers.insert("X-GitHub-Api-Version", "2022-11-28".parse().unwrap()); if let Some(token) = env::var_os("GITHUB_TOKEN") { - debug!("{} Auth header added.", emoji::DEBUG); + debug!("{} Auth header added", emoji::DEBUG); headers.insert( "Authorization", format!("Bearer {}", token.to_string_lossy()) diff --git a/src/toolchain/rust.rs b/src/toolchain/rust.rs index cca1b3fe..1e144699 100644 --- a/src/toolchain/rust.rs +++ b/src/toolchain/rust.rs @@ -200,13 +200,19 @@ impl Installable for XtensaRust { let output = String::from_utf8_lossy(&rustc_version.stdout); if rustc_version.status.success() && output.contains(&self.version) { warn!( - "{} Previous installation of Xtensa Rust {} exists in: '{}'. Reusing this installation.", + "{} Previous installation of Xtensa Rust {} exists in: '{}'. Reusing this installation", emoji::WARN, &self.version, &self.toolchain_destination.display() ); return Ok(vec![]); } else { + if !rustc_version.status.success() { + warn!( + "{} Failed to detect version of Xtensa Rust, reinstalling it", + emoji::WARN + ); + } Self::uninstall(&self.toolchain_destination)?; } }