Created
January 27, 2015 06:10
-
-
Save thedoritos/8be998c16a34100e1fb5 to your computer and use it in GitHub Desktop.
Build ipa from Unity Project
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| WORKSPACE=/Path/To/Your/Unity/Project | |
| PROJECT_NAME=YourUnityProjectName | |
| # suppose Builder.cs has BuildXcodeProject method | |
| /Applications/Unity/Unity.app/Contents/MacOS/Unity -projectPath $WORKSPACE -quit -batchmode -executeMethod Builder.BuildXcodeProject | |
| XCODE_WORKSPACE_CONFIG_PATH=$PROJECT_NAME/Unity-iPhone.xcworkspace | |
| SCHEME=Unity-iPhone | |
| CONFIGURATION=Release | |
| CODE_SIGN_IDENTITY="Your Code Sign Identity Name (ex. iOS Development: Xxxxx)" | |
| PROVISIONING_PROFILE="Your Provisioning Profile Name (ex. iOSTeam Provisioning Profile: Xxxxx)" | |
| ARCHIVE_FILE_PATH=$WORKSPACE/$PROJECT_NAME.xcarchive | |
| IPA_FILE_PATH=$WORKSPACE/$PROJECT_NAME.ipa | |
| # clean | |
| rm -rf "${ARCHIVE_FILE_PATH}" | |
| rm -rf "${IPA_FILE_PATH}" | |
| # build archive | |
| BUILD_OPTIONS="DEBUG_INFORMATION_FORMAT=dwarf" | |
| xcodebuild -workspace "${XCODE_WORKSPACE_CONFIG_PATH}" -scheme "${SCHEME}" -configuration "${CONFIGURATION}" CODE_SIGN_IDENTITY="${CODE_SIGN_IDENTITY}" archive -archivePath "${ARCHIVE_FILE_PATH}" "${BUILD_OPTIONS}" | |
| EXIT_CODE=$? | |
| if [ $EXIT_CODE -ne 0 ]; then | |
| cat "failed to build app file" | |
| exit $EXIT_CODE | |
| fi | |
| # build ipa | |
| xcodebuild -exportArchive -exportFormat ipa -archivePath "${ARCHIVE_FILE_PATH}" -exportPath "${IPA_FILE_PATH}" -exportProvisioningProfile "${PROVISIONING_PROFILE}" | |
| EXIT_CODE=$? | |
| if [ $EXIT_CODE -ne 0 ]; then | |
| cat "failed to build ipa file" | |
| exit $EXIT_CODE | |
| fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment