From 5f8d0f6c407bcb3b18df88cced4e6aa1c52a9ec0 Mon Sep 17 00:00:00 2001 From: Evan Almloff Date: Wed, 14 Feb 2024 09:56:29 -0600 Subject: [PATCH] add a third party feature for freya --- packages/dioxus/Cargo.toml | 2 ++ packages/dioxus/build.rs | 4 ++++ packages/dioxus/src/launch.rs | 3 +++ 3 files changed, 9 insertions(+) diff --git a/packages/dioxus/Cargo.toml b/packages/dioxus/Cargo.toml index b808bdc85..352a258d5 100644 --- a/packages/dioxus/Cargo.toml +++ b/packages/dioxus/Cargo.toml @@ -54,6 +54,8 @@ salvo = ["dioxus-fullstack?/salvo", "ssr", "dioxus-liveview?/salvo"] warp = ["dioxus-fullstack?/warp", "ssr", "dioxus-liveview?/warp"] rocket = ["dioxus-liveview?/rocket"] tui = ["dioxus-tui", "dioxus-config-macro/tui"] +# This feature just disables the no-renderer-enabled warning +third-party-renderer = [] # This feature enables some nightly flags that make it more clear what structs/methods are available in each feature nightly-doc = [] diff --git a/packages/dioxus/build.rs b/packages/dioxus/build.rs index 01ddf5220..27a9a198b 100644 --- a/packages/dioxus/build.rs +++ b/packages/dioxus/build.rs @@ -1,6 +1,10 @@ fn main() { // Warn the user if they enabled the launch feature without any renderers if feature_enabled("launch") { + if feature_enabled("third-party-renderer"){ + return; + } + let liveview_renderers = [ "liveview", "axum", diff --git a/packages/dioxus/src/launch.rs b/packages/dioxus/src/launch.rs index d214dc610..1a5f0b5d9 100644 --- a/packages/dioxus/src/launch.rs +++ b/packages/dioxus/src/launch.rs @@ -211,6 +211,9 @@ mod current_platform { contexts: Vec>, platform_config: (), ) { + #[cfg(feature = "third-party-renderer")] + panic!("No first party renderer feature enabled. It looks like you are trying to use a third party renderer. You will need to use the launch function from the third party renderer crate."); + panic!("No platform feature enabled. Please enable one of the following features: liveview, desktop, mobile, web, tui, fullstack to use the launch API."); } }