Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move simpleservo_jni into servoshell #32533

Merged
merged 1 commit into from
Jun 19, 2024
Merged
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
26 changes: 5 additions & 21 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
resolver = "2"
members = [
"ports/servoshell",
"ports/jniapi/",
"tests/unit/*",
"support/crown",
]
Expand Down
2 changes: 1 addition & 1 deletion etc/ci/check_dynamic_symbols.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
'android-toolchains', 'ndk', 'toolchains', 'arm-linux-androideabi-4.9',
'prebuilt', 'linux-x86_64', 'bin', 'arm-linux-androideabi-objdump'),
'-T',
'target/android/armv7-linux-androideabi/debug/libsimpleservo.so']
'target/android/armv7-linux-androideabi/debug/libservoshell.so']
).split(b'\n')

for line in objdump_output:
Expand Down
2 changes: 1 addition & 1 deletion etc/run_in_headless_android_emulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def main(avd_name, apk_path, *args):
# in case they say something useful while we wait in subsequent steps.
logcat_args = [
"--format=raw", # Print no metadata, only log messages
"simpleservo:D", # Show (debug level) Rust stdio
"servoshell:D", # Show (debug level) Rust stdio
"*:S", # Hide everything else
]
with terminate_on_exit(adb + ["logcat"] + logcat_args) as logcat:
Expand Down
53 changes: 0 additions & 53 deletions ports/jniapi/Cargo.toml

This file was deleted.

54 changes: 0 additions & 54 deletions ports/jniapi/build.rs

This file was deleted.

56 changes: 0 additions & 56 deletions ports/jniapi/src/gl_glue.rs

This file was deleted.

29 changes: 24 additions & 5 deletions ports/servoshell/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,16 @@ name = "servo"
path = "main.rs"
bench = false

# Some of these dependencies are only needed for a specific target os, but
# since build-scripts can't detect the cargo target os at build-time, we
# must unconditionally add these dependencies. See https://github.com/rust-lang/cargo/issues/4932
[build-dependencies]
vergen = { version = "8.3.1", features = ["git", "git2"] }
# Android and OpenHarmony
gl_generator = "0.14"
# Android only
serde_json = { workspace = true }
# MacOS only
cc = "1.0"

[target.'cfg(windows)'.build-dependencies]
Expand Down Expand Up @@ -47,26 +55,37 @@ webgl_backtrace = ["libservo/webgl_backtrace"]
xr-profile = ["libservo/xr-profile"]

[dependencies]
# For optional feature servo_allocator/use-system-allocator
servo_allocator = { path = "../../components/allocator" }
libc = { workspace = true }
libservo = { path = "../../components/servo" }
cfg-if = { workspace = true }
log = { workspace = true }
url = { workspace = true }
lazy_static = { workspace = true }
getopts = { workspace = true }
url = { workspace = true }

[target.'cfg(target_os = "android")'.dependencies]
android_logger = "0.14"
ipc-channel = { workspace = true }
jni = "0.21.1"
libloading = "0.8"
serde_json = { workspace = true }
servo-media = { workspace = true }
surfman = { workspace = true, features = ["sm-angle-default"] }
webxr = { git = "https://github.com/servo/webxr" }


[target.'cfg(not(target_os = "android"))'.dependencies]
backtrace = { workspace = true }
getopts = { workspace = true }

[target.'cfg(target_env = "ohos")'.dependencies]
# force inprocess, until libc-rs is updated to include `shm_open` and unlink.
# force inprocess, until libc-rs 0.2.156 is released containing
# https://github.com/rust-lang/libc/commit/9e248e212c5602cb4e98676e4c21ea0382663a12
ipc-channel = { workspace = true, features = ["force-inprocess"] }


[target.'cfg(not(any(target_os = "android", target_env = "ohos")))'.dependencies]
# For optional feature servo_allocator/use-system-allocator
servo_allocator = { path = "../../components/allocator" }
arboard = { version = "3" }
egui = { version = "0.26.2" }
egui_glow = { version = "0.26.2", features = ["winit"] }
Expand Down
29 changes: 28 additions & 1 deletion ports/servoshell/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,12 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */

use std::error::Error;
use std::path::Path;
use std::fs::File;
use std::io::Write;
use std::path::{Path, PathBuf};

use gl_generator::{Api, Fallbacks, Profile, Registry};
use serde_json::Value;
use vergen::EmitBuilder;

fn main() -> Result<(), Box<dyn Error>> {
Expand Down Expand Up @@ -39,6 +43,29 @@ fn main() -> Result<(), Box<dyn Error>> {
cc::Build::new()
.file("platform/macos/count_threads.c")
.compile("count_threads");
} else if target_os == "android" {
// Generate GL bindings. For now, we only support EGL.
let mut file = File::create(out.join("egl_bindings.rs")).unwrap();
Registry::new(Api::Egl, (1, 5), Profile::Core, Fallbacks::All, [])
.write_bindings(gl_generator::StaticStructGenerator, &mut file)
.unwrap();
println!("cargo:rustc-link-lib=EGL");

// FIXME: We need this workaround since jemalloc-sys still links
// to libgcc instead of libunwind, but Android NDK 23c and above
// don't have libgcc. We can't disable jemalloc for Android as
// in 64-bit aarch builds, the system allocator uses tagged
// pointers by default which causes the assertions in SM & mozjs
// to fail. See https://github.com/servo/servo/issues/32175.
let mut libgcc = File::create(out.join("libgcc.a")).unwrap();
libgcc.write_all(b"INPUT(-lunwind)").unwrap();
println!("cargo:rustc-link-search=native={}", out.display());

let mut default_prefs = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
default_prefs.push("../../resources/prefs.json");
let prefs: Value = serde_json::from_reader(File::open(&default_prefs).unwrap()).unwrap();
let file = File::create(out.join("prefs.json")).unwrap();
serde_json::to_writer(file, &prefs).unwrap();
}

if let Err(error) = EmitBuilder::builder()
Expand Down
Loading