真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

IOS命令生成ipa文件

#!/bin/bash

創(chuàng)新互聯(lián)是一家集網(wǎng)站建設(shè),安溪企業(yè)網(wǎng)站建設(shè),安溪品牌網(wǎng)站建設(shè),網(wǎng)站定制,安溪網(wǎng)站建設(shè)報(bào)價(jià),網(wǎng)絡(luò)營銷,網(wǎng)絡(luò)優(yōu)化,安溪網(wǎng)站推廣為一體的創(chuàng)新建站企業(yè),幫助傳統(tǒng)企業(yè)提升企業(yè)形象加強(qiáng)企業(yè)競爭力??沙浞譂M足這一群體相比中小企業(yè)更為豐富、高端、多元的互聯(lián)網(wǎng)需求。同時(shí)我們時(shí)刻保持專業(yè)、時(shí)尚、前沿,時(shí)刻以成就客戶成長自我,堅(jiān)持不斷學(xué)習(xí)、思考、沉淀、凈化自己,讓我們?yōu)楦嗟钠髽I(yè)打造出實(shí)用型網(wǎng)站。

#--------------------------------------------

# 功能:編譯xcode項(xiàng)目并打ipa包

# 使用說明:

# 編譯project

# ipa-build [-c ] [-o ] [-t ] [-n]

# 編譯workspace

# ipa-build   -w -s [-c ] [-n]

#

# 參數(shù)說明:-c NAME 工程的configuration,默認(rèn)為Release。

# -o PATH 生成的ipa文件輸出的文件夾(必須為已存在的文件路徑)默認(rèn)為工程根路徑下的”build/ipa-build“文件夾中

# -t NAME 需要編譯的target的名稱

# -w 編譯workspace

# -s NAME 對應(yīng)workspace下需要編譯的scheme

# -n 編譯前是否先clean工程

# 作者:ccf

# E-mail:ccf.developer@gmail.com

# 創(chuàng)建日期:2012/09/24

#--------------------------------------------

# 修改日期:2013/02/18

# 修改人:ccf

# 修改內(nèi)容:打包方式改為使用xcrun命令,并修改第二個(gè)參數(shù)

#--------------------------------------------

# 修改日期:2013/04/25

# 修改人:ccf

# 修改內(nèi)容:采用getopts來處理命令參數(shù),并增加編譯前清除選項(xiàng)

#--------------------------------------------

# 修改日期:2013/04/26

# 修改人:ccf

# 修改內(nèi)容:增加編譯workspace的功能

#--------------------------------------------

if [ $# -lt 1 ];then

echo "Error! Should enter the root directory of xcode project after the ipa-build command."

exit 2

fi

if [ ! -d $1 ];then

echo "Error! The first param must be a directory."

exit 2

fi

#工程絕對路徑

cd $1

project_path=$(pwd)

#編譯的configuration,默認(rèn)為Release

build_config=Release

param_pattern=":nc:o:t:ws:"

OPTIND=2

while getopts $param_pattern optname

  do

    case "$optname" in

 "n")        

should_clean=y

        ;;

      "c")        

tmp_optind=$OPTIND

tmp_optname=$optname

tmp_optarg=$OPTARG

OPTIND=$OPTIND-1

if getopts $param_pattern optname ;then

echo  "Error argument value for option $tmp_optname"

exit 2

fi

OPTIND=$tmp_optind

build_config=$tmp_optarg

        ;;

      "o")

tmp_optind=$OPTIND

tmp_optname=$optname

tmp_optarg=$OPTARG

OPTIND=$OPTIND-1

if getopts $param_pattern optname ;then

echo  "Error argument value for option $tmp_optname"

exit 2

fi

OPTIND=$tmp_optind

cd $tmp_optarg

output_path=$(pwd)

if [ ! -d $output_path ];then

echo "Error!The value of option o must be an exist directory."

exit 2

fi

        ;;

 "w")

workspace_name='*.xcworkspace'

ls $project_path/$workspace_name &>/dev/null

rtnValue=$?

if [ $rtnValue = 0 ];then

build_workspace=$(echo $(basename $project_path/$workspace_name))

else

echo  "Error!Current path is not a xcode workspace.Please check, or do not use -w option."

exit 2

fi

        ;;

 "s")

tmp_optind=$OPTIND

tmp_optname=$optname

tmp_optarg=$OPTARG

OPTIND=$OPTIND-1

if getopts $param_pattern optname ;then

echo  "Error argument value for option $tmp_optname"

exit 2

fi

OPTIND=$tmp_optind

build_scheme=$tmp_optarg

        ;;

 "t")

tmp_optind=$OPTIND

tmp_optname=$optname

tmp_optarg=$OPTARG

OPTIND=$OPTIND-1

if getopts $param_pattern optname ;then

echo  "Error argument value for option $tmp_optname"

exit 2

fi

OPTIND=$tmp_optind

build_target=$tmp_optarg

        ;;

      "?")

        echo "Error! Unknown option $OPTARG"

exit 2

        ;;

      ":")

        echo "Error! No argument value for option $OPTARG"

exit 2

        ;;

      *)

      # Should not occur

        echo "Error! Unknown error while processing options"

exit 2

        ;;

    esac

  done

#build文件夾路徑

build_path=${project_path}/build

#生成的app文件目錄

appdirname=Release-iphoneos

if [ $build_config = Debug ];then

appdirname=Debug-iphoneos

fi

if [ $build_config = Distribute ];then

appdirname=Distribute-iphoneos

fi

#編譯后文件路徑(僅當(dāng)編譯workspace時(shí)才會用到)

compiled_path=${build_path}/${appdirname}

#是否clean

if [ "$should_clean" = "y" ];then

xcodebuild clean

fi

#組合編譯命令

build_cmd='xcodebuild'

if [ "$build_workspace" != "" ];then

#編譯workspace

if [ "$build_scheme" = "" ];then

echo "Error! Must provide a scheme by -s option together when using -w option to compile a workspace."

exit 2

fi

build_cmd=${build_cmd}' -workspace '${build_workspace}' -scheme '${build_scheme}' -configuration '${build_config}' CONFIGURATION_BUILD_DIR='${compiled_path}' ONLY_ACTIVE_ARCH=NO'

else

#編譯project

build_cmd=${build_cmd}' -configuration '${build_config}

if [ "$build_target" != "" ];then

build_cmd=${build_cmd}' -target '${build_target}

fi

fi

#編譯工程

cd $project_path

$build_cmd || exit

#進(jìn)入build路徑

cd $build_path

#創(chuàng)建ipa-build文件夾

if [ -d ./ipa-build ];then

rm -rf ipa-build

fi

mkdir ipa-build

#app文件名稱

appname=$(basename ./${appdirname}/*.app)

#通過app文件名獲得工程target名字

target_name=$(echo $appname | awk -F. '{print $1}')

#app文件中Info.plist文件路徑

app_infoplist_path=${build_path}/${appdirname}/${appname}/Info.plist

#取版本號

bundleShortVersion=$(/usr/libexec/PlistBuddy -c "print CFBundleShortVersionString" ${app_infoplist_path})

#取build值

bundleVersion=$(/usr/libexec/PlistBuddy -c "print CFBundleVersion" ${app_infoplist_path})

#IPA名稱

ipa_name="${target_name}_${bundleShortVersion}_${build_config}${bundleVersion}_$(date +"%Y%m%d")"

echo $ipa_name

#xcrun打包

xcrun -sdk iphoneos PackageApplication -v ./${appdirname}/*.app -o ${build_path}/ipa-build/${ipa_name}.ipa || exit

if [ "$output_path" != "" ];then

cp ${build_path}/ipa-build/${ipa_name}.ipa $output_path/${ipa_name}.ipa

echo "Copy ipa file successfully to the path $output_path/${ipa_name}.ipa"

fi


網(wǎng)頁題目:IOS命令生成ipa文件
新聞來源:http://weahome.cn/article/jssjch.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部