Skip to content

Commit 41f49ae

Browse files
authored
fix(cli.js): adb commands not working, closes #6659 (#6708)
fix(cli.js): adb commands not working, closes #6659
1 parent 96639ca commit 41f49ae

File tree

8 files changed

+54
-67
lines changed

8 files changed

+54
-67
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"cli.js": patch
3+
---
4+
5+
Update tauri-mobile to fix running ADB scripts.

core/tauri-build/src/mobile.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,15 +101,19 @@ impl PluginBuilder {
101101
pub fn link_swift_library(name: &str, source: impl AsRef<Path>) {
102102
let source = source.as_ref();
103103

104-
let curr_dir = std::env::current_dir().unwrap();
105-
std::env::set_current_dir(source).unwrap();
104+
let sdk_root = std::env::var_os("SDKROOT");
105+
std::env::remove_var("SDKROOT");
106+
106107
swift_rs::SwiftLinker::new(
107108
&std::env::var("MACOSX_DEPLOYMENT_TARGET").unwrap_or_else(|_| "10.13".into()),
108109
)
109110
.with_ios(&std::env::var("IPHONEOS_DEPLOYMENT_TARGET").unwrap_or_else(|_| "13.0".into()))
110111
.with_package(name, source)
111112
.link();
112-
std::env::set_current_dir(curr_dir).unwrap();
113+
114+
if let Some(root) = sdk_root {
115+
std::env::set_var("SDKROOT", root);
116+
}
113117
}
114118

115119
#[doc(hidden)]

examples/api/src-tauri/Cargo.lock

Lines changed: 2 additions & 43 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: 3 additions & 3 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: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ path = "src/main.rs"
4242
openssl-vendored = [ "tauri-mobile/openssl-vendored" ]
4343

4444
[dependencies]
45-
tauri-mobile = { version = "0.3", default-features = false }
45+
tauri-mobile = { version = "0.4", default-features = false }
4646
textwrap = { version = "0.11.0", features = [ "term_size" ] }
4747
jsonrpsee = { version = "0.16", features = [ "server" ] }
4848
jsonrpsee-core = "0.16"
@@ -60,6 +60,7 @@ serde_json = "1.0"
6060
notify = "5.0"
6161
notify-debouncer-mini = "0.2"
6262
shared_child = "1.0"
63+
duct = "0.13"
6364
toml_edit = "0.14"
6465
json-patch = "0.2"
6566
tauri-utils = { version = "2.0.0-alpha.4", path = "../../core/tauri-utils", features = [ "isolation", "schema", "config-json5", "config-toml" ] }

tooling/cli/node/index.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
2+
// SPDX-License-Identifier: Apache-2.0
3+
// SPDX-License-Identifier: MIT
4+
5+
/* tslint:disable */
6+
/* eslint-disable */
7+
/* prettier-ignore */
8+
9+
/* auto-generated by NAPI-RS */
10+
111
const { existsSync, readFileSync } = require('fs')
212
const { join } = require('path')
313

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

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ use tauri_mobile::{
1717
deps, rust_version_check,
1818
target::Target,
1919
},
20-
bossy,
2120
config::app::DEFAULT_ASSET_DIR,
2221
target::TargetTrait as _,
2322
util::{self, cli::TextWrapper},
@@ -181,17 +180,27 @@ pub fn gen(
181180
// Note that Xcode doesn't always reload the project nicely; reopening is
182181
// often necessary.
183182
println!("Generating Xcode project...");
184-
bossy::Command::impure("xcodegen")
185-
.with_args(["generate", "--spec"])
186-
.with_arg(dest.join("project.yml"))
187-
.run_and_wait()
188-
.with_context(|| "failed to run `xcodegen`")?;
183+
duct::cmd(
184+
"xcodegen",
185+
[
186+
"generate",
187+
"--spec",
188+
&dest.join("project.yml").to_string_lossy(),
189+
],
190+
)
191+
.run()
192+
.with_context(|| "failed to run `xcodegen`")?;
189193

190194
if !ios_pods.is_empty() || !macos_pods.is_empty() {
191-
bossy::Command::impure_parse("pod install")
192-
.with_arg(format!("--project-directory={}", dest.display()))
193-
.run_and_wait()
194-
.with_context(|| "failed to run `pod install`")?;
195+
duct::cmd(
196+
"pod",
197+
[
198+
"install",
199+
&format!("--project-directory={}", dest.display()),
200+
],
201+
)
202+
.run()
203+
.with_context(|| "failed to run `pod install`")?;
195204
}
196205
Ok(())
197206
}

tooling/cli/src/mobile/mod.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ use jsonrpsee::server::{RpcModule, ServerBuilder, ServerHandle};
1717
use jsonrpsee_client_transport::ws::WsTransportClientBuilder;
1818
use jsonrpsee_core::rpc_params;
1919
use serde::{Deserialize, Serialize};
20-
use shared_child::SharedChild;
2120

2221
use std::{
2322
collections::HashMap,
@@ -34,10 +33,10 @@ use std::{
3433
},
3534
};
3635
use tauri_mobile::{
37-
bossy,
3836
config::app::{App, Raw as RawAppConfig},
3937
env::Error as EnvError,
4038
opts::{NoiseLevel, Profile},
39+
ChildHandle,
4140
};
4241
use tokio::runtime::Runtime;
4342

@@ -55,14 +54,14 @@ const MIN_DEVICE_MATCH_SCORE: isize = 0;
5554

5655
#[derive(Clone)]
5756
pub struct DevChild {
58-
child: Arc<SharedChild>,
57+
child: Arc<ChildHandle>,
5958
manually_killed_process: Arc<AtomicBool>,
6059
}
6160

6261
impl DevChild {
63-
fn new(handle: bossy::Handle) -> Self {
62+
fn new(handle: ChildHandle) -> Self {
6463
Self {
65-
child: Arc::new(SharedChild::new(handle.into()).unwrap()),
64+
child: Arc::new(handle),
6665
manually_killed_process: Default::default(),
6766
}
6867
}
@@ -76,11 +75,11 @@ impl DevProcess for DevChild {
7675
}
7776

7877
fn try_wait(&self) -> std::io::Result<Option<ExitStatus>> {
79-
self.child.try_wait()
78+
self.child.try_wait().map(|res| res.map(|o| o.status))
8079
}
8180

8281
fn wait(&self) -> std::io::Result<ExitStatus> {
83-
self.child.wait()
82+
self.child.wait().map(|o| o.status)
8483
}
8584

8685
fn manually_killed_process(&self) -> bool {

0 commit comments

Comments
 (0)