Skip to content

Commit

Permalink
Merge pull request #143 from rust-mobile/readme-update-versions
Browse files Browse the repository at this point in the history
README: Update crate version in `Cargo.toml` example
  • Loading branch information
rib authored Nov 20, 2023
2 parents 2deec16 + a84722f commit 9fce890
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 24 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ jobs:
fail-fast: false
matrix:
# See top README for MSRV policy
rust_version: [1.68.0, stable]
rust-version: [1.68.0, stable]
steps:
- uses: actions/checkout@v4

- uses: hecrj/setup-rust-action@v2
with:
rust-version: ${{ matrix.rust_version }}
rust-version: ${{ matrix.rust-version }}

- name: Install Rust targets
run: >
Expand Down Expand Up @@ -57,7 +57,7 @@ jobs:
build --features native-activity
- name: Build agdk-mainloop example
if: matrix.rust_version == 'stable'
if: matrix.rust-version == 'stable'
working-directory: examples/agdk-mainloop
run: >
cargo ndk
Expand All @@ -68,7 +68,7 @@ jobs:
-o app/src/main/jniLibs/ -- build
- name: Build na-mainloop example
if: matrix.rust_version == 'stable'
if: matrix.rust-version == 'stable'
working-directory: examples/na-mainloop
run: >
cargo ndk
Expand Down
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[![ci](https://github.com/rust-mobile/android-activity/actions/workflows/ci.yml/badge.svg)](https://github.com/rust-mobile/android-activity/actions/workflows/ci.yml)
[![crates.io](https://img.shields.io/crates/v/android-activity.svg)](https://crates.io/crates/android-activity)
[![Docs](https://docs.rs/android-activity/badge.svg)](https://docs.rs/android-activity)
[![MSRV](https://img.shields.io/badge/rustc-1.64.0+-ab6000.svg)](https://blog.rust-lang.org/2022/09/22/Rust-1.64.0.html)
[![MSRV](https://img.shields.io/badge/rustc-1.68.0+-ab6000.svg)](https://blog.rust-lang.org/2023/03/09/Rust-1.68.0.html)

## Overview

Expand Down Expand Up @@ -36,8 +36,8 @@ Cargo.toml
```toml
[dependencies]
log = "0.4"
android_logger = "0.11"
android-activity = { version = "0.4", features = [ "native-activity" ] }
android_logger = "0.13"
android-activity = { version = "0.5", features = [ "native-activity" ] }

[lib]
crate_type = ["cdylib"]
Expand Down Expand Up @@ -126,8 +126,8 @@ Middleware libraries can instead look at using the [ndk-context](https://crates.
The steps to switch a simple standalone application over from `ndk-glue` to `android-activity` (still based on `NativeActivity`) should be:

1. Remove `ndk-glue` from your Cargo.toml
2. Add a dependency on `android-activity`, like `android-activity = { version="0.4", features = [ "native-activity" ] }`
3. Optionally add a dependency on `android_logger = "0.11.0"`
2. Add a dependency on `android-activity`, like `android-activity = { version="0.5", features = [ "native-activity" ] }`
3. Optionally add a dependency on `android_logger = "0.13.0"`
4. Update the `main` entry point to look like this:

```rust
Expand Down Expand Up @@ -157,8 +157,8 @@ Prior to working on android-activity, the existing glue crates available for bui
## MSRV

We aim to (at least) support stable releases of Rust from the last three months. Rust has a 6 week release cycle which means we will support the last three stable releases.
For example, when Rust 1.69 is released we would limit our `rust_version` to 1.67.
For example, when Rust 1.69 is released we would limit our `rust-version` to 1.67.

We will only bump the `rust_version` at the point where we either depend on a new features or a dependency has increased its MSRV, and we won't be greedy. In other words we will only set the MSRV to the lowest version that's _needed_.
We will only bump the `rust-version` at the point where we either depend on a new features or a dependency has increased its MSRV, and we won't be greedy. In other words we will only set the MSRV to the lowest version that's _needed_.

MSRV updates are not considered to be inherently semver breaking (unless a new feature is exposed in the public API) and so a `rust_version` change may happen in patch releases.
MSRV updates are not considered to be inherently semver breaking (unless a new feature is exposed in the public API) and so a `rust-version` change may happen in patch releases.
12 changes: 5 additions & 7 deletions android-activity/src/game_activity/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -764,18 +764,16 @@ impl<'a> From<Arc<InputReceiver>> for InputIteratorInner<'a> {
let buffered = unsafe {
let app_ptr = receiver.native_app.as_ptr();
let input_buffer = ffi::android_app_swap_input_buffers(app_ptr);
if input_buffer.is_null() {
None
} else {
let buffer = InputBuffer::from_ptr(NonNull::new_unchecked(input_buffer));
NonNull::new(input_buffer).map(|input_buffer| {
let buffer = InputBuffer::from_ptr(input_buffer);
let keys_iter = KeyEventsLendingIterator::new(&buffer);
let motion_iter = MotionEventsLendingIterator::new(&buffer);
Some(BufferedEvents::<'a> {
BufferedEvents::<'a> {
buffer,
keys_iter,
motion_iter,
})
}
}
})
};

let native_app = receiver.native_app.clone();
Expand Down
2 changes: 2 additions & 0 deletions android-activity/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@
//! [`GameActivity`]: https://developer.android.com/games/agdk/integrate-game-activity
//! [Looper]: https://developer.android.com/reference/android/os/Looper

#![deny(clippy::manual_let_else)]

use std::hash::Hash;
use std::sync::Arc;
use std::sync::RwLock;
Expand Down
6 changes: 1 addition & 5 deletions android-activity/src/native_activity/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -485,11 +485,7 @@ impl<'a> InputIteratorInner<'a> {
where
F: FnOnce(&input::InputEvent) -> InputStatus,
{
// XXX: would use `let Some(queue) = &self.receiver.queue else { return
// false; }` but we're stuck supporting Rust 1.64 for Winit currently
let queue = if let Some(queue) = &self.receiver.queue {
queue
} else {
let Some(queue) = &self.receiver.queue else {
log::trace!("no queue available for events");
return false;
};
Expand Down

0 comments on commit 9fce890

Please sign in to comment.