在Xcode的Clean/Clean All中运行脚本 [英] Run script during Clean / Clean All in Xcode

查看:475
本文介绍了在Xcode的Clean/Clean All中运行脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个相当复杂的(iPhone SDK)Xcode项目,其中有许多目标-4个静态库,单元测试,多个示例应用程序,运行Shell脚本的BuildAll和运行另一个Shell脚本的Package. "BuildAll"目标在项目中创建一个目录,其中包含一些子目录,其中的内容可供分发.

I have a fairly complex (iPhone SDK) Xcode project, with many targets -- 4 static libs, unit tests, multiple sample apps, a BuildAll that runs a shell script, and a Package that runs another shell script. The "BuildAll" target creates a directory in the project with some subdirectories with contents ready for distribution.

但是,当我单击全部清除"时,Xcode不知道要清除我的分发目录.我想要.我似乎找不到解决方法,有人知道吗?

When I click "Clean All," though, Xcode doesn't know to clean my Distribution directory. I'd like it to. I can't seem to find a way to do this -- does anybody know how?


感觉Clean and Clean All实际上应该只是Xcode中的目标,并且我应该能够添加运行脚本"阶段.据我所知,不是这样.

It feels like Clean and Clean All should really just be targets in Xcode, and I should be able to add a "Run Script" phase. Not so, to my knowledge.

顺便说一句,"BuildAll"目标确实可以清理分发目录,所以这对我来说不是世界末日.在我的特定情况下,全部清除"实际上并没有全部清除,这真是令人讨厌.

BTW, the "BuildAll" target does handle cleaning the Distribution directory, so this is not the end of the world to me. It's just irksome that "Clean All" doesn't actually clean all in my particular case.

推荐答案

您可以添加一个外部目标",以在外部脚本中进行清理,然后将该目标添加为您的静态库目标之一的依赖项.创建目标,并将其拖到您的静态库目标之一下.使用脚本中的$ ACTION环境变量检查操作.

You can add an "External Target" that does the cleaning in an external script, and add that target as a dependency of one of your static library targets. Create the target, and drag it under one of your static library targets. Check for the action using the $ACTION environment variable in the script.

这篇关于在Xcode的Clean/Clean All中运行脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆