Apple 使用什么来生成 XCode 4 模板?
Xcode 4 彻底改变了(项目)模板系统。现在您可以做更多事情,但这是有代价的。看看分散在 /Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/Templates/Project Templates/Application
文件夹中的 TemplateInfo.plist 文件,您很快就会失去视角。新的设置很难修改,更难重新创建。 boreal-kiss.net 的作者有 一篇关于新结构的真正好的帖子。
他提到的一件事让我印象深刻,因为我在连接 XML 中继承的广泛使用时也有同样的想法:
事实上,Apple 似乎不是通过编码而是通过自动生成工具创建它们。
我的问题是:有人知道这样的工具吗? Xcode 中有隐藏的帮助实用程序吗?是不是哪里有下载啊?或者有人可能创建了一个像这样的工具来生成那些 TemplateInfo.plist XML?
我知道这是一个延伸,但是手动处理所有这些文件是它自己的一个项目,不应该是一个麻烦在现代 IDE 中很难担心这个问题。
更新:虽然您可以手动对模板文件进行编码,但您不能依赖您创建的模板来应对 Apple 新发布的 Xcode 中的 API 更改。我最终通过将现有项目复制到新项目中,编写了自己的模板项目系统。这是在一组专有的脚本指令和名为 klipp
的命令行 RubyGem 中完成的。请参阅:https://rubygems.org/gems/klipp
Xcode 4 completely changed the (project) template system. There's a lot more you can do now, but it comes at a price. Take a look in the TemplateInfo.plist files scattered around your /Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/Templates/Project Templates/Application
folder and you'll quickly lose the perspective. The new setup is very hard to modify, even harder to re-create. The writer of boreal-kiss.net has a real good post about the new structure.
One of the things he mentions struck me because I had the same thought while connecting the dots of the extensive use of inheritance in XML:
In fact it seems Apple creates them not by coding but by automatic generation tools.
My question is: Does someone know of such a tool? Is there a hidden helper utility in Xcode? Is it a download somewhere? Or has someone maybe created a tool like this to generate those TemplateInfo.plist XMLs?
It's a stretch, I know, but doing all those files by hand is a project of it's own, a hassle one shouldn't have to worry this hard about in a modern IDE.
UPDATE: While you can code the template files by hand, you can't rely on the templates you create to survive API changes by Apple with new releases of Xcode. I eventually wrote my own system for templating projects, by way of copying existing projects into new ones. This is done within a proprietary set of scripting instructions and a command line RubyGem called klipp
. See: https://rubygems.org/gems/klipp
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我预计苹果会在某个时候发布一个帮助开发人员管理模板库的工具,但如果你想很快看到它,那么优先级就必须在那里。请务必提交错误报告 (https://bugreport.apple.com/),以便 Apple 知道这是一个问题。您甚至可以参考所有博客文章和论坛文章,这些文章显示了想要使用工具管理模板的开发人员数量。
I'd expect that a tool to help developers manage template libraries is something Apple will be releasing at some point but the priority has to be there if you want to see it anytime soon. Be sure to submit a bug report (https://bugreport.apple.com/) so that Apple knows that it is a concern. You could even reference all of the blog posts and forum posts which show the number of developers who want to manage templates with a tool.