Skip to content

Commit

Permalink
Fixed build pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
cp-divyesh-v committed Nov 15, 2024
1 parent 382eb14 commit b8095a7
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 0 deletions.
47 changes: 47 additions & 0 deletions scripts/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/bin/bash

# Documentation:
# This script builds a <TARGET> for all supported platforms.

# Exit immediately if a command exits with a non-zero status
set -e

# Verify that all required arguments are provided
if [ $# -eq 0 ]; then
echo "Error: This script requires exactly one argument"
echo "Usage: $0 <TARGET>"
exit 1
fi

# Create local argument variables.
TARGET=$1

# Use the script folder to refer to other scripts.
FOLDER="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
SCRIPT="$FOLDER/build_platform.sh"

# Make the script executable
chmod +x $SCRIPT

# A function that builds a specific platform
build_platform() {
local platform=$1
echo "Building for $platform..."
if ! bash $SCRIPT $TARGET $platform; then
echo "Failed to build $platform"
return 1
fi
echo "Successfully built $platform"
}

# Array of platforms to build
platforms=("iOS" "macOS" "tvOS" "watchOS" "xrOS")

# Loop through platforms and build
for platform in "${platforms[@]}"; do
if ! build_platform "$platform"; then
exit 1
fi
done

echo "All platforms built successfully!"
16 changes: 16 additions & 0 deletions scripts/build_platform.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash

# Documentation:
# This script builds a <TARGET> for a specific <PLATFORM>.

# Verify that all required arguments are provided
if [ $# -ne 2 ]; then
echo "Error: This script requires exactly two arguments"
echo "Usage: $0 <TARGET> <PLATFORM>"
exit 1
fi

TARGET=$1
PLATFORM=$2

xcodebuild -scheme $TARGET -derivedDataPath .build -destination generic/platform=$PLATFORM

0 comments on commit b8095a7

Please sign in to comment.