enable both FASTWAVE_PLATFORM values in Rust Analyzer

This commit is contained in:
Martin Kavík 2024-06-01 23:46:12 +02:00
parent be5d33e5c1
commit 84700cf61b
4 changed files with 8 additions and 1 deletions

1
.gitignore vendored
View file

@ -7,3 +7,4 @@ frontend_dist/_api
frontend_dist/index.html
mzoon
tauri
!.vscode

View file

@ -42,6 +42,9 @@ run_task = { fork = true, parallel = true, name = [
description = "Compile in the release mode and create installation packages"
dependencies = ["tauri_build", "show_release_paths"]
# @TODO Write task `bundle_browser` once we know whether we need only the frontend
# or also the backend side (Moon server)
# @TODO: Format also Typescript and CSS
[tasks.format]
description = "Format code"

View file

@ -16,7 +16,8 @@ macro_rules! instruction {
// }
fn main() {
let default_platform = "BROWSER";
let default_platform = "TAURI";
let platform = env::var("FASTWAVE_PLATFORM").unwrap_or_else(|_| default_platform.to_owned());
instruction!("cargo:rustc-cfg=FASTWAVE_PLATFORM=\"{platform}\"");
instruction!("cargo:rerun-if-env-changed=FASTWAVE_PLATFORM");
}

View file

@ -1,6 +1,8 @@
// @TODO maybe rewrite `FASTWAVE_PLATFORM` to features once it's possible to set them through env vars:
// https://github.com/rust-lang/cargo/issues/4829
// NOTE: `FASTWAVE_PLATFORM` is set in `Makefile.toml` tasks and then in `build.rs`
#[cfg(FASTWAVE_PLATFORM = "TAURI")]
mod tauri;
#[cfg(FASTWAVE_PLATFORM = "TAURI")]