fix(cli.js): adb commands not working, closes #6659 (#6708)

fix(cli.js): adb commands not working, closes #6659
This commit is contained in:
Lucas Fernandes Nogueira 2023-04-23 05:14:54 -07:00 committed by GitHub
parent 96639ca239
commit 41f49aeae6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 54 additions and 67 deletions

View File

@ -0,0 +1,5 @@
---
"cli.js": patch
---
Update tauri-mobile to fix running ADB scripts.

View File

@ -101,15 +101,19 @@ impl PluginBuilder {
pub fn link_swift_library(name: &str, source: impl AsRef<Path>) {
let source = source.as_ref();
let curr_dir = std::env::current_dir().unwrap();
std::env::set_current_dir(source).unwrap();
let sdk_root = std::env::var_os("SDKROOT");
std::env::remove_var("SDKROOT");
swift_rs::SwiftLinker::new(
&std::env::var("MACOSX_DEPLOYMENT_TARGET").unwrap_or_else(|_| "10.13".into()),
)
.with_ios(&std::env::var("IPHONEOS_DEPLOYMENT_TARGET").unwrap_or_else(|_| "13.0".into()))
.with_package(name, source)
.link();
std::env::set_current_dir(curr_dir).unwrap();
if let Some(root) = sdk_root {
std::env::set_var("SDKROOT", root);
}
}
#[doc(hidden)]

View File

@ -1934,16 +1934,6 @@ version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5"
[[package]]
name = "open"
version = "3.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2078c0039e6a54a0c42c28faa984e115fb4c2d5bf2208f77d1961002df8576f8"
dependencies = [
"pathdiff",
"windows-sys 0.42.0",
]
[[package]]
name = "os_info"
version = "3.6.0"
@ -1955,16 +1945,6 @@ dependencies = [
"winapi",
]
[[package]]
name = "os_pipe"
version = "1.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a53dbb20faf34b16087a931834cba2d7a73cc74af2b7ef345a4c8324e2409a12"
dependencies = [
"libc",
"windows-sys 0.45.0",
]
[[package]]
name = "overload"
version = "0.1.1"
@ -2020,12 +2000,6 @@ dependencies = [
"windows-sys 0.45.0",
]
[[package]]
name = "pathdiff"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8835116a5c179084a830efb3adc117ab007512b535bc1a21c991d3b32a6b44dd"
[[package]]
name = "percent-encoding"
version = "2.2.0"
@ -2699,16 +2673,6 @@ dependencies = [
"lazy_static",
]
[[package]]
name = "shared_child"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b0d94659ad3c2137fef23ae75b03d5241d633f8acded53d672decfa0e6e0caef"
dependencies = [
"libc",
"winapi",
]
[[package]]
name = "siphasher"
version = "0.3.10"
@ -2823,9 +2787,9 @@ checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601"
[[package]]
name = "swift-rs"
version = "1.0.4"
version = "1.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8fa67d647176dfa7bdc5775430a1cb339e0ea48fe24707424023a4b17eb9688e"
checksum = "05e51d6f2b5fff4808614f429f8a7655ac8bcfe218185413f3a60c508482c2d6"
dependencies = [
"base64 0.21.0",
"serde",
@ -2954,21 +2918,17 @@ dependencies = [
"minisign-verify",
"objc",
"once_cell",
"open",
"os_info",
"os_pipe",
"percent-encoding",
"png",
"rand 0.8.5",
"raw-window-handle",
"regex",
"reqwest",
"semver 1.0.16",
"serde",
"serde_json",
"serde_repr",
"serialize-to-javascript",
"shared_child",
"state",
"swift-rs",
"tar",
@ -3021,7 +2981,6 @@ dependencies = [
"png",
"proc-macro2",
"quote",
"regex",
"semver 1.0.16",
"serde",
"serde_json",

View File

@ -3700,6 +3700,7 @@ dependencies = [
"css-color",
"ctrlc",
"dialoguer",
"duct",
"env_logger",
"handlebars 4.3.6",
"heck",
@ -3770,9 +3771,9 @@ dependencies = [
[[package]]
name = "tauri-mobile"
version = "0.3.0"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8fad13092a3a94d64f783bb2818a839897431d7224c26a98890d189af041c404"
checksum = "9734a0128db0a9729b5264dd0be546527c21555e7f05844226786d027b1b6aaa"
dependencies = [
"cocoa",
"colored 1.9.3",
@ -3805,7 +3806,6 @@ dependencies = [
"toml",
"ureq",
"which",
"winapi",
"windows 0.39.0",
]

View File

@ -42,7 +42,7 @@ path = "src/main.rs"
openssl-vendored = [ "tauri-mobile/openssl-vendored" ]
[dependencies]
tauri-mobile = { version = "0.3", default-features = false }
tauri-mobile = { version = "0.4", default-features = false }
textwrap = { version = "0.11.0", features = [ "term_size" ] }
jsonrpsee = { version = "0.16", features = [ "server" ] }
jsonrpsee-core = "0.16"
@ -60,6 +60,7 @@ serde_json = "1.0"
notify = "5.0"
notify-debouncer-mini = "0.2"
shared_child = "1.0"
duct = "0.13"
toml_edit = "0.14"
json-patch = "0.2"
tauri-utils = { version = "2.0.0-alpha.4", path = "../../core/tauri-utils", features = [ "isolation", "schema", "config-json5", "config-toml" ] }

View File

@ -1,3 +1,13 @@
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
/* tslint:disable */
/* eslint-disable */
/* prettier-ignore */
/* auto-generated by NAPI-RS */
const { existsSync, readFileSync } = require('fs')
const { join } = require('path')

View File

@ -17,7 +17,6 @@ use tauri_mobile::{
deps, rust_version_check,
target::Target,
},
bossy,
config::app::DEFAULT_ASSET_DIR,
target::TargetTrait as _,
util::{self, cli::TextWrapper},
@ -181,17 +180,27 @@ pub fn gen(
// Note that Xcode doesn't always reload the project nicely; reopening is
// often necessary.
println!("Generating Xcode project...");
bossy::Command::impure("xcodegen")
.with_args(["generate", "--spec"])
.with_arg(dest.join("project.yml"))
.run_and_wait()
.with_context(|| "failed to run `xcodegen`")?;
duct::cmd(
"xcodegen",
[
"generate",
"--spec",
&dest.join("project.yml").to_string_lossy(),
],
)
.run()
.with_context(|| "failed to run `xcodegen`")?;
if !ios_pods.is_empty() || !macos_pods.is_empty() {
bossy::Command::impure_parse("pod install")
.with_arg(format!("--project-directory={}", dest.display()))
.run_and_wait()
.with_context(|| "failed to run `pod install`")?;
duct::cmd(
"pod",
[
"install",
&format!("--project-directory={}", dest.display()),
],
)
.run()
.with_context(|| "failed to run `pod install`")?;
}
Ok(())
}

View File

@ -17,7 +17,6 @@ use jsonrpsee::server::{RpcModule, ServerBuilder, ServerHandle};
use jsonrpsee_client_transport::ws::WsTransportClientBuilder;
use jsonrpsee_core::rpc_params;
use serde::{Deserialize, Serialize};
use shared_child::SharedChild;
use std::{
collections::HashMap,
@ -34,10 +33,10 @@ use std::{
},
};
use tauri_mobile::{
bossy,
config::app::{App, Raw as RawAppConfig},
env::Error as EnvError,
opts::{NoiseLevel, Profile},
ChildHandle,
};
use tokio::runtime::Runtime;
@ -55,14 +54,14 @@ const MIN_DEVICE_MATCH_SCORE: isize = 0;
#[derive(Clone)]
pub struct DevChild {
child: Arc<SharedChild>,
child: Arc<ChildHandle>,
manually_killed_process: Arc<AtomicBool>,
}
impl DevChild {
fn new(handle: bossy::Handle) -> Self {
fn new(handle: ChildHandle) -> Self {
Self {
child: Arc::new(SharedChild::new(handle.into()).unwrap()),
child: Arc::new(handle),
manually_killed_process: Default::default(),
}
}
@ -76,11 +75,11 @@ impl DevProcess for DevChild {
}
fn try_wait(&self) -> std::io::Result<Option<ExitStatus>> {
self.child.try_wait()
self.child.try_wait().map(|res| res.map(|o| o.status))
}
fn wait(&self) -> std::io::Result<ExitStatus> {
self.child.wait()
self.child.wait().map(|o| o.status)
}
fn manually_killed_process(&self) -> bool {