Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
zmerp authored Dec 21, 2022
2 parents c4152cc + ce1e652 commit 46b4515
Show file tree
Hide file tree
Showing 57 changed files with 11,591 additions and 8,162 deletions.
38 changes: 0 additions & 38 deletions .github/workflows/android_test.sh

This file was deleted.

5 changes: 0 additions & 5 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,6 @@ jobs:
crate:
- { name: "ndk-sys", target: "armv7-linux-androideabi" }
- { name: "ndk", target: "armv7-linux-androideabi" }
- { name: "ndk-macro", target: "x86_64-unknown-linux-gnu" }
- { name: "ndk-context", target: "armv7-linux-androideabi" }
- { name: "ndk-glue", target: "armv7-linux-androideabi" }
- { name: "ndk-build", target: "x86_64-unknown-linux-gnu" }
- { name: "cargo-apk", target: "x86_64-unknown-linux-gnu" }
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
Expand Down
153 changes: 32 additions & 121 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,136 +30,63 @@ jobs:
uses: actions-rs/cargo@v1
with:
command: clippy
# Use one of our supported targets to lint all crates including
# the target-specific `ndk` in one go.
# This assumes our host-tools (cargo-apk and dependencies)
# also compile cleanly under this target.
# Use a cross-compilation target (that's typical for Android) to lint everything
args: --all --all-targets --all-features --target aarch64-linux-android -- -Dwarnings

check_msrv:
name: Check MSRV (1.60.0)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: dtolnay/rust-toolchain@1.60.0
with:
target: aarch64-linux-android
- uses: actions-rs/cargo@v1
with:
command: check
# Use a cross-compilation target (that's typical for Android) to lint everything
args: --workspace --all-targets --all-features --target aarch64-linux-android

build:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
rust-channel: ['stable', 'nightly']
rust-target:
- 'armv7-linux-androideabi'
- 'aarch64-linux-android'
- 'i686-linux-android'
- 'x86_64-linux-android'
- { triple: 'armv7-linux-androideabi', abi: armeabi-v7a }
- { triple: 'aarch64-linux-android', abi: arm64-v8a }
- { triple: 'i686-linux-android', abi: x86 }
- { triple: 'x86_64-linux-android', abi: x86_64 }
include:
- os: windows-latest
rust-channel: 'stable'
rust-target: 'aarch64-linux-android'
rust-target: { triple: 'aarch64-linux-android', abi: arm64-v8a }
- os: windows-latest
rust-channel: 'stable'
rust-target: 'x86_64-linux-android'
rust-target: { triple: 'x86_64-linux-android', abi: x86_64 }

runs-on: ${{ matrix.os }}
name: Build apk
name: Cross-compile

steps:
- uses: actions/checkout@v2

- name: Installing Rust ${{ matrix.rust-channel }} w/ ${{ matrix.rust-target }}
- name: Setup Android SDK
uses: android-actions/setup-android@v2

- name: Install cargo-ndk
run: cargo install cargo-ndk

- name: Installing Rust ${{ matrix.rust-channel }} w/ ${{ matrix.rust-target.triple }}
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust-channel }}
target: ${{ matrix.rust-target }}
target: ${{ matrix.rust-target.triple }}
override: true

- name: Install cargo-apk
run:
cargo install --path cargo-apk

- name: Cargo check for target ${{ matrix.rust-target }}
run: cargo check -p ndk --target ${{ matrix.rust-target }} --all-features

- name: Cargo apk build for target ${{ matrix.rust-target }}
run: cargo apk build -p ndk-examples --target ${{ matrix.rust-target }} --examples

- uses: actions/upload-artifact@v2
# Only need this for CI, unless users are interested in downloading
# a ready-made app that does nothing but printing "hello world".
if: ${{ matrix.rust-target == 'x86_64-linux-android' }}
name: Upload hello_world apk
with:
name: hello_world_${{ matrix.os }}_${{ matrix.rust-target }}
path: ./target/debug/apk/examples/hello_world.apk

android_emulator:
name: hello_world example on emulator
needs: build
runs-on: macos-latest
strategy:
matrix:
source_os: [ubuntu-latest, windows-latest, local]
env:
api-level: 29
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
arch: x86_64
# the `googleapis` emulator target is considerably slower on CI.
target: default
profile: Nexus 6

steps:
- name: Checkout
uses: actions/checkout@v2

- uses: actions/download-artifact@v2
name: Download hello_world APK
if: ${{ matrix.source_os != 'local' }}
id: download
with:
name: hello_world_${{ matrix.source_os }}_x86_64-linux-android

- name: Install `cargo-apk` and add `x86_64-linux-android` target
if: ${{ matrix.source_os == 'local' }}
run: |
cargo install --path cargo-apk
rustup target add x86_64-linux-android
- name: AVD cache
uses: actions/cache@v2
id: avd-cache
with:
path: |
~/.android/avd/*
~/.android/adb*
# Bump the trailing number when making changes to the emulator setup below
key: avd-${{ env.api-level }}-1

- name: create AVD and generate snapshot for caching
if: steps.avd-cache.outputs.cache-hit != 'true'
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ env.api-level }}
arch: ${{ env.arch }}
target: ${{ env.target }}
profile: ${{ env.profile }}
emulator-options: ${{ env.emulator-options }}
disable-animations: true
force-avd-creation: false
script: echo "Generated AVD snapshot for caching."

- name: Start hello_world example
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ env.api-level }}
arch: ${{ env.arch }}
target: ${{ env.target }}
profile: ${{ env.profile }}
emulator-options: -no-snapshot-save ${{ env.emulator-options }}
disable-animations: true
force-avd-creation: false
script: ./.github/workflows/android_test.sh "${{ steps.download.outputs.download-path }}"

- name: Upload emulator logs
uses: actions/upload-artifact@v2
if: ${{ always() }}
with:
name: log
path: ~/logcat.log
- name: Compile for ${{ matrix.rust-target.triple }}
run: cargo ndk -t ${{ matrix.rust-target.abi }} build

build-host:
strategy:
Expand Down Expand Up @@ -188,22 +115,6 @@ jobs:
run:
cargo test -p ndk --all-features

- name: Test ndk-build
run:
cargo test -p ndk-build --all-features

- name: Test ndk-glue
run:
cargo test -p ndk-glue --all-features

- name: Test ndk-macro
run:
cargo test -p ndk-macro --all-features

- name: Test cargo-apk
run:
cargo test -p cargo-apk --all-features

docs:
strategy:
fail-fast: false
Expand Down
6 changes: 0 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
[workspace]
members = [
"ndk",
"ndk-context",
"ndk-macro",
"ndk-build",
"ndk-examples",
"ndk-glue",
"ndk-sys",
"cargo-apk",
]
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Rust on Android

[![Rust](https://github.com/rust-windowing/android-ndk-rs/workflows/Rust/badge.svg)](https://github.com/rust-windowing/android-ndk-rs/actions) ![MIT license](https://img.shields.io/badge/License-MIT-green.svg) ![APACHE2 license](https://img.shields.io/badge/License-APACHE2-green.svg)
[![Rust](https://github.com/rust-windowing/android-ndk-rs/workflows/Rust/badge.svg)](https://github.com/rust-windowing/android-ndk-rs/actions) ![MIT license](https://img.shields.io/badge/License-MIT-green.svg) ![APACHE2 license](https://img.shields.io/badge/License-APACHE2-green.svg) [![MSRV](https://img.shields.io/badge/rustc-1.60.0+-ab6000.svg)](https://blog.rust-lang.org/2022/04/07/Rust-1.60.0.html)


Libraries and tools for Rust programming on Android targets:

Expand All @@ -19,7 +20,7 @@ See [`ndk-examples`](./ndk-examples) for examples using the NDK and the README f

`android-ndk-rs` aims to support at least the `LTS` and `Rolling Release` branches of the NDK, as described on [their wiki](https://github.com/android/ndk/wiki#supported-downloads). Additionally the `Beta Release` might be supported to prepare for an upcoming release.

As of writing (2021-07-24) the following NDKs are tested:
As of writing (2022-10-10) the following NDKs are tested:

Branch | Version | Status | Working
-|-|:-:|:-:
Expand All @@ -28,10 +29,9 @@ r19 | 19.2.5345600 | _Deprecated_ | :heavy_check_mark:
r20 | 20.1.5948944 | _Deprecated_ | :heavy_check_mark:
r21 | 21.4.7075529 | _Deprecated_ | :heavy_check_mark:
r22 | 22.1.7171670 | _Deprecated_ | :heavy_check_mark:
r23 | beta 1/2 | _Deprecated_ | :heavy_check_mark:
r23 | 23.0.7272597-beta3 | _Deprecated_ | :heavy_check_mark: Workaround in [#189](https://github.com/rust-windowing/android-ndk-rs/pull/189)
r23 | 23.1.7779620 | LTS | :heavy_check_mark: Workaround in [#189](https://github.com/rust-windowing/android-ndk-rs/pull/189)
r24 | 24.0.7856742-beta1 | Rolling Release | :heavy_check_mark: Workaround in [#189](https://github.com/rust-windowing/android-ndk-rs/pull/189)
r23 | 23.1.7779620 | _Deprecated_ | :heavy_check_mark:
r24 | 24.0.8215888 | _Deprecated_ | :heavy_check_mark:
r25 | 25.1.8937393 | LTS | :heavy_check_mark:


## Quick start: `Hello World` crate on Android
Expand Down
91 changes: 0 additions & 91 deletions cargo-apk/CHANGELOG.md

This file was deleted.

Loading

0 comments on commit 46b4515

Please sign in to comment.