Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only build the XCFramework for the current configuration from Xcode #809

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 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,13 @@ elif [[ "$SDK_NAME" == *"iphoneos"* ]] && [[ "$ARCHS" == *"arm64"* ]]; then
target_arch="arm64"
fi

# Assign the correct framework to build based on Xcode's configuration (or build all on unknown values)
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 +36,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"
Loading