diff --git a/.ci/scripts/build_android_instrumentation.sh b/.ci/scripts/build_android_instrumentation.sh
index 91bf03691b0..93b0591a261 100644
--- a/.ci/scripts/build_android_instrumentation.sh
+++ b/.ci/scripts/build_android_instrumentation.sh
@@ -13,9 +13,11 @@ fi
which "${PYTHON_EXECUTABLE}"
build_android_test() {
- pushd extension/android_test
- ANDROID_HOME="${ANDROID_SDK:-/opt/android/sdk}" ./gradlew testDebugUnitTest
- ANDROID_HOME="${ANDROID_SDK:-/opt/android/sdk}" ./gradlew build assembleAndroidTest
+ mkdir -p extension/android/executorch_android/src/androidTest/resources
+ cp extension/module/test/resources/add.pte extension/android/executorch_android/src/androidTest/resources
+ pushd extension/android
+ ANDROID_HOME="${ANDROID_SDK:-/opt/android/sdk}" ./gradlew :executorch_android:testDebugUnitTest
+ ANDROID_HOME="${ANDROID_SDK:-/opt/android/sdk}" ./gradlew :executorch_android:assembleAndroidTest
popd
}
@@ -24,8 +26,7 @@ collect_artifacts_to_be_uploaded() {
# Collect Java library test
JAVA_LIBRARY_TEST_DIR="${ARTIFACTS_DIR_NAME}/library_test_dir"
mkdir -p "${JAVA_LIBRARY_TEST_DIR}"
- cp extension/android_test/build/outputs/apk/debug/*.apk "${JAVA_LIBRARY_TEST_DIR}"
- cp extension/android_test/build/outputs/apk/androidTest/debug/*.apk "${JAVA_LIBRARY_TEST_DIR}"
+ cp extension/android/executorch_android/build/outputs/apk/androidTest/debug/*.apk "${JAVA_LIBRARY_TEST_DIR}"
}
main() {
diff --git a/.github/workflows/_android.yml b/.github/workflows/_android.yml
index 40969e59911..4ffb7ee9950 100644
--- a/.github/workflows/_android.yml
+++ b/.github/workflows/_android.yml
@@ -28,14 +28,16 @@ jobs:
PYTHON_EXECUTABLE=python bash .ci/scripts/setup-linux.sh --build-tool buck2
export ARTIFACTS_DIR_NAME=artifacts-to-be-uploaded
+ mkdir -p ${ARTIFACTS_DIR_NAME}/fp32-xnnpack-custom
+ bash examples/models/llama/install_requirements.sh
+ bash ".ci/scripts/test_llama.sh" -model stories110M -build_tool cmake -dtype fp16 -mode portable -upload ${ARTIFACTS_DIR_NAME}/fp32-xnnpack-custom
+
# Build LLM Demo for Android
export BUILD_AAR_DIR=aar-out
+ mkdir -p $BUILD_AAR_DIR
bash build/build_android_library.sh ${ARTIFACTS_DIR_NAME}
bash .ci/scripts/build_android_instrumentation.sh ${ARTIFACTS_DIR_NAME}
- mkdir -p ${ARTIFACTS_DIR_NAME}/fp32-xnnpack-custom
- bash ".ci/scripts/test_llama.sh" -model stories110M -build_tool cmake -dtype fp16 -mode portable -upload ${ARTIFACTS_DIR_NAME}/fp32-xnnpack-custom
-
mkdir -p examples/demo-apps/android/LlamaDemo/app/libs
cp aar-out/executorch.aar examples/demo-apps/android/LlamaDemo/app/libs
pushd examples/demo-apps/android/LlamaDemo
@@ -94,7 +96,6 @@ jobs:
curl -O https://gha-artifacts.s3.amazonaws.com/${{ github.repository }}/${{ github.run_id }}/artifacts/llm_demo/app-debug.apk
curl -O https://gha-artifacts.s3.amazonaws.com/${{ github.repository }}/${{ github.run_id }}/artifacts/llm_demo/app-debug-androidTest.apk
curl -O https://gha-artifacts.s3.amazonaws.com/${{ github.repository }}/${{ github.run_id }}/artifacts/fp32-xnnpack-custom/model.zip
- curl -o android-test-debug.apk https://gha-artifacts.s3.amazonaws.com/${{ github.repository }}/${{ github.run_id }}/artifacts/library_test_dir/executorch-debug.apk
curl -o android-test-debug-androidTest.apk https://gha-artifacts.s3.amazonaws.com/${{ github.repository }}/${{ github.run_id }}/artifacts/library_test_dir/executorch-debug-androidTest.apk
unzip model.zip
mv *.pte model.pte
diff --git a/.github/workflows/doc-build.yml b/.github/workflows/doc-build.yml
index aa3fed97d4a..b8b63078643 100644
--- a/.github/workflows/doc-build.yml
+++ b/.github/workflows/doc-build.yml
@@ -26,7 +26,7 @@ jobs:
with:
job-name: Build doc
runner: linux.2xlarge
- docker-image: executorch-ubuntu-22.04-clang12
+ docker-image: executorch-ubuntu-22.04-clang12-android
submodules: 'true'
repository: pytorch/executorch
upload-artifact: docs
@@ -70,8 +70,8 @@ jobs:
# Build javadoc:
cd extension/android
- ./gradlew javadoc
- cp -rf build/docs/javadoc "${RUNNER_DOCS_DIR}"
+ ANDROID_HOME="${ANDROID_SDK:-/opt/android/sdk}" ./gradlew :executorch_android:javaDocReleaseGeneration
+ cp -rf executorch_android/build/intermediates/java_doc_dir/release/javaDocReleaseGeneration "${RUNNER_DOCS_DIR}/javadoc"
cd ../..
# If it's main branch, add noindex tag to all .html files to exclude from Google Search indexing.
diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml
index 69fcc11a347..5a3c8595c72 100644
--- a/.github/workflows/lint.yml
+++ b/.github/workflows/lint.yml
@@ -76,8 +76,8 @@ jobs:
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
timeout: 90
script: |
- FILES_NEEDS_FORMAT=$(/opt/google-java-format -n extension/android/src/main/java/org/pytorch/executorch/*.java \
- examples/demo-apps/android/ExecuTorchDemo/app/src/main/java/com/example/executorchdemo/*.java \
+ FILES_NEEDS_FORMAT=$(/opt/google-java-format -n \
+ extension/android/executorch_android/src/main/java/org/pytorch/executorch/*.java \
examples/demo-apps/android/LlamaDemo/app/src/main/java/com/example/executorchllamademo/*.java \
extension/benchmark/android/benchmark/app/src/main/java/org/pytorch/minibench/*.java)
if [ -n "$FILES_NEEDS_FORMAT" ]; then
diff --git a/.github/workflows/pull.yml b/.github/workflows/pull.yml
index 42e65eb3253..5cc117fb3f7 100644
--- a/.github/workflows/pull.yml
+++ b/.github/workflows/pull.yml
@@ -60,7 +60,7 @@ jobs:
- runner: linux.arm64.2xlarge
docker-image: executorch-ubuntu-22.04-clang12
# TODO: Need to figure out why buck2 doesnt work on Graviton instances.
- - runner: linux.arm64.2xlarge
+ - runner: linux.arm64.2xlarge
build-tool: buck2
fail-fast: false
with:
@@ -420,7 +420,6 @@ jobs:
permissions:
id-token: write
contents: read
- needs: test-llama-runner-linux
unittest:
uses: ./.github/workflows/_unittest.yml
diff --git a/build/build_android_library.sh b/build/build_android_library.sh
index e5e1b0eeb7b..36d66dd4e21 100755
--- a/build/build_android_library.sh
+++ b/build/build_android_library.sh
@@ -12,12 +12,9 @@ if [[ -z "${PYTHON_EXECUTABLE:-}" ]]; then
fi
which "${PYTHON_EXECUTABLE}"
-build_jar() {
- pushd extension/android
- ./gradlew build
- popd
- mkdir -p "${BUILD_AAR_DIR}/libs"
- cp extension/android/build/libs/executorch.jar "${BUILD_AAR_DIR}/libs/"
+copy_src() {
+ cp -r extension/android/build.gradle extension/android/settings.gradle extension/android/gradlew extension/android/gradle extension/android/gradlew.bat extension/android/gradle.properties "${BUILD_AAR_DIR}"
+ cp -r extension/android/executorch_android "${BUILD_AAR_DIR}/executorch_android"
}
build_android_native_library() {
@@ -96,44 +93,40 @@ build_android_native_library() {
cmake --build "${CMAKE_OUT}"/extension/android -j "${CMAKE_JOBS}" --config "${EXECUTORCH_CMAKE_BUILD_TYPE}"
# Copy artifacts to ABI specific directory
- mkdir -p "${BUILD_AAR_DIR}/jni/${ANDROID_ABI}"
- cp "${CMAKE_OUT}"/extension/android/*.so "${BUILD_AAR_DIR}/jni/${ANDROID_ABI}/"
+ mkdir -p "${BUILD_AAR_DIR}/executorch_android/src/main/jniLibs/${ANDROID_ABI}"
+ cp "${CMAKE_OUT}"/extension/android/*.so "${BUILD_AAR_DIR}/executorch_android/src/main/jniLibs/${ANDROID_ABI}/"
# Copy QNN related so library
if [ -n "$QNN_SDK_ROOT" ] && [ "$ANDROID_ABI" == "arm64-v8a" ]; then
- cp "${CMAKE_OUT}"/lib/libqnn_executorch_backend.so "${BUILD_AAR_DIR}/jni/${ANDROID_ABI}/"
- cp "${QNN_SDK_ROOT}"/lib/aarch64-android/libQnnHtp.so "${BUILD_AAR_DIR}/jni/${ANDROID_ABI}/"
- cp "${QNN_SDK_ROOT}"/lib/aarch64-android/libQnnSystem.so "${BUILD_AAR_DIR}/jni/${ANDROID_ABI}/"
- cp "${QNN_SDK_ROOT}"/lib/aarch64-android/libQnnHtpV69Stub.so "${BUILD_AAR_DIR}/jni/${ANDROID_ABI}/"
- cp "${QNN_SDK_ROOT}"/lib/aarch64-android/libQnnHtpV73Stub.so "${BUILD_AAR_DIR}/jni/${ANDROID_ABI}/"
- cp "${QNN_SDK_ROOT}"/lib/aarch64-android/libQnnHtpV75Stub.so "${BUILD_AAR_DIR}/jni/${ANDROID_ABI}/"
- cp "${QNN_SDK_ROOT}"/lib/hexagon-v69/unsigned/libQnnHtpV69Skel.so "${BUILD_AAR_DIR}/jni/${ANDROID_ABI}/"
- cp "${QNN_SDK_ROOT}"/lib/hexagon-v73/unsigned/libQnnHtpV73Skel.so "${BUILD_AAR_DIR}/jni/${ANDROID_ABI}/"
- cp "${QNN_SDK_ROOT}"/lib/hexagon-v75/unsigned/libQnnHtpV75Skel.so "${BUILD_AAR_DIR}/jni/${ANDROID_ABI}/"
+ cp "${CMAKE_OUT}"/lib/libqnn_executorch_backend.so "${BUILD_AAR_DIR}/executorch_android/src/main/jniLibs/${ANDROID_ABI}/"
+ cp "${QNN_SDK_ROOT}"/lib/aarch64-android/libQnnHtp.so "${BUILD_AAR_DIR}/executorch_android/src/main/jniLibs/${ANDROID_ABI}/"
+ cp "${QNN_SDK_ROOT}"/lib/aarch64-android/libQnnSystem.so "${BUILD_AAR_DIR}/executorch_android/src/main/jniLibs/${ANDROID_ABI}/"
+ cp "${QNN_SDK_ROOT}"/lib/aarch64-android/libQnnHtpV69Stub.so "${BUILD_AAR_DIR}/executorch_android/src/main/jniLibs/${ANDROID_ABI}/"
+ cp "${QNN_SDK_ROOT}"/lib/aarch64-android/libQnnHtpV73Stub.so "${BUILD_AAR_DIR}/executorch_android/src/main/jniLibs/${ANDROID_ABI}/"
+ cp "${QNN_SDK_ROOT}"/lib/aarch64-android/libQnnHtpV75Stub.so "${BUILD_AAR_DIR}/executorch_android/src/main/jniLibs/${ANDROID_ABI}/"
+ cp "${QNN_SDK_ROOT}"/lib/hexagon-v69/unsigned/libQnnHtpV69Skel.so "${BUILD_AAR_DIR}/executorch_android/src/main/jniLibs/${ANDROID_ABI}/"
+ cp "${QNN_SDK_ROOT}"/lib/hexagon-v73/unsigned/libQnnHtpV73Skel.so "${BUILD_AAR_DIR}/executorch_android/src/main/jniLibs/${ANDROID_ABI}/"
+ cp "${QNN_SDK_ROOT}"/lib/hexagon-v75/unsigned/libQnnHtpV75Skel.so "${BUILD_AAR_DIR}/executorch_android/src/main/jniLibs/${ANDROID_ABI}/"
fi
# Copy MTK related so library
if [ -n "$NEURON_BUFFER_ALLOCATOR_LIB" ] && [ -n "$NEURON_USDK_ADAPTER_LIB" ] && [ "$ANDROID_ABI" == "arm64-v8a" ]; then
- cp "${CMAKE_OUT}"/backends/mediatek/libneuron_backend.so ${BUILD_AAR_DIR}/jni/${ANDROID_ABI}/
- cp "${NEURON_BUFFER_ALLOCATOR_LIB}" ${BUILD_AAR_DIR}/jni/${ANDROID_ABI}/
- cp "${NEURON_USDK_ADAPTER_LIB}" ${BUILD_AAR_DIR}/jni/${ANDROID_ABI}/
+ cp "${CMAKE_OUT}"/backends/mediatek/libneuron_backend.so ${BUILD_AAR_DIR}/executorch_android/src/main/jniLibs/${ANDROID_ABI}/
+ cp "${NEURON_BUFFER_ALLOCATOR_LIB}" ${BUILD_AAR_DIR}/executorch_android/src/main/jniLibs/${ANDROID_ABI}/
+ cp "${NEURON_USDK_ADAPTER_LIB}" ${BUILD_AAR_DIR}/executorch_android/src/main/jniLibs/${ANDROID_ABI}/
fi
}
build_aar() {
- echo \ \
- \ \
- \ > "${BUILD_AAR_DIR}/AndroidManifest.xml"
pushd "${BUILD_AAR_DIR}"
# Rename libexecutorch_jni.so to libexecutorch.so for soname consistency
# between Java and JNI
- find jni -type f -name "libexecutorch_jni.so" -exec bash -c 'mv "$1" "${1/_jni/}"' bash {} \;
+ find . -type f -name "libexecutorch_jni.so" -exec bash -c 'mv "$1" "${1/_jni/}"' bash {} \;
if [ "$EXECUTORCH_CMAKE_BUILD_TYPE" == "Release" ]; then
- find jni -type f -name "*.so" -exec "$ANDROID_NDK"/toolchains/llvm/prebuilt/*/bin/llvm-strip {} \;
+ find . -type f -name "*.so" -exec "$ANDROID_NDK"/toolchains/llvm/prebuilt/*/bin/llvm-strip {} \;
fi
- # Zip all necessary files into the AAR file
- zip -r executorch.aar libs jni/*/libexecutorch.so jni/*/libqnn*.so jni/*/libQnn*.so jni/*/libneuron_backend.so jni/*/libneuron_buffer_allocator.so jni/*/libneuronusdk_adapter.mtk.so AndroidManifest.xml
+ ANDROID_HOME="${ANDROID_SDK:-/opt/android/sdk}" ./gradlew build
+ cp executorch_android/build/outputs/aar/executorch_android-debug.aar executorch.aar
popd
}
@@ -149,7 +142,7 @@ main() {
ARTIFACTS_DIR_NAME="$1"
- build_jar
+ copy_src
for ANDROID_ABI in "${ANDROID_ABIS[@]}"; do
build_android_native_library ${ANDROID_ABI}
done
diff --git a/build/run_android_emulator.sh b/build/run_android_emulator.sh
index cd625988ec4..363ded31b5e 100755
--- a/build/run_android_emulator.sh
+++ b/build/run_android_emulator.sh
@@ -28,9 +28,7 @@ adb push model.pte /data/local/tmp/llama
adb push tokenizer.bin /data/local/tmp/llama
adb shell am instrument -w -r com.example.executorchllamademo.test/androidx.test.runner.AndroidJUnitRunner
-adb uninstall org.pytorch.executorch || true
-adb uninstall org.pytorch.executorch.test || true
-adb install -t android-test-debug.apk
-adb install -t android-test-debug-androidTest.apk
+# adb uninstall org.pytorch.executorch.test || true
+# adb install -t android-test-debug-androidTest.apk
-adb shell am instrument -w -r org.pytorch.executorch.test/androidx.test.runner.AndroidJUnitRunner
+# adb shell am instrument -w -r org.pytorch.executorch.test/androidx.test.runner.AndroidJUnitRunner
diff --git a/extension/android/BUCK b/extension/android/BUCK
index e74f0fdc69a..7312545d6eb 100644
--- a/extension/android/BUCK
+++ b/extension/android/BUCK
@@ -5,12 +5,12 @@ oncall("executorch")
fb_android_library(
name = "executorch",
srcs = [
- "src/main/java/org/pytorch/executorch/DType.java",
- "src/main/java/org/pytorch/executorch/EValue.java",
- "src/main/java/org/pytorch/executorch/Module.java",
- "src/main/java/org/pytorch/executorch/NativePeer.java",
- "src/main/java/org/pytorch/executorch/Tensor.java",
- "src/main/java/org/pytorch/executorch/annotations/Experimental.java",
+ "executorch_android/src/main/java/org/pytorch/executorch/DType.java",
+ "executorch_android/src/main/java/org/pytorch/executorch/EValue.java",
+ "executorch_android/src/main/java/org/pytorch/executorch/Module.java",
+ "executorch_android/src/main/java/org/pytorch/executorch/NativePeer.java",
+ "executorch_android/src/main/java/org/pytorch/executorch/Tensor.java",
+ "executorch_android/src/main/java/org/pytorch/executorch/annotations/Experimental.java",
],
autoglob = False,
language = "JAVA",
@@ -23,8 +23,8 @@ fb_android_library(
fb_android_library(
name = "executorch_llama",
srcs = [
- "src/main/java/org/pytorch/executorch/extension/llm/LlmCallback.java",
- "src/main/java/org/pytorch/executorch/extension/llm/LlmModule.java",
+ "executorch_android/src/main/java/org/pytorch/executorch/extension/llm/LlmCallback.java",
+ "executorch_android/src/main/java/org/pytorch/executorch/extension/llm/LlmModule.java",
],
autoglob = False,
language = "JAVA",
diff --git a/extension/android/build.gradle b/extension/android/build.gradle
index a4172e90578..ac031653a7a 100644
--- a/extension/android/build.gradle
+++ b/extension/android/build.gradle
@@ -1,24 +1,30 @@
-/*
- * Copyright (c) Meta Platforms, Inc. and affiliates.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree.
- */
+allprojects {
+ buildscript {
+ ext {
+ minSdkVersion = 21
+ targetSdkVersion = 34
+ compileSdkVersion = 34
+ buildToolsVersion = '33.0.1'
-plugins {
- id 'java-library'
-}
+ fbjniJavaOnlyVersion = "0.5.1"
+ soLoaderNativeLoaderVersion = "0.10.5"
+ }
-group 'org.pytorch.executorch'
+ repositories {
+ google()
+ mavenCentral()
+ }
-repositories {
- mavenCentral()
-}
+ dependencies {
+ classpath 'com.android.tools.build:gradle:8.9.0'
+ classpath 'com.vanniktech:gradle-maven-publish-plugin:0.31.0'
+ }
+
+ }
-task makeJar(type: Jar) {
- dependencies {
- implementation 'com.facebook.fbjni:fbjni-java-only:0.5.1'
- implementation 'com.facebook.soloader:nativeloader:0.10.5'
+ repositories {
+ google()
+ jcenter()
+ mavenCentral()
}
}
diff --git a/extension/android/executorch_android/build.gradle b/extension/android/executorch_android/build.gradle
new file mode 100644
index 00000000000..16c3d97c87e
--- /dev/null
+++ b/extension/android/executorch_android/build.gradle
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+plugins {
+ id "com.android.library" version "8.9.0"
+ id "com.vanniktech.maven.publish" version "0.31.0"
+}
+
+android {
+ namespace = "org.pytorch.executorch"
+ compileSdk = 34
+
+ defaultConfig {
+ minSdk = 23
+
+ testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
+ }
+
+ compileOptions {
+ sourceCompatibility = JavaVersion.VERSION_1_8
+ targetCompatibility = JavaVersion.VERSION_1_8
+ }
+
+ sourceSets {
+ androidTest {
+ resources.srcDirs += [ 'src/androidTest/resources' ]
+ }
+ }
+}
+
+dependencies {
+ implementation 'com.facebook.fbjni:fbjni-java-only:0.5.1'
+ implementation 'com.facebook.soloader:nativeloader:0.10.5'
+ testImplementation 'junit:junit:4.12'
+ androidTestImplementation 'androidx.test.ext:junit:1.1.5'
+ androidTestImplementation 'androidx.test:rules:1.2.0'
+ androidTestImplementation 'commons-io:commons-io:2.4'
+}
+
+import com.vanniktech.maven.publish.SonatypeHost
+
+mavenPublishing {
+ publishToMavenCentral(SonatypeHost.DEFAULT)
+ signAllPublications()
+
+ coordinates("org.pytorch", "executorch-android", "0.5.0-SNAPSHOT")
+
+ pom {
+ name = "ExecuTorch Android"
+ description = "ExecuTorch Android API"
+ inceptionYear = "2025"
+ url = "https://github.com/pytorch/executorch/"
+ licenses {
+ license {
+ name = "BSD 3-Clause"
+ url = "https://github.com/pytorch/executorch/blob/main/LICENSE"
+ distribution = "https://github.com/pytorch/executorch/blob/main/LICENSE"
+ }
+ }
+ developers {
+ developer {
+ id = "pytorch"
+ name = "pytorch"
+ url = "https://github.com/pytorch/executorch/"
+ }
+ }
+ scm {
+ url = "https://github.com/pytorch/executorch.git"
+ connection = "scm:git:https://github.com/pytorch/executorch"
+ developerConnection = "scm:git:git@github.com:pytorch/executorch.git"
+ }
+ }
+
+}
+
+repositories {
+ maven {
+ url "https://oss.sonatype.org/content/repositories/snapshots"
+ }
+}
diff --git a/extension/android_test/src/androidTest/java/org/pytorch/executorch/LlmModuleInstrumentationTest.java b/extension/android/executorch_android/src/androidTest/java/org/pytorch/executorch/LlmModuleInstrumentationTest.java
similarity index 95%
rename from extension/android_test/src/androidTest/java/org/pytorch/executorch/LlmModuleInstrumentationTest.java
rename to extension/android/executorch_android/src/androidTest/java/org/pytorch/executorch/LlmModuleInstrumentationTest.java
index 5acdba21521..b3b515d7ed0 100644
--- a/extension/android_test/src/androidTest/java/org/pytorch/executorch/LlmModuleInstrumentationTest.java
+++ b/extension/android/executorch_android/src/androidTest/java/org/pytorch/executorch/LlmModuleInstrumentationTest.java
@@ -6,7 +6,7 @@
* LICENSE file in the root directory of this source tree.
*/
-package com.example.executorch;
+package org.pytorch.executorch;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
@@ -34,13 +34,10 @@
import org.apache.commons.io.FileUtils;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.test.InstrumentationRegistry;
-import org.pytorch.executorch.extension.llm.LlmModule;
import org.pytorch.executorch.extension.llm.LlmCallback;
-import org.pytorch.executorch.Module;
-import org.pytorch.executorch.EValue;
-import org.pytorch.executorch.Tensor;
+import org.pytorch.executorch.extension.llm.LlmModule;
-/** Unit tests for {@link LlmModule}. */
+/** Unit tests for {@link org.pytorch.executorch.extension.llm.LlmModule}. */
@RunWith(AndroidJUnit4.class)
public class LlmModuleInstrumentationTest implements LlmCallback {
private static String TEST_FILE_NAME = "/tinyllama_portable_fp16_h.pte";
diff --git a/extension/android_test/src/androidTest/java/org/pytorch/executorch/ModuleInstrumentationTest.java b/extension/android/executorch_android/src/androidTest/java/org/pytorch/executorch/ModuleInstrumentationTest.java
similarity index 96%
rename from extension/android_test/src/androidTest/java/org/pytorch/executorch/ModuleInstrumentationTest.java
rename to extension/android/executorch_android/src/androidTest/java/org/pytorch/executorch/ModuleInstrumentationTest.java
index e8259969ab1..a25c0bf6343 100644
--- a/extension/android_test/src/androidTest/java/org/pytorch/executorch/ModuleInstrumentationTest.java
+++ b/extension/android/executorch_android/src/androidTest/java/org/pytorch/executorch/ModuleInstrumentationTest.java
@@ -6,7 +6,7 @@
* LICENSE file in the root directory of this source tree.
*/
-package com.example.executorch;
+package org.pytorch.executorch;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
@@ -32,9 +32,6 @@
import org.apache.commons.io.FileUtils;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.test.InstrumentationRegistry;
-import org.pytorch.executorch.Module;
-import org.pytorch.executorch.EValue;
-import org.pytorch.executorch.Tensor;
/** Unit tests for {@link Module}. */
@RunWith(AndroidJUnit4.class)
diff --git a/extension/android_test/src/androidTest/resources/test.txt b/extension/android/executorch_android/src/androidTest/resources/test.txt
similarity index 100%
rename from extension/android_test/src/androidTest/resources/test.txt
rename to extension/android/executorch_android/src/androidTest/resources/test.txt
diff --git a/extension/android/executorch_android/src/main/AndroidManifest.xml b/extension/android/executorch_android/src/main/AndroidManifest.xml
new file mode 100644
index 00000000000..cb2a2dcdc53
--- /dev/null
+++ b/extension/android/executorch_android/src/main/AndroidManifest.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
diff --git a/extension/android/src/main/java/org/pytorch/executorch/DType.java b/extension/android/executorch_android/src/main/java/org/pytorch/executorch/DType.java
similarity index 100%
rename from extension/android/src/main/java/org/pytorch/executorch/DType.java
rename to extension/android/executorch_android/src/main/java/org/pytorch/executorch/DType.java
diff --git a/extension/android/src/main/java/org/pytorch/executorch/EValue.java b/extension/android/executorch_android/src/main/java/org/pytorch/executorch/EValue.java
similarity index 100%
rename from extension/android/src/main/java/org/pytorch/executorch/EValue.java
rename to extension/android/executorch_android/src/main/java/org/pytorch/executorch/EValue.java
diff --git a/extension/android/src/main/java/org/pytorch/executorch/Module.java b/extension/android/executorch_android/src/main/java/org/pytorch/executorch/Module.java
similarity index 100%
rename from extension/android/src/main/java/org/pytorch/executorch/Module.java
rename to extension/android/executorch_android/src/main/java/org/pytorch/executorch/Module.java
diff --git a/extension/android/src/main/java/org/pytorch/executorch/NativePeer.java b/extension/android/executorch_android/src/main/java/org/pytorch/executorch/NativePeer.java
similarity index 100%
rename from extension/android/src/main/java/org/pytorch/executorch/NativePeer.java
rename to extension/android/executorch_android/src/main/java/org/pytorch/executorch/NativePeer.java
diff --git a/extension/android/src/main/java/org/pytorch/executorch/Tensor.java b/extension/android/executorch_android/src/main/java/org/pytorch/executorch/Tensor.java
similarity index 100%
rename from extension/android/src/main/java/org/pytorch/executorch/Tensor.java
rename to extension/android/executorch_android/src/main/java/org/pytorch/executorch/Tensor.java
diff --git a/extension/android/src/main/java/org/pytorch/executorch/annotations/Experimental.java b/extension/android/executorch_android/src/main/java/org/pytorch/executorch/annotations/Experimental.java
similarity index 100%
rename from extension/android/src/main/java/org/pytorch/executorch/annotations/Experimental.java
rename to extension/android/executorch_android/src/main/java/org/pytorch/executorch/annotations/Experimental.java
diff --git a/extension/android/src/main/java/org/pytorch/executorch/extension/llm/LlmCallback.java b/extension/android/executorch_android/src/main/java/org/pytorch/executorch/extension/llm/LlmCallback.java
similarity index 100%
rename from extension/android/src/main/java/org/pytorch/executorch/extension/llm/LlmCallback.java
rename to extension/android/executorch_android/src/main/java/org/pytorch/executorch/extension/llm/LlmCallback.java
diff --git a/extension/android/src/main/java/org/pytorch/executorch/extension/llm/LlmModule.java b/extension/android/executorch_android/src/main/java/org/pytorch/executorch/extension/llm/LlmModule.java
similarity index 100%
rename from extension/android/src/main/java/org/pytorch/executorch/extension/llm/LlmModule.java
rename to extension/android/executorch_android/src/main/java/org/pytorch/executorch/extension/llm/LlmModule.java
diff --git a/extension/android_test/src/test/java/org/pytorch/executorch/EValueTest.java b/extension/android/executorch_android/src/test/java/org/pytorch/executorch/EValueTest.java
similarity index 100%
rename from extension/android_test/src/test/java/org/pytorch/executorch/EValueTest.java
rename to extension/android/executorch_android/src/test/java/org/pytorch/executorch/EValueTest.java
diff --git a/extension/android_test/src/test/java/org/pytorch/executorch/TensorTest.java b/extension/android/executorch_android/src/test/java/org/pytorch/executorch/TensorTest.java
similarity index 100%
rename from extension/android_test/src/test/java/org/pytorch/executorch/TensorTest.java
rename to extension/android/executorch_android/src/test/java/org/pytorch/executorch/TensorTest.java
diff --git a/extension/android/gradle.properties b/extension/android/gradle.properties
new file mode 100644
index 00000000000..5bac8ac5046
--- /dev/null
+++ b/extension/android/gradle.properties
@@ -0,0 +1 @@
+android.useAndroidX=true
diff --git a/extension/android/gradle/wrapper/gradle-wrapper.properties b/extension/android/gradle/wrapper/gradle-wrapper.properties
index a80b22ce5cf..e2847c82004 100644
--- a/extension/android/gradle/wrapper/gradle-wrapper.properties
+++ b/extension/android/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
diff --git a/extension/android/settings.gradle b/extension/android/settings.gradle
index 2a0a78b30cc..95d46203058 100644
--- a/extension/android/settings.gradle
+++ b/extension/android/settings.gradle
@@ -5,10 +5,20 @@
* For more detailed information on multi-project builds, please refer to https://docs.gradle.org/8.6/userguide/multi_project_builds.html in the Gradle documentation.
*/
+pluginManagement {
+ repositories {
+ google()
+ gradlePluginPortal()
+ mavenCentral()
+ mavenLocal()
+ }
+}
+
plugins {
// Apply the foojay-resolver plugin to allow automatic download of JDKs
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.7.0'
}
rootProject.name = 'executorch'
-include('src')
+
+include('executorch_android')
diff --git a/extension/android_test/.gitignore b/extension/android_test/.gitignore
deleted file mode 100644
index a43b7e827a8..00000000000
--- a/extension/android_test/.gitignore
+++ /dev/null
@@ -1,6 +0,0 @@
-local.properties
-.gradle
-.idea/*
-.externalNativeBuild
-src/libs/*
-build
diff --git a/extension/android_test/TARGETS b/extension/android_test/TARGETS
deleted file mode 100644
index 5c4f482b5ea..00000000000
--- a/extension/android_test/TARGETS
+++ /dev/null
@@ -1 +0,0 @@
-# This file needs to exist to avoid build system breakage, see https://fburl.com/workplace/jtdlgdmd
diff --git a/extension/android_test/add_model.py b/extension/android_test/add_model.py
deleted file mode 100644
index b7ac3955ee3..00000000000
--- a/extension/android_test/add_model.py
+++ /dev/null
@@ -1,26 +0,0 @@
-import torch
-from executorch.exir import to_edge
-from torch.export import export
-
-
-# Start with a PyTorch model that adds two input tensors (matrices)
-class Add(torch.nn.Module):
- def __init__(self):
- super(Add, self).__init__()
-
- def forward(self, x: torch.Tensor, y: torch.Tensor):
- return x + y
-
-
-# 1. torch.export: Defines the program with the ATen operator set.
-aten_dialect = export(Add(), (torch.ones(1), torch.ones(1)), strict=True)
-
-# 2. to_edge: Make optimizations for Edge devices
-edge_program = to_edge(aten_dialect)
-
-# 3. to_executorch: Convert the graph to an ExecuTorch program
-executorch_program = edge_program.to_executorch()
-
-# 4. Save the compiled .pte program
-with open("add.pte", "wb") as file:
- file.write(executorch_program.buffer)
diff --git a/extension/android_test/build.gradle b/extension/android_test/build.gradle
deleted file mode 100644
index d2310d8b5fb..00000000000
--- a/extension/android_test/build.gradle
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (c) Meta Platforms, Inc. and affiliates.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree.
- */
-plugins {
- id("com.android.application") version "8.1.0" apply false
-}
-
-group 'org.pytorch.executorch'
-
-apply plugin: "com.android.application"
-
-android {
- namespace 'org.pytorch.executorch'
- compileSdk = 34
-
- defaultConfig {
- minSdk = 28
- targetSdk = 33
- versionCode 1
- versionName "1.0"
- testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
- }
- compileOptions {
- sourceCompatibility JavaVersion.VERSION_1_8
- targetCompatibility JavaVersion.VERSION_1_8
- }
- sourceSets {
- androidTest {
- resources.srcDirs += [ 'src/androidTest/resources' ]
- }
- }
-}
-
-dependencies {
- implementation 'com.facebook.soloader:nativeloader:0.10.5'
- implementation("com.facebook.fbjni:fbjni:0.5.1")
- implementation(files("src/libs/executorch.aar"))
- testImplementation 'junit:junit:4.13.2'
- androidTestImplementation 'androidx.test.ext:junit:1.1.5'
- androidTestImplementation 'androidx.test:rules:1.2.0'
- androidTestImplementation 'commons-io:commons-io:2.4'
- androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
- androidTestImplementation 'com.google.gms:google-services:4.3.3'
-}
-
-task('setupNativeLibs', type: Exec){
- commandLine("bash", "setup.sh")
-}
-
-gradle.projectsEvaluated {
- preBuild.dependsOn setupNativeLibs
-}
diff --git a/extension/android_test/gradle.properties b/extension/android_test/gradle.properties
deleted file mode 100644
index 2cbd6d19d33..00000000000
--- a/extension/android_test/gradle.properties
+++ /dev/null
@@ -1,23 +0,0 @@
-# Project-wide Gradle settings.
-# IDE (e.g. Android Studio) users:
-# Gradle settings configured through the IDE *will override*
-# any settings specified in this file.
-# For more details on how to configure your build environment visit
-# http://www.gradle.org/docs/current/userguide/build_environment.html
-# Specifies the JVM arguments used for the daemon process.
-# The setting is particularly useful for tweaking memory settings.
-org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
-# When configured, Gradle will run in incubating parallel mode.
-# This option should only be used with decoupled projects. More details, visit
-# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
-# org.gradle.parallel=true
-# AndroidX package structure to make it clearer which packages are bundled with the
-# Android operating system, and which are packaged with your app's APK
-# https://developer.android.com/topic/libraries/support-library/androidx-rn
-android.useAndroidX=true
-# Kotlin code style for this project: "official" or "obsolete":
-kotlin.code.style=official
-# Enables namespacing of each library's R class so that its R class includes only the
-# resources declared in the library itself and none from the library's dependencies,
-# thereby reducing the size of the R class for that library
-android.nonTransitiveRClass=true
diff --git a/extension/android_test/gradle/libs.versions.toml b/extension/android_test/gradle/libs.versions.toml
deleted file mode 100644
index 561988cb1f6..00000000000
--- a/extension/android_test/gradle/libs.versions.toml
+++ /dev/null
@@ -1,12 +0,0 @@
-# This file was generated by the Gradle 'init' task.
-# https://docs.gradle.org/current/userguide/platforms.html#sub::toml-dependencies-format
-
-[versions]
-commons-math3 = "3.6.1"
-guava = "32.1.3-jre"
-junit = "4.13.2"
-
-[libraries]
-commons-math3 = { module = "org.apache.commons:commons-math3", version.ref = "commons-math3" }
-guava = { module = "com.google.guava:guava", version.ref = "guava" }
-junit = { module = "junit:junit", version.ref = "junit" }
diff --git a/extension/android_test/gradle/wrapper/gradle-wrapper.jar b/extension/android_test/gradle/wrapper/gradle-wrapper.jar
deleted file mode 100644
index d64cd491770..00000000000
Binary files a/extension/android_test/gradle/wrapper/gradle-wrapper.jar and /dev/null differ
diff --git a/extension/android_test/gradle/wrapper/gradle-wrapper.properties b/extension/android_test/gradle/wrapper/gradle-wrapper.properties
deleted file mode 100644
index a80b22ce5cf..00000000000
--- a/extension/android_test/gradle/wrapper/gradle-wrapper.properties
+++ /dev/null
@@ -1,7 +0,0 @@
-distributionBase=GRADLE_USER_HOME
-distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
-networkTimeout=10000
-validateDistributionUrl=true
-zipStoreBase=GRADLE_USER_HOME
-zipStorePath=wrapper/dists
diff --git a/extension/android_test/gradlew b/extension/android_test/gradlew
deleted file mode 100755
index 1aa94a42690..00000000000
--- a/extension/android_test/gradlew
+++ /dev/null
@@ -1,249 +0,0 @@
-#!/bin/sh
-
-#
-# Copyright © 2015-2021 the original authors.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# https://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-##############################################################################
-#
-# Gradle start up script for POSIX generated by Gradle.
-#
-# Important for running:
-#
-# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
-# noncompliant, but you have some other compliant shell such as ksh or
-# bash, then to run this script, type that shell name before the whole
-# command line, like:
-#
-# ksh Gradle
-#
-# Busybox and similar reduced shells will NOT work, because this script
-# requires all of these POSIX shell features:
-# * functions;
-# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
-# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
-# * compound commands having a testable exit status, especially «case»;
-# * various built-in commands including «command», «set», and «ulimit».
-#
-# Important for patching:
-#
-# (2) This script targets any POSIX shell, so it avoids extensions provided
-# by Bash, Ksh, etc; in particular arrays are avoided.
-#
-# The "traditional" practice of packing multiple parameters into a
-# space-separated string is a well documented source of bugs and security
-# problems, so this is (mostly) avoided, by progressively accumulating
-# options in "$@", and eventually passing that to Java.
-#
-# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
-# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
-# see the in-line comments for details.
-#
-# There are tweaks for specific operating systems such as AIX, CygWin,
-# Darwin, MinGW, and NonStop.
-#
-# (3) This script is generated from the Groovy template
-# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
-# within the Gradle project.
-#
-# You can find Gradle at https://github.com/gradle/gradle/.
-#
-##############################################################################
-
-# Attempt to set APP_HOME
-
-# Resolve links: $0 may be a link
-app_path=$0
-
-# Need this for daisy-chained symlinks.
-while
- APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
- [ -h "$app_path" ]
-do
- ls=$( ls -ld "$app_path" )
- link=${ls#*' -> '}
- case $link in #(
- /*) app_path=$link ;; #(
- *) app_path=$APP_HOME$link ;;
- esac
-done
-
-# This is normally unused
-# shellcheck disable=SC2034
-APP_BASE_NAME=${0##*/}
-# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
-APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
-
-# Use the maximum available, or set MAX_FD != -1 to use that value.
-MAX_FD=maximum
-
-warn () {
- echo "$*"
-} >&2
-
-die () {
- echo
- echo "$*"
- echo
- exit 1
-} >&2
-
-# OS specific support (must be 'true' or 'false').
-cygwin=false
-msys=false
-darwin=false
-nonstop=false
-case "$( uname )" in #(
- CYGWIN* ) cygwin=true ;; #(
- Darwin* ) darwin=true ;; #(
- MSYS* | MINGW* ) msys=true ;; #(
- NONSTOP* ) nonstop=true ;;
-esac
-
-CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
-
-
-# Determine the Java command to use to start the JVM.
-if [ -n "$JAVA_HOME" ] ; then
- if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
- # IBM's JDK on AIX uses strange locations for the executables
- JAVACMD=$JAVA_HOME/jre/sh/java
- else
- JAVACMD=$JAVA_HOME/bin/java
- fi
- if [ ! -x "$JAVACMD" ] ; then
- die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
-
-Please set the JAVA_HOME variable in your environment to match the
-location of your Java installation."
- fi
-else
- JAVACMD=java
- if ! command -v java >/dev/null 2>&1
- then
- die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-
-Please set the JAVA_HOME variable in your environment to match the
-location of your Java installation."
- fi
-fi
-
-# Increase the maximum file descriptors if we can.
-if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
- case $MAX_FD in #(
- max*)
- # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
- # shellcheck disable=SC2039,SC3045
- MAX_FD=$( ulimit -H -n ) ||
- warn "Could not query maximum file descriptor limit"
- esac
- case $MAX_FD in #(
- '' | soft) :;; #(
- *)
- # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
- # shellcheck disable=SC2039,SC3045
- ulimit -n "$MAX_FD" ||
- warn "Could not set maximum file descriptor limit to $MAX_FD"
- esac
-fi
-
-# Collect all arguments for the java command, stacking in reverse order:
-# * args from the command line
-# * the main class name
-# * -classpath
-# * -D...appname settings
-# * --module-path (only if needed)
-# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
-
-# For Cygwin or MSYS, switch paths to Windows format before running java
-if "$cygwin" || "$msys" ; then
- APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
- CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
-
- JAVACMD=$( cygpath --unix "$JAVACMD" )
-
- # Now convert the arguments - kludge to limit ourselves to /bin/sh
- for arg do
- if
- case $arg in #(
- -*) false ;; # don't mess with options #(
- /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
- [ -e "$t" ] ;; #(
- *) false ;;
- esac
- then
- arg=$( cygpath --path --ignore --mixed "$arg" )
- fi
- # Roll the args list around exactly as many times as the number of
- # args, so each arg winds up back in the position where it started, but
- # possibly modified.
- #
- # NB: a `for` loop captures its iteration list before it begins, so
- # changing the positional parameters here affects neither the number of
- # iterations, nor the values presented in `arg`.
- shift # remove old arg
- set -- "$@" "$arg" # push replacement arg
- done
-fi
-
-
-# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
-
-# Collect all arguments for the java command:
-# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
-# and any embedded shellness will be escaped.
-# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
-# treated as '${Hostname}' itself on the command line.
-
-set -- \
- "-Dorg.gradle.appname=$APP_BASE_NAME" \
- -classpath "$CLASSPATH" \
- org.gradle.wrapper.GradleWrapperMain \
- "$@"
-
-# Stop when "xargs" is not available.
-if ! command -v xargs >/dev/null 2>&1
-then
- die "xargs is not available"
-fi
-
-# Use "xargs" to parse quoted args.
-#
-# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
-#
-# In Bash we could simply go:
-#
-# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
-# set -- "${ARGS[@]}" "$@"
-#
-# but POSIX shell has neither arrays nor command substitution, so instead we
-# post-process each arg (as a line of input to sed) to backslash-escape any
-# character that might be a shell metacharacter, then use eval to reverse
-# that process (while maintaining the separation between arguments), and wrap
-# the whole thing up as a single "set" statement.
-#
-# This will of course break if any of these variables contains a newline or
-# an unmatched quote.
-#
-
-eval "set -- $(
- printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
- xargs -n1 |
- sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
- tr '\n' ' '
- )" '"$@"'
-
-exec "$JAVACMD" "$@"
diff --git a/extension/android_test/gradlew.bat b/extension/android_test/gradlew.bat
deleted file mode 100644
index 25da30dbdee..00000000000
--- a/extension/android_test/gradlew.bat
+++ /dev/null
@@ -1,92 +0,0 @@
-@rem
-@rem Copyright 2015 the original author or authors.
-@rem
-@rem Licensed under the Apache License, Version 2.0 (the "License");
-@rem you may not use this file except in compliance with the License.
-@rem You may obtain a copy of the License at
-@rem
-@rem https://www.apache.org/licenses/LICENSE-2.0
-@rem
-@rem Unless required by applicable law or agreed to in writing, software
-@rem distributed under the License is distributed on an "AS IS" BASIS,
-@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-@rem See the License for the specific language governing permissions and
-@rem limitations under the License.
-@rem
-
-@if "%DEBUG%"=="" @echo off
-@rem ##########################################################################
-@rem
-@rem Gradle startup script for Windows
-@rem
-@rem ##########################################################################
-
-@rem Set local scope for the variables with windows NT shell
-if "%OS%"=="Windows_NT" setlocal
-
-set DIRNAME=%~dp0
-if "%DIRNAME%"=="" set DIRNAME=.
-@rem This is normally unused
-set APP_BASE_NAME=%~n0
-set APP_HOME=%DIRNAME%
-
-@rem Resolve any "." and ".." in APP_HOME to make it shorter.
-for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
-
-@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
-
-@rem Find java.exe
-if defined JAVA_HOME goto findJavaFromJavaHome
-
-set JAVA_EXE=java.exe
-%JAVA_EXE% -version >NUL 2>&1
-if %ERRORLEVEL% equ 0 goto execute
-
-echo. 1>&2
-echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
-echo. 1>&2
-echo Please set the JAVA_HOME variable in your environment to match the 1>&2
-echo location of your Java installation. 1>&2
-
-goto fail
-
-:findJavaFromJavaHome
-set JAVA_HOME=%JAVA_HOME:"=%
-set JAVA_EXE=%JAVA_HOME%/bin/java.exe
-
-if exist "%JAVA_EXE%" goto execute
-
-echo. 1>&2
-echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
-echo. 1>&2
-echo Please set the JAVA_HOME variable in your environment to match the 1>&2
-echo location of your Java installation. 1>&2
-
-goto fail
-
-:execute
-@rem Setup the command line
-
-set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
-
-
-@rem Execute Gradle
-"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
-
-:end
-@rem End local scope for the variables with windows NT shell
-if %ERRORLEVEL% equ 0 goto mainEnd
-
-:fail
-rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
-rem the _cmd.exe /c_ return code!
-set EXIT_CODE=%ERRORLEVEL%
-if %EXIT_CODE% equ 0 set EXIT_CODE=1
-if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
-exit /b %EXIT_CODE%
-
-:mainEnd
-if "%OS%"=="Windows_NT" endlocal
-
-:omega
diff --git a/extension/android_test/settings.gradle b/extension/android_test/settings.gradle
deleted file mode 100644
index 6b1bd4f7f85..00000000000
--- a/extension/android_test/settings.gradle
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * This file was generated by the Gradle 'init' task.
- *
- * The settings file is used to specify which projects to include in your build.
- * For more detailed information on multi-project builds, please refer to https://docs.gradle.org/8.6/userguide/multi_project_builds.html in the Gradle documentation.
- */
-pluginManagement {
- repositories {
- google()
- mavenCentral()
- gradlePluginPortal()
- }
-}
-
-dependencyResolutionManagement {
- repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
- repositories {
- google()
- mavenCentral()
- }
-}
-
-rootProject.name = 'executorch'
-include('src')
diff --git a/extension/android_test/setup.sh b/extension/android_test/setup.sh
deleted file mode 100755
index e1306af4205..00000000000
--- a/extension/android_test/setup.sh
+++ /dev/null
@@ -1,65 +0,0 @@
-#!/bin/bash
-# Copyright (c) Meta Platforms, Inc. and affiliates.
-# All rights reserved.
-#
-# This source code is licensed under the BSD-style license found in the
-# LICENSE file in the root directory of this source tree.
-
-set -eu
-
-BUILD_AAR_DIR="$(mktemp -d)"
-export BUILD_AAR_DIR
-
-BASEDIR=$(dirname "$0")
-source "$BASEDIR"/../../build/build_android_library.sh
-
-build_native_library() {
- ANDROID_ABI="$1"
- CMAKE_OUT="cmake-out-android-${ANDROID_ABI}"
- ANDROID_NDK="${ANDROID_NDK:-/opt/ndk}"
- EXECUTORCH_CMAKE_BUILD_TYPE="${EXECUTORCH_CMAKE_BUILD_TYPE:-Release}"
- cmake . -DCMAKE_INSTALL_PREFIX="${CMAKE_OUT}" \
- -DCMAKE_TOOLCHAIN_FILE="${ANDROID_NDK}/build/cmake/android.toolchain.cmake" \
- -DANDROID_ABI="${ANDROID_ABI}" \
- -DBUILD_TESTING=OFF \
- -DEXECUTORCH_BUILD_XNNPACK=ON \
- -DEXECUTORCH_XNNPACK_SHARED_WORKSPACE=ON \
- -DEXECUTORCH_BUILD_EXTENSION_DATA_LOADER=ON \
- -DEXECUTORCH_BUILD_EXTENSION_MODULE=ON \
- -DEXECUTORCH_BUILD_EXTENSION_RUNNER_UTIL=ON \
- -DEXECUTORCH_BUILD_EXTENSION_TENSOR=ON \
- -DEXECUTORCH_BUILD_KERNELS_OPTIMIZED=ON \
- -DEXECUTORCH_BUILD_KERNELS_CUSTOM=ON \
- -B"${CMAKE_OUT}"
-
- cmake --build "${CMAKE_OUT}" -j16 --target install
-
- cmake extension/android \
- -DCMAKE_TOOLCHAIN_FILE="${ANDROID_NDK}"/build/cmake/android.toolchain.cmake \
- -DANDROID_ABI="${ANDROID_ABI}" \
- -DBUILD_TESTING=OFF \
- -DCMAKE_INSTALL_PREFIX=c"${CMAKE_OUT}" \
- -DEXECUTORCH_BUILD_KERNELS_CUSTOM=ON \
- -DEXECUTORCH_BUILD_LLAMA_JNI=ON \
- -B"${CMAKE_OUT}"/extension/android
-
- cmake --build "${CMAKE_OUT}"/extension/android -j16
-
- # Copy artifacts to ABI specific directory
- mkdir -p "${BUILD_AAR_DIR}/jni/${ANDROID_ABI}"
- cp "${CMAKE_OUT}"/extension/android/*.so "${BUILD_AAR_DIR}/jni/${ANDROID_ABI}/"
-}
-
-pushd "$BASEDIR"/../../
-build_jar
-build_native_library "arm64-v8a"
-build_native_library "x86_64"
-build_aar
-bash examples/models/llama/install_requirements.sh
-source ".ci/scripts/test_llama.sh" -model stories110M -build_tool cmake -dtype fp16 -mode portable -upload ${BUILD_AAR_DIR}
-popd
-mkdir -p "$BASEDIR"/src/libs
-cp "$BUILD_AAR_DIR/executorch.aar" "$BASEDIR"/src/libs/executorch.aar
-python add_model.py
-mv "add.pte" "$BASEDIR"/src/androidTest/resources/add.pte
-unzip -o "$BUILD_AAR_DIR"/model.zip -d "$BASEDIR"/src/androidTest/resources
diff --git a/extension/android_test/src/main/AndroidManifest.xml b/extension/android_test/src/main/AndroidManifest.xml
deleted file mode 100644
index b8ac862938e..00000000000
--- a/extension/android_test/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
-
-
-
-
-