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

Specify NDK version #15

Merged
merged 9 commits into from
Oct 24, 2024
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
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
Loading