【问题标题】:Hook in Podfile to edit my project file挂钩 Podfile 以编辑我的项目文件
【发布时间】:2016-07-06 15:44:30
【问题描述】:

当它为扩展目标添加Embed Pods Frameworks 构建阶段时,我想修复 Cocoapods 错误。那里不需要这些阶段。

https://github.com/CocoaPods/CocoaPods/issues/4203

我写了脚本来删除它

puts "Deleting not needed phases…"
project_path = "Keyboard.xcodeproj"
project = Xcodeproj::Project.open(project_path)
project.targets.each do |target|
    if target.name.include?("Extension")
        phase = target.shell_script_build_phases.find { |bp| bp.name == 'Embed Pods Frameworks' }
        if !phase.nil?
            puts "Deleting Embed Pods Frameworks phase…"
            target.build_phases.delete(phase)
        end
    end
end

project.save

我可以在pod install 之后手动运行这个脚本,但我想以某种方式将它添加到 Podfile 中。它在post_install钩子中不起作用

post_install do |installer|
    ...
end

因为UserProjectIntegrator.integrate! 是在post_install 之后调用的,它会覆盖我的更改。

有没有办法把这个脚本集成到 Podfile 中?

【问题讨论】:

  • 将它添加到 podfile 是一个不错的主意。这方面有成功吗?
  • @the.evangelist no :( 也没有来自 github 问题的消息。我在“pod install”之后手动运行 ruby​​ 脚本。
  • @pilot34,很高兴在网上认识你 =))

标签: cocoapods xcodeproj


【解决方案1】:

简短的回答是不。
长答案:
pod install --verbose 的输出中,构建阶段Embed Pods Frameworks 被添加到Integrating client project,它在Podfile 中的post_install 步骤之后运行。 这就是为什么您应该在 pod install 运行完成后单独执行此脚本的原因。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-08-28
    • 2021-04-09
    • 1970-01-01
    • 1970-01-01
    • 2017-10-02
    相关资源
    最近更新 更多