Skip to content

Commit 6fca3c9

Browse files
authored
Build AAR in release/0.2 branch (#3820)
* Rename so file to match soname (#3810) Summary: Pull Request resolved: #3810 Test Plan: Use artifact from https://gha-artifacts.s3.amazonaws.com/pytorch/executorch/9356134478/artifact/executorch-llama.aar to build demo app Reviewed By: shoumikhin Differential Revision: D58100605 Pulled By: kirklandsign fbshipit-source-id: a1febda12a546b7bf53c1059a603fece0e5553c5 (cherry picked from commit 2c00ade) * Need to build aar in release branch as well
1 parent 6c74717 commit 6fca3c9

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

build/test_android_ci.sh

+20
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ build_android_native_library() {
2222
pushd examples/demo-apps/android/LlamaDemo
2323
CMAKE_OUT="cmake-out-android-$1" ANDROID_NDK=/opt/ndk ANDROID_ABI="$1" ./gradlew setup
2424
popd
25+
cp "cmake-out-android-$1"/extension/android/*.so build_aar/jni/$1/
2526
}
2627

2728
build_android_demo_app() {
@@ -37,8 +38,27 @@ build_android_llama_demo_app() {
3738
popd
3839
}
3940

41+
build_aar() {
42+
cp extension/android/build/libs/executorch.jar build_aar/libs
43+
echo \<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\" \
44+
package=\"org.pytorch.executorch\"\> \
45+
\<uses-sdk android:minSdkVersion=\"19\" /\> \
46+
\</manifest\> > build_aar/AndroidManifest.xml
47+
pushd build_aar
48+
mv jni/arm64-v8a/libexecutorch_jni.so jni/arm64-v8a/libexecutorch.so
49+
mv jni/x86_64/libexecutorch_jni.so jni/x86_64/libexecutorch.so
50+
zip -r executorch.aar libs jni AndroidManifest.xml
51+
52+
rm jni/arm64-v8a/libexecutorch.so jni/x86_64/libexecutorch.so
53+
zip -r executorch-llama.aar libs jni AndroidManifest.xml
54+
popd
55+
}
56+
57+
mkdir -p build_aar/jni/arm64-v8a build_aar/jni/x86_64 build_aar/libs
58+
4059
build_android_native_library arm64-v8a
4160
build_android_native_library x86_64
4261
export_model
4362
build_android_demo_app
4463
build_android_llama_demo_app
64+
build_aar

0 commit comments

Comments
 (0)