diff --git a/.changes/tauri-build-dev-fn.md b/.changes/tauri-build-dev-fn.md new file mode 100644 index 000000000..580437e97 --- /dev/null +++ b/.changes/tauri-build-dev-fn.md @@ -0,0 +1,5 @@ +--- +"tauri-build": "patch:breaking" +--- + +Renamed `dev` function to `is_dev` \ No newline at end of file diff --git a/.changes/tauri-dev-fn-const.md b/.changes/tauri-dev-fn-const.md new file mode 100644 index 000000000..eafb464ac --- /dev/null +++ b/.changes/tauri-dev-fn-const.md @@ -0,0 +1,5 @@ +--- +"tauri": "patch:breaking" +--- + +Renamed `dev` function to `is_dev` and marked it as `const fn` \ No newline at end of file diff --git a/core/tauri-build/src/codegen/context.rs b/core/tauri-build/src/codegen/context.rs index 0bd8dbcf5..695e8ed73 100644 --- a/core/tauri-build/src/codegen/context.rs +++ b/core/tauri-build/src/codegen/context.rs @@ -121,7 +121,7 @@ impl CodegenContext { ); let code = context_codegen(ContextData { - dev: crate::dev(), + dev: crate::is_dev(), config, config_parent, // it's very hard to have a build script for unit tests, so assume this is always called from diff --git a/core/tauri-build/src/lib.rs b/core/tauri-build/src/lib.rs index fc90d2b7e..bc08cd87e 100644 --- a/core/tauri-build/src/lib.rs +++ b/core/tauri-build/src/lib.rs @@ -386,7 +386,7 @@ impl Attributes { } } -pub fn dev() -> bool { +pub fn is_dev() -> bool { std::env::var("DEP_TAURI_DEV") .expect("missing `cargo:dev` instruction, please update tauri to latest") == "true" @@ -474,7 +474,7 @@ pub fn try_build(attributes: Attributes) -> Result<()> { mobile::generate_gradle_files(project_dir, &config)?; } - cfg_alias("dev", dev()); + cfg_alias("dev", is_dev()); let ws_path = get_workspace_dir()?; let mut manifest = diff --git a/core/tauri/src/lib.rs b/core/tauri/src/lib.rs index 24a7aceb9..ca09e1777 100644 --- a/core/tauri/src/lib.rs +++ b/core/tauri/src/lib.rs @@ -335,7 +335,7 @@ macro_rules! tauri_build_context { pub use pattern::Pattern; /// Whether we are running in development mode or not. -pub fn dev() -> bool { +pub const fn is_dev() -> bool { !cfg!(feature = "custom-protocol") } diff --git a/core/tauri/src/manager/mod.rs b/core/tauri/src/manager/mod.rs index 36a2b54f3..f16d2bba0 100644 --- a/core/tauri/src/manager/mod.rs +++ b/core/tauri/src/manager/mod.rs @@ -330,7 +330,7 @@ impl AppManager { } fn csp(&self) -> Option { - if !crate::dev() { + if !crate::is_dev() { self.config.app.security.csp.clone() } else { self