Skip to content
14 changes: 12 additions & 2 deletions build/build_android_llm_demo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,18 @@ build_aar() {
popd
}

build_android_llm_demo_app() {
build_android_demo_apps() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we rename the script and steps in android-perf as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes! Let's do that later. It's really used in different places

mkdir -p examples/demo-apps/android/LlamaDemo/app/libs
cp ${BUILD_AAR_DIR}/executorch-llama.aar examples/demo-apps/android/LlamaDemo/app/libs
pushd examples/demo-apps/android/LlamaDemo
ANDROID_HOME="${ANDROID_SDK:-/opt/android/sdk}" ./gradlew build assembleAndroidTest
popd

mkdir -p extension/android/benchmark/app/libs
cp ${BUILD_AAR_DIR}/executorch.aar extension/android/benchmark/app/libs
pushd extension/android/benchmark
ANDROID_HOME="${ANDROID_SDK:-/opt/android/sdk}" ./gradlew build
popd
}

collect_artifacts_to_be_uploaded() {
Expand All @@ -116,6 +122,10 @@ collect_artifacts_to_be_uploaded() {
# Collect JAR and AAR
cp extension/android/build/libs/executorch.jar "${DEMO_APP_DIR}"
find "${BUILD_AAR_DIR}/" -name 'executorch*.aar' -exec cp {} "${DEMO_APP_DIR}" \;
# Collect MiniBench APK
MINIBENCH_APP_DIR="${ARTIFACTS_DIR_NAME}/minibench"
mkdir -p "${MINIBENCH_APP_DIR}"
cp extension/android/benchmark/app/build/outputs/apk/debug/*.apk "${MINIBENCH_APP_DIR}"
}

BUILD_AAR_DIR="$(mktemp -d)"
Expand All @@ -130,5 +140,5 @@ for ANDROID_ABI in "${ANDROID_ABIS[@]}"; do
build_android_native_library ${ANDROID_ABI}
done
build_aar
build_android_llm_demo_app
build_android_demo_apps
collect_artifacts_to_be_uploaded ${ARTIFACTS_DIR_NAME}
Loading