servo/ports/servoshell/lib.rs
Jonathan Schwender ff4cd4af96
Split servoshell into Desktop and common part (#32457)
* servoshell: Move desktop files

Move files related to winit into a desktop module.
This is a preparation to merge the android and ohos apps into
servoshell.

* servoshell: Format imports

* servoshell: Move panic hook into separate file

* servoshell: Move desktop main

* Consider ohos as not desktop

* servoshell: Adjust dependencies for shared code

* servoshell: Remove native-bluetooth from default features

There currently is no good way to have target specific default features.

* Rename desktop_main.rs to cli.rs

* Remove todo
2024-06-14 06:26:35 +00:00

59 lines
1.3 KiB
Rust

/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// For Android, see /support/android/apk/ + /ports/jniapi/.
#![cfg(not(target_os = "android"))]
#[cfg(any(target_os = "macos", target_os = "linux"))]
#[macro_use]
extern crate sig;
#[cfg(test)]
mod test;
mod backtrace;
mod crash_handler;
#[cfg(not(any(target_os = "android", target_env = "ohos")))]
pub(crate) mod desktop;
mod panic_hook;
mod parser;
mod prefs;
mod resources;
pub mod platform {
#[cfg(target_os = "macos")]
pub use crate::platform::macos::deinit;
#[cfg(target_os = "macos")]
pub mod macos;
#[cfg(not(target_os = "macos"))]
pub fn deinit(_clean_shutdown: bool) {}
}
#[cfg(not(any(target_os = "android", target_env = "ohos")))]
pub fn main() {
desktop::cli::main()
}
#[cfg(target_os = "android")]
pub fn main() {
println!(
"Cannot start /ports/servoshell/ on Android. \
Use /support/android/apk/ + /ports/jniapi/ instead"
);
}
#[cfg(target_env = "ohos")]
pub fn main() {
println!("You shouldn't start /ports/servoshell/ on OpenHarmony.");
}
pub fn servo_version() -> String {
format!(
"Servo {}-{}",
env!("CARGO_PKG_VERSION"),
env!("VERGEN_GIT_SHA")
)
}