Skip to content

Commit

Permalink
Fix build for android (java-native-access#348)
Browse files Browse the repository at this point in the history
Motivation:

7164389 did introduce some build changes but did not correctly specify things for android.

Modifications:

- Fix build on android
- Enable PR builds for android

Result:

Be able to build on android again
  • Loading branch information
normanmaurer authored Oct 14, 2021
1 parent 7164389 commit 9355bbf
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 1 deletion.
52 changes: 52 additions & 0 deletions .github/workflows/ci-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -173,3 +173,55 @@ jobs:
path: |
**/target/surefire-reports/
**/hs_err*.log
build-pr-android:
runs-on: ubuntu-latest
name: android
env:
SDK_VER: "platforms;android-21"
NDK_VER: "ndk;21.4.7075529"
steps:
- uses: actions/checkout@v2

- name: Setup ninja-build
run: sudo apt-get install ninja-build

- name: Setup go
uses: actions/setup-go@v2

- name: Install cargo-ndk
uses: actions-rs/install@v0.1
with:
crate: cargo-ndk

- name: Install Rust toolchain for Android architectures
run: rustup target add aarch64-linux-android armv7-linux-androideabi i686-linux-android x86_64-linux-android

- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8

- name: Setup Android SDK
uses: android-actions/setup-android@v2

- name: Install Android SDK platforms
run: sdkmanager "${{ env.SDK_VER }}"

- name: Install Android NDK
run: sdkmanager "${{ env.NDK_VER }}"

- name: Setup environment
run: export ANDROID_NDK_HOME=${{ steps.setup-ndk.outputs.ndk-path }}

- name: Build project
run: ./mvnw -B -ntp --file pom.xml clean package -Dandroid

- uses: actions/upload-artifact@v2
if: ${{ failure() }}
with:
name: build-pr-android-target
path: |
**/target/surefire-reports/
**/hs_err*.log
3 changes: 2 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,8 @@
<filter token="MIN_SDK_VERSION" value="${androidMinSdkVersion}" />

<copy file="src/main/AndroidManifest.xml" todir="${project.build.directory}/android-build/" filtering="true" />

<!-- Create an empty MANIFEST.MF file -->
<touch file="${project.build.outputDirectory}/META-INF/MANIFEST.MF" mkdirs="true"/>
</target>
</configuration>
</execution>
Expand Down

0 comments on commit 9355bbf

Please sign in to comment.