Commit Graph

72 Commits

Author SHA1 Message Date
sftse
e3fdcb5002 refactor tauri-cli (#14836)
* refactor(tauri-cli): use OsString where possible

* refactor(tauri-cli): remove needless scoping blocks

* refactor(tauri-cli): make return type concrete

* refactor(tauri-cli): use ?

* refactor(tauri-cli): coerce later to trait object

* refactor(tauri-cli): remove clone

* refactor(tauri-cli): make better use of static OnceLock

* fix(tauri-cli): upgrade atomics to SeqCst

* Add change file

* Update .changes/change-pr-14836.md

Co-authored-by: Tony <68118705+Legend-Master@users.noreply.github.com>
2026-01-29 10:39:00 +08:00
sftse
d453e2e06a refactor(tauri-cli): remove trait implemented only once (#14840) 2026-01-29 10:35:55 +08:00
sftse
3a4e165b6f Less statics fixup (#14833)
* fix(tauri-cli): be more conservative to preserve behavior (#14804)

* refactor(tauri-cli): move app path initialization into commands
2026-01-27 16:33:11 +08:00
Lucas Fernandes Nogueira
62aa13a124 fix(cli): Android build --apk and --aab flags requiring a value (#14629)
Co-authored-by: Fabian-Lars <github@fabianlars.de>
2026-01-19 20:32:43 +01:00
Tony
08e35fcda0 refactor(cli): remove mutex on config (#14791)
* refactor(cli): remove mutex on config

* Fix ios

* Clippy

* Fix ios

* Unused import

* Fix ios closure and clippy

* Import `ConfigMetadata`

* Remove life time tags
2026-01-18 21:09:36 +08:00
Tony
10a8066db3 refactor(cli): reorder a few parameters (#14792) 2026-01-18 20:57:36 +08:00
sftse
7f7d9aac21 Less statics (#14668)
* refactor(tauri-cli): introduce replacement functions

* refactor(tauri-cli): apply replacement to remove.rs

* refactor(tauri-cli): apply replacement to icon.rs

* refactor(tauri-cli): apply replacement to bundle.rs

* refactor(tauri-cli): apply replacement to build.rs

* refactor(tauri-cli): apply replacement to add.rs

* refactor(tauri-cli): apply replacement to dev.rs

* refactor(tauri-cli): less controlflow

* refactor(tauri-cli): split config loading from locking static

* refactor(tauri-cli): remove duplicate checks covered by if let Some(tauri_dir) = tauri_dir

tauri_dir.is_some() must be true, otherwise the entire block is not run, so the frontend_dir check
is irrelevant

* fmt

* refactor(tauri-cli): apply replacement to inspect.rs

* refactor(tauri-cli): dont use statics for config

* refactor(tauri-cli): finish threading directory paths through functions

* fix: clippy

* fixup CI

* refactor(tauri-cli): dont need mutex

* refactor(tauri-cli): rescope mutex use to minimal necessary

* fix CI, reduce mutex use

* fixup PR #14607

* fix: clippy

* refactor(tauri-cli): remove ConfigHandle

* refactor(tauri-cli): remove more unwraps and panicing functions

* refactor(tauri-cli): less mutexes

* refactor(tauri-cli): undo mistaken change, address review comment

* Split android build to 2 functions

* Pass in dirs to migration v1 like the v2 beta

* Add change file

---------

Co-authored-by: Tony <legendmastertony@gmail.com>
2026-01-17 23:52:42 +08:00
sftse
a2abe2e6bc refactor(cli): simplify features: Option<Vec<String>> to Vec<String> (#14607)
* refactor: use empty vector for features instead of None

* refactor: reorder

* add change file

* comment: highlight places where serialization is used

* refactor: simplify serialization

* Update .changes/empty-vec-instead-of-none.md

* Update crates/tauri-cli/src/mobile/ios/mod.rs

---------

Co-authored-by: Tony <68118705+Legend-Master@users.noreply.github.com>
2025-12-29 13:54:51 +08:00
sftse
2d28e3143e Cleanups (#14632)
* refactor(tauri-utils): current_dest and current_pattern always change in-sync, group them to one Option

* refactor(tauri-utils): pass path as explicit argument instead of implicitly through self

* refactor(tauri-utils): remove struct field that is never set to Some

* refactor(tauri-cli): use OsString, OsStr where possible

* refactor(tauri-cli): Deref Arc early

* refactor(tauri-cli): lock config before passing to build::setup()

* refactor(tauri-build, tauri-utils): bettern pattern matching and borrowing

* refactor(tauri-cli): dont need Arc if already have static

* fix(tauri-cli): race condition initializing static flag, remove unnecessary OnceLock

* refactor(tauri-cli): use expect

* refactor(tauri-cli): remove unnecessary OnceLock

* refactor(tauri-cli): better use of dunce api

* refactor(tauri-cli): rename
2025-12-09 21:38:14 +08:00
Tunglies
ee3cc4a91b perf: remove needless clones in various files for improved performance (#14475)
Co-authored-by: Fabian-Lars <github@fabianlars.de>
2025-11-17 15:27:49 +01:00
Bipin Pandey
3b4fac2017 feat(android): add auto_increment_version_code option for Android builds (#14194)
* add new api (auto_increment_version_code) in android configuration

* ensure increment is only ran once

* skip on dev

* update doc

* change file

---------

Co-authored-by: Lucas Nogueira <lucas@tauri.app>
2025-10-14 15:01:54 -03:00
Lucas Fernandes Nogueira
75082cc5b3 feat(cli): add mobile run commands, closes #13196 (#14120)
* feat(cli): add mobile run commands, closes #13196

* headers

* debug by default

* fix android env

* implement watcher

* clippy

* skip ipa build
2025-10-08 07:58:17 -03:00
DomanskiFilip
19fb6f7cb0 fix(cli): improve Android BuildTask.kt Windows executable detection for nvm4w Fixes #13892 (#14146)
* fix(cli): improve Android BuildTask.kt Windows executable detection

- Fix Android build error on Windows when using nvm4w
- Add robust fallback logic for Windows executable detection
- Prevent 'node.exe.cmd' and 'Cannot find module' errors
- Graceful fallback to cargo when Node.js detection fails

Fixes #13892

* strip extension from project, try exe/cmd/bat

* revert args

---------

Co-authored-by: Lucas Nogueira <lucas@tauri.app>
2025-10-07 15:25:49 -03:00
Lucas Fernandes Nogueira
28a2f9bc55 fix(cli): ensure Xcode project is up to date with Cargo project name (#14101)
* fix(cli): ensure Xcode project is up to date with Cargo project name

closes #13542

* clippy
2025-10-06 14:06:04 -03:00
Lucas Fernandes Nogueira
ed7c9a4100 feat(core): add config for Info.plist extensions, closes #13667 (#14108)
* feat(core): add config for Info.plist extensions, closes #13667

* add missing tag

* do not lie :)
2025-10-06 14:05:33 -03:00
Lucas Fernandes Nogueira
abf7e8850b fix(cli): mobile init when using pnpm dlx (#14118)
i noticed this when testing #13180 (though the original issue refers to npx, which I could not reproduce yet)
2025-10-06 13:12:00 -03:00
Lucas Fernandes Nogueira
b0012424c5 fix(cli): resolve IP when dev URL host is unspecified, closes #13356 (#14115)
currently the `use_network_address_for_dev_url` function already detects Ipv4Addr::UNSPECIFIED to resolve the local IP address for mobile development when the dev URL host is 0.0.0.0, but we only call it when `--host` is provided or running on a physical device. This change detects the unspecified host early and force the resolution to run even for simulator builds
2025-10-06 13:11:48 -03:00
Lucas Fernandes Nogueira
6bbb530fd5 chore(cli): warn when product name is missing, closes #14034 (#14105) 2025-10-02 08:28:30 -03:00
Lucas Fernandes Nogueira
b06b3bd091 refactor(cli): improve errors (#14126)
* refactor(cli): improve errors

* update change files

* license

* add errorext with fs_context helper

* update linux

* lint

* fmt

* windows

* revert bundler breaking change

* fix ios mod

* ref

* reduce amount of enum variants

* fix macos build

* Fix windows build

* Clippy

* capitalize cargo [skip ci]

---------

Co-authored-by: Tony <legendmastertony@gmail.com>
2025-10-02 06:58:26 -03:00
Lucas Fernandes Nogueira
673867aa0e feat(cli): detect Android env and install SDK and NDK if needed (#14094)
* feat(cli): detect Android env and install SDK and NDK if needed

changes the Android setup to be a bit more automated - looking up ANDROID_HOME and NDK_HOME from common system paths and installing the Android SDK and NDK if needed using the command line tools

* fix windows

* clippy

* lint

* add prmopts and ci check

* also check ANDROID_SDK_ROOT
2025-10-01 09:33:14 -03:00
SHIGRAF SALIK
2a06d10066 feat(bundle): add --no-sign flag to skip code signing in bundling pro… (#14052)
* feat(bundle): add --no-sign flag to skip code signing in bundling process

- Introduce a
o_sign option in bundle settings to allow skipping code signing
- Update macOS and Windows bundler implementations to respect the flag
- Wire up CLI option --no-sign to control signing behavior during bundling
- Add necessary config and type changes to propagate the flag throughout bundler

Signed-off-by: ShigrafS <shigrafsalik@proton.me>

* ci: added yml for github action testing

Signed-off-by: ShigrafS <shigrafsalik@proton.me>

* fix: fixed field 'digest_algorithm' is already declared error

Signed-off-by: ShigrafS <shigrafsalik@proton.me>

* ci: updated to test the new features as well

Signed-off-by: ShigrafS <shigrafsalik@proton.me>

* ci: fixed yml issue

Signed-off-by: ShigrafS <shigrafsalik@proton.me>

* fix: fixed missing parameter issue in android sign.rs

Signed-off-by: ShigrafS <shigrafsalik@proton.me>

* chore: apply linting

Signed-off-by: ShigrafS <shigrafsalik@proton.me>

* chore: remove redundant files

Signed-off-by: ShigrafS <shigrafsalik@proton.me>

* chore: revert indentations

Signed-off-by: ShigrafS <shigrafsalik@proton.me>

* fix: added parameters to ios mobile build.rs

Signed-off-by: ShigrafS <shigrafsalik@proton.me>

* docs: updated documentation for settigs.rs

Signed-off-by: ShigrafS <shigrafsalik@proton.me>

* docs(cli): add documentation for
o_sign flag in build options

Signed-off-by: ShigrafS <shigrafsalik@proton.me>

* chore: apply cargo fmt

Signed-off-by: ShigrafS <shigrafsalik@proton.me>

* docs: added CHANGES.md

Signed-off-by: ShigrafS <shigrafsalik@proton.me>

* refactor(bundler): make
o_sign private and add getter

Signed-off-by: ShigrafS <shigrafsalik@proton.me>

* fix: minor error

Signed-off-by: ShigrafS <shigrafsalik@proton.me>

* refactor: revert build_benchmark_jsons.rs

Signed-off-by: ShigrafS <shigrafsalik@proton.me>

* impl for macos too

* fix ci

* fix windows build

---------

Signed-off-by: ShigrafS <shigrafsalik@proton.me>
Co-authored-by: Lucas Nogueira <lucas@tauri.app>
2025-09-01 13:59:55 -03:00
Lucas Fernandes Nogueira
f6622a3e34 feat(cli): prompt to install iOS runtime if needed, closes #9186 (#14129)
* feat(cli): prompt to install iOS runtime if needed, closes #9186

* ensure runtime is installed

* only when running directly

* use starts_with
2025-09-01 13:55:51 -03:00
Lucas Fernandes Nogueira
bcf000c0a8 fix(cli): ios command failing when running with deno, closes #13547 (#14110)
Deno doesn't set an environment variable to help us, so I had to use the exe path to determine whether we're running under deno or not
2025-08-28 18:02:46 -03:00
Lucas Fernandes Nogueira
61b9b681e8 feat(cli): retain all RUST_* env vars on mobile commands (#14111)
useful to propagate RUST_BACKTRACE to the IDE commands
2025-08-28 18:02:22 -03:00
Lucas Fernandes Nogueira
956b4fd6ff fix(cli): export method on Xcode < 15.4, closes #13818 (#14106)
see https://github.com/fastlane/fastlane/issues/22028 for additional context
2025-08-28 12:37:26 -03:00
Lucas Fernandes Nogueira
f70b28529d feat(cli): ensure mobile Rust targets are installed (#14093)
currently we only install Rust targets for mobile when initializing the projects.

Users can commit the Android/iOS projects, so running the init command is not a requirement to develop mobile apps. This change ensures the Rust targets are installed before trying to compile them.
2025-08-27 18:05:24 -03:00
Lucas Fernandes Nogueira
bc4afe7dd4 feat(cli): check plugin versions for incompatibilities (#13993)
* feat(cli): check plugin versions for incompatibilities

check core plugin versions for incompatibilities between Cargo and NPM releases

a plugin NPM/cargo version is considered "incompatible" if their major or minor versions are not equal

on dev we show an warning
on build we error out (with a `--ignore-incompatible-plugins` flag to prevent that)

this is an idea from @oscartbeaumont
we've seen several plugin changes that require updates for both the cargo and the NPM releases of a plugin, and if they are not in sync, the functionality does not work
e.g. https://github.com/tauri-apps/plugins-workspace/pull/2573 where the change actually breaks the app updater if you miss the NPM update

* Use list to get multiple package versions at once

* Fix for older rust versions

* Clippy

* Support yarn classic

* Support yarn berry

* Use `.cmd` only for `npm`, `yarn`, `pnpm`

* Use yarn list without --pattern

* rename

* Extract function `check_incompatible_packages`

* Check `tauri` <-> `@tauri-apps/api`

* incompatible -> mismatched

* run build check in parallel

* rename struct

* Switch back to use sync check and add todo

* Extract to function `cargo_manifest_and_lock`

---------

Co-authored-by: Tony <legendmastertony@gmail.com>
2025-08-17 12:24:40 -03:00
Lucas Fernandes Nogueira
d6d5f37077 feat: add --root-certificate-path option for mobile dev (#13358)
* feat: add `--root-certificate-path` option for mobile dev

lets you use a HTTPS development server

example usage:
```
cargo install tauri-cli --git https://github.com/tauri-apps/tauri --branch feat/mobile-dev-cert
cargo tauri android dev --open --root-certificate-path "/Users/lucas/Library/Application Support/mkcert/rootCA.pem" --features tauri/rustls-tls
```

* Apply suggestions from code review

Co-authored-by: Fabian-Lars <github@fabianlars.de>

---------

Co-authored-by: Fabian-Lars <github@fabianlars.de>
2025-08-16 09:13:10 -03:00
Fabian-Lars
a9ec12843a feat: add option to not wait on notarization to finish (#13521)
* feat: add option to not wait on notarization to finish

* cli arg istead of config

* changefile

* fix serde

---------

Co-authored-by: Lucas Nogueira <lucas@tauri.app>
2025-08-11 14:29:41 -03:00
Tony
196ace3c04 fix: return error on window creation failed (#13970)
* fix: return error on window creation failed

* Add todo about adding error inside `CreateWindow`
2025-08-09 22:43:18 +08:00
Jack Lavigne
91508c0b8d feat: add config option for custom watch folders (#13881)
* feat: add config option for custom watch folders

* fix: cargo clippy changes

* chore: remove file

* fix: ios dev

* docs: clarify absolute allowed

* refactor: rename variable

* fix: review suggestions

* fix: resolve paths

* fixL use canonicalize

* chore: add changefile

* chore: add error if cant canonicalize

* reformat changelog

* Update .changes/additional-watch-folders.md

* Update crates/tauri-cli/src/interface/rust.rs

Co-authored-by: Tony <68118705+Legend-Master@users.noreply.github.com>

* Revert "Update .changes/additional-watch-folders.md"

This reverts commit 98186b1a89.

* Also bump `@tauri-apps/cli`

* Apparently I'm so used to a higher rust version

* Revert "Apparently I'm so used to a higher rust version"

This reverts commit ea1d89e2d3.

* Need to check for existence for abs paths as well

---------

Co-authored-by: Tony <68118705+Legend-Master@users.noreply.github.com>
Co-authored-by: Tony <legendmastertony@gmail.com>
2025-07-24 22:21:00 +08:00
Lucas Fernandes Nogueira
916aeaa486 fix(cli): android commands reading iOS config closes #13765 (#13781) 2025-07-08 08:49:47 -03:00
Lucas Fernandes Nogueira
cbd9629729 fix(cli): load --config values on xcode and android-studio scripts (#13730) 2025-06-28 17:16:36 -03:00
Fabian-Lars
6b2b9d6cbf chore: clippy 1.88 (#13720) 2025-06-27 15:33:36 +02:00
renovate[bot]
a3ae2cebbf chore(deps): update rust crate rand to 0.9 (#13700)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: FabianLars <github@fabianlars.de>
2025-06-26 15:47:42 +02:00
Lucas Fernandes Nogueira
3242e1c946 feat(cli): allow passing Cargo commands to mobile dev/build commands (#13659)
* feat(cli): allow passing Cargo commands to mobile dev/build commands

* fmt
2025-06-23 14:47:21 -03:00
Lucas Fernandes Nogueira
4a880ca697 feat(cli): synchronize productName changes with iOS Xcode project (#13658)
* feat(cli): synchronize productName changes with iOS Xcode project

* fmt
2025-06-23 14:47:10 -03:00
Lucas Fernandes Nogueira
d1ce9af628 feat(cli): add --config arg to the mobile init cmds, closes #13284 (#13660) 2025-06-23 12:55:07 -03:00
Lucas Fernandes Nogueira
ec6065fa4a fix(cli): use original identifier to fix mobile options reading (#13625)
* fix(cli): read original identifier to fix mobile options reading

the iOS and Android CLI commands leverage an android_studio_script/xcode_script that is executed by the native IDE or build tool. This script reads the Tauri configuration to find the app identifier used to communicate with the parent Tauri CLI process to read CLI options.

The communication is broken when the `--config` arg is used, since the IDE script does not have access to that value before reaching the parent process, which is impossible without knowing the actual identifier used.

To bypass this we'll agree on using the original identifier. This obviously won't work if the original tauri.conf.json do not have an identifier, so we error out in this case

* fix build, lint
2025-06-23 09:29:46 -03:00
Lucas Fernandes Nogueira
5a5291d66c fix(cli): use platform name to detect iOS architecture to build (#13483) 2025-05-21 14:12:44 -03:00
Lucas Fernandes Nogueira
82406c61e0 feat(cli): improve iOS simulator usage and check SDK installation (#13231)
applies https://github.com/tauri-apps/cargo-mobile2/pull/453
2025-04-14 14:57:13 -03:00
Lucas Fernandes Nogueira
3752fed282 feat(cli): enhance iOS bundle version formatting (#13218)
* feat(cli): enhance iOS bundle version formatting

follow-up for #13030 and https://github.com/tauri-apps/cargo-mobile2/pull/450

the bundle version validation has been updated, now it can actually handle one or two integers (e.g. `100` or `10.7`) instead of just full triple semver strings (e.g. `10.7.1`).

* lint
2025-04-12 20:51:56 -03:00
Lucas Fernandes Nogueira
0802529031 fix(cli): iOS dev broken on Xcode 16.3, closes #13128 (#13210)
* fix(cli): iOS dev broken on Xcode 16.3, closes #13128

Looks like we cannot use the arm64-sim custom architecture on Xcode 16.3, as it incorrectly appends the -sim suffix on some clang build scripts which ends up with an invalid target triple.

Currently we do not have automation to update Xcode/Android projects, so a manual intervention is required by our users, either recreating the project or modifying it manually (the arm64-sim arch must be removed and all its references).

ref https://github.com/tauri-apps/cargo-mobile2/pull/445

* fix dev on macOS with intel chip
2025-04-12 12:50:06 -03:00
Matthew Richardson
0aa48fb9e4 feat: Support custom CFBundleVersion for iOS and macOS (#13030)
* feat: Add bundleVersion for iOS and macOS

* feat: Use bundleVersion for CFBundleVersion

* feat: Synchronize bundleVersion with Info.plist

* cleanup

* fix bundle version, enhance prerelease/buildnumber support and checks

* fix change file

* tauri-bundler to change file

* expand doc

---------

Co-authored-by: Lucas Nogueira <lucas@tauri.app>
2025-04-12 09:28:48 -03:00
Tony
80dccb6a2e chore: fix a few internal docs and apply clippy suggestions (#13131)
* chore: fix a few internal docs

* Remove label clone

* Unused allow lint

* No way clippy just updated

* `cargo clippy --fix -- -W clippy::redundant_clone`

* format
2025-04-03 17:57:36 +02:00
Pietagorh
f805061d11 feat(cli): allow for toml and json5 files in --config arg (#13079) 2025-03-30 18:11:47 +02:00
Lucas Fernandes Nogueira
b83921226c fix(cli): ios command wrong cwd on bun 1.2, closes #12965 (#12977)
bun 1.2 changed the current working directory behavior to match NPM managers, so we must adapt our xcode-script logic to check the bun version

see https://bun.sh/blog/bun-v1.2#bun-run-uses-the-correct-directory
2025-03-14 16:20:39 -03:00
Lucas Fernandes Nogueira
d91bfa5cb9 feat(cli): allow merging multiple configuration values (#12970)
* feat(cli): allow merging multiple configuration values

Currently the dev/build/bundle commands can only merge a single Tauri configuration value (file or raw JSON string), which imposes a limitation in scenarios where you need more flexibility (like multiple app flavors and environments). This changes the config CLI option to allow multiple values, letting you merge multiple Tauri config files with the main one.

* fix ios build
2025-03-14 12:04:58 -03:00
bradleat
1a86974aa3 fix(cli): let xcode handle building for ios build --open (#12406)
Co-authored-by: Fabian-Lars <github@fabianlars.de>
2025-01-25 13:42:20 +01:00
Fabian-Lars
cde0ff7798 chore: Fix clippy 1.84 warnings (#12328) 2025-01-10 13:47:37 +01:00