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

  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。

猜你喜欢

转载自www.cnblogs.com/lulushen/p/9110808.html