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
"$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..."
cd ../java
javac -bootclasspath "$ANDROID_JAR" \
-cp "$LAMBDA_JAR:$GEN_DIR" \
-d "$CLASSES_DIR" \
-source 1.8 -target 1.8 \
com/genymobile/scrcpy/*.java \
com/genymobile/scrcpy/wrappers/*.java
${SRC[@]}
echo "Dexing..."
cd "$CLASSES_DIR"
@ -68,8 +78,7 @@ then
"$BUILD_TOOLS_DIR/dx" --dex --output "$BUILD_DIR/classes.dex" \
android/view/*.class \
android/content/*.class \
com/genymobile/scrcpy/*.class \
com/genymobile/scrcpy/wrappers/*.class
${CLASSES[@]}
echo "Archiving..."
cd "$BUILD_DIR"
@ -81,8 +90,7 @@ else
--output "$BUILD_DIR/classes.zip" \
android/view/*.class \
android/content/*.class \
com/genymobile/scrcpy/*.class \
com/genymobile/scrcpy/wrappers/*.class
${CLASSES[@]}
cd "$BUILD_DIR"
mv classes.zip "$SERVER_BINARY"