better logs, don't run codesign if no assets are found (#4464)

This commit is contained in:
Jonathan Kelley authored and GitHub committed 2025-07-23 17:41:04 -07:00
1 parent f9f30263d3
commit 66c2dac38f
5 files changed
+119 -54

No files matched your search

+41 -20
View File
@@ -21,7 +21,6 @@ pub struct Workspace {
pub(crate) ignore: Gitignore,
pub(crate) cargo_toml: cargo_toml::Manifest,
pub(crate) android_tools: Option<Arc<AndroidTools>>,
pub(crate) xcode: Option<PathBuf>,
}
impl Workspace {
@@ -86,19 +85,12 @@ impl Workspace {
};
let settings = CliSettings::global_or_default();
let sysroot = Command::new("rustc")
.args(["--print", "sysroot"])
.output()
let sysroot = Self::get_rustc_sysroot()
.await
.map(|out| String::from_utf8(out.stdout))?
.context("Failed to extract rustc sysroot output")?;
let rustc_version = Command::new("rustc")
.args(["--version"])
.output()
.context("Failed to get rustc sysroot")?;
let rustc_version = Self::get_rustc_version()
.await
.map(|out| String::from_utf8(out.stdout))?
.context("Failed to extract rustc version output")?;
.context("Failed to get rustc version")?;
let wasm_opt = which::which("wasm-opt").ok();
@@ -110,13 +102,6 @@ impl Workspace {
let android_tools = crate::build::get_android_tools();
let xcode = Command::new("xcode-select")
.arg("-p")
.output()
.await
.ok()
.map(|s| String::from_utf8_lossy(&s.stdout).trim().to_string().into());
let workspace = Arc::new(Self {
krates,
settings,
@@ -126,7 +111,6 @@ impl Workspace {
ignore,
cargo_toml,
android_tools,
xcode,
});
tracing::debug!(
@@ -263,6 +247,13 @@ impl Workspace {
self.gcc_ld_dir().join("wasm-ld")
}
pub fn select_ranlib() -> Option<PathBuf> {
// prefer the modern llvm-ranlib if they have it
which::which("llvm-ranlib")
.or_else(|_| which::which("ranlib"))
.ok()
}
/// Return the version of the wasm-bindgen crate if it exists
pub fn wasm_bindgen_version(&self) -> Option<String> {
self.krates
@@ -484,6 +475,36 @@ impl Workspace {
.context("Failed to find directory containing Cargo.toml")
}
pub async fn get_xcode_path() -> Option<PathBuf> {
let xcode = Command::new("xcode-select")
.arg("-p")
.output()
.await
.ok()
.map(|s| String::from_utf8_lossy(&s.stdout).trim().to_string().into());
xcode
}
pub async fn get_rustc_sysroot() -> Result<String, anyhow::Error> {
let sysroot = Command::new("rustc")
.args(["--print", "sysroot"])
.output()
.await
.map(|out| String::from_utf8(out.stdout).map(|s| s.trim().to_string()))?
.context("Failed to extract rustc sysroot output")?;
Ok(sysroot)
}
pub async fn get_rustc_version() -> Result<String> {
let rustc_version = Command::new("rustc")
.args(["--version"])
.output()
.await
.map(|out| String::from_utf8(out.stdout))?
.context("Failed to extract rustc version output")?;
Ok(rustc_version)
}
/// Returns the properly canonicalized path to the dx executable, used for linking and wrapping rustc
pub(crate) fn path_to_dx() -> Result<PathBuf> {
dunce::canonicalize(std::env::current_exe().context("Failed to find dx")?)