#!/bin/sh# autobuild.sh# ctest## Created by Ethan on 14-11-3.# Copyright (c) 2014 Ethan. All rights reserved.############################################### #使用方法 #./build.sh arg1 arg2 arg3 The path of the project, For example:/volumes/work/buildcommand/test/ctest#arg2 compile ID#ARG3 for the project to complete the callback address #arg4 Company Project Special Usage # The server needs to modify the source ###################### ######################################################################## #回调函数function Fcallback () {echo $ #1/-1 EC Ho #buildID echo $ #http://www.baidu.com#echo ${logpath}# Echo ${ipapath} url= "${3}?status=${1}&buildid=${2} &logger=${logpath}&package=${ipapath} "#echo $url curl $url}############################################## # #参数检查if [-Z "$"]; Thenecho "ERROR: Project path is empty" Exit 1fiif [-Z "$"]; Thenecho "ERROR: Project compilation ID is empty" exit 1fiif [-Z "$"]; Thenecho "ERROR: Callback address is empty" Exit 1fiif [-Z "$4"]; Thenecho "Error: Certificate number is empty" Exit 1fi# log Address logpath= "${1}/log.txt" #ipa地址ipaPath = "${1}/${2}.ipa" ######################### ##################### #证书检查PROFILE_FILE = "/VOlumes/${4}.mobileprovision "Echo $PROFILE _fileuuid= '/usr/libexec/plistbuddy-c ' print:uuid '/dev/stdin <<< $ (Security cms-d-I ${profile_file}) ' If [-Z ' $UUID ']; Thenecho "error: Certificate not found" Exit 1fiecho $UUIDCP ${profile_file} "$HOME/library/mobiledevice/provisioning Profiles/${uuid} . mobileprovision "############################################### #清理项目cd $1xcodebuild clean###################### ######################### #编译并将日志写到文件 formal use needs to be modified PROVISIONING_PROFILEXCODEBUILD-SDK Iphoneos provisioning_profile=${ UUID} > ${logpath} #判断是否编译成功if [[$-eq 0]]; Then echo "Build success" Else echo "Build Error" Fcallback "-1" $ $ $ exit 2fi################################ ############### #生成ipaxcrun-sdk iphoneos packageapplication-v./build/release-iphoneos/*.app-o ${ipaPath}if [[$?-eq 0 ]]; THENRM-RF Buildecho "Create IPA Success" Fcallback "1" $ $3exit 0elseecho "Create IPA Error" fcallback "-1" $ $3exit 2fi
Xcodebuild Compiling IPA