فهرست منبع

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
Lucas Fernandes Nogueira 1 سال پیش
والد
کامیت
a029b9f77e

+ 6 - 0
.changes/ios-signing-optional.md

@@ -0,0 +1,6 @@
+---
+"@tauri-apps/cli": patch:enhance
+"tauri-cli": patch:enhance
+---
+
+Setting up code signing is no longer required on iOS when using the simulator.

+ 8 - 8
examples/api/src-tauri/Cargo.lock

@@ -3680,7 +3680,7 @@ checksum = "69758bda2e78f098e4ccb393021a0963bb3442eac05f135c30f61b7370bbafae"
 
 [[package]]
 name = "tauri"
-version = "2.0.0-beta.2"
+version = "2.0.0-beta.3"
 dependencies = [
  "anyhow",
  "bytes",
@@ -3731,7 +3731,7 @@ dependencies = [
 
 [[package]]
 name = "tauri-build"
-version = "2.0.0-beta.1"
+version = "2.0.0-beta.2"
 dependencies = [
  "anyhow",
  "cargo_toml",
@@ -3753,7 +3753,7 @@ dependencies = [
 
 [[package]]
 name = "tauri-codegen"
-version = "2.0.0-beta.1"
+version = "2.0.0-beta.2"
 dependencies = [
  "base64",
  "brotli",
@@ -3778,7 +3778,7 @@ dependencies = [
 
 [[package]]
 name = "tauri-macros"
-version = "2.0.0-beta.1"
+version = "2.0.0-beta.2"
 dependencies = [
  "heck",
  "proc-macro2",
@@ -3790,7 +3790,7 @@ dependencies = [
 
 [[package]]
 name = "tauri-plugin"
-version = "2.0.0-beta.1"
+version = "2.0.0-beta.2"
 dependencies = [
  "anyhow",
  "glob",
@@ -3830,7 +3830,7 @@ dependencies = [
 
 [[package]]
 name = "tauri-runtime"
-version = "2.0.0-beta.1"
+version = "2.0.0-beta.2"
 dependencies = [
  "gtk",
  "http",
@@ -3846,7 +3846,7 @@ dependencies = [
 
 [[package]]
 name = "tauri-runtime-wry"
-version = "2.0.0-beta.1"
+version = "2.0.0-beta.2"
 dependencies = [
  "cocoa",
  "gtk",
@@ -3866,7 +3866,7 @@ dependencies = [
 
 [[package]]
 name = "tauri-utils"
-version = "2.0.0-beta.1"
+version = "2.0.0-beta.2"
 dependencies = [
  "aes-gcm",
  "brotli",

+ 7 - 16
tooling/cli/Cargo.lock

@@ -459,9 +459,9 @@ dependencies = [
 
 [[package]]
 name = "cargo-mobile2"
-version = "0.8.0"
+version = "0.10.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b7110143b830dfc731cd21cee98f6d7b490078005dda4e26b966afd83e918954"
+checksum = "2324a8dabdfe7ecbc0ec64686fbaf0121ebdfafb2848c15ac49301aa6a85a535"
 dependencies = [
  "colored",
  "core-foundation",
@@ -1869,7 +1869,7 @@ dependencies = [
  "iana-time-zone-haiku",
  "js-sys",
  "wasm-bindgen",
- "windows-core 0.52.0",
+ "windows-core",
 ]
 
 [[package]]
@@ -5691,21 +5691,12 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
 
 [[package]]
 name = "windows"
-version = "0.51.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ca229916c5ee38c2f2bc1e9d8f04df975b4bd93f9955dc69fabb5d91270045c9"
-dependencies = [
- "windows-core 0.51.1",
- "windows-targets 0.48.5",
-]
-
-[[package]]
-name = "windows-core"
-version = "0.51.1"
+version = "0.52.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f1f8cf84f35d2db49a46868f947758c7a1138116f7fac3bc844f43ade1292e64"
+checksum = "e48a53791691ab099e5e2ad123536d0fff50652600abaf43bbf952894110d0be"
 dependencies = [
- "windows-targets 0.48.5",
+ "windows-core",
+ "windows-targets 0.52.0",
 ]
 
 [[package]]

+ 1 - 1
tooling/cli/Cargo.toml

@@ -39,7 +39,7 @@ name = "cargo-tauri"
 path = "src/main.rs"
 
 [dependencies]
-cargo-mobile2 = { version = "0.8", default-features = false }
+cargo-mobile2 = { version = "0.10", default-features = false }
 jsonrpsee = { version = "0.20", features = [ "server" ] }
 jsonrpsee-core = "0.20"
 jsonrpsee-client-transport = { version = "0.20", features = [ "ws" ] }

+ 3 - 35
tooling/cli/src/mobile/ios/dev.rs

@@ -4,7 +4,7 @@
 
 use super::{
   configure_cargo, device_prompt, ensure_init, env, get_app, get_config, inject_assets,
-  merge_plist, open_and_wait, setup_dev_config, MobileTarget, APPLE_DEVELOPMENT_TEAM_ENV_VAR_NAME,
+  merge_plist, open_and_wait, setup_dev_config, MobileTarget,
 };
 use crate::{
   dev::Options as DevOptions,
@@ -21,14 +21,13 @@ use clap::{ArgAction, Parser};
 
 use anyhow::Context;
 use cargo_mobile2::{
-  apple::{config::Config as AppleConfig, device::Device, teams::find_development_teams},
+  apple::{config::Config as AppleConfig, device::Device},
   config::app::App,
   env::Env,
   opts::{NoiseLevel, Profile},
 };
-use dialoguer::{theme::ColorfulTheme, Select};
 
-use std::env::{set_current_dir, set_var, var_os};
+use std::env::set_current_dir;
 
 #[derive(Debug, Clone, Parser)]
 #[clap(
@@ -98,37 +97,6 @@ pub fn command(options: Options, noise_level: NoiseLevel) -> Result<()> {
 }
 
 fn run_command(options: Options, noise_level: NoiseLevel) -> Result<()> {
-  if var_os(APPLE_DEVELOPMENT_TEAM_ENV_VAR_NAME).is_none() {
-    if let Ok(teams) = find_development_teams() {
-      let index = match teams.len() {
-        0 => None,
-        1 => Some(0),
-        _ => {
-          let index = Select::with_theme(&ColorfulTheme::default())
-            .items(
-              &teams
-                .iter()
-                .map(|t| format!("{} (ID: {})", t.name, t.id))
-                .collect::<Vec<String>>(),
-            )
-            .default(0)
-            .interact()?;
-          Some(index)
-        }
-      };
-      if let Some(index) = index {
-        let team = teams.get(index).unwrap();
-        log::info!(
-            "Using development team `{}`. To make this permanent, set the `{}` environment variable to `{}`",
-            team.name,
-            APPLE_DEVELOPMENT_TEAM_ENV_VAR_NAME,
-            team.id
-          );
-        set_var(APPLE_DEVELOPMENT_TEAM_ENV_VAR_NAME, &team.id);
-      }
-    }
-  }
-
   let env = env()?;
   let device = if options.open {
     None

+ 6 - 7
tooling/cli/src/mobile/ios/mod.rs

@@ -33,7 +33,6 @@ use std::{
   env::set_var,
   fs::create_dir_all,
   path::{Path, PathBuf},
-  process::exit,
   thread::sleep,
   time::Duration,
 };
@@ -114,17 +113,17 @@ pub fn get_config(
     development_team: std::env::var(APPLE_DEVELOPMENT_TEAM_ENV_VAR_NAME)
         .ok()
         .or_else(|| config.bundle.ios.development_team.clone())
-        .unwrap_or_else(|| {
+        .or_else(|| {
           let teams = find_development_teams().unwrap_or_default();
           match teams.len() {
             0 => {
-              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`.");
-              exit(1);
+              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`.");
+              None
             }
-            1 => teams.first().unwrap().id.clone(),
+            1 => Some(teams.first().unwrap().id.clone()),
             _ => {
-              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(", "));
-              exit(1);
+              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(", "));
+              None
             }
           }
         }),

+ 2 - 0
tooling/cli/templates/mobile/ios/project.yml

@@ -12,7 +12,9 @@ settingGroups:
     base:
       PRODUCT_NAME: {{app.stylized-name}}
       PRODUCT_BUNDLE_IDENTIFIER: {{reverse-domain app.domain}}.{{app.name}}
+      {{#if apple.development-team}}
       DEVELOPMENT_TEAM: {{apple.development-team}}
+      {{/if}}
 targetTemplates:
   app:
     type: application