#!/bin/sh branch=$1 variant=$2 if [ "$variant" == "Release" ]; then profile="Just Dance Controller - Ad hoc" else profile="Just Dance Controller - Development" fi projectPath="/Users/jd4-robot/Workspaces/JDMCA/${branch}/phone_apps/JDCompanionApp/" logPath="/Users/jd4-robot/Workspaces/JDMCA/${branch}/UnityLogs/iOSlog-${variant}.txt" outputPath="/Users/jd4-robot/Workspaces/JDMCA/${branch}/phone_apps/JDCompanionApp/Build/iOS-${variant}" echo "Removing previous output in case it already exists" rm -rf ${outputPath} echo "Creating Output path if doesn't exists" mkdir ${outputPath} echo "Creating JDController XCode project for branch $branch with variant $variant" # create XCode project /Applications/Unity/Hub/Editor/2018.4.24f1/Unity.app/Contents/MacOS/Unity -batchmode -projectPath "${projectPath}" -executeMethod Builder.Build_iOS_${variant} -logFile "-" -quit echo "Building JDController XCode project for branch $branch with variant $variant" # change directory to JDController location cd ${outputPath} # clean archive then rebuild archive for my app xcodebuild -scheme Unity-iPhone clean archive -archivePath output/jdcontroller # create IPA for JDController app if [ "$variant" == "Release" ]; then xcodebuild -exportArchive -exportOptionsPlist "/Users/jd4-robot/Workspaces/JDMCA/${branch}/phone_apps/BuilderScripts/adhoc.plist" -archivePath "output/jdcontroller.xcarchive" -exportPath "output/" PROVISIONING_PROFILE_SPECIFIER="${profile}" else xcodebuild -exportArchive -exportOptionsPlist "/Users/jd4-robot/Workspaces/JDMCA/${branch}/phone_apps/BuilderScripts/debug.plist" -archivePath "output/jdcontroller.xcarchive" -exportPath "output/" PROVISIONING_PROFILE_SPECIFIER="${profile}" fi echo "DONE : JDController built"