rip out tauri bundle (v2), swc -> esbuild, blacksmith -> warpbuild, FAST CI 🚀 (#5328)

- inline mac, windows, linux bundling in the cli
- remove tauri bundle from our dep tree
- trim down the rpm crate for fewer dependencies in tree
- migrate from blacksmith to warpbuild
- move off swc and instead use esbuild via tool
- use dev drives in windows CI
- use fork of nix action for faster caching
- test bundling in CI
- fix asset handling in linux 
- add default APPDATA location for webview2 installs for dioxus apps on windows
This commit is contained in:
Jonathan Kelley authored and GitHub committed 2026-03-20 12:27:13 -07:00
1 parent be7296f4f0
commit b2d01e6779
83 files changed
+7756 -5403

No files matched your search

+78 -17
View File
@@ -42,14 +42,14 @@ use futures_util::FutureExt;
use itertools::Itertools;
use serde::{Deserialize, Serialize};
use serde_json::json;
use std::{any::Any, io::Read, str::FromStr, sync::Arc, time::SystemTime};
use std::{any::Any, io::Read, pin::Pin, str::FromStr, sync::Arc, time::SystemTime};
use std::{borrow::Cow, sync::OnceLock};
use std::{
collections::HashMap,
env,
fmt::{Debug, Display, Write as _},
sync::atomic::{AtomicBool, Ordering},
time::Instant,
time::{Duration, Instant},
};
use std::{future::Future, panic::AssertUnwindSafe};
use tracing::{field::Visit, Level, Subscriber};
@@ -139,10 +139,9 @@ impl TraceController {
///
/// We pass the TraceController around the CLI in a few places, namely the serve command so the TUI
/// can access things like the logs.
pub async fn main<F>(run_app: impl FnOnce(Commands, Self) -> F) -> StructuredOutput
where
F: Future<Output = Result<StructuredOutput>>,
{
pub async fn main(
run_app: impl FnOnce(Commands, Self) -> Pin<Box<dyn Future<Output = Result<StructuredOutput>>>>,
) -> StructuredOutput {
let args = Cli::parse();
let tui_active = Arc::new(AtomicBool::new(false));
let is_serve_cmd = matches!(args.action, Commands::Serve(_));
@@ -178,7 +177,7 @@ impl TraceController {
// We complete filter out a few fields that are not relevant to the user, like `dx_src` and `json`
let fmt_layer = tracing_subscriber::fmt::layer()
.with_target(args.verbosity.verbose)
.with_target(false)
.fmt_fields(
format::debug_fn(move |writer, field, value| {
if field.name() == "json" && !args.verbosity.json_output {
@@ -521,7 +520,7 @@ impl TraceController {
error_handled,
} = event;
let mut ph_event = posthog_rs::Event::new(action, distinct_id.to_string());
let mut ph_event = PosthogEvent::new(action, distinct_id.to_string());
// The reporter's fields
_ = ph_event.insert_prop("is_ci", CliSettings::is_ci());
@@ -649,7 +648,7 @@ impl TraceController {
reset_cursor();
// re-emit any remaining messages in case they're useful.
while let Ok(Some(msg)) = self.tui_rx.lock().await.try_next() {
while let Ok(msg) = self.tui_rx.lock().await.try_recv() {
let content = match msg.content {
TraceContent::Text(text) => text,
TraceContent::Cargo(msg) => msg.message.to_string(),
@@ -729,7 +728,7 @@ impl TraceController {
true => {
let mut msgs = self.telemetry_rx.lock().await;
let request_body = std::iter::from_fn(|| msgs.try_next().ok().flatten())
let request_body = std::iter::from_fn(|| msgs.try_recv().ok())
.filter_map(|msg| serde_json::to_value(msg).ok())
.collect::<Vec<_>>();
@@ -740,8 +739,7 @@ impl TraceController {
false => {
let mut msgs = self.telemetry_rx.lock().await;
let msg_list =
std::iter::from_fn(|| msgs.try_next().ok().flatten()).collect::<Vec<_>>();
let msg_list = std::iter::from_fn(|| msgs.try_recv().ok()).collect::<Vec<_>>();
if !msg_list.is_empty() {
let dest = Workspace::dioxus_data_dir()
@@ -1336,10 +1334,43 @@ impl Default for PrettyUptime {
impl FormatTime for PrettyUptime {
fn format_time(&self, w: &mut Writer<'_>) -> std::fmt::Result {
let e = self.epoch.elapsed();
write!(w, "{:4}.{:2}s", e.as_secs(), e.subsec_millis())
Self::write_elapsed(self.epoch.elapsed(), w)
}
}
impl PrettyUptime {
fn write_elapsed(elapsed: Duration, mut w: impl std::fmt::Write) -> std::fmt::Result {
write!(
w,
"{:3}.{:02}s",
elapsed.as_secs(),
elapsed.subsec_millis() / 10
)
}
}
#[cfg(test)]
mod pretty_uptime_tests {
use super::PrettyUptime;
use std::time::Duration;
#[test]
fn pretty_uptime_pads_centiseconds_to_keep_a_stable_width() {
let cases = [
(Duration::from_millis(92_993), " 92.99s"),
(Duration::from_millis(93_085), " 93.08s"),
(Duration::from_millis(93_130), " 93.13s"),
(Duration::from_millis(999_999), "999.99s"),
];
for (elapsed, expected) in cases {
let mut rendered = String::new();
PrettyUptime::write_elapsed(elapsed, &mut rendered).unwrap();
assert_eq!(rendered, expected);
}
}
}
/// Run the provided future and wait for it to complete, handling Ctrl-C gracefully.
///
/// If ctrl-c is pressed twice, it exits immediately, skipping our telemetry flush.
@@ -1372,7 +1403,37 @@ async fn run_with_ctrl_c(
/// We only store non-pii information in telemetry to track issues and performance
/// across the CLI.
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct Reporter {
pub session_id: Uuid,
pub distinct_id: Uuid,
struct Reporter {
session_id: Uuid,
distinct_id: Uuid,
}
/// A minimal PostHog event, replacing the `posthog-rs` crate dependency.
/// See <https://posthog.com/docs/api/capture>
#[derive(Serialize, Debug)]
struct PosthogEvent {
event: String,
#[serde(rename = "$distinct_id")]
distinct_id: String,
properties: std::collections::HashMap<String, serde_json::Value>,
}
impl PosthogEvent {
fn new(event: impl Into<String>, distinct_id: impl Into<String>) -> Self {
Self {
event: event.into(),
distinct_id: distinct_id.into(),
properties: std::collections::HashMap::new(),
}
}
fn insert_prop<V: Serialize>(
&mut self,
key: impl Into<String>,
value: V,
) -> Result<(), serde_json::Error> {
self.properties
.insert(key.into(), serde_json::to_value(value)?);
Ok(())
}
}