From 8a8feaf1989cea3c32f1bd042ad9cc5a9fd6ac48 Mon Sep 17 00:00:00 2001 From: Marcel Schnelle Date: Mon, 26 Aug 2024 08:36:49 +0900 Subject: [PATCH] Only build the XCFramework for the current configuration from Xcode This prevents release frameworks from being built during debug, and vice versa. --- build_xcframework_with_xcode_environment_variable.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/build_xcframework_with_xcode_environment_variable.sh b/build_xcframework_with_xcode_environment_variable.sh index ad1a78475..fca05e9d3 100755 --- a/build_xcframework_with_xcode_environment_variable.sh +++ b/build_xcframework_with_xcode_environment_variable.sh @@ -6,8 +6,9 @@ if [ -z "$SDK_NAME" ] || [ -z "$ARCHS" ]; then exit 1 fi -# Initialize the target architecture +# Initialize the target architecture and configuration (debug vs. release) target_arch="" +target_configuration="" # Determine the target architecture based on SDK_NAME and ARCHS if [[ "$SDK_NAME" == *"simulator"* ]]; then @@ -20,6 +21,12 @@ elif [[ "$SDK_NAME" == *"iphoneos"* ]] && [[ "$ARCHS" == *"arm64"* ]]; then target_arch="arm64" fi +if [[ "$CONFIGURATION" == *"Debug"** ]]; then + target_configuration="Debug" +elif [[ "$CONFIGURATION" == *"Release"** ]]; then + target_configuration="Release" +fi + # Check if a valid target architecture was determined if [ -z "$target_arch" ]; then echo "Error: Unable to determine target architecture from SDK_NAME=$SDK_NAME and ARCHS=$ARCHS" @@ -28,6 +35,6 @@ fi # Execute Gradle command with the determined architecture echo "Building for architecture: $target_arch" -./gradlew assembleSharedXCFramework --no-configuration-cache -Papp.ios.shared.arch=$target_arch +./gradlew assembleShared${target_configuration}XCFramework --no-configuration-cache -Papp.ios.shared.arch=$target_arch echo "Build completed for $target_arch"