1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-31 05:40:03 -04:00

Remove android-activity dependency + add activity features (#2863)

Instead of depending on android-activity directly, this exposes the
android-native-activity and android-game-activity features from Winit.

This ensures that applications can choose what android-backend they use
while also relying on Winit to decide what version of android-activity to
use - without increasing the risk of a version conflict by having a direct
dependency.

_(NB: Egui doesn't currently use the android-activity API itself)_

Since android-activity provides the `android_main()` entry point for
Android applications it's not possible to link in multiple version of
the android-activity crate and so it's particularly important to
avoid unnecessary direct dependencies that could cause a version
conflict in the future.

To help avoid the need for applications to directly depend on
android-activity the Winit crate re-exports the android-activity API
and exposes features to configure the backend so that application crates
can instead rely on Winit to pull in a compatible version of
android-activity. (This way version bumps for android-activity only
need to be synchronized with the Winit crate).

CI now enables the `android-native-activity` feature for testing.

Fixes: #2829
Fixes: #2720
Closes: #2834
This commit is contained in:
Robert Bragg
2023-04-18 14:40:30 +01:00
committed by GitHub
parent b604b6200c
commit 89e42884fc
4 changed files with 20 additions and 5 deletions

View File

@@ -69,6 +69,15 @@ __screenshot = ["dep:image"]
## This overrides the `glow` feature.
wgpu = ["dep:wgpu", "dep:egui-wgpu", "dep:pollster"]
# Allow crates to choose an android-activity backend via Winit
# - It's important that most applications should not have to depend on android-activity directly, and can
# rely on Winit to pull in a suitable version (unlike most Rust crates, any version conflicts won't link)
# - It's also important that we don't impose an android-activity backend by taking this choice away from applications.
## Enable the `native-activity` backend via `egui-winit` on Android
android-native-activity = [ "egui-winit/android-native-activity" ]
## Enable the `game-activity` backend via `egui-winit` on Android
android-game-activity = [ "egui-winit/android-game-activity" ]
[dependencies]
egui = { version = "0.21.0", path = "../egui", default-features = false, features = [