Skip to content

Commit 9bb6897

Browse files
fix(cli.rs): prefix the "before script" env vars with TAURI_ (#3274)
1 parent d801cc8 commit 9bb6897

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

.changes/before-script-envs.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
"cli.rs": patch
33
---
44

5-
Define `PLATFORM`, `ARCH`, `FAMILY`, `PLATFORM_TYPE` and `TAURI_DEBUG` environment variables for the `beforeDevCommand` and `beforeBuildCommand` scripts.
5+
Define `TAURI_PLATFORM`, `TAURI_ARCH`, `TAURI_FAMILY`, `TAURI_PLATFORM_TYPE`, `TAURI_PLATFORM_VERSION` and `TAURI_DEBUG` environment variables for the `beforeDevCommand` and `beforeBuildCommand` scripts.

tooling/cli.rs/config_definition.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -850,11 +850,11 @@ pub struct BuildConfig {
850850
pub dist_dir: AppUrl,
851851
/// A shell command to run before `tauri dev` kicks in.
852852
///
853-
/// The PLATFORM, ARCH, FAMILY, PLATFORM_TYPE and TAURI_DEBUG environment variables are set if you perform conditional compilation.
853+
/// The TAURI_PLATFORM, TAURI_ARCH, TAURI_FAMILY, TAURI_PLATFORM_VERSION, TAURI_PLATFORM_TYPE and TAURI_DEBUG environment variables are set if you perform conditional compilation.
854854
pub before_dev_command: Option<String>,
855855
/// A shell command to run before `tauri build` kicks in.
856856
///
857-
/// The PLATFORM, ARCH, FAMILY, PLATFORM_TYPE and TAURI_DEBUG environment variables are set if you perform conditional compilation.
857+
/// The TAURI_PLATFORM, TAURI_ARCH, TAURI_FAMILY, TAURI_PLATFORM_VERSION, TAURI_PLATFORM_TYPE and TAURI_DEBUG environment variables are set if you perform conditional compilation.
858858
pub before_build_command: Option<String>,
859859
/// Features passed to `cargo` commands.
860860
pub features: Option<Vec<String>>,

tooling/cli.rs/src/helpers/mod.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,17 +44,17 @@ pub fn execute_with_output(cmd: &mut Command) -> crate::Result<()> {
4444
pub fn command_env(debug: bool) -> HashMap<String, String> {
4545
let mut map = HashMap::new();
4646

47-
map.insert("PLATFORM".into(), std::env::consts::OS.into());
48-
map.insert("ARCH".into(), std::env::consts::ARCH.into());
49-
map.insert("FAMILY".into(), std::env::consts::FAMILY.into());
50-
map.insert("VERSION".into(), os_info::get().version().to_string());
47+
map.insert("TAURI_PLATFORM".into(), std::env::consts::OS.into());
48+
map.insert("TAURI_ARCH".into(), std::env::consts::ARCH.into());
49+
map.insert("TAURI_FAMILY".into(), std::env::consts::FAMILY.into());
50+
map.insert("TAURI_PLATFORM_VERSION".into(), os_info::get().version().to_string());
5151

5252
#[cfg(target_os = "linux")]
53-
map.insert("PLATFORM_TYPE".into(), "Linux".into());
53+
map.insert("TAURI_PLATFORM_TYPE".into(), "Linux".into());
5454
#[cfg(target_os = "windows")]
55-
map.insert("PLATFORM_TYPE".into(), "Windows_NT".into());
55+
map.insert("TAURI_PLATFORM_TYPE".into(), "Windows_NT".into());
5656
#[cfg(target_os = "macos")]
57-
map.insert("PLATFORM_TYPE".into(), "Darwin".into());
57+
map.insert("TAURI_PLATFORM_TYPE".into(), "Darwin".into());
5858

5959
if debug {
6060
map.insert("TAURI_DEBUG".into(), "true".to_string());

0 commit comments

Comments
 (0)