fastlane 自动化打包不同的target,以及手动传版本号参数
fastlane安裝及自動化打包在之前的文檔中已經詳述——fastlane 安裝
一、這里是說明打包不同的target,例如兩個target,TestOne和TestTwo,ipa的大小分別是10M和20M。
主要是修改fastlane相關的Fastfile配置:兩個lane對應兩個target。
fasfile文件:
# This file contains the fastlane.tools configuration # You can find the documentation at https://docs.fastlane.tools # # For a list of all available actions, check out # # https://docs.fastlane.tools/actions # # Uncomment the line if you want fastlane to automatically update itself # update_fastlane # 定義打包平臺 default_platform :ios #指定項目的scheme名稱 output_name=“TestOne” output_name_Two=“TestTwo” platform :ios do desc "企業版" lane :TestOne do |op|
#根據輸入參version獲取app版本號
increment_version_number(version_number: op[:version])
puts “開始打enterprise ipa”
# 開始打包
gym(
scheme: "TestOne",
#輸出的ipa名稱
output_name:”#{output_name}”,
# 是否清空以前的編譯信息 true:是
clean:true,
# 指定打包方式,Release 或者 Debug
configuration:"Release",
# 指定打包所使用的輸出方式,目前支持app-store, package, ad-hoc, enterprise, development
export_method:"enterprise",
# 指定輸出文件夾
output_directory:"./fastlane/build",
)
end
lane :TestTwo do
puts “開始打enterprise ipa,SEMF標準版”
# 開始打包
gym(
scheme: "TestTwo",
#輸出的ipa名稱
output_name:”#{output_name_Two}”,
# 是否清空以前的編譯信息 true:是
clean:true,
# 指定打包方式,Release 或者 Debug
configuration:"Release",
# 指定打包所使用的輸出方式,目前支持app-store, package, ad-hoc, enterprise, development
export_method:"enterprise",
# 指定輸出文件夾
output_directory:"./fastlane/build",
)
end
end
在終端輸入fastlane ios TestOne 打包的第一個target的ipa 大小10M
在終端輸入fastlane ios TestTwo 打包的第一個target的ipa 大小20M
這里有一個問題,就是在打包第二個target的時候有失敗,打包出來的還是第一個target只有10M的ipa或者直接失敗。
錯誤提示會出現
Couldn't find specified scheme 'TestTwo'.xxxxxx.
如下圖:
解決方法:
xcode打開項目,選中scheme,點擊Manage scheme,在相應的target后面點擊shared。如下圖所示:
勾選之后,點擊close。
在終端輸入命令:fastlane ios TestTwo 打包成功ipa大小20M。
二、版本號問題
lane : TestOne do |op|
#根據輸入入參version獲取app版本號
increment_version_number(version_number: op[:version])
具體如下圖:
打包命令 eg:fastlane TestOne version:1.0.0
總結
以上是生活随笔為你收集整理的fastlane 自动化打包不同的target,以及手动传版本号参数的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: php 判断update返回为0_PHP
- 下一篇: nodejs连接池 连接关闭_「转」连接