Skip to content

Commit

Permalink
CI: add _android-ci-activity feature to select NativeActivity class
Browse files Browse the repository at this point in the history
Normally an application crate based on android-activity should specify
the Activity class they are using via the "native-activity" or
"game-activity" features.

The choices are mutually exclusive with no default and the
android-activity crate will emit a `compiler_error()` if no class has
been chosen.

It's important that Winit (and other middleware crates that may link
against android-activity) do not impose a default class choice,
considering that cargo features are additive.

For CI to be able to compile Winit standalone this adds a private
`_android-ci-activity` feature that will select the NativeActivity
class as if building an application crate.
  • Loading branch information
rib committed Sep 17, 2022
1 parent dc38487 commit 9b3b3b0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
- { target: x86_64-unknown-linux-gnu, os: ubuntu-latest, }
- { target: x86_64-unknown-linux-gnu, os: ubuntu-latest, options: --no-default-features, features: x11 }
- { target: x86_64-unknown-linux-gnu, os: ubuntu-latest, options: --no-default-features, features: "wayland,wayland-dlopen" }
- { target: aarch64-linux-android, os: ubuntu-latest, cmd: 'apk --' }
- { target: aarch64-linux-android, os: ubuntu-latest, cmd: 'apk --', features: "_android-ci-activity" }
- { target: x86_64-apple-darwin, os: macos-latest, }
- { target: x86_64-apple-ios, os: macos-latest, }
- { target: aarch64-apple-ios, os: macos-latest, }
Expand Down
5 changes: 5 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ wayland-csd-adwaita = ["sctk-adwaita", "sctk-adwaita/ab_glyph"]
wayland-csd-adwaita-crossfont = ["sctk-adwaita", "sctk-adwaita/crossfont"]
wayland-csd-adwaita-notitle = ["sctk-adwaita"]

# Normally the app specifies the Android Activity class, but we have this feature
# for CI, to select NativeActivity (otherwise android-activity will emit
# a compiler_error() if no class has been chosen).
_android-ci-activity = [ "android-activity/native-activity" ]

[dependencies]
instant = { version = "0.1", features = ["wasm-bindgen"] }
once_cell = "1.12"
Expand Down

0 comments on commit 9b3b3b0

Please sign in to comment.