Procházet zdrojové kódy

[godot] Fix build script for Android template, closes #2657

Mario Zechner před 9 měsíci
rodič
revize
32be2c1ef1

+ 1 - 0
.gitignore

@@ -214,3 +214,4 @@ spine-godot/compile_commands.json
 spine-godot/bin
 spine-godot/example-v4-extension/bin/macos/macos.framework/libspine_godot.macos.editor
 spine-godot/.idea
+spine-godot/build/version.txt

+ 20 - 9
spine-godot/build/build-templates-v4.sh

@@ -26,6 +26,9 @@ fi
 
 platform=${1%/}
 mono=false
+version=$(cat version.txt)
+major=$(echo $version | cut -d. -f1)
+minor=$(echo $version | cut -d. -f2)
 
 if [[ $# -eq 2 ]]; then
 	mono=${2%/}
@@ -171,15 +174,23 @@ elif [ "$platform" = "web" ]; then
 elif [ "$platform" = "android" ]; then
 	# --- ANROID ---
 	# generates android_release.apk, android_debug.apk, android_source.zip
-	scons platform=android target=template_release android_arch=armv7 custom_modules="../spine_godot" --jobs=$cpus
-	scons platform=android target=template_debug android_arch=armv7 custom_modules="../spine_godot" --jobs=$cpus
-	scons platform=android target=template_release android_arch=arm64v8 custom_modules="../spine_godot" --jobs=$cpus
-	scons platform=android target=template_debug android_arch=arm64v8 custom_modules="../spine_godot" --jobs=$cpus
-
-	pushd platform/android/java
-		chmod a+x gradlew
-		./gradlew generateGodotTemplates
-	popd
+	if [[ $major -lt 4 || ($major -eq 4 && $minor -lt 3) ]]; then
+		# Godot < 4.3 generates APKs via Gradle invocation.
+		scons platform=android target=template_release arch=arm32 custom_modules="../spine_godot" --jobs=$cpus
+		scons platform=android target=template_debug arch=arm32 custom_modules="../spine_godot" --jobs=$cpus
+		scons platform=android target=template_release arch=arm64 custom_modules="../spine_godot" --jobs=$cpus
+		scons platform=android target=template_debug arch=arm64 custom_modules="../spine_godot" --jobs=$cpus
+
+		pushd platform/android/java
+			chmod a+x gradlew
+			./gradlew generateGodotTemplates
+		popd
+	else
+		scons platform=android target=template_release arch=arm32 --jobs=$cpus
+		scons platform=android target=template_release arch=arm64 generate_apk=yes --jobs=$cpus
+		scons platform=android target=template_debug arch=arm32 --jobs=$cpus
+		scons platform=android target=template_debug arch=arm64 generate_apk=yes --jobs=$cpus
+	fi
 else
 	echo "Unknown platform: $platform"
 	exit 1

+ 1 - 1
spine-godot/build/setup-extension.sh

@@ -33,7 +33,7 @@ if [ "$mono" != "true" ] && [ "$mono" != "false" ]; then
     exit 1
 fi
 
-godot_cpp_branch=$(echo $godot_branch | cut -d- -f1)
+godot_cpp_branch=$(echo $godot_branch | cut -d. -f1-2)
 
 cpus=2
 if [ "$OSTYPE" == "msys" ]; then

+ 2 - 0
spine-godot/build/setup.sh

@@ -21,6 +21,8 @@ branch=${1%/}
 dev=${2%/}
 mono=false
 repo=https://github.com/godotengine/godot.git
+version=$(echo $branch | cut -d. -f1-2)
+echo $version > version.txt
 
 if [[ $# -eq 3 && "$branch" != 3* ]]; then
 	mono=${3%/}