From 4a5cdcd3908b5bdce7e8528d9045553a6019faa6 Mon Sep 17 00:00:00 2001 From: Romain Vimont Date: Fri, 10 Jun 2022 15:19:53 +0200 Subject: [PATCH] Extract $BUILD_TOOLS_DIR In the script to build without gradle, the build-tools full path is used at several places. Use a separate variable for readability. --- server/build_without_gradle.sh | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/server/build_without_gradle.sh b/server/build_without_gradle.sh index 1444e72c..f4fcba10 100755 --- a/server/build_without_gradle.sh +++ b/server/build_without_gradle.sh @@ -16,6 +16,7 @@ SCRCPY_VERSION_NAME=1.24 PLATFORM=${ANDROID_PLATFORM:-33} BUILD_TOOLS=${ANDROID_BUILD_TOOLS:-33.0.0} +BUILD_TOOLS_DIR="$ANDROID_HOME/build-tools/$BUILD_TOOLS" BUILD_DIR="$(realpath ${BUILD_DIR:-build_manual})" CLASSES_DIR="$BUILD_DIR/classes" @@ -41,9 +42,8 @@ EOF echo "Generating java from aidl..." cd "$SERVER_DIR/src/main/aidl" -"$ANDROID_HOME/build-tools/$BUILD_TOOLS/aidl" -o"$CLASSES_DIR" \ - android/view/IRotationWatcher.aidl -"$ANDROID_HOME/build-tools/$BUILD_TOOLS/aidl" -o"$CLASSES_DIR" \ +"$BUILD_TOOLS_DIR/aidl" -o"$CLASSES_DIR" android/view/IRotationWatcher.aidl +"$BUILD_TOOLS_DIR/aidl" -o"$CLASSES_DIR" \ android/content/IOnPrimaryClipChangedListener.aidl echo "Compiling java sources..." @@ -59,8 +59,7 @@ cd "$CLASSES_DIR" if [[ $PLATFORM -lt 31 ]] then # use dx - "$ANDROID_HOME/build-tools/$BUILD_TOOLS/dx" --dex \ - --output "$BUILD_DIR/classes.dex" \ + "$BUILD_TOOLS_DIR/dx" --dex --output "$BUILD_DIR/classes.dex" \ android/view/*.class \ android/content/*.class \ com/genymobile/scrcpy/*.class \ @@ -72,7 +71,7 @@ then rm -rf classes.dex classes else # use d8 - "$ANDROID_HOME/build-tools/$BUILD_TOOLS/d8" --classpath "$ANDROID_JAR" \ + "$BUILD_TOOLS_DIR/d8" --classpath "$ANDROID_JAR" \ --output "$BUILD_DIR/classes.zip" \ android/view/*.class \ android/content/*.class \