new tasks, frontend crate platform features

This commit is contained in:
Martin Kavík 2024-06-01 23:06:27 +02:00
parent ea38f61058
commit e034a2bb14
3 changed files with 36 additions and 7 deletions

View file

@ -29,6 +29,15 @@ run_task = { fork = true, parallel = true, name = [
"watch_tauri_glue", "watch_tauri_glue",
]} ]}
[tasks.start_web]
description = "Run without Tauri in the browser & watch Typescript and Rust in the debug mode"
dependencies = ["store_current_process_id"]
run_task = { fork = true, parallel = true, name = [
"tauri_dev_with_cleanup",
"watch_pixi_canvas",
"watch_tauri_glue",
]}
[tasks.bundle] [tasks.bundle]
description = "Compile in the release mode and create installation packages" description = "Compile in the release mode and create installation packages"
dependencies = ["tauri_build", "show_release_paths"] dependencies = ["tauri_build", "show_release_paths"]
@ -46,10 +55,13 @@ description = "Run locally installed tauri"
command = "tauri/bin/cargo-tauri" command = "tauri/bin/cargo-tauri"
args = ["${@}"] args = ["${@}"]
[tasks.mzoon_for_tauri]
description = "Run locally installed mzoon with enabled `frontend` feature `platform_tauri"
extend = "mzoon_with_disabled_frontend_features"
[tasks.mzoon] [tasks.mzoon]
description = "Run locally installed mzoon" description = "Run locally installed mzoon with enabled `frontend` feature `platform_browser"
command = "mzoon/bin/mzoon" extend = "mzoon_with_disabled_frontend_features"
args = ["${@}"]
# [tasks.mzoon] # [tasks.mzoon]
# description = "Run mzoon from a cloned MoonZoon repo" # description = "Run mzoon from a cloned MoonZoon repo"
@ -58,6 +70,11 @@ args = ["${@}"]
###### HELPER TASKS ###### ###### HELPER TASKS ######
[tasks.mzoon_with_disabled_frontend_features]
description = "Run locally installed mzoo"
command = "mzoon/bin/mzoon"
args = ["${@}"]
[tasks.store_current_process_id] [tasks.store_current_process_id]
description = "" description = ""
script_runner = "@duckscript" script_runner = "@duckscript"
@ -72,11 +89,20 @@ description = "Run `tauri dev`"
extend = "tauri" extend = "tauri"
args = ["dev"] args = ["dev"]
[tasks.mzoon_start]
description = "Run `mzoon start`"
extend = "mzoon"
args = ["start"]
[tasks.tauri_dev_with_cleanup] [tasks.tauri_dev_with_cleanup]
description = "Run forked `tauri dev` with cleanup" description = "Run forked `tauri dev` with cleanup"
run_task = { fork = true, cleanup_task = "cleanup_after_tauri_dev", name = ["tauri_dev"] } run_task = { fork = true, cleanup_task = "kill_watchers", name = ["tauri_dev"] }
[tasks.cleanup_after_tauri_dev] [tasks.mzoon_start_with_cleanup]
description = "Run forked `mzoon start` with cleanup"
run_task = { fork = true, cleanup_task = "kill_watchers", name = ["mzoon_start"] }
[tasks.kill_watchers]
description = "Kill the cargo-make/makers process and all its children / forked processes" description = "Kill the cargo-make/makers process and all its children / forked processes"
script_runner = "@duckscript" script_runner = "@duckscript"
script = ''' script = '''

View file

@ -8,6 +8,9 @@ mod browser;
#[cfg(feature = "platform_browser")] #[cfg(feature = "platform_browser")]
use browser as platform; use browser as platform;
#[cfg(all(feature = "platform_tauri", feature = "platform_browser"))]
compile_error!("feature \"foo\" and feature \"bar\" cannot be enabled at the same time");
pub async fn show_window() { pub async fn show_window() {
platform::show_window().await platform::show_window().await
} }

View file

@ -5,8 +5,8 @@
"build": { "build": {
"frontendDist": "../frontend_dist", "frontendDist": "../frontend_dist",
"devUrl": "http://localhost:8080", "devUrl": "http://localhost:8080",
"beforeDevCommand": "makers mzoon start", "beforeDevCommand": "makers mzoon_for_tauri start",
"beforeBuildCommand": "makers mzoon build -r -f" "beforeBuildCommand": "makers mzoon_for_tauri build -r -f"
}, },
"app": { "app": {
"macOSPrivateApi": true, "macOSPrivateApi": true,