Put asset collection behind a feature flag

This commit is contained in:
Jonathan Kelley committed 2024-01-05 23:14:03 -08:00
1 parent 347351d1ee
commit 20135368b8
3 files changed
+13 -4

No files matched your search

+8 -1
View File
@@ -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] [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 # 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", "webp",
"html", "html",
] } ] }
@@ -67,6 +67,12 @@ objc_id = "0.1.1"
core-foundation = "0.9.3" core-foundation = "0.9.3"
objc = "0.2.7" 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] [features]
default = ["tokio_runtime", "hot-reload", "wry/objc-exception"] default = ["tokio_runtime", "hot-reload", "wry/objc-exception"]
tokio_runtime = ["tokio"] tokio_runtime = ["tokio"]
@@ -74,6 +80,7 @@ fullscreen = ["wry/fullscreen"]
transparent = ["wry/transparent"] transparent = ["wry/transparent"]
devtools = ["wry/devtools"] devtools = ["wry/devtools"]
hot-reload = ["dioxus-hot-reload"] hot-reload = ["dioxus-hot-reload"]
asset-collect = ["manganis-cli-support"]
gnu = [] gnu = []
[package.metadata.docs.rs] [package.metadata.docs.rs]
+2 -2
View File
@@ -82,6 +82,8 @@ impl<P: 'static> App<P> {
}; };
// Copy over any assets we find // 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(); crate::collect_assets::copy_assets();
// Set the event converter // Set the event converter
@@ -119,7 +121,6 @@ impl<P: 'static> App<P> {
}); });
} }
//
pub fn handle_new_window(&mut self) { pub fn handle_new_window(&mut self) {
for handler in self.shared.pending_webviews.borrow_mut().drain(..) { for handler in self.shared.pending_webviews.borrow_mut().drain(..) {
let id = handler.desktop_context.window.id(); let id = handler.desktop_context.window.id();
@@ -320,7 +321,6 @@ impl<P: 'static> App<P> {
let Some(view) = self.webviews.get_mut(&id) else { let Some(view) = self.webviews.get_mut(&id) else {
return; return;
}; };
println!("poll_vdom");
view.poll_vdom(); view.poll_vdom();
} }
+3 -1
View File
@@ -6,7 +6,6 @@
mod app; mod app;
mod assets; mod assets;
mod cfg; mod cfg;
mod collect_assets;
mod desktop_context; mod desktop_context;
mod edits; mod edits;
mod element; mod element;
@@ -23,6 +22,9 @@ mod shortcut;
mod waker; mod waker;
mod webview; mod webview;
#[cfg(feature = "collect-assets")]
mod collect_assets;
#[cfg(any(target_os = "ios", target_os = "android"))] #[cfg(any(target_os = "ios", target_os = "android"))]
mod mobile_shortcut; mod mobile_shortcut;