From 20135368b803fcab9dde177c21dd21d75b8446dd Mon Sep 17 00:00:00 2001 From: Jonathan Kelley Date: Fri, 5 Jan 2024 23:14:03 -0800 Subject: [PATCH] Put asset collection behind a feature flag --- packages/desktop/Cargo.toml | 9 ++++++++- packages/desktop/src/app.rs | 4 ++-- packages/desktop/src/lib.rs | 4 +++- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/packages/desktop/Cargo.toml b/packages/desktop/Cargo.toml index 7f4933a7e..9e72c3eb2 100644 --- a/packages/desktop/Cargo.toml +++ b/packages/desktop/Cargo.toml @@ -52,7 +52,7 @@ muda = "0.11.3" [target.'cfg(any(target_os = "windows",target_os = "macos",target_os = "linux",target_os = "dragonfly", target_os = "freebsd", target_os = "netbsd", target_os = "openbsd"))'.dependencies] # This is only for debug mode, and it appears mobile does not support some packages this uses -manganis-cli-support = { git = "https://github.com/DioxusLabs/collect-assets", features = [ +manganis-cli-support = { git = "https://github.com/DioxusLabs/collect-assets", optional = true, features = [ "webp", "html", ] } @@ -67,6 +67,12 @@ objc_id = "0.1.1" core-foundation = "0.9.3" objc = "0.2.7" +[target."cfg(any(target_os = \"linux\", target_os = \"dragonfly\", target_os = \"freebsd\", target_os = \"openbsd\", target_os = \"netbsd\"))".dependencies] +gtk = { version = "0.18", features = [ "v3_24" ] } +webkit2gtk = { version = "=2.0", features = [ "v2_38" ] } +percent-encoding = "2.1" + + [features] default = ["tokio_runtime", "hot-reload", "wry/objc-exception"] tokio_runtime = ["tokio"] @@ -74,6 +80,7 @@ fullscreen = ["wry/fullscreen"] transparent = ["wry/transparent"] devtools = ["wry/devtools"] hot-reload = ["dioxus-hot-reload"] +asset-collect = ["manganis-cli-support"] gnu = [] [package.metadata.docs.rs] diff --git a/packages/desktop/src/app.rs b/packages/desktop/src/app.rs index 9a3bc7906..6d95757c4 100644 --- a/packages/desktop/src/app.rs +++ b/packages/desktop/src/app.rs @@ -82,6 +82,8 @@ impl App

{ }; // Copy over any assets we find + // todo - re-enable this when we have a faster way of copying assets + #[cfg(feature = "collect-assets")] crate::collect_assets::copy_assets(); // Set the event converter @@ -119,7 +121,6 @@ impl App

{ }); } - // pub fn handle_new_window(&mut self) { for handler in self.shared.pending_webviews.borrow_mut().drain(..) { let id = handler.desktop_context.window.id(); @@ -320,7 +321,6 @@ impl App

{ let Some(view) = self.webviews.get_mut(&id) else { return; }; - println!("poll_vdom"); view.poll_vdom(); } diff --git a/packages/desktop/src/lib.rs b/packages/desktop/src/lib.rs index 86f587862..b058fad68 100644 --- a/packages/desktop/src/lib.rs +++ b/packages/desktop/src/lib.rs @@ -6,7 +6,6 @@ mod app; mod assets; mod cfg; -mod collect_assets; mod desktop_context; mod edits; mod element; @@ -23,6 +22,9 @@ mod shortcut; mod waker; mod webview; +#[cfg(feature = "collect-assets")] +mod collect_assets; + #[cfg(any(target_os = "ios", target_os = "android"))] mod mobile_shortcut;