Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion crates/nsh-linux-app/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ webview = ["nsh-platform-linux/webview"]
[dependencies]
log.workspace = true

[target.'cfg(target_os = "linux")'.dependencies]
[target.'cfg(all(target_os = "linux", not(target_env = "ohos")))'.dependencies]
nsh-platform-linux.workspace = true
serde_json.workspace = true
12 changes: 6 additions & 6 deletions crates/nsh-linux-app/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
//! without the feature `js`: the runner then links no QuickJS.

/// Runs the release runner (until its window closes).
#[cfg(all(target_os = "linux", feature = "js"))]
#[cfg(all(target_os = "linux", not(target_env = "ohos"), feature = "js"))]
pub fn main() -> std::process::ExitCode {
use nsh_platform_linux::{AppSource, Bundle};

Expand All @@ -29,7 +29,7 @@ pub fn main() -> std::process::ExitCode {

/// Runs the Rust app whose root is `root` (until its window closes), with
/// the package's assets, name, id and appearance as [`main`] has them.
#[cfg(target_os = "linux")]
#[cfg(all(target_os = "linux", not(target_env = "ohos")))]
pub fn run_rust(root: nsh_platform_linux::Root) -> std::process::ExitCode {
let Some((_, options)) = setup() else {
return std::process::ExitCode::FAILURE;
Expand All @@ -40,7 +40,7 @@ pub fn run_rust(root: nsh_platform_linux::Root) -> std::process::ExitCode {
/// Installs the logger and reads the package: its `nsh` directory (next
/// to the executable, or `NSH_APP_DIR`: `nsh run` of a Rust app) and the
/// window's options.
#[cfg(target_os = "linux")]
#[cfg(all(target_os = "linux", not(target_env = "ohos")))]
fn setup() -> Option<(std::path::PathBuf, nsh_platform_linux::AppOptions)> {
use nsh_platform_linux::{AppOptions, Appearance, AssetBase, Limits};

Expand Down Expand Up @@ -102,7 +102,7 @@ fn setup() -> Option<(std::path::PathBuf, nsh_platform_linux::AppOptions)> {
Some((dir, options))
}

#[cfg(target_os = "linux")]
#[cfg(all(target_os = "linux", not(target_env = "ohos")))]
fn run(
source: nsh_platform_linux::AppSource,
options: nsh_platform_linux::AppOptions,
Expand All @@ -117,14 +117,14 @@ fn run(
}

/// Built without the feature `js`: runs Rust apps only ([`run_rust`]).
#[cfg(all(target_os = "linux", not(feature = "js")))]
#[cfg(all(target_os = "linux", not(target_env = "ohos"), not(feature = "js")))]
pub fn main() -> std::process::ExitCode {
eprintln!("this runner was built without the feature `js`: it runs Rust apps (run_rust)");
std::process::ExitCode::FAILURE
}

/// Not on Linux: says so and exits.
#[cfg(not(target_os = "linux"))]
#[cfg(not(all(target_os = "linux", not(target_env = "ohos"))))]
pub fn main() -> std::process::ExitCode {
eprintln!("nsh-linux-app is the executable of packaged Linux apps; build it on Linux");
std::process::ExitCode::FAILURE
Expand Down
2 changes: 1 addition & 1 deletion crates/nsh-linux-host/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ webview = ["nsh-platform-linux/webview"]
[dependencies]
log.workspace = true

[target.'cfg(target_os = "linux")'.dependencies]
[target.'cfg(all(target_os = "linux", not(target_env = "ohos")))'.dependencies]
nsh-platform-linux = { workspace = true, features = ["dev"] }
nsh-dev.workspace = true
nsh-engine = { workspace = true, features = ["js"] }
4 changes: 2 additions & 2 deletions crates/nsh-linux-host/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
//! `nsh_platform_linux::set_ui_sets` and then [`main`].

/// Runs the development host (until its window closes).
#[cfg(target_os = "linux")]
#[cfg(all(target_os = "linux", not(target_env = "ohos")))]
pub fn main() -> std::process::ExitCode {
use std::{env, path::PathBuf};

Expand Down Expand Up @@ -96,7 +96,7 @@ pub fn main() -> std::process::ExitCode {
}

/// Not on Linux: says so and exits.
#[cfg(not(target_os = "linux"))]
#[cfg(not(all(target_os = "linux", not(target_env = "ohos"))))]
pub fn main() -> std::process::ExitCode {
eprintln!("nsh-linux-host runs on Linux");
std::process::ExitCode::FAILURE
Expand Down
2 changes: 1 addition & 1 deletion crates/nsh-platform-linux/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ webview = ["dep:webkit6"]
log.workspace = true

# Empty off Linux (like the other platform crates off their targets).
[target.'cfg(target_os = "linux")'.dependencies]
[target.'cfg(all(target_os = "linux", not(target_env = "ohos")))'.dependencies]
nsh-core = { workspace = true, features = ["svg", "loader"] }
nsh-engine = { workspace = true, features = ["net", "shader"] }
nsh-base = { workspace = true, features = ["highlight"] }
Expand Down
2 changes: 1 addition & 1 deletion crates/nsh-platform-linux/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
//! [`AppView`] is one surface as a widget (for embedding); [`run_app`]
//! opens one in a window. Off Linux this crate is empty.

#![cfg(target_os = "linux")]
#![cfg(all(target_os = "linux", not(target_env = "ohos")))]

mod access;
#[cfg(feature = "dev")]
Expand Down