Skip to content

Commit 68771b0

Browse files
authored
fix(apple): ignore errors when checking outdated dependencies (#483)
closes tauri-apps/tauri#11244
1 parent da4ee56 commit 68771b0

File tree

2 files changed

+32
-16
lines changed

2 files changed

+32
-16
lines changed

.changes/ignore-outdated-error.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"cargo-mobile2": patch
3+
---
4+
5+
Ignore errors when checking outdated dependencies with `gem` and `brew`.

src/apple/deps/mod.rs

Lines changed: 27 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,8 @@ fn installed_with_brew(package: &str) -> bool {
116116
}
117117

118118
fn brew_reinstall(package: &'static str) -> Result<(), Error> {
119+
log::info!("Installing `{}` with brew...", package);
120+
119121
// reinstall works even if it's not installed yet, and will upgrade
120122
// if it's already installed!
121123
duct::cmd("brew", ["reinstall", package])
@@ -129,6 +131,7 @@ fn update_package(package: &'static str, gem_cache: &mut GemCache) -> Result<(),
129131
if installed_with_brew(package) {
130132
brew_reinstall(package)?;
131133
} else {
134+
log::info!("Installing `{}` with gem...", package);
132135
gem_cache.reinstall(package)?;
133136
}
134137
Ok(())
@@ -175,13 +178,14 @@ impl PackageSpec {
175178
package: self.pkg_name,
176179
source,
177180
})?;
178-
log::info!("package `{}` present: {}", self.pkg_name, found);
181+
if !found {
182+
log::info!("package `{}` not found", self.pkg_name);
183+
}
179184
Ok(found)
180185
}
181186

182187
pub fn install(&self, reinstall_deps: bool, gem_cache: &mut GemCache) -> Result<bool, Error> {
183188
if !self.found()? || reinstall_deps {
184-
println!("Installing `{}`...", self.pkg_name);
185189
match self.package_source {
186190
PackageSource::Brew => brew_reinstall(self.pkg_name)?,
187191
PackageSource::BrewOrGem => update_package(self.pkg_name, gem_cache)?,
@@ -207,23 +211,30 @@ pub fn install_all(
207211
IOS_DEPLOY_PACKAGE.install(reinstall_deps, &mut gem_cache)?;
208212
}
209213
gem_cache.initialize()?;
210-
let outdated = Outdated::load(&mut gem_cache)?;
211-
outdated.print_notice();
212-
if !outdated.is_empty() && !non_interactive {
213-
let answer = loop {
214-
if let Some(answer) = prompt::yes_no(
215-
"Would you like these outdated dependencies to be updated for you?",
216-
Some(true),
217-
)? {
218-
break answer;
219-
}
220-
};
221-
if answer {
222-
for package in outdated.iter() {
223-
update_package(package, &mut gem_cache)?;
214+
match Outdated::load(&mut gem_cache) {
215+
Ok(outdated) => {
216+
outdated.print_notice();
217+
if !outdated.is_empty() && !non_interactive {
218+
let answer = loop {
219+
if let Some(answer) = prompt::yes_no(
220+
"Would you like these outdated dependencies to be updated for you?",
221+
Some(true),
222+
)? {
223+
break answer;
224+
}
225+
};
226+
if answer {
227+
for package in outdated.iter() {
228+
update_package(package, &mut gem_cache)?;
229+
}
230+
}
224231
}
225232
}
233+
Err(e) => {
234+
log::warn!("Failed to check for outdated dependencies: {}", e);
235+
}
226236
}
237+
227238
// we definitely don't want to install this on CI...
228239
if !skip_dev_tools {
229240
let tool_info = DeveloperTools::new()?;

0 commit comments

Comments
 (0)