Skip to content

Commit

Permalink
Specify NDK version (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
maxded authored Oct 24, 2024
1 parent 710da78 commit 1e7ac6c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/sdk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@ jobs:
TOOLCHAIN="$ANDROID_NDK_LATEST_HOME/toolchains/llvm/prebuilt/linux-x86_64"
CLANG_VERSION="$(ls $TOOLCHAIN/lib/clang)"
CLANG="$TOOLCHAIN/lib/clang/$CLANG_VERSION"
NDK_VERSION=$(basename $ANDROID_NDK_LATEST_HOME)
echo "ANDROID_NDK_LATEST_HOME=$ANDROID_NDK_LATEST_HOME"
echo "ANDROID_NDK_VERSION=$NDK_VERSION"
echo "CLANG_VERSION=$CLANG_VERSION"
mkdir -p Android.ndk && cd Android.ndk
mkdir -p $NDK_VERSION && cd $NDK_VERSION
cp -r $TOOLCHAIN/sysroot/usr ./usr
cp -r $CLANG/lib/linux/aarch64/* ./usr/lib/aarch64-linux-android/
Expand All @@ -31,7 +33,9 @@ jobs:
echo "INPUT(-lunwind)" > ./usr/lib/arm-linux-androideabi/libgcc.a
echo "INPUT(-lunwind)" > ./usr/lib/x86_64-linux-android/libgcc.a
echo "INPUT(-lunwind)" > ./usr/lib/i686-linux-android/libgcc.a
- run: tar --zstd -cf Android.ndk.tar.zst Android.ndk
- run: |
NDK_VERSION=$(basename $ANDROID_NDK_LATEST_HOME)
tar --zstd -cf Android.ndk.tar.zst $NDK_VERSION
- run: gh release upload $TAG Android.ndk.tar.zst -R Traverse-Research/xbuild
env:
GITHUB_TOKEN: ${{ secrets.XBUILD_SECRET }}
Expand Down
12 changes: 11 additions & 1 deletion xbuild/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,14 @@ mod download;
mod gradle;
mod task;

/// Current NDK version xbuild should use for Android.
///
/// If this version is not available on a users machine xbuild will download it
/// from our releases: ['https://github.com/Traverse-Research/xbuild/releases'].
///
/// The actual version used is determined by whatever the "ubuntu-latest" image has installed.
const ANDROID_NDK_CURRENT: &str = "27.1.12297006";

#[derive(Clone, Debug, Eq, PartialEq)]
pub enum Opt {
Debug,
Expand Down Expand Up @@ -753,7 +761,9 @@ impl BuildEnv {
}

pub fn android_ndk(&self) -> PathBuf {
self.cache_dir().join("Android.ndk")
self.cache_dir()
.join("Android.ndk")
.join(ANDROID_NDK_CURRENT)
}

pub fn ios_sdk(&self) -> PathBuf {
Expand Down

0 comments on commit 1e7ac6c

Please sign in to comment.