• xcodebuild编译ipa


    #!/bin/sh
    
    #  autoBuild.sh
    #  CTest
    #
    #  Created by Ethan on 14-11-3.
    #  Copyright (c) 2014年 Ethan. All rights reserved.
    
    ###############################################
    #使用方法
    #./build.sh arg1 arg2 arg3 arg4
    #arg1 项目的路径,例如:/Volumes/work/buildCommand/test/CTest
    #arg2 为项目编译ID
    #arg3 为编译完成回调地址
    #arg4 公司项目特殊用法
    #服务器需要修改源
    ###############################################
    
    ###############################################
    #回调函数
    function fCallBack()
    {
        echo $1 #1/-1
        echo $2 #buildID
        echo $3 #http://www.baidu.com
    #echo ${logPath}
    # echo ${ipaPath}
    
        url="${3}?status=${1}&buildId=${2}&logger=${logPath}&package=${ipaPath}"
    #echo $url
        curl $url
    }
    
    
    ###############################################
    #参数检查
    if [ -z "$1" ]; then
    echo "error:项目路径为空"
    exit 1
    fi
    
    if [ -z "$2" ]; then
    echo "error:项目编译ID为空"
    exit 1
    fi
    
    if [ -z "$3" ]; then
    echo "error:回调地址为空"
    exit 1
    fi
    
    if [ -z "$4" ]; then
    echo "error:证书编号为空"
    exit 1
    fi
    
    
    #日志地址
    logPath="${1}/log.txt"
    #ipa地址
    ipaPath="${1}/${2}.ipa"
    ##############################################
    #证书检查
    PROFILE_FILE="/Volumes/${4}.mobileprovision"
    echo $PROFILE_FILE
    UUID=`/usr/libexec/PlistBuddy -c 'Print :UUID' /dev/stdin <<< $(security cms -D -i ${PROFILE_FILE} )`
    if [ -z "$UUID" ]; then
    echo "error:找不到证书"
    exit 1
    fi
    echo $UUID
    cp ${PROFILE_FILE} "$HOME/Library/MobileDevice/Provisioning Profiles/${UUID}.mobileprovision"
    
    ###############################################
    #清理项目
    cd $1
    xcodebuild clean
    
    
    ###############################################
    #编译并将日志写到文件 正式使用需要修改PROVISIONING_PROFILE
    xcodebuild  -sdk iphoneos PROVISIONING_PROFILE=${UUID} > ${logPath}
    #判断是否编译成功
    if [[ $? -eq 0 ]];  then
        echo "build success"
    else
        echo "build error"
        fCallBack "-1" $2 $3
        exit 2
    fi
    
    
    ###############################################
    #生成ipa
    
    xcrun -sdk iphoneos PackageApplication -v ./build/Release-iphoneos/*.app -o ${ipaPath}
    if [[ $? -eq 0 ]];  then
    rm -rf build
    echo "create ipa success"
    fCallBack "1" $2 $3
    exit 0
    else
    echo "create ipa error"
    fCallBack "-1" $2 $3
    exit 2
    fi
    

      

  • 相关阅读:
    邮件发送的存储过程写法
    FormsAuthentication.GetRedirectUrl 方法
    视图性能优化——索引视图
    删除多字段的重复行保留最大最小行
    c#知识点
    sql存储过程exec执行字符串select 的区别
    UVALive5198 UVA512 Spreadsheet Tracking
    UVA129 HDU1627 Krypton Factor
    UVA129 HDU1627 Krypton Factor
    UVA10603 Fill
  • 原文地址:https://www.cnblogs.com/bandy/p/4186136.html
Copyright © 2020-2023  润新知