Skip to content

Commit 1e2768e

Browse files
committed
sh clean.sh script that does cleaning
Let's encapsulate important steps inside this single script for cleaning up. As next steps, I'd like to restart buck as part of this script. #7083
1 parent be87cff commit 1e2768e

File tree

10 files changed

+15
-14
lines changed

10 files changed

+15
-14
lines changed

.ci/scripts/build_llama_android.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ source "$(dirname "${BASH_SOURCE[0]}")/utils.sh"
1212

1313
install_executorch_and_backend_lib() {
1414
echo "Installing executorch and xnnpack backend"
15-
rm -rf cmake-android-out && mkdir cmake-android-out
15+
sh clean.sh
1616
ANDROID_NDK=/opt/ndk
1717
BUCK2=buck2
1818
ANDROID_ABI=arm64-v8a

.ci/scripts/test_llama.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ which "${PYTHON_EXECUTABLE}"
143143

144144
cmake_install_executorch_libraries() {
145145
echo "Installing libexecutorch.a, libextension_module.so, libportable_ops_lib.a"
146-
rm -rf cmake-out
146+
sh clean.sh
147147
retry cmake \
148148
-DCMAKE_INSTALL_PREFIX=cmake-out \
149149
-DCMAKE_BUILD_TYPE="$CMAKE_BUILD_TYPE" \

.ci/scripts/utils.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ build_executorch_runner_buck2() {
7474
build_executorch_runner_cmake() {
7575
CMAKE_OUTPUT_DIR=cmake-out
7676
# Build executorch runtime using cmake
77-
rm -rf "${CMAKE_OUTPUT_DIR}" && mkdir "${CMAKE_OUTPUT_DIR}"
77+
sh clean.sh
7878

7979
pushd "${CMAKE_OUTPUT_DIR}" || return
8080
# This command uses buck2 to gather source files and buck2 could crash flakily
@@ -103,7 +103,7 @@ build_executorch_runner() {
103103

104104
cmake_install_executorch_lib() {
105105
echo "Installing libexecutorch.a and libportable_kernels.a"
106-
rm -rf cmake-out
106+
sh clean.sh
107107
retry cmake -DBUCK2="$BUCK" \
108108
-DCMAKE_INSTALL_PREFIX=cmake-out \
109109
-DCMAKE_BUILD_TYPE=Release \

clean.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@
66
# LICENSE file in the root directory of this source tree
77

88
set -eu
9-
rm -rf cmake-out pip-out
9+
rm -rf cmake-out pip-out cmake-android-out
1010
mkdir cmake-out
11+
mkdir cmake-android-out

docs/source/runtime-build-and-cross-compilation.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ cd executorch
4545

4646
# Clean and configure the CMake build system. It's good practice to do this
4747
# whenever cloning or pulling the upstream repo.
48-
(rm -rf cmake-out && mkdir cmake-out && cd cmake-out && cmake ..)
48+
(sh clean.sh && cd cmake-out && cmake ..)
4949
```
5050

5151
Once this is done, you don't need to do it again until you pull from the upstream repo again, or if you modify any CMake-related files.
@@ -121,7 +121,7 @@ Following are instruction on how to perform cross compilation for Android and iO
121121
Assuming Android NDK is available, run:
122122
```bash
123123
# Run the following lines from the `executorch/` folder
124-
rm -rf cmake-android-out && mkdir cmake-android-out && cd cmake-android-out
124+
sh clean.sh && cd cmake-android-out
125125

126126
# point -DCMAKE_TOOLCHAIN_FILE to the location where ndk is installed
127127
cmake -DCMAKE_TOOLCHAIN_FILE=/Users/{user_name}/Library/Android/sdk/ndk/25.2.9519653/build/cmake/android.toolchain.cmake -DANDROID_ABI=arm64-v8a ..

examples/demo-apps/android/ExecuTorchDemo/README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@ We build the required ExecuTorch runtime library to run the model.
6969
export ANDROID_NDK=<path-to-android-ndk>
7070
export ANDROID_ABI=arm64-v8a
7171

72-
rm -rf cmake-android-out && mkdir cmake-android-out
72+
# Run the following lines from the `executorch/` folder
73+
sh clean.sh
7374

7475
# Build the core executorch library
7576
cmake . -DCMAKE_INSTALL_PREFIX=cmake-android-out \
@@ -112,7 +113,7 @@ export ANDROID_NDK=<path-to-android-ndk>
112113
export ANDROID_ABI=arm64-v8a
113114
export QNN_SDK_ROOT=<path-to-qnn-sdk>
114115

115-
rm -rf cmake-android-out && mkdir cmake-android-out && cd cmake-android-out
116+
sh clean.sh && cd cmake-android-out
116117
cmake . -DCMAKE_INSTALL_PREFIX=cmake-android-out \
117118
-DCMAKE_TOOLCHAIN_FILE="${ANDROID_NDK}/build/cmake/android.toolchain.cmake" \
118119
-DANDROID_ABI="${ANDROID_ABI}" \

examples/devtools/build_example_runner.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ done
3737
main() {
3838
cd "${EXECUTORCH_ROOT}"
3939

40-
rm -rf cmake-out
40+
sh clean.sh
4141

4242
if [[ "${BUILD_COREML}" == "ON" ]]; then
4343
cmake -DCMAKE_INSTALL_PREFIX=cmake-out \

examples/devtools/test_example_runner.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ source "$(dirname "${BASH_SOURCE[0]}")/../../.ci/scripts/utils.sh"
1616

1717
cmake_install_executorch_devtools_lib() {
1818
echo "Installing libexecutorch.a, libportable_kernels.a, libetdump.a, libbundled_program.a"
19-
rm -rf cmake-out
19+
sh clean.sh
2020

2121
retry cmake -DCMAKE_INSTALL_PREFIX=cmake-out \
2222
-DCMAKE_BUILD_TYPE=Release \

examples/xnnpack/quantization/test_quantize.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,7 @@ test_cmake_quantization() {
4747
SITE_PACKAGES="$(${PYTHON_EXECUTABLE} -c 'from distutils.sysconfig import get_python_lib; print(get_python_lib())')"
4848
CMAKE_PREFIX_PATH="${SITE_PACKAGES}/torch"
4949

50-
(rm -rf cmake-out \
51-
&& mkdir cmake-out \
50+
(sh clean.sh \
5251
&& cd cmake-out \
5352
&& retry cmake \
5453
-DCMAKE_BUILD_TYPE=Release \

test/build_size_test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ source "$(dirname "${BASH_SOURCE[0]}")/../.ci/scripts/utils.sh"
1313

1414
cmake_install_executorch_lib() {
1515
echo "Installing libexecutorch.a"
16-
rm -rf cmake-out
16+
sh clean.sh
1717

1818
retry cmake -DBUCK2="$BUCK2" \
1919
-DCMAKE_CXX_STANDARD_REQUIRED=ON \

0 commit comments

Comments
 (0)