Add CLI.yaml (#2)
This commit is contained in:
79
.github/workflows/ci.yml
vendored
Normal file
79
.github/workflows/ci.yml
vendored
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
name: CI
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
push:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
test:
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
os: [windows-latest, ubuntu-latest]
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
~/.cargo/bin/
|
||||||
|
~/.cargo/registry/index/
|
||||||
|
~/.cargo/registry/cache/
|
||||||
|
~/.cargo/git/db/
|
||||||
|
target/
|
||||||
|
key: ${{ runner.os }}-cargo-test-${{ hashFiles('**/Cargo.toml') }}
|
||||||
|
- uses: dtolnay/rust-toolchain@master
|
||||||
|
with:
|
||||||
|
toolchain: stable
|
||||||
|
- name: Install alsa and udev
|
||||||
|
run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev
|
||||||
|
if: runner.os == 'linux'
|
||||||
|
- name: Build & run tests
|
||||||
|
run: |
|
||||||
|
cargo test --workspace --no-default-features
|
||||||
|
all-doc-tests:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
~/.cargo/bin/
|
||||||
|
~/.cargo/registry/index/
|
||||||
|
~/.cargo/registry/cache/
|
||||||
|
~/.cargo/git/db/
|
||||||
|
target/
|
||||||
|
key: ubuntu-latest-cargo-all-doc-tests-${{ hashFiles('**/Cargo.toml') }}
|
||||||
|
- uses: dtolnay/rust-toolchain@master
|
||||||
|
with:
|
||||||
|
toolchain: stable
|
||||||
|
- name: Install alsa and udev
|
||||||
|
run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev
|
||||||
|
- name: Run doc tests with all features (this also compiles README examples)
|
||||||
|
run: cargo test --doc
|
||||||
|
lint:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
~/.cargo/bin/
|
||||||
|
~/.cargo/registry/index/
|
||||||
|
~/.cargo/registry/cache/
|
||||||
|
~/.cargo/git/db/
|
||||||
|
target/
|
||||||
|
key: ubuntu-latest-cargo-lint-${{ hashFiles('**/Cargo.toml') }}
|
||||||
|
- uses: dtolnay/rust-toolchain@master
|
||||||
|
with:
|
||||||
|
toolchain: stable
|
||||||
|
components: rustfmt, clippy
|
||||||
|
- name: Install alsa and udev
|
||||||
|
run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev
|
||||||
|
- name: Run clippy
|
||||||
|
run: cargo clippy --workspace --all-targets --all-features -- -Dwarnings
|
||||||
|
- name: Check format
|
||||||
|
run: cargo fmt --all -- --check
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,3 +1,4 @@
|
|||||||
target/
|
target/
|
||||||
.idea/
|
.idea/
|
||||||
book/
|
book/
|
||||||
|
.DS_Store
|
||||||
@@ -61,7 +61,7 @@ serde_json = { workspace = true }
|
|||||||
raw-window-handle = "0.6"
|
raw-window-handle = "0.6"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
bevy = { workspace = true, features = ["tonemapping_luts", "multi_threaded", "file_watcher"]}
|
bevy = { workspace = true, default-features = true, features = ["file_watcher"]}
|
||||||
bevy_cef = { workspace = true, features = ["debug"] }
|
bevy_cef = { workspace = true, features = ["debug"] }
|
||||||
|
|
||||||
[target.'cfg(target_os = "macos")'.dependencies]
|
[target.'cfg(target_os = "macos")'.dependencies]
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ impl Browsers {
|
|||||||
ipc_event_sender: Sender<IpcEventRaw>,
|
ipc_event_sender: Sender<IpcEventRaw>,
|
||||||
brp_sender: Sender<BrpMessage>,
|
brp_sender: Sender<BrpMessage>,
|
||||||
system_cursor_icon_sender: SystemCursorIconSenderInner,
|
system_cursor_icon_sender: SystemCursorIconSenderInner,
|
||||||
window_handle: Option<RawWindowHandle>,
|
_window_handle: Option<RawWindowHandle>,
|
||||||
) {
|
) {
|
||||||
let mut context = Self::request_context(requester);
|
let mut context = Self::request_context(requester);
|
||||||
let size = Rc::new(Cell::new(webview_size));
|
let size = Rc::new(Cell::new(webview_size));
|
||||||
@@ -70,7 +70,8 @@ impl Browsers {
|
|||||||
Some(&WindowInfo {
|
Some(&WindowInfo {
|
||||||
windowless_rendering_enabled: true as _,
|
windowless_rendering_enabled: true as _,
|
||||||
external_begin_frame_enabled: true as _,
|
external_begin_frame_enabled: true as _,
|
||||||
parent_view: match window_handle {
|
#[cfg(target_os = "macos")]
|
||||||
|
parent_view: match _window_handle {
|
||||||
Some(RawWindowHandle::AppKit(handle)) => handle.ns_view.as_ptr(),
|
Some(RawWindowHandle::AppKit(handle)) => handle.ns_view.as_ptr(),
|
||||||
Some(RawWindowHandle::Win32(handle)) => handle.hwnd.get() as _,
|
Some(RawWindowHandle::Win32(handle)) => handle.hwnd.get() as _,
|
||||||
Some(RawWindowHandle::Xlib(handle)) => handle.window as _,
|
Some(RawWindowHandle::Xlib(handle)) => handle.window as _,
|
||||||
|
|||||||
@@ -91,7 +91,9 @@ impl ImplDisplayHandler for DisplayHandlerBuilder {
|
|||||||
fn on_cursor_change(
|
fn on_cursor_change(
|
||||||
&self,
|
&self,
|
||||||
_browser: Option<&mut Browser>,
|
_browser: Option<&mut Browser>,
|
||||||
_cursor: *mut u8,
|
#[cfg(target_os = "macos")] _cursor: *mut u8,
|
||||||
|
#[cfg(target_os = "windows")] _cursor: *mut cef_dll_sys::HICON__,
|
||||||
|
#[cfg(target_os = "linux")] _cursor: u64,
|
||||||
type_: CursorType,
|
type_: CursorType,
|
||||||
_: Option<&CursorInfo>,
|
_: Option<&CursorInfo>,
|
||||||
) -> c_int {
|
) -> c_int {
|
||||||
|
|||||||
@@ -114,4 +114,4 @@ mod tests {
|
|||||||
assert_eq!(responser.offset, 2);
|
assert_eq!(responser.offset, 2);
|
||||||
assert_eq!(responser.end_offset, 7);
|
assert_eq!(responser.end_offset, 7);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -146,20 +146,6 @@ impl ImplRenderHandler for RenderHandlerBuilder {
|
|||||||
let _ = self.texture_sender.send_blocking(texture);
|
let _ = self.texture_sender.send_blocking(texture);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// MEMO: This method only supports on Windows
|
|
||||||
///
|
|
||||||
/// In Windows, this method is more performant than `on_paint`?
|
|
||||||
#[cfg(target_os = "windows")]
|
|
||||||
fn on_accelerated_paint(
|
|
||||||
&self,
|
|
||||||
_browser: Option<&mut Browser>,
|
|
||||||
_type_: PaintElementType,
|
|
||||||
_dirty_rects_count: usize,
|
|
||||||
_dirty_rects: Option<&Rect>,
|
|
||||||
_: Option<&AcceleratedPaintInfo>,
|
|
||||||
) {
|
|
||||||
}
|
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn get_raw(&self) -> *mut sys::_cef_render_handler_t {
|
fn get_raw(&self) -> *mut sys::_cef_render_handler_t {
|
||||||
self.object.cast()
|
self.object.cast()
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
mod browser_process;
|
mod browser_process;
|
||||||
|
#[cfg(target_os = "macos")]
|
||||||
mod debug;
|
mod debug;
|
||||||
mod render_process;
|
mod render_process;
|
||||||
mod util;
|
mod util;
|
||||||
|
|
||||||
pub mod prelude {
|
pub mod prelude {
|
||||||
pub use crate::browser_process::*;
|
pub use crate::browser_process::*;
|
||||||
|
#[cfg(target_os = "macos")]
|
||||||
pub use crate::debug::*;
|
pub use crate::debug::*;
|
||||||
pub use crate::render_process::app::*;
|
pub use crate::render_process::app::*;
|
||||||
pub use crate::render_process::brp::*;
|
pub use crate::render_process::brp::*;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
use bevy_cef_core::prelude::{DebugLibraryLoader, RenderProcessAppBuilder};
|
use bevy_cef_core::prelude::*;
|
||||||
use cef::{args::Args, *};
|
use cef::{args::Args, *};
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ use crate::RunOnMainThread;
|
|||||||
use bevy::prelude::*;
|
use bevy::prelude::*;
|
||||||
use bevy_cef_core::prelude::*;
|
use bevy_cef_core::prelude::*;
|
||||||
use cef::args::Args;
|
use cef::args::Args;
|
||||||
use cef::{Settings, api_hash, do_message_loop_work, execute_process, initialize, shutdown, sys};
|
use cef::{Settings, api_hash, execute_process, initialize, shutdown, sys};
|
||||||
|
|
||||||
/// Controls the CEF message loop.
|
/// Controls the CEF message loop.
|
||||||
///
|
///
|
||||||
@@ -28,6 +28,7 @@ impl Plugin for MessageLoopPlugin {
|
|||||||
|
|
||||||
impl Default for MessageLoopPlugin {
|
impl Default for MessageLoopPlugin {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
|
#[cfg(target_os = "macos")]
|
||||||
let _loader = {
|
let _loader = {
|
||||||
macos::install_cef_app_protocol();
|
macos::install_cef_app_protocol();
|
||||||
#[cfg(all(target_os = "macos", feature = "debug"))]
|
#[cfg(all(target_os = "macos", feature = "debug"))]
|
||||||
@@ -84,8 +85,9 @@ impl Default for MessageLoopPlugin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(target_os = "macos")]
|
||||||
fn cef_do_message_loop_work(_: NonSend<RunOnMainThread>) {
|
fn cef_do_message_loop_work(_: NonSend<RunOnMainThread>) {
|
||||||
do_message_loop_work();
|
cef::do_message_loop_work();
|
||||||
}
|
}
|
||||||
|
|
||||||
fn cef_shutdown(_: NonSend<RunOnMainThread>) {
|
fn cef_shutdown(_: NonSend<RunOnMainThread>) {
|
||||||
|
|||||||
Reference in New Issue
Block a user