Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove split subdirectories as part of #372 modularization #374

Merged
merged 4 commits into from
Dec 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
141 changes: 19 additions & 122 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,7 @@ 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
Copy link
Member

@MarijnS95 MarijnS95 Dec 12, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you clean this up in the inverse way in the cargo-apk repository, since it specifically does not have to run on the target arch anymore, but on a (set of) host(s)?

OTOH that host might as well be an Android phone; linting for all the triples is fine by me but the comment is dated.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, it'd make sense in cargo-apk to lint with host targets, since it's a tool that runs on the host. It should be easy to follow up on iterating / cleaning up the CI in any of the standalone repos.

My first changes were just focused on making minimal CI updates that could ensure everything was building with green lights in the standalone repos.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly the comment that's off now, I'm fine having "android" itself as a host if someone wants to build APKs from Android for Android (Termux anyone?).

args: --all --all-targets --all-features --target aarch64-linux-android -- -Dwarnings

check_msrv:
Expand All @@ -47,7 +44,7 @@ jobs:
- uses: actions-rs/cargo@v1
with:
command: check
# See comment above about using one of our supported targets.
# Use a cross-compilation target (that's typical for Android) to lint everything
args: --workspace --all-targets --all-features --target aarch64-linux-android

build:
Expand All @@ -57,123 +54,39 @@ jobs:
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 }
Comment on lines +57 to +60
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I saw you created an issue about the abi mess, hope it'll be resolved soon.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, it's a bit of a weird quirk with cargo ndk

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
Comment on lines +78 to +79
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/me pukes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I was worried you were going to dislike it.

It makes sense to me for now though, we just want to cross compile a library crate and that's not really what cargo apk is for.

Hopefully this can just be seen as a minimal adaptation that's pragmatic for now?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As long as it works... The CI is green, so it surprisingly does?


- 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 @@ -202,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",
]
105 changes: 0 additions & 105 deletions cargo-apk/CHANGELOG.md

This file was deleted.

24 changes: 0 additions & 24 deletions cargo-apk/Cargo.toml

This file was deleted.

Loading