Skip to content

Commit

Permalink
Only build the XCFramework for the current configuration from Xcode
Browse files Browse the repository at this point in the history
This prevents release frameworks from being built during debug, and vice versa.
  • Loading branch information
mannodermaus committed Aug 25, 2024
1 parent 9e1ac60 commit df9d44b
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions build_xcframework_with_xcode_environment_variable.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
Expand All @@ -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"

0 comments on commit df9d44b

Please sign in to comment.