59 lines
1.7 KiB
Bash
59 lines
1.7 KiB
Bash
#!/bin/bash
|
|
|
|
# This script automates the process of building an Xcode project and creating an IPA file.
|
|
SHELL_DIR=$(dirname $0)
|
|
echo "change dir to $SHELL_DIR"
|
|
cd "$SHELL_DIR"
|
|
|
|
PROJECT_NAME="$1"
|
|
SCHEME_NAME="$2"
|
|
PLATFORM="$3"
|
|
VERSION="$4"
|
|
|
|
# Define variables
|
|
BUILD_NAME="AveryBuild"
|
|
PROJECT_PATH="../../Builds/$PLATFORM/$VERSION/$BUILD_NAME/"
|
|
#PROJECT_NAME="Unity-iPhone" # Replace with your Xcode project name (without the .xcodeproj extension)
|
|
#SCHEME_NAME="Unity-iPhone" # Replace with your Xcode scheme
|
|
OUTPUT_DIRECTORY="../" # Replace with the desired output directory for the IPA file
|
|
|
|
|
|
# create export Options plist
|
|
#echo "Generating a new exportOptions.plist file"
|
|
#sh generate_exportOptions.sh $PACKAGE_NAME $PACKAGE_ID
|
|
|
|
|
|
# Define source and destination paths
|
|
EXPORT_OPTIONS_FILE="./exportOptions.plist"
|
|
|
|
# Copy the file
|
|
echo "copy export options to $PROJECT_PATH"
|
|
cp "$EXPORT_OPTIONS_FILE" "$PROJECT_PATH"
|
|
|
|
|
|
echo "change direction to $PROJECT_PATH"
|
|
cd $PROJECT_PATH
|
|
|
|
xcodebuild -list -project $PROJECT_NAME.xcodeproj
|
|
|
|
|
|
echo "clean..."
|
|
xcodebuild clean
|
|
|
|
|
|
|
|
|
|
# Build the Xcode project and create an archive
|
|
echo "Building Xcode project..."
|
|
xcodebuild archive -project $PROJECT_NAME.xcodeproj -scheme $SCHEME_NAME -archivePath $OUTPUT_DIRECTORY/$PROJECT_NAME.xcarchive
|
|
|
|
# Export the archive to create an IPA file
|
|
echo "Exporting archive to IPA..."
|
|
xcodebuild -exportArchive -archivePath $OUTPUT_DIRECTORY/$PROJECT_NAME.xcarchive -exportPath $OUTPUT_DIRECTORY -exportOptionsPlist exportOptions.plist
|
|
|
|
# Clean up the temporary archive
|
|
echo "Cleaning up temporary archive..."
|
|
rm -rf $OUTPUT_DIRECTORY/$PROJECT_NAME.xcarchive
|
|
|
|
# The script is now complete.
|
|
echo "Build process completed. IPA file is available at: $OUTPUT_DIRECTORY/YourProject.ipa" |