Extract sources paths in build_without_gradle.sh

This avoids duplication, and will be useful to add more packages.
This commit is contained in:
Romain Vimont 2024-07-11 22:34:58 +02:00
parent 79242957a0
commit 80ca7b15e5

View File

@ -50,14 +50,24 @@ cd "$SERVER_DIR/src/main/aidl"
android/content/IOnPrimaryClipChangedListener.aidl android/content/IOnPrimaryClipChangedListener.aidl
"$BUILD_TOOLS_DIR/aidl" -o"$GEN_DIR" android/view/IDisplayFoldListener.aidl "$BUILD_TOOLS_DIR/aidl" -o"$GEN_DIR" android/view/IDisplayFoldListener.aidl
SRC=( \
com/genymobile/scrcpy/*.java \
com/genymobile/scrcpy/wrappers/*.java \
)
CLASSES=()
for src in "${SRC[@]}"
do
CLASSES+=("${src%.java}.class")
done
echo "Compiling java sources..." echo "Compiling java sources..."
cd ../java cd ../java
javac -bootclasspath "$ANDROID_JAR" \ javac -bootclasspath "$ANDROID_JAR" \
-cp "$LAMBDA_JAR:$GEN_DIR" \ -cp "$LAMBDA_JAR:$GEN_DIR" \
-d "$CLASSES_DIR" \ -d "$CLASSES_DIR" \
-source 1.8 -target 1.8 \ -source 1.8 -target 1.8 \
com/genymobile/scrcpy/*.java \ ${SRC[@]}
com/genymobile/scrcpy/wrappers/*.java
echo "Dexing..." echo "Dexing..."
cd "$CLASSES_DIR" cd "$CLASSES_DIR"
@ -68,8 +78,7 @@ then
"$BUILD_TOOLS_DIR/dx" --dex --output "$BUILD_DIR/classes.dex" \ "$BUILD_TOOLS_DIR/dx" --dex --output "$BUILD_DIR/classes.dex" \
android/view/*.class \ android/view/*.class \
android/content/*.class \ android/content/*.class \
com/genymobile/scrcpy/*.class \ ${CLASSES[@]}
com/genymobile/scrcpy/wrappers/*.class
echo "Archiving..." echo "Archiving..."
cd "$BUILD_DIR" cd "$BUILD_DIR"
@ -81,8 +90,7 @@ else
--output "$BUILD_DIR/classes.zip" \ --output "$BUILD_DIR/classes.zip" \
android/view/*.class \ android/view/*.class \
android/content/*.class \ android/content/*.class \
com/genymobile/scrcpy/*.class \ ${CLASSES[@]}
com/genymobile/scrcpy/wrappers/*.class
cd "$BUILD_DIR" cd "$BUILD_DIR"
mv classes.zip "$SERVER_BINARY" mv classes.zip "$SERVER_BINARY"