【问题标题】:Building targets in podfile post_install hook在 podfile post_install 挂钩中构建目标
【发布时间】:2015-07-23 22:32:05
【问题描述】:

在我的 podfile 中,我使用安装后挂钩将构建阶段脚本添加到 Pods 项目目标并构建每个目标。我遇到的问题是我正在使用

system "xcodebuild -target #{target.name} -sdk iphonesimulator"

它正在构建当前的 Pods 项目,因为我在 Pods 目录中,而不是由 podfile 生成并传递到安装后挂钩的 pods 项目。所以我想知道是否有人遇到过允许在 post_install 挂钩中构建目标的方法或 ruby​​ gem?我已经尝试了几天,但没有找到任何解决方法,我能找到的唯一解决方案是运行 pod install 两次,首先添加脚本并集成项目,然后构建目标以运行小于理想。

post_install do | installer |
   installer.project.targets do |target|
      // adding build script to target
      target.build() <-- this is what i need, some way to build this target.
   end
end

谢谢。

【问题讨论】:

  • 或者另一种方法是实现后集成挂钩,而不是安装后挂钩。我正在尝试使用我让线程休眠一段时间以使集成有机会完成但如果我使用 thread.join 集成阶段将不会完成,直到线程被执行并且没有线程.join 刚刚执行完的程序,线程从未被调用过。

标签: ruby-on-rails ruby xcode cocoapods post-install


【解决方案1】:

想出了一个方法来做到这一点。基本上我的问题是我需要能够在集成后更改 pods 项目并在其上运行 xcodebuild。但是 podfile 中没有 post_integration 挂钩。我所做的是创建了一个 setup.sh 文件,它有两行

pod install
ruby myScript.sh

然后在 myScript.sh 中,我使用 xcodeproj 添加构建阶段,保存项目,然后运行 ​​xcodebuild,然后使用正确的运行 sctipts 构建目标。

【讨论】:

    猜你喜欢
    • 2021-04-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-06-13
    • 1970-01-01
    • 2015-01-20
    相关资源
    最近更新 更多