diff --git a/.changes/cli-env-vars.md b/.changes/cli-env-vars.md new file mode 100644 index 000000000000..67ad78827900 --- /dev/null +++ b/.changes/cli-env-vars.md @@ -0,0 +1,16 @@ +--- +'tauri-cli': 'major:breaking' +'@tauri-apps/cli': 'major:breaking' +--- + +Changed a number of environment variables used by tauri CLI for consistency and clarity: + +- `TAURI_PRIVATE_KEY` -> `TAURI_SIGNINING_PRIVATE_KEY` +- `TAURI_KEY_PASSWORD` -> `TAURI_SIGNINING_PRIVATE_KEY_PASSWORD ` +- `TAURI_SKIP_DEVSERVER_CHECK` -> `TAURI_CLI_NO_DEV_SERVER_WAIT` +- `TAURI_DEV_SERVER_PORT` -> `TAURI_CLI_PORT` +- `TAURI_PATH_DEPTH` -> `TAURI_CLI_CONFIG_DEPTH` +- `TAURI_FIPS_COMPLIANT` -> `TAURI_BUNDLER_WIX_FIPS_COMPLIANT` +- `TAURI_DEV_WATCHER_IGNORE_FILE` -> `TAURI_CLI_WATCHER_IGNORE_FILENAME` +- `TAURI_TRAY` -> `TAURI_LINUX_AYATANA_APPINDICATOR` +- `TAURI_APPLE_DEVELOPMENT_TEAM` -> `APPLE_DEVELOPMENT_TEAM` diff --git a/.changes/cli-no-dev-server-wait.md b/.changes/cli-no-dev-server-wait.md new file mode 100644 index 000000000000..6a9b65d8a483 --- /dev/null +++ b/.changes/cli-no-dev-server-wait.md @@ -0,0 +1,6 @@ +--- +'tauri-cli': 'minor' +'@tauri-apps/cli': 'minor' +--- + +Add `--no-dev-server-wait` option to skip waiting for the dev server to start when using `tauri dev`. diff --git a/.changes/cli-removed-new-version-check.md b/.changes/cli-removed-new-version-check.md new file mode 100644 index 000000000000..6aa9dd07b1d5 --- /dev/null +++ b/.changes/cli-removed-new-version-check.md @@ -0,0 +1,6 @@ +--- +'tauri-cli': 'major:breaking' +'@tauri-apps/cli': 'major:breaking' +--- + +Removed checking for a new version of the CLI. diff --git a/.changes/tauri-env-vars.md b/.changes/tauri-env-vars.md new file mode 100644 index 000000000000..200baf9e3ba0 --- /dev/null +++ b/.changes/tauri-env-vars.md @@ -0,0 +1,16 @@ +--- +'tauri': 'major:breaking' +--- + +Changed a number of environment variables used by tauri for consistency and clarity: + +- `TAURI_AUTOMATION` -> `TAURI_WEBVIEW_AUTOMATION` +- `TAURI_PRIVATE_KEY` -> `TAURI_SIGNINING_PRIVATE_KEY` +- `TAURI_KEY_PASSWORD` -> `TAURI_SIGNINING_PRIVATE_KEY_PASSWORD ` +- `TAURI_SKIP_DEVSERVER_CHECK` -> `TAURI_CLI_NO_DEV_SERVER_WAIT` +- `TAURI_DEV_SERVER_PORT` -> `TAURI_CLI_PORT` +- `TAURI_PATH_DEPTH` -> `TAURI_CLI_CONFIG_DEPTH` +- `TAURI_FIPS_COMPLIANT` -> `TAURI_BUNDLER_WIX_FIPS_COMPLIANT` +- `TAURI_DEV_WATCHER_IGNORE_FILE` -> `TAURI_CLI_WATCHER_IGNORE_FILENAME` +- `TAURI_TRAY` -> `TAURI_LINUX_AYATANA_APPINDICATOR` +- `TAURI_APPLE_DEVELOPMENT_TEAM` -> `APPLE_DEVELOPMENT_TEAM` diff --git a/.changes/tauri-runtime-wry-env-vars.md b/.changes/tauri-runtime-wry-env-vars.md new file mode 100644 index 000000000000..6255b939e1dd --- /dev/null +++ b/.changes/tauri-runtime-wry-env-vars.md @@ -0,0 +1,5 @@ +--- +'tauri': 'major:breaking' +--- + +Changed `TAURI_AUTOMATION` to `TAURI_WEBVIEW_AUTOMATION` diff --git a/core/tauri-runtime-wry/src/lib.rs b/core/tauri-runtime-wry/src/lib.rs index d1e36a5508da..8d25d105f4a4 100644 --- a/core/tauri-runtime-wry/src/lib.rs +++ b/core/tauri-runtime-wry/src/lib.rs @@ -2680,7 +2680,7 @@ fn create_webview( let mut web_context = web_context_store.lock().expect("poisoned WebContext store"); let is_first_context = web_context.is_empty(); - let automation_enabled = std::env::var("TAURI_AUTOMATION").as_deref() == Ok("true"); + let automation_enabled = std::env::var("TAURI_WEBVIEW_AUTOMATION").as_deref() == Ok("true"); let web_context_key = // force a unique WebContext when automation is false; // the context must be stored on the HashMap because it must outlive the WebView on macOS if automation_enabled { diff --git a/tooling/bundler/src/bundle/linux/templates/appimage b/tooling/bundler/src/bundle/linux/templates/appimage index 9d1308a020c9..b5815a0600b7 100644 --- a/tooling/bundler/src/bundle/linux/templates/appimage +++ b/tooling/bundler/src/bundle/linux/templates/appimage @@ -8,7 +8,7 @@ set -euxo pipefail export ARCH={{arch}} APPIMAGE_BUNDLE_XDG_OPEN=${APPIMAGE_BUNDLE_XDG_OPEN-0} APPIMAGE_BUNDLE_GSTREAMER=${APPIMAGE_BUNDLE_GSTREAMER-0} -TRAY_LIBRARY_PATH=${TRAY_LIBRARY_PATH-0} +TAURI_TRAY_LIBRARY_PATH=${TAURI_TRAY_LIBRARY_PATH-0} if [ "$ARCH" == "i686" ]; then linuxdeploy_arch="i386" @@ -28,15 +28,15 @@ if [[ "$APPIMAGE_BUNDLE_XDG_OPEN" != "0" ]] && [[ -f "/usr/bin/xdg-open" ]]; the cp /usr/bin/xdg-open usr/bin fi -if [[ "$TRAY_LIBRARY_PATH" != "0" ]]; then - echo "Copying appindicator library ${TRAY_LIBRARY_PATH}" - cp ${TRAY_LIBRARY_PATH} usr/lib +if [[ "$TAURI_TRAY_LIBRARY_PATH" != "0" ]]; then + echo "Copying appindicator library ${TAURI_TRAY_LIBRARY_PATH}" + cp ${TAURI_TRAY_LIBRARY_PATH} usr/lib # It looks like we're practicing good hygiene by adding the ABI version. # But for compatibility we'll symlink this file to what we did before. # Specifically this prevents breaking libappindicator-sys v0.7.1 and v0.7.2. - if [[ "$TRAY_LIBRARY_PATH" == *.so.1 ]]; then - readonly soname=$(basename "$TRAY_LIBRARY_PATH") - readonly old_name=$(basename "$TRAY_LIBRARY_PATH" .1) + if [[ "$TAURI_TRAY_LIBRARY_PATH" == *.so.1 ]]; then + readonly soname=$(basename "$TAURI_TRAY_LIBRARY_PATH") + readonly old_name=$(basename "$TAURI_TRAY_LIBRARY_PATH" .1) echo "Adding compatibility symlink ${old_name} -> ${soname}" ln -s ${soname} usr/lib/${old_name} fi diff --git a/tooling/cli/Cargo.toml b/tooling/cli/Cargo.toml index e31de8fa3ea6..acbd1c42128a 100644 --- a/tooling/cli/Cargo.toml +++ b/tooling/cli/Cargo.toml @@ -48,7 +48,7 @@ jsonrpsee-ws-client = { version = "0.16", default-features = false } thiserror = "1" sublime_fuzzy = "0.7" clap_complete = "4" -clap = { version = "4.0", features = [ "derive" ] } +clap = { version = "4.0", features = [ "derive", "env" ] } anyhow = "1.0" tauri-bundler = { version = "2.0.0-alpha.8", default-features = false, path = "../bundler" } colored = "2.0" diff --git a/tooling/cli/ENVIRONMENT_VARIABLES.md b/tooling/cli/ENVIRONMENT_VARIABLES.md index 8416b62b93e2..3364e6c8e024 100644 --- a/tooling/cli/ENVIRONMENT_VARIABLES.md +++ b/tooling/cli/ENVIRONMENT_VARIABLES.md @@ -10,28 +10,30 @@ These environment variables are inputs to the CLI which may have an equivalent C > if both environment variable and CLI flag are used, the CLI flag will have priority. -- `TAURI_PATH_DEPTH` — Number of levels to traverse and find tauri configuration file. -- `TAURI_DEV_SERVER_PORT` — Port to use for the CLI built-in dev server. -- `TAURI_DEV_WATCHER_IGNORE_FILE` — A `.gitignore`-style file to control which files should be watched by the CLI in `dev` command. -- `TAURI_SKIP_DEVSERVER_CHECK` — Skip waiting for the frontend dev server to start before building the tauri application. -- `TAURI_SKIP_UPDATE_CHECK` — Skip checking for a newer CLI version before exiting the CLI process. -- `TAURI_TRAY` — Set this var to `ayatana` to use `libayatana-appindicator` for system tray on Linux or set it `appindicator` to use `libappindicator`. - - For `deb` bundle target, the CLI will add the appropriate package as a dependency, if unset, the CLI will default to `ayatana`. - - For `appimage` bundle target, the CLI will copy the appropriate package to the appimage. if unset, the CLI will make a guess based on what package is installed on the developer system. -- `TAURI_FIPS_COMPLIANT` — Specify WiX `FipsCompliant` option -- `TAURI_PRIVATE_KEY` — Private key used to sign your app bundles -- `TAURI_KEY_PASSWORD` — The private key password, see `TAURI_PRIVATE_KEY` +- `CI` — If set, the CLI will run in CI mode and won't require any user interaction. +- `TAURI_CLI_CONFIG_DEPTH` — Number of levels to traverse and find tauri configuration file. +- `TAURI_CLI_PORT` — Port to use for the CLI built-in dev server. +- `TAURI_CLI_WATCHER_IGNORE_FILENAME` — Name of a `.gitignore`-style file to control which files should be watched by the CLI in `dev` command. The CLI will look for this file name in each directory. +- `TAURI_CLI_NO_DEV_SERVER_WAIT` — Skip waiting for the frontend dev server to start before building the tauri application. +- `TAURI_LINUX_AYATANA_APPINDICATOR` — Set this var to `true` or `1` to force usage of `libayatana-appindicator` for system tray on Linux. +- `TAURI_BUNDLER_WIX_FIPS_COMPLIANT` — Specify the bundler's WiX `FipsCompliant` option. +- `TAURI_SIGNINING_PRIVATE_KEY` — Private key used to sign your app bundles, can be either a string or a path to the file. +- `TAURI_SIGNINING_PRIVATE_KEY_PASSWORD` — The signging private key password, see `TAURI_SIGNINING_PRIVATE_KEY`. - `APPLE_CERTIFICATE` — Base64 encoded of the `.p12` certificate for code signing. To get this value, run `openssl base64 -in MyCertificate.p12 -out MyCertificate-base64.txt`. - `APPLE_CERTIFICATE_PASSWORD` — The password you used to export the certificate. - `APPLE_ID` — The Apple ID used to notarize the application. If this environment variable is provided, `APPLE_PASSWORD` must also be set. Alternatively, `APPLE_API_KEY` and `APPLE_API_ISSUER` can be used to authenticate. - `APPLE_PASSWORD` — The Apple password used to authenticate for application notarization. Required if `APPLE_ID` is specified. An app-specific password can be used. Alternatively to entering the password in plaintext, it may also be specified using a '@keychain:' or '@env:' prefix followed by a keychain password item name or environment variable name. - `APPLE_API_KEY` — Alternative to `APPLE_ID` and `APPLE_PASSWORD` for notarization authentication using JWT. - - This option will search the following directories in sequence for a private key file with the name of 'AuthKey_.p8': './private_keys', '~/private_keys', '~/.private_keys', and '~/.appstoreconnect/private_keys'. Additionally, you can set environment variable $API_PRIVATE_KEYS_DIR or a user default API_PRIVATE_KEYS_DIR to specify the directory where your AuthKey file is located. + - This option will search the following directories in sequence for a private key file with the name of `AuthKey\_.p8`: `./private_keys`, `~/private_keys`, `~/.private_keys`, and `~/.appstoreconnect/private_keys`. Additionally, you can set environment variable `API_PRIVATE_KEYS_DIR` to specify the directory where your AuthKey file is located. - See [creating API keys](https://developer.apple.com/documentation/appstoreconnectapi/creating_api_keys_for_app_store_connect_api) for more information. +- `API_PRIVATE_KEYS_DIR` — Specify the directory where your AuthKey file is located. See `APPLE_API_KEY`. - `APPLE_API_ISSUER` — Issuer ID. Required if `APPLE_API_KEY` is specified. - `APPLE_SIGNING_IDENTITY` — The identity used to code sign. Overwrites `tauri.conf.json > tauri > bundle > macOS > signingIdentity`. - `APPLE_PROVIDER_SHORT_NAME` — If your Apple ID is connected to multiple teams, you have to specify the provider short name of the team you want to use to notarize your app. Overwrites `tauri.conf.json > tauri > bundle > macOS > providerShortName`. -- `CI` — If set, the CLI will run in CI mode and won't require any user interaction. +- `APPLE_DEVELOPMENT_TEAM` — TODO +- `TAURI_WEBVIEW_AUTOMATION` — Enables webview automation (Linux Only). +- `TAURI_ANDROID_PROJECT_PATH` — Path of the tauri android project, usually will be `/src-tauri/gen/android`. +- `TAURI_IOS_PROJECT_PATH` — Path of the tauri iOS project, usually will be `/src-tauri/gen/ios`. ### Tauri CLI Hook Commands diff --git a/tooling/cli/src/build.rs b/tooling/cli/src/build.rs index a9a7e4bc3614..729cf176c703 100644 --- a/tooling/cli/src/build.rs +++ b/tooling/cli/src/build.rs @@ -166,12 +166,12 @@ pub fn command(mut options: Options, verbosity: u8) -> Result<()> { // If updater is active and we bundled it if config_.tauri.bundle.updater.active && !updater_bundles.is_empty() { // if no password provided we use an empty string - let password = var_os("TAURI_KEY_PASSWORD") + let password = var_os("TAURI_SIGNINING_PRIVATE_KEY_PASSWORD") .map(|v| v.to_str().unwrap().to_string()) .or_else(|| if ci { Some("".into()) } else { None }); // get the private key let secret_key = if let Some(mut private_key) = - var_os("TAURI_PRIVATE_KEY").map(|v| v.to_str().unwrap().to_string()) + var_os("TAURI_SIGNINING_PRIVATE_KEY").map(|v| v.to_str().unwrap().to_string()) { // check if env var points to a file.. let pk_dir = Path::new(&private_key); @@ -183,7 +183,7 @@ pub fn command(mut options: Options, verbosity: u8) -> Result<()> { } updater_secret_key(private_key, password) } else { - Err(anyhow::anyhow!("A public key has been found, but no private key. Make sure to set `TAURI_PRIVATE_KEY` environment variable.")) + Err(anyhow::anyhow!("A public key has been found, but no private key. Make sure to set `TAURI_SIGNINING_PRIVATE_KEY` environment variable.")) }?; let pubkey = @@ -201,7 +201,7 @@ pub fn command(mut options: Options, verbosity: u8) -> Result<()> { let (signature_path, signature) = sign_file(&secret_key, path)?; if signature.keynum() != public_key.keynum() { return Err(anyhow::anyhow!( - "The updater secret key from `TAURI_PRIVATE_KEY` does not match the public key defined in `tauri.conf.json > tauri > updater > pubkey`." + "The updater secret key from `TAURI_SIGNINING_PRIVATE_KEY` does not match the public key defined in `tauri.conf.json > tauri > updater > pubkey`." )); } signed_paths.append(&mut vec![signature_path]); diff --git a/tooling/cli/src/dev.rs b/tooling/cli/src/dev.rs index 734cfa443d32..1e91a566c217 100644 --- a/tooling/cli/src/dev.rs +++ b/tooling/cli/src/dev.rs @@ -36,7 +36,8 @@ static KILL_BEFORE_DEV_FLAG: OnceCell = OnceCell::new(); #[cfg(unix)] const KILL_CHILDREN_SCRIPT: &[u8] = include_bytes!("../scripts/kill-children.sh"); -pub const TAURI_DEV_WATCHER_GITIGNORE: &[u8] = include_bytes!("../tauri-dev-watcher.gitignore"); +pub const TAURI_CLI_BUILTIN_WATCHER_IGNORE_FILE: &[u8] = + include_bytes!("../tauri-dev-watcher.gitignore"); #[derive(Debug, Clone, Parser)] #[clap(about = "Tauri dev", trailing_var_arg(true))] @@ -61,19 +62,22 @@ pub struct Options { pub release_mode: bool, /// Command line arguments passed to the runner. Arguments after `--` are passed to the application. pub args: Vec, - /// Disable the file watcher + /// Skip waiting for the frontend dev server to start before building the tauri application. + #[clap(long, env = "TAURI_CLI_NO_DEV_SERVER_WAIT")] + pub no_dev_server_wait: bool, + /// Disable the file watcher. #[clap(long)] pub no_watch: bool, - /// Disable the dev server for static files. - #[clap(long)] - pub no_dev_server: bool, - /// Specify port for the dev server for static files. Defaults to 1430 - /// Can also be set using `TAURI_DEV_SERVER_PORT` env var. - #[clap(long)] - pub port: Option, /// Force prompting for an IP to use to connect to the dev server on mobile. #[clap(long)] pub force_ip_prompt: bool, + + /// Disable the built-in dev server for static files. + #[clap(long)] + pub no_dev_server: bool, + /// Specify port for the built-in dev server for static files. Defaults to 1430. + #[clap(long, env = "TAURI_CLI_PORT")] + pub port: Option, } pub fn command(options: Options) -> Result<()> { @@ -318,10 +322,6 @@ pub fn setup(target: Target, options: &mut Options, mobile: bool) -> Result Result, reason: ExitReason, exit_on_panic: bool, n && (exit_on_panic || matches!(reason, ExitReason::NormalExit))) { kill_before_dev_process(); - #[cfg(not(debug_assertions))] - let _ = check_for_updates(); exit(code.unwrap_or(0)); } } -#[cfg(not(debug_assertions))] -fn check_for_updates() -> Result<()> { - if std::env::var_os("TAURI_SKIP_UPDATE_CHECK") != Some("true".into()) { - let current_version = crate::info::cli_current_version()?; - let current = semver::Version::parse(¤t_version)?; - - let upstream_version = crate::info::cli_upstream_version()?; - let upstream = semver::Version::parse(&upstream_version)?; - if current < upstream { - println!( - "🚀 A new version of Tauri CLI is available! [{}]", - upstream.to_string() - ); - }; - } - Ok(()) -} - pub fn kill_before_dev_process() { if let Some(child) = BEFORE_DEV.get() { let child = child.lock().unwrap(); diff --git a/tooling/cli/src/helpers/app_paths.rs b/tooling/cli/src/helpers/app_paths.rs index 63eb85d51f43..01f3520bb483 100644 --- a/tooling/cli/src/helpers/app_paths.rs +++ b/tooling/cli/src/helpers/app_paths.rs @@ -41,10 +41,10 @@ fn lookup bool>(dir: &Path, checker: F) -> Option { .require_git(false) .ignore(false) .max_depth(Some( - std::env::var("TAURI_PATH_DEPTH") + std::env::var("TAURI_CLI_CONFIG_DEPTH") .map(|d| { d.parse() - .expect("`TAURI_PATH_DEPTH` environment variable must be a positive integer") + .expect("`TAURI_CLI_CONFIG_DEPTH` environment variable must be a positive integer") }) .unwrap_or(3), )) diff --git a/tooling/cli/src/helpers/config.rs b/tooling/cli/src/helpers/config.rs index bbf1f5129f0b..59e0ecf79125 100644 --- a/tooling/cli/src/helpers/config.rs +++ b/tooling/cli/src/helpers/config.rs @@ -95,7 +95,7 @@ pub fn wix_settings(config: WixConfig) -> tauri_bundler::WixSettings { enable_elevated_update_task: config.enable_elevated_update_task, banner_path: config.banner_path, dialog_image_path: config.dialog_image_path, - fips_compliant: var_os("TAURI_FIPS_COMPLIANT").map_or(false, |v| v == "true"), + fips_compliant: var_os("TAURI_BUNDLER_WIX_FIPS_COMPLIANT").map_or(false, |v| v == "true"), } } diff --git a/tooling/cli/src/helpers/web_dev_server.rs b/tooling/cli/src/helpers/web_dev_server.rs index 446f9291ff6c..eb63716c7661 100644 --- a/tooling/cli/src/helpers/web_dev_server.rs +++ b/tooling/cli/src/helpers/web_dev_server.rs @@ -73,13 +73,8 @@ pub fn start_dev_server>( let mut auto_port = false; let mut port = port.unwrap_or_else(|| { - std::env::var("TAURI_DEV_SERVER_PORT") - .unwrap_or_else(|_| { - auto_port = true; - "1430".to_string() - }) - .parse() - .unwrap() + auto_port = true; + 1430 }); let (server, server_url) = loop { diff --git a/tooling/cli/src/interface/rust.rs b/tooling/cli/src/interface/rust.rs index 07d7f481a163..b05762d69988 100644 --- a/tooling/cli/src/interface/rust.rs +++ b/tooling/cli/src/interface/rust.rs @@ -306,11 +306,14 @@ fn build_ignore_matcher(dir: &Path) -> IgnoreMatcher { ignore_builder.add(path); - if let Ok(ignore_file) = std::env::var("TAURI_DEV_WATCHER_IGNORE_FILE") { + if let Ok(ignore_file) = std::env::var("TAURI_CLI_WATCHER_IGNORE_FILENAME") { ignore_builder.add(dir.join(ignore_file)); } - for line in crate::dev::TAURI_DEV_WATCHER_GITIGNORE.lines().flatten() { + for line in crate::dev::TAURI_CLI_BUILTIN_WATCHER_IGNORE_FILE + .lines() + .flatten() + { let _ = ignore_builder.add_line(None, &line); } @@ -328,14 +331,14 @@ fn lookup(dir: &Path, mut f: F) { default_gitignore.push(".gitignore"); if !default_gitignore.exists() { if let Ok(mut file) = std::fs::File::create(default_gitignore.clone()) { - let _ = file.write_all(crate::dev::TAURI_DEV_WATCHER_GITIGNORE); + let _ = file.write_all(crate::dev::TAURI_CLI_BUILTIN_WATCHER_IGNORE_FILE); } } let mut builder = ignore::WalkBuilder::new(dir); builder.add_custom_ignore_filename(".taurignore"); let _ = builder.add_ignore(default_gitignore); - if let Ok(ignore_file) = std::env::var("TAURI_DEV_WATCHER_IGNORE_FILE") { + if let Ok(ignore_file) = std::env::var("TAURI_CLI_WATCHER_IGNORE_FILENAME") { builder.add_ignore(ignore_file); } builder.require_git(false).ignore(false).max_depth(Some(1)); @@ -1069,9 +1072,9 @@ fn tauri_config_to_bundle_settings( if enabled_features.contains(&"tray-icon".into()) || enabled_features.contains(&"tauri/tray-icon".into()) { - let (tray_kind, path) = std::env::var("TAURI_TRAY") - .map(|kind| { - if kind == "ayatana" { + let (tray_kind, path) = std::env::var("TAURI_LINUX_AYATANA_APPINDICATOR") + .map(|ayatana| { + if ayatana == "true" || ayatana == "1" { ( pkgconfig_utils::TrayKind::Ayatana, format!( @@ -1101,7 +1104,7 @@ fn tauri_config_to_bundle_settings( } } - std::env::set_var("TRAY_LIBRARY_PATH", path); + std::env::set_var("TAURI_TRAY_LIBRARY_PATH", path); } // provides `libwebkit2gtk-4.1.so.37` and all `4.0` versions have the -37 package name diff --git a/tooling/cli/src/mobile/android/dev.rs b/tooling/cli/src/mobile/android/dev.rs index 49063f664605..cf25a5037d3e 100644 --- a/tooling/cli/src/mobile/android/dev.rs +++ b/tooling/cli/src/mobile/android/dev.rs @@ -55,27 +55,29 @@ pub struct Options { /// JSON string or path to JSON file to merge with tauri.conf.json #[clap(short, long)] pub config: Option, + /// Run the code in release mode + #[clap(long = "release")] + pub release_mode: bool, + /// Skip waiting for the frontend dev server to start before building the tauri application. + #[clap(long, env = "TAURI_CLI_NO_DEV_SERVER_WAIT")] + pub no_dev_server_wait: bool, /// Disable the file watcher #[clap(long)] pub no_watch: bool, - /// Disable the dev server for static files. - #[clap(long)] - pub no_dev_server: bool, /// Open Android Studio instead of trying to run on a connected device #[clap(short, long)] pub open: bool, /// Runs on the given device name pub device: Option, - /// Specify port for the dev server for static files. Defaults to 1430 - /// Can also be set using `TAURI_DEV_SERVER_PORT` env var. - #[clap(long)] - pub port: Option, /// Force prompting for an IP to use to connect to the dev server on mobile. #[clap(long)] pub force_ip_prompt: bool, - /// Run the code in release mode - #[clap(long = "release")] - pub release_mode: bool, + /// Disable the built-in dev server for static files. + #[clap(long)] + pub no_dev_server: bool, + /// Specify port for the built-in dev server for static files. Defaults to 1430. + #[clap(long, env = "TAURI_CLI_PORT")] + pub port: Option, } impl From for DevOptions { @@ -88,6 +90,7 @@ impl From for DevOptions { config: options.config, args: Vec::new(), no_watch: options.no_watch, + no_dev_server_wait: options.no_dev_server_wait, no_dev_server: options.no_dev_server, port: options.port, force_ip_prompt: options.force_ip_prompt, diff --git a/tooling/cli/src/mobile/ios.rs b/tooling/cli/src/mobile/ios.rs index db6011bdc4f7..394ab22df55e 100644 --- a/tooling/cli/src/mobile/ios.rs +++ b/tooling/cli/src/mobile/ios.rs @@ -38,7 +38,7 @@ mod open; pub(crate) mod project; mod xcode_script; -pub const APPLE_DEVELOPMENT_TEAM_ENV_VAR_NAME: &str = "TAURI_APPLE_DEVELOPMENT_TEAM"; +pub const APPLE_DEVELOPMENT_TEAM_ENV_VAR_NAME: &str = "APPLE_DEVELOPMENT_TEAM"; const TARGET_IOS_VERSION: &str = "13.0"; #[derive(Parser)] diff --git a/tooling/cli/src/mobile/ios/dev.rs b/tooling/cli/src/mobile/ios/dev.rs index 0e0ea56cc68e..9ed6c3d8e330 100644 --- a/tooling/cli/src/mobile/ios/dev.rs +++ b/tooling/cli/src/mobile/ios/dev.rs @@ -45,24 +45,26 @@ pub struct Options { /// Run the code in release mode #[clap(long = "release")] pub release_mode: bool, + /// Skip waiting for the frontend dev server to start before building the tauri application. + #[clap(long, env = "TAURI_CLI_NO_DEV_SERVER_WAIT")] + pub no_dev_server_wait: bool, /// Disable the file watcher #[clap(long)] pub no_watch: bool, - /// Disable the dev server for static files. - #[clap(long)] - pub no_dev_server: bool, /// Open Xcode instead of trying to run on a connected device #[clap(short, long)] pub open: bool, /// Runs on the given device name pub device: Option, - /// Specify port for the dev server for static files. Defaults to 1430 - /// Can also be set using `TAURI_DEV_SERVER_PORT` env var. - #[clap(long)] - pub port: Option, /// Force prompting for an IP to use to connect to the dev server on mobile. #[clap(long)] pub force_ip_prompt: bool, + /// Disable the built-in dev server for static files. + #[clap(long)] + pub no_dev_server: bool, + /// Specify port for the built-in dev server for static files. Defaults to 1430. + #[clap(long, env = "TAURI_CLI_PORT")] + pub port: Option, } impl From for DevOptions { @@ -77,6 +79,7 @@ impl From for DevOptions { args: Vec::new(), no_watch: options.no_watch, no_dev_server: options.no_dev_server, + no_dev_server_wait: options.no_dev_server_wait, port: options.port, force_ip_prompt: options.force_ip_prompt, } diff --git a/tooling/cli/src/mobile/mod.rs b/tooling/cli/src/mobile/mod.rs index be71c589caa4..f00be93d94ca 100644 --- a/tooling/cli/src/mobile/mod.rs +++ b/tooling/cli/src/mobile/mod.rs @@ -198,7 +198,9 @@ fn env_vars() -> HashMap { vars.insert("RUST_LOG_STYLE".into(), "always".into()); for (k, v) in std::env::vars_os() { let k = k.to_string_lossy(); - if (k.starts_with("TAURI") && k != "TAURI_PRIVATE_KEY" && k != "TAURI_KEY_PASSWORD") + if (k.starts_with("TAURI") + && k != "TAURI_SIGNINING_PRIVATE_KEY" + && k != "TAURI_SIGNINING_PRIVATE_KEY_PASSWORD") || k.starts_with("WRY") || k.starts_with("CARGO_") || k == "TMPDIR" diff --git a/tooling/cli/src/signer/generate.rs b/tooling/cli/src/signer/generate.rs index 5bcb69c25d6c..7134f3e234b7 100644 --- a/tooling/cli/src/signer/generate.rs +++ b/tooling/cli/src/signer/generate.rs @@ -57,7 +57,7 @@ pub fn command(mut options: Options) -> Result<()> { ); } - println!("\nEnvironment variables used to sign:\n`TAURI_PRIVATE_KEY` Path or String of your private key\n`TAURI_KEY_PASSWORD` Your private key password (optional)\n\nATTENTION: If you lose your private key OR password, you'll not be able to sign your update package and updates will not work.\n---------------------------\n"); + println!("\nEnvironment variables used to sign:\n`TAURI_SIGNINING_PRIVATE_KEY` Path or String of your private key\n`TAURI_SIGNINING_PRIVATE_KEY_PASSWORD` Your private key password (optional)\n\nATTENTION: If you lose your private key OR password, you'll not be able to sign your update package and updates will not work.\n---------------------------\n"); Ok(()) } diff --git a/tooling/webdriver/src/webdriver.rs b/tooling/webdriver/src/webdriver.rs index cbdda96efc18..e17a18283283 100644 --- a/tooling/webdriver/src/webdriver.rs +++ b/tooling/webdriver/src/webdriver.rs @@ -45,7 +45,7 @@ pub fn native(args: &Args) -> Command { }; let mut cmd = Command::new(native_binary); - cmd.env("TAURI_AUTOMATION", "true"); + cmd.env("TAURI_WEBVIEW_AUTOMATION", "true"); cmd.arg(format!("--port={}", args.native_port)); cmd.arg(format!("--host={}", args.native_host)); cmd