aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ports/servoshell/Cargo.toml5
-rw-r--r--ports/servoshell/lib.rs (renamed from ports/servoshell/main2.rs)38
-rw-r--r--ports/servoshell/main.rs52
3 files changed, 50 insertions, 45 deletions
diff --git a/ports/servoshell/Cargo.toml b/ports/servoshell/Cargo.toml
index bbf4f75a12a..1ec6d3c3ec9 100644
--- a/ports/servoshell/Cargo.toml
+++ b/ports/servoshell/Cargo.toml
@@ -8,6 +8,11 @@ edition = "2021"
build = "build.rs"
publish = false
+[lib]
+name = "servoshell"
+path = "lib.rs"
+bench = false
+
[[bin]]
name = "servo"
path = "main.rs"
diff --git a/ports/servoshell/main2.rs b/ports/servoshell/lib.rs
index e5e63050830..2c24e11572b 100644
--- a/ports/servoshell/main2.rs
+++ b/ports/servoshell/lib.rs
@@ -2,6 +2,44 @@
* 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 app;
+mod backtrace;
+mod crash_handler;
+mod egui_glue;
+mod embedder;
+mod events_loop;
+mod geometry;
+mod headed_window;
+mod headless_window;
+mod keyutils;
+mod minibrowser;
+mod parser;
+mod prefs;
+mod resources;
+mod webview;
+mod window_trait;
+
+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) {}
+}
+
use std::io::Write;
use std::{env, panic, process, thread};
diff --git a/ports/servoshell/main.rs b/ports/servoshell/main.rs
index a215089bfea..84d878eea71 100644
--- a/ports/servoshell/main.rs
+++ b/ports/servoshell/main.rs
@@ -20,52 +20,14 @@
// mode is turned on.
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
-cfg_if::cfg_if! {
- if #[cfg(not(target_os = "android"))] {
- #[cfg(any(target_os = "macos", target_os = "linux"))]
- #[macro_use]
- extern crate sig;
-
- #[cfg(test)]
- mod test;
-
- mod app;
- mod backtrace;
- mod crash_handler;
- mod egui_glue;
- mod embedder;
- mod events_loop;
- mod geometry;
- mod headed_window;
- mod headless_window;
- mod keyutils;
- mod main2;
- mod minibrowser;
- mod parser;
- mod prefs;
- mod resources;
- mod webview;
- mod window_trait;
-
- 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) {}
- }
-
- pub fn main() {
- main2::main()
- }
- } else {
- pub fn main() {
+fn main() {
+ cfg_if::cfg_if! {
+ if #[cfg(not(target_os = "android"))] {
+ servoshell::main()
+ } else {
println!(
- "Cannot start /ports/servo/ on Android. \
- Use /support/android/apk/ + /ports/libsimpleservo/ instead"
+ "Cannot start /ports/servoshell/ on Android. \
+ Use /support/android/apk/ + /ports/jniapi/ instead"
);
}
}