diff --git a/.changes/cli-hook-env-vars.md b/.changes/cli-hook-env-vars.md deleted file mode 100644 index 1b906a10e..000000000 --- a/.changes/cli-hook-env-vars.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -'tauri-cli': 'patch:bug' -'@tauri-apps/cli': 'patch:bug' ---- - -Prevent `Invalid target triple` warnings and correctly set `TAURI_ENV_` vars when target triple contains 4 components. `darwin` and `androideabi` are no longer replaced with `macos` and `android` in `TAURI_ENV_PLATFORM`. diff --git a/.changes/cli-hook-invalid-target-triple-env-vars.md b/.changes/cli-hook-invalid-target-triple-env-vars.md new file mode 100644 index 000000000..b5aa5cc6f --- /dev/null +++ b/.changes/cli-hook-invalid-target-triple-env-vars.md @@ -0,0 +1,6 @@ +--- +'tauri-cli': 'patch:bug' +'@tauri-apps/cli': 'patch:bug' +--- + +Prevent `Invalid target triple` warnings and correctly set `TAURI_ENV_` vars when target triple contains 4 components. diff --git a/.changes/cli-hooks-env-vars-breaking.md b/.changes/cli-hooks-env-vars-breaking.md new file mode 100644 index 000000000..6941f5d74 --- /dev/null +++ b/.changes/cli-hooks-env-vars-breaking.md @@ -0,0 +1,9 @@ +--- +'tauri-cli': 'patch:breaking' +'@tauri-apps/cli': 'patch:breaking' +--- + +Removed `TAURI_ENV_PLATFORM_TYPE` which will not be set for CLI hook commands anymore, use `TAURI_ENV_PLATFORM` instead. Also Changed value of `TAURI_ENV_PLATFORM` and `TAURI_ENV_ARCH` values to match the target triple more accurately: + +- `darwin` and `androideabi` are no longer replaced with `macos` and `android` in `TAURI_ENV_PLATFORM`. +- `i686` and `i586` are no longer replaced with `x86` in `TAURI_ENV_ARCH`. diff --git a/tooling/cli/ENVIRONMENT_VARIABLES.md b/tooling/cli/ENVIRONMENT_VARIABLES.md index b4611a276..b03a378a7 100644 --- a/tooling/cli/ENVIRONMENT_VARIABLES.md +++ b/tooling/cli/ENVIRONMENT_VARIABLES.md @@ -1,5 +1,3 @@ - - ### Tauri's Environment Variables This is a documentation of all environment variables used by tauri core crates and tauri CLI. @@ -42,10 +40,9 @@ These environment variables are inputs to the CLI which may have an equivalent C These environment variables are set for each hook command (`beforeDevCommand`, `beforeBuildCommand`, ...etc) which could be useful to conditionally build your frontend or execute a specific action. -- `TAURI_ENV_ARCH` — Target arch, `x86_64`, `aarch64`...etc. -- `TAURI_ENV_PLATFORM` — Target platform, `windows`, `macos`, `linux`...etc. -- `TAURI_ENV_FAMILY` — Target platform family `unix` or `windows`. -- `TAURI_ENV_PLATFORM_TYPE` — Target platform type `Linux`, `Windows_NT` or `Darwin` -- `TAURI_ENV_PLATFORM_VERSION` — Build platform version -- `TAURI_ENV_DEBUG` — `true` for `dev` command, `false` for `build` command. +- `TAURI_ENV_DEBUG` — `true` for `dev` command or `build --debug`, `false` otherwise. - `TAURI_ENV_TARGET_TRIPLE` — Target triple the CLI is building. +- `TAURI_ENV_ARCH` — Target arch, `x86_64`, `aarch64`...etc. +- `TAURI_ENV_PLATFORM` — Target platform, `windows`, `darwin`, `linux`...etc. +- `TAURI_ENV_PLATFORM_VERSION` — Build platform version +- `TAURI_ENV_FAMILY` — Target platform family `unix` or `windows`. diff --git a/tooling/cli/src/interface/rust.rs b/tooling/cli/src/interface/rust.rs index 4a1e7eb6d..9cecade8d 100644 --- a/tooling/cli/src/interface/rust.rs +++ b/tooling/cli/src/interface/rust.rs @@ -241,17 +241,8 @@ impl Interface for Rust { } }; - env.insert( - "TAURI_ENV_ARCH", - match arch { - // keeps compatibility with old `std::env::consts::ARCH` implementation - "i686" | "i586" => "x86".into(), - a => a.into(), - }, - ); - + env.insert("TAURI_ENV_ARCH", arch.into()); env.insert("TAURI_ENV_PLATFORM", host.into()); - env.insert( "TAURI_ENV_FAMILY", match host { @@ -260,13 +251,6 @@ impl Interface for Rust { }, ); - match host { - "linux" => env.insert("TAURI_ENV_PLATFORM_TYPE", "Linux".into()), - "windows" => env.insert("TAURI_ENV_PLATFORM_TYPE", "Windows_NT".into()), - "darwin" => env.insert("TAURI_ENV_PLATFORM_TYPE", "Darwin".into()), - _ => None, - }; - env } }