final 0.7 fixes: xcode 15/16 hybrid, auto openssldir for android, include_*! tracking hotpatch, fix /assets/ brick at high opt levels, windows linker file, etc (#4376)
* wip: openssl autodetection * add voltaile read inside of asset fn * support xcode 15 for --device * vendor openssl on android * Smaller width TUI * switch to anyhow for the entire CLI * add backtrace and print double printing of cargo_metadata errors * add some padding to multi-line anyhow error * check semvers * don't open if not interactive * set the tailwind current_dir so it doesn't twitch * get the oboe demo working * copy the c++ library on android * cleanup env vars * add depinfo watcher * fix stale hotpatches and crate count * add musl support * remove outdated autofmt test * update scanner app * add hotdog app and bundle to ci * upload dx on every branch * collapse mobile into desktop * `dx doctor` command * windows command files * no pipe on doctor * fix ci? * fix links * fix ci * use main instead of nightly * bump node * build cli for host * cargo doc * prep dog_app for bundle * package hotdog * no bundle or nightly cli * comment out nightly cli * add quotes to linker files
This commit is contained in:
1 parent
97947b169b
commit
727752a965
78 files changed
+2270
-817
No files matched your search
@@ -1,6 +1,6 @@
|
||||
use crate::config::WasmOptLevel;
|
||||
use crate::{CliSettings, Result, WasmOptConfig, Workspace};
|
||||
use anyhow::{anyhow, Context};
|
||||
use anyhow::{anyhow, bail, Context};
|
||||
use flate2::read::GzDecoder;
|
||||
use std::path::{Path, PathBuf};
|
||||
use tar::Archive;
|
||||
@@ -16,8 +16,11 @@ pub async fn write_wasm(bytes: &[u8], output_path: &Path, cfg: &WasmOptConfig) -
|
||||
pub async fn optimize(input_path: &Path, output_path: &Path, cfg: &WasmOptConfig) -> Result<()> {
|
||||
let wasm_opt = WasmOpt::new(input_path, output_path, cfg)
|
||||
.await
|
||||
.inspect_err(|err| tracing::error!("Failed to create wasm-opt instance: {}", err))?;
|
||||
wasm_opt.optimize().await?;
|
||||
.context("Failed to create wasm-opt instance")?;
|
||||
wasm_opt
|
||||
.optimize()
|
||||
.await
|
||||
.context("Failed to run wasm-opt")?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
@@ -170,9 +173,7 @@ async fn find_latest_wasm_opt_download_url() -> anyhow::Result<String> {
|
||||
} else if cfg!(all(target_os = "macos", target_arch = "aarch64")) {
|
||||
"arm64-macos"
|
||||
} else {
|
||||
return Err(anyhow::anyhow!(
|
||||
"Unknown platform for wasm-opt installation. Please install wasm-opt manually from https://github.com/WebAssembly/binaryen/releases and add it to your PATH."
|
||||
));
|
||||
bail!("Unknown platform for wasm-opt installation. Please install wasm-opt manually from https://github.com/WebAssembly/binaryen/releases and add it to your PATH.");
|
||||
};
|
||||
|
||||
// Find the first asset with a name that contains the platform string
|
||||
@@ -184,12 +185,10 @@ async fn find_latest_wasm_opt_download_url() -> anyhow::Result<String> {
|
||||
.and_then(|name| name.as_str())
|
||||
.is_some_and(|name| name.contains(platform) && !name.ends_with("sha256"))
|
||||
})
|
||||
.ok_or_else(|| {
|
||||
anyhow::anyhow!(
|
||||
"No suitable wasm-opt binary found for platform: {}. Please install wasm-opt manually from https://github.com/WebAssembly/binaryen/releases and add it to your PATH.",
|
||||
platform
|
||||
)
|
||||
})?;
|
||||
.with_context(|| anyhow!(
|
||||
"No suitable wasm-opt binary found for platform: {}. Please install wasm-opt manually from https://github.com/WebAssembly/binaryen/releases and add it to your PATH.",
|
||||
platform
|
||||
))?;
|
||||
|
||||
// Extract the download URL from the asset
|
||||
let download_url = asset
|
||||
@@ -201,7 +200,7 @@ async fn find_latest_wasm_opt_download_url() -> anyhow::Result<String> {
|
||||
}
|
||||
|
||||
/// Get the path to the wasm-opt binary, downloading it if necessary
|
||||
async fn get_binary_path() -> anyhow::Result<PathBuf> {
|
||||
pub async fn get_binary_path() -> anyhow::Result<PathBuf> {
|
||||
let install_dir = install_dir();
|
||||
let install_path = installed_bin_path(&install_dir);
|
||||
|
||||
@@ -224,6 +223,25 @@ async fn get_binary_path() -> anyhow::Result<PathBuf> {
|
||||
Ok(install_path)
|
||||
}
|
||||
|
||||
pub fn installed_location() -> Option<PathBuf> {
|
||||
let install_dir = install_dir();
|
||||
let install_path = installed_bin_path(&install_dir);
|
||||
|
||||
if install_path.exists() {
|
||||
return Some(install_path);
|
||||
}
|
||||
|
||||
if CliSettings::prefer_no_downloads() {
|
||||
if let Ok(existing) = which::which("wasm-opt") {
|
||||
return Some(existing);
|
||||
} else {
|
||||
return None;
|
||||
}
|
||||
}
|
||||
|
||||
None
|
||||
}
|
||||
|
||||
fn install_dir() -> PathBuf {
|
||||
Workspace::dioxus_home_dir().join("binaryen")
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user