Skip to content

Commit a029b9f

Browse files
authored
feat(cli): codesign on iOS is optional for the simulator (#8910)
* feat(cli): codesign on iOS is optional for the simulator * cargo-mobile2 0.10
1 parent 3fb414b commit a029b9f

File tree

7 files changed

+33
-67
lines changed

7 files changed

+33
-67
lines changed

.changes/ios-signing-optional.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"@tauri-apps/cli": patch:enhance
3+
"tauri-cli": patch:enhance
4+
---
5+
6+
Setting up code signing is no longer required on iOS when using the simulator.

examples/api/src-tauri/Cargo.lock

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tooling/cli/Cargo.lock

Lines changed: 7 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tooling/cli/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ name = "cargo-tauri"
3939
path = "src/main.rs"
4040

4141
[dependencies]
42-
cargo-mobile2 = { version = "0.8", default-features = false }
42+
cargo-mobile2 = { version = "0.10", default-features = false }
4343
jsonrpsee = { version = "0.20", features = [ "server" ] }
4444
jsonrpsee-core = "0.20"
4545
jsonrpsee-client-transport = { version = "0.20", features = [ "ws" ] }

tooling/cli/src/mobile/ios/dev.rs

Lines changed: 3 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
use super::{
66
configure_cargo, device_prompt, ensure_init, env, get_app, get_config, inject_assets,
7-
merge_plist, open_and_wait, setup_dev_config, MobileTarget, APPLE_DEVELOPMENT_TEAM_ENV_VAR_NAME,
7+
merge_plist, open_and_wait, setup_dev_config, MobileTarget,
88
};
99
use crate::{
1010
dev::Options as DevOptions,
@@ -21,14 +21,13 @@ use clap::{ArgAction, Parser};
2121

2222
use anyhow::Context;
2323
use cargo_mobile2::{
24-
apple::{config::Config as AppleConfig, device::Device, teams::find_development_teams},
24+
apple::{config::Config as AppleConfig, device::Device},
2525
config::app::App,
2626
env::Env,
2727
opts::{NoiseLevel, Profile},
2828
};
29-
use dialoguer::{theme::ColorfulTheme, Select};
3029

31-
use std::env::{set_current_dir, set_var, var_os};
30+
use std::env::set_current_dir;
3231

3332
#[derive(Debug, Clone, Parser)]
3433
#[clap(
@@ -98,37 +97,6 @@ pub fn command(options: Options, noise_level: NoiseLevel) -> Result<()> {
9897
}
9998

10099
fn run_command(options: Options, noise_level: NoiseLevel) -> Result<()> {
101-
if var_os(APPLE_DEVELOPMENT_TEAM_ENV_VAR_NAME).is_none() {
102-
if let Ok(teams) = find_development_teams() {
103-
let index = match teams.len() {
104-
0 => None,
105-
1 => Some(0),
106-
_ => {
107-
let index = Select::with_theme(&ColorfulTheme::default())
108-
.items(
109-
&teams
110-
.iter()
111-
.map(|t| format!("{} (ID: {})", t.name, t.id))
112-
.collect::<Vec<String>>(),
113-
)
114-
.default(0)
115-
.interact()?;
116-
Some(index)
117-
}
118-
};
119-
if let Some(index) = index {
120-
let team = teams.get(index).unwrap();
121-
log::info!(
122-
"Using development team `{}`. To make this permanent, set the `{}` environment variable to `{}`",
123-
team.name,
124-
APPLE_DEVELOPMENT_TEAM_ENV_VAR_NAME,
125-
team.id
126-
);
127-
set_var(APPLE_DEVELOPMENT_TEAM_ENV_VAR_NAME, &team.id);
128-
}
129-
}
130-
}
131-
132100
let env = env()?;
133101
let device = if options.open {
134102
None

tooling/cli/src/mobile/ios/mod.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ use std::{
3333
env::set_var,
3434
fs::create_dir_all,
3535
path::{Path, PathBuf},
36-
process::exit,
3736
thread::sleep,
3837
time::Duration,
3938
};
@@ -114,17 +113,17 @@ pub fn get_config(
114113
development_team: std::env::var(APPLE_DEVELOPMENT_TEAM_ENV_VAR_NAME)
115114
.ok()
116115
.or_else(|| config.bundle.ios.development_team.clone())
117-
.unwrap_or_else(|| {
116+
.or_else(|| {
118117
let teams = find_development_teams().unwrap_or_default();
119118
match teams.len() {
120119
0 => {
121-
log::error!("No code signing certificates found. You must add one and set the certificate development team ID on the `bundle > iOS > developmentTeam` config value or the `{APPLE_DEVELOPMENT_TEAM_ENV_VAR_NAME}` environment variable. To list the available certificates, run `tauri info`.");
122-
exit(1);
120+
log::warn!("No code signing certificates found. You must add one and set the certificate development team ID on the `bundle > iOS > developmentTeam` config value or the `{APPLE_DEVELOPMENT_TEAM_ENV_VAR_NAME}` environment variable. To list the available certificates, run `tauri info`.");
121+
None
123122
}
124-
1 => teams.first().unwrap().id.clone(),
123+
1 => Some(teams.first().unwrap().id.clone()),
125124
_ => {
126-
log::error!("You must set the code signing certificate development team ID on the `bundle > iOS > developmentTeam` config value or the `{APPLE_DEVELOPMENT_TEAM_ENV_VAR_NAME}` environment variable. Available certificates: {}", teams.iter().map(|t| format!("{} (ID: {})", t.name, t.id)).collect::<Vec<String>>().join(", "));
127-
exit(1);
125+
log::warn!("You must set the code signing certificate development team ID on the `bundle > iOS > developmentTeam` config value or the `{APPLE_DEVELOPMENT_TEAM_ENV_VAR_NAME}` environment variable. Available certificates: {}", teams.iter().map(|t| format!("{} (ID: {})", t.name, t.id)).collect::<Vec<String>>().join(", "));
126+
None
128127
}
129128
}
130129
}),

tooling/cli/templates/mobile/ios/project.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ settingGroups:
1212
base:
1313
PRODUCT_NAME: {{app.stylized-name}}
1414
PRODUCT_BUNDLE_IDENTIFIER: {{reverse-domain app.domain}}.{{app.name}}
15+
{{#if apple.development-team}}
1516
DEVELOPMENT_TEAM: {{apple.development-team}}
17+
{{/if}}
1618
targetTemplates:
1719
app:
1820
type: application

0 commit comments

Comments
 (0)