Xcode构建阶段脚本编写教程或指南

编程入门 行业动态 更新时间:2024-10-28 00:25:31
本文介绍了Xcode构建阶段脚本编写教程或指南的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我想使用Xcode中的脚本将一些文件添加到编译源构建阶段,该脚本从某些文件夹引用中提取。到目前为止,我还找不到很多文档。

I would like to add some files to the Compile Sources build phase using a script in Xcode, which pulls from some folder references. I haven't been able to find much documentation so far.

  • 在哪里编写Xcode构建阶段脚本的常规文档(或好的教程)?
  • Where is the general documentation (or a good tutorial) for scripting Xcode build phases?
  • How can I add files to the Compile Sources phase?
  • How can I discover information about the project and the folder references within it?
  • Are there any special considerations if I want to script in Ruby or Python vs. bash scripting?
  • 推荐答案

    要使用脚本将文件添加到编译源构建阶段,您将需要操纵项目的项目。 pbxproj 文件。

    To add files to the Compile Sources build phase using a script, you will need to manipulate your project's project.pbxproj file programmatically.

    通常来说,您可以通过将 project.pbxproj 文件解析为内存数据结构来完成此操作,通过程序接口操作该数据结构,然后将数据结构写到新的 project.pbxproj 文件中。

    Generally speaking, you would accomplish this by parsing the project.pbxproj file into an in-memory data structure, manipulating that data structure through a programmatic interface, and then writing the data structure out to a new project.pbxproj file.

    有几个项目可能会帮助您做到这一点,我还没有尝试过这些项目:

    There are several projects out there that could potentially help you do this, I haven't tried any of them:

    • github/owlforestry/pbxproject
    • github/gonzoua/pbxproj/
    • github/facebook/three20/blob/master /src/scripts/Pbxproj.py
    • http ://code.googl e/p/xcodeutils
    • github/appcelerator/titanium_mobile/blob/master/support/iphone/pbxproj.py
    • github/owlforestry/pbxproject
    • github/gonzoua/pbxproj/
    • github/facebook/three20/blob/master/src/scripts/Pbxproj.py
    • code.google/p/xcodeutils
    • github/appcelerator/titanium_mobile/blob/master/support/iphone/pbxproj.py

    这是一系列博客文章,其中包含有关XCode project.pbxproj 文件的内容和格式的大量常规信息。

    And here is a series of blog posts with great general info on the contents and format of XCode project.pbxproj files.

    • danwright.info/blog/2010/10/xcode-pbxproject-files/
    • > danwright.info/blog/2010/10/xcode-pbxproject-files-2/
    • danwright.info/ blog / 2010/10 / xcode-pbxproject-files-3 /
    • danwright.info/blog/2010/10/xcode-pbxproject-files/
    • danwright.info/blog/2010/10/xcode-pbxproject-files-2/
    • danwright.info/blog/2010/10/xcode-pbxproject-files-3/

    最后,可能是请注意,对于非常简单的操作,尤其是如果您不担心 project.pbxproj 文件的外观弄乱时,可以按照此堆栈溢出答案,以在命令行上解析 project.pbxproj 文件像这样:

    Finally, it may be worth noting that for very simple manipulations, particularly if you aren't concerned about the cosmetics of your project.pbxproj file getting messed up, you can follow the suggestion over at this Stack Overflow answer to parse the project.pbxproj file on the command line like so:

    plutil-转换xml1 -o-myproj.xcodeproj / project.pbxproj

    解析愉快!

    更多推荐

    Xcode构建阶段脚本编写教程或指南

    本文发布于:2023-10-31 00:47:27,感谢您对本站的认可!
    本文链接:https://www.elefans.com/category/jswz/34/1544501.html
    版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
    本文标签:脚本   阶段   指南   教程   Xcode

    发布评论

    评论列表 (有 0 条评论)
    草根站长

    >www.elefans.com

    编程频道|电子爱好者 - 技术资讯及电子产品介绍!