tauri-apps / tauri

Build smaller, faster, and more secure desktop and mobile applications with a web frontend.
https://tauri.app
Apache License 2.0
84.58k stars 2.54k forks source link

[bug] cargo tauri ios build with -c configuration override fails to build #9970

Open jrouaix opened 5 months ago

jrouaix commented 5 months ago

Describe the bug

Hello,

We have an issue when overriding configuration at build time, in order to have distinct package identifier in dev or release.

the command cargo tauri ios build build the .ipa as expected, asking for the keychain and everything to build the app.

then the cargo tauri ios build -c ./src-tauri/tauri.conf-release.json where tauri.conf-release.json => (same values but "prd" in place of "dev")

{
  "productName": "supermobileapp.prd",
  "identifier": "com.awesome.prd.supermobileapp"
}

fails at

    /bin/sh -c /Users/me/Library/Developer/Xcode/DerivedData/supermobileapp-hjxnjxtlmccquodlbefzjuhxqfgw/Build/Intermediates.noindex/supermobileapp.build/release-iphoneos/supermobileapp_iOS.build/Script-9580F20638C11F3BDA18A1D4.sh
    Debug [jsonrpsee-client] Connecting to target: Target { sockaddrs: [127.0.0.1:50565], host: "127.0.0.1", host_header: "127.0.0.1:50565", _mode: Plain, path_and_query: "/" }
    Debug [jsonrpsee-client] Failed to connect to sockaddr: 127.0.0.1:50565
    Debug [jsonrpsee-client] Connecting to target: Target { sockaddrs: [], host: "127.0.0.1", host_header: "127.0.0.1:50565", _mode: Plain, path_and_query: "/" }
    Debug [jsonrpsee-client] Connecting to target: Target { sockaddrs: [], host: "127.0.0.1", host_header: "127.0.0.1:50565", _mode: Plain, path_and_query: "/" }
    Debug [jsonrpsee-client] Connecting to target: Target { sockaddrs: [], host: "127.0.0.1", host_header: "127.0.0.1:50565", _mode: Plain, path_and_query: "/" }
    Debug [jsonrpsee-client] Connecting to target: Target { sockaddrs: [], host: "127.0.0.1", host_header: "127.0.0.1:50565", _mode: Plain, path_and_query: "/" }
thread 'main' panicked at /Users/me/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tauri-cli-2.0.0-beta.20/src/mobile/mod.rs:282:6:
failed to read CLI options: Error when opening the TCP socket: Connection refused (os error 61)
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Command PhaseScriptExecution failed with a nonzero exit code

** BUILD FAILED **

The following build commands failed:
        PhaseScriptExecution Build\ Rust\ Code /Users/me/Library/Developer/Xcode/DerivedData/supermobileapp-hjxnjxtlmccquodlbefzjuhxqfgw/Build/Intermediates.noindex/supermobileapp.build/release-iphoneos/supermobileapp_iOS.build/Script-9580F20638C11F3BDA18A1D4.sh (in target 'supermobileapp_iOS' from project 'supermobileapp')
(1 failure)
    Error command ["xcodebuild"] exited with code 65

Worth to note : there are a lot of .dev name in the long list of environment variables passed by the script So I don't think the -c override really works

Reproduction

No response

Expected behavior

It should build the .ipa with .prd bundle ids (overrided by tauri build -c ...)

Full tauri info output

$ cargo tauri info

[✔] Environment
    - OS: Mac OS 14.5.0 X64
    ✔ Xcode Command Line Tools: installed
    ✔ rustc: 1.78.0 (9b00956e5 2024-04-29)
    ✔ cargo: 1.78.0 (54d8815d0 2024-03-26)
    ✔ rustup: 1.27.1 (2024-04-24)
    ✔ Rust toolchain: 1.78-aarch64-apple-darwin (environment override by RUSTUP_TOOLCHAIN)
    - node: 22.1.0
    - npm: 10.7.0

[-] Packages
    - tauri [RUST]: 2.0.0-beta.22
    - tauri-build [RUST]: 2.0.0-beta.17
    - wry [RUST]: no manifest (0.37.0, 0.40.0)
    - tao [RUST]: no manifest (0.26.2, 0.28.0)
    - tauri-cli [RUST]: 2.0.0-beta.20
    - @tauri-apps/api [NPM]: 2.0.0-beta.12
    - @tauri-apps/cli [NPM]: 2.0.0-beta.20

[-] App
    - build-type: bundle
    - CSP: unset
    - frontendDist: ../build
    - devUrl: http://localhost:1420/
    - framework: Svelte
    - bundler: Vite

[-] iOS
    - Developer Teams: ###########

Stack trace

No response

Additional context

No response

mrguiman commented 1 day ago

@lucasfernog We're still encountering the issue today

[✔] Environment
    - OS: Mac OS 14.6.1 arm64 (X64)
    ✔ Xcode Command Line Tools: installed
    ✔ rustc: 1.80.0 (051478957 2024-07-21)
    ✔ cargo: 1.80.0 (376290515 2024-07-16)
    ✔ rustup: 1.27.1 (2024-04-24)
    ✔ Rust toolchain: stable-aarch64-apple-darwin (environment override by RUSTUP_TOOLCHAIN)
    - node: 22.0.0
    - npm: 10.5.1

[-] Packages
    - tauri 🦀: 2.0.6
    - tauri-build 🦀: 2.0.2
    - wry 🦀: 0.46.3
    - tao 🦀: 0.30.5
    - tauri-cli 🦀: 2.0.4
    - @tauri-apps/api : 2.0.3
    - @tauri-apps/cli : 2.0.5

[-] Plugins
    - tauri-plugin-shell 🦀: 2.0.2
    - @tauri-apps/plugin-shell : 2.0.1

[-] App
    - build-type: bundle
    - CSP: unset
    - frontendDist: ../dist
    - devUrl: http://localhost:1420/
    - framework: Svelte
    - bundler: Vite

It can be reproduced within the following repository:

https://github.com/mrguiman/tauri2-test/

Running cargo tauri ios build -c ./src-tauri/tauri.conf-release.json fails