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

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

IOS命令生成ipa文件-創(chuàng)新互聯(lián)

#!/bin/bash

創(chuàng)新互聯(lián)公司堅(jiān)持“要么做到,要么別承諾”的工作理念,服務(wù)領(lǐng)域包括:成都網(wǎng)站設(shè)計(jì)、網(wǎng)站制作、企業(yè)官網(wǎng)、英文網(wǎng)站、手機(jī)端網(wǎng)站、網(wǎng)站推廣等服務(wù),滿足客戶于互聯(lián)網(wǎng)時(shí)代的四川網(wǎng)站設(shè)計(jì)、移動(dòng)媒體設(shè)計(jì)的需求,幫助企業(yè)找到有效的互聯(lián)網(wǎng)解決方案。努力成為您成熟可靠的網(wǎng)絡(luò)建設(shè)合作伙伴!

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

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

# 使用說(shuō)明:

# 編譯project

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

# 編譯workspace

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

#

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

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

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

# -w 編譯workspace

# -s NAME 對(duì)應(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來(lái)處理命令參數(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

#工程絕對(duì)路徑

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í)才會(huì)用到)

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)

#通過(guò)app文件名獲得工程target名字

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

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

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

#取版本號(hào)

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ù)器可以了解下創(chuàng)新互聯(lián)scvps.cn,海內(nèi)外云服務(wù)器15元起步,三天無(wú)理由+7*72小時(shí)售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國(guó)服務(wù)器、虛擬主機(jī)、免備案服務(wù)器”等云主機(jī)租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡(jiǎn)單易用、服務(wù)可用性高、性價(jià)比高”等特點(diǎn)與優(yōu)勢(shì),專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場(chǎng)景需求。


本文標(biāo)題:IOS命令生成ipa文件-創(chuàng)新互聯(lián)
文章位置:http://weahome.cn/article/ddhphh.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部