Skip to content

[Android] Add llama demo app to CI #2763

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

Closed
wants to merge 2 commits into from
Closed
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
9 changes: 9 additions & 0 deletions build/test_android_ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ build_executorch() {
rm -rf cmake-out && mkdir cmake-out
ANDROID_NDK=/opt/ndk BUCK2=$(which buck2) FLATC=$(which flatc) ANDROID_ABI=arm64-v8a \
bash examples/demo-apps/android/ExecuTorchDemo/setup.sh
ANDROID_NDK=/opt/ndk BUCK2=$(which buck2) FLATC=$(which flatc) ANDROID_ABI=arm64-v8a \
bash examples/demo-apps/android/LlamaDemo/setup.sh
}

build_android_demo_app() {
Expand All @@ -28,5 +30,12 @@ build_android_demo_app() {
popd
}

build_android_llama_demo_app() {
pushd examples/demo-apps/android/LlamaDemo
ANDROID_HOME=/opt/android/sdk ./gradlew build
popd
}

build_executorch
build_android_demo_app
build_android_llama_demo_app
8 changes: 2 additions & 6 deletions examples/demo-apps/android/LlamaDemo/setup.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
Expand Down Expand Up @@ -28,7 +28,7 @@ else
fi
cmake --build "${CMAKE_OUT}" -j "${CMAKE_JOBS}" --target install

cmake examples/models/llama2 -DBUCK2="$BUCK" \
cmake examples/models/llama2 -DBUCK2="${BUCK2}" \
-DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK/build/cmake/android.toolchain.cmake \
-DANDROID_ABI="$ANDROID_ABI" \
-DCMAKE_INSTALL_PREFIX="${CMAKE_OUT}" \
Expand All @@ -48,7 +48,3 @@ cmake --build "${CMAKE_OUT}"/extension/android -j "${CMAKE_JOBS}"
JNI_LIBS_PATH="examples/demo-apps/android/LlamaDemo/app/src/main/jniLibs"
mkdir -p "${JNI_LIBS_PATH}/${ANDROID_ABI}"
cp "${CMAKE_OUT}"/extension/android/libexecutorch_llama_jni.so "${JNI_LIBS_PATH}/${ANDROID_ABI}/"

pushd extension/android
./gradlew build
popd