# This is a sample Python script.
# Press ?R to execute it or replace it with your code.
# Press Double ? to search everywhere for classes, files, tool windows, actions, and settings.
import argparse
import os
def print_hi(name):
# Use a breakpoint in the code line below to debug your script.
print(f'Hi, {name}') # Press ?F8 to toggle the breakpoint.
def check_result(result):
if result == 0 or result is None:
return
else:
raise Exception(result)
# def init_git():
# cwd = os.getcwd()
# os.chdir('../')
#
# result = os.system('git pull')
# check_result(result)
# os.chdir(cwd)
class Task:
def __init__(self, arguments):
if arguments.debug:
self.type = 'Debug'
else:
self.type = 'Release'
self.project_name = 'ios 工程名稱(chēng)'
self.export_options_plist_path = arguments.exportOptionsPlistPath
self.cwd = os.getcwd()
self.scheme = arguments.scheme
self.build_path = '%s/build/%s' % (self.cwd, self.scheme)
get_build_numberCode = 'sed -n \'/CURRENT_PROJECT_VERSION/{s/CURRENT_PROJECT_VERSION = //;s/;//;s/^[[' \
':space:]]*//;p;q;}\' ./%s.xcodeproj/project.pbxproj' % self.project_name
self.build_number = os.system(get_build_numberCode)
self.export_file_path = '%s/ipa/%s/%d/%s' % (self.cwd, self.type, self.build_number, self.scheme)
def clean_project(self):
print('*** 正在 清理工程 ***')
clean_code = 'xcodebuild clean -workspace %s/%s.xcworkspace -scheme %s -' \
'configuration %s -quiet' % (self.cwd, self.project_name, self.scheme, self.type)
print(clean_code)
result = os.system(clean_code)
check_result(result)
print('*** 清理完成 ***')
def build_project(self):
print('*** 正在 編譯工程 ***')
build_code = 'xcodebuild archive -workspace %s/%s.xcworkspace -scheme %s -' \
'configuration %s -archivePath %s.xcarchive -quiet' % (
self.cwd, self.project_name, self.scheme, self.type, self.build_path)
print(build_code)
result = os.system(build_code)
check_result(result)
print('*** 編譯完成 ***')
def export_project(self):
print('*** 正在 打包 ***')
export_code = 'xcodebuild -exportArchive -archivePath %s.xcarchive -' \
'configuration %s -exportPath %s -exportOptionsPlist %s -allowProvisioningUpdates YES -quiet' % (
self.build_path, self.type, self.export_file_path, self.export_options_plist_path)
print(export_code)
result = os.system(export_code)
check_result(result)
print('*** 打包完成 ***')
def start(self):
# init_git()
self.clean_project()
self.build_project()
self.export_project()
# Press the green button in the gutter to run the script.
if __name__ == '__main__':
print_hi('PyCharm')
parser = argparse.ArgumentParser(description="build ios Project")
parser.add_argument('--flavor', default='firIm', choices=['firIm', 'testflight'], help='default is firIm')
parser.add_argument('--debug', action='store_true', default=False,
help='set the environment of build the project')
parser.add_argument('--scheme', default='scheme', choices=['scheme1', 'scheme2', 'scheme3'],
help='select the target to build ')
parser.add_argument('--exportOptionsPlistPath', default='ios'
'/ExportOptions/AppStoreExportOptions1.plist',
help='set the exportOptionsPlist path')
task = Task(parser.parse_args())
task.start()
# See PyCharm help at https://www.jetbrains.com/help/pycharm/
打包腳本
最后編輯于 :
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
- 文/潘曉璐 我一進(jìn)店門(mén)蔬顾,熙熙樓的掌柜王于貴愁眉苦臉地迎上來(lái)宴偿,“玉大人,你說(shuō)我怎么就攤上這事诀豁≌酰” “怎么了?”我有些...
- 文/不壞的土叔 我叫張陵舷胜,是天一觀的道長(zhǎng)娩践。 經(jīng)常有香客問(wèn)我,道長(zhǎng)烹骨,這世上最難降的妖魔是什么翻伺? 我笑而不...
- 正文 為了忘掉前任,我火速辦了婚禮沮焕,結(jié)果婚禮上吨岭,老公的妹妹穿的比我還像新娘。我一直安慰自己遇汞,他們只是感情好未妹,可當(dāng)我...
- 文/花漫 我一把揭開(kāi)白布簿废。 她就那樣靜靜地躺著空入,像睡著了一般。 火紅的嫁衣襯著肌膚如雪族檬。 梳的紋絲不亂的頭發(fā)上歪赢,一...
- 那天,我揣著相機(jī)與錄音单料,去河邊找鬼埋凯。 笑死点楼,一個(gè)胖子當(dāng)著我的面吹牛,可吹牛的內(nèi)容都是我干的白对。 我是一名探鬼主播掠廓,決...
- 文/蒼蘭香墨 我猛地睜開(kāi)眼,長(zhǎng)吁一口氣:“原來(lái)是場(chǎng)噩夢(mèng)啊……” “哼甩恼!你這毒婦竟也來(lái)了蟀瞧?” 一聲冷哼從身側(cè)響起,我...
- 序言:老撾萬(wàn)榮一對(duì)情侶失蹤条摸,失蹤者是張志新(化名)和其女友劉穎悦污,沒(méi)想到半個(gè)月后,有當(dāng)?shù)厝嗽跇?shù)林里發(fā)現(xiàn)了一具尸體钉蒲,經(jīng)...
- 正文 獨(dú)居荒郊野嶺守林人離奇死亡切端,尸身上長(zhǎng)有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
- 正文 我和宋清朗相戀三年,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了顷啼。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片踏枣。...
- 正文 年R本政府宣布瘾婿,位于F島的核電站,受9級(jí)特大地震影響烤咧,放射性物質(zhì)發(fā)生泄漏偏陪。R本人自食惡果不足惜,卻給世界環(huán)境...
- 文/蒙蒙 一煮嫌、第九天 我趴在偏房一處隱蔽的房頂上張望笛谦。 院中可真熱鬧,春花似錦昌阿、人聲如沸饥脑。這莊子的主人今日做“春日...
- 文/蒼蘭香墨 我抬頭看了看天上的太陽(yáng)灶轰。三九已至,卻和暖如春刷钢,著一層夾襖步出監(jiān)牢的瞬間笋颤,已是汗流浹背。 一陣腳步聲響...
- 正文 我出身青樓,卻偏偏與公主長(zhǎng)得像非凌,于是被迫代替她去往敵國(guó)和親举农。 傳聞我的和親對(duì)象是個(gè)殘疾皇子,可洞房花燭夜當(dāng)晚...
推薦閱讀更多精彩內(nèi)容
- ant打包腳本未指定 <user-sdk/>標(biāo)簽,打包生成apk運(yùn)行界面異常 1 問(wèn)題描述: 情況一未設(shè)置 標(biāo)簽秸妥,...
- 問(wèn)題 使用 Jenkins 來(lái)做 iOS 項(xiàng)目的持續(xù)集成滚停,升級(jí) Xcode 9 之后,編譯完成之后打包會(huì)一直報(bào)如下...
- 腳本 SYIPAGeneratedScript 腳本文件"xxx.sh"使用"Sublime_Text"工具進(jìn)行編...
- !/bin/bash export LANG=en_US.UTF-8export LANG=zh_CN.UTF-8...
- 開(kāi)發(fā)過(guò)程中遇到了一個(gè)需求粥惧,需要隱項(xiàng)目中VPN相關(guān)的代碼键畴,而是否隱藏需要在自動(dòng)化打包時(shí)進(jìn)行可選配置。需要用到條件編譯...