xcode 如何将“运行脚本”构建阶段限制为我的发布配置?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3614017/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 03:32:27  来源:igfitidea点击:

How can I limit a "Run Script" build phase to my release configuration?

xcodemacos

提问by Reed Olsen

I have a shell script that I would like to run at the end of my target's build phase. However, I would like this script to only run when I build with the releaseconfiguration. How can this be done? Thanks!

我有一个 shell 脚本,我想在目标的构建阶段结束时运行它。但是,我希望此脚本仅在我使用发布配置构建时运行。如何才能做到这一点?谢谢!

回答by Jason Coco

if [ "${CONFIGURATION}" = "Release" ]; then
  echo Do something really release-like
fi

The script will run at the end of every configuration, but it won't do anything in this case unless the configuration is Release (assuming everything it does is contained within the test block).

该脚本将在每个配置结束时运行,但在这种情况下它不会做任何事情,除非配置是 Release(假设它所做的一切都包含在测试块中)。

回答by Menno

The easiest way to do this, is checking the "Run script only when installing" checkbox.

最简单的方法是选中“仅在安装时运行脚本”复选框。