add. build script

This commit is contained in:
Lucas Nogueira
2025-08-19 15:12:42 -03:00
parent f7afdb7210
commit d2a1fde346
5 changed files with 9 additions and 2 deletions

1
Cargo.lock generated
View File

@@ -8837,6 +8837,7 @@ dependencies = [
"glob",
"heck 0.5.0",
"json-patch",
"napi-build-ohos",
"quote",
"schemars",
"semver",

View File

@@ -47,6 +47,9 @@ toml = "0.9"
# Our code requires at least 0.8.21 so don't simplify this to 0.8
schemars = { version = "0.8.21", features = ["preserve_order"] }
[target.'cfg(target_env = "ohos")'.dependencies]
napi-build-ohos = { version = "1.1" }
[features]
default = ["config-json"]
codegen = ["tauri-codegen", "quote"]

View File

@@ -460,6 +460,9 @@ pub fn build() {
pub fn try_build(attributes: Attributes) -> Result<()> {
use anyhow::anyhow;
#[cfg(target_env = "ohos")]
napi_build_ohos::setup();
println!("cargo:rerun-if-env-changed=TAURI_CONFIG");
let target_os = std::env::var("CARGO_CFG_TARGET_OS").unwrap();

View File

@@ -83,7 +83,7 @@ pub fn entry_point(_attributes: TokenStream, item: TokenStream) -> TokenStream {
}
// be careful when renaming this, the `start_app` symbol is checked by the CLI
#[cfg(not(target_os = "android"))]
#[cfg(target_os = "ios")]
#[no_mangle]
#[inline(never)]
pub extern "C" fn start_app() {

View File

@@ -2174,7 +2174,7 @@ tauri::Builder::default()
app: crate::ohos::APP
.lock()
.unwrap()
.take()
.clone()
.expect("OpenHarmony app instance not initialized"),
};