I have a run script build phase I have added to an XCode project. I want to be able to toggle this run script on when I want it to run and off when I don't. Is this possible in XCode and if so how can it be done?
我在XCode项目中添加了一个运行脚本构建阶段。当我想让这个运行脚本运行时,我想能够切换它,当我不希望它运行时,我可以切换它。这在XCode中是可能的吗?
1 个解决方案
#1
1
I used to write exit
in the first line to toggle off the script and #exit
to toggle on, just like this:
我曾经在第一行写exit以切换脚本和#exit来切换,就像这样:
Turn off a script e.g. SwiftLint:
关掉一个脚本,例如SwiftLint:
exit
if which swiftlint >/dev/null; then
swiftlint
else
echo "warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint"
fi
Turn on:
打开:
#exit
if which swiftlint >/dev/null; then
swiftlint
else
echo "warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint"
fi
You just have to modify 1 character whether exit is commented out or not.
你只需要修改一个字符,不管退出是否被注释掉。
#1
1
I used to write exit
in the first line to toggle off the script and #exit
to toggle on, just like this:
我曾经在第一行写exit以切换脚本和#exit来切换,就像这样:
Turn off a script e.g. SwiftLint:
关掉一个脚本,例如SwiftLint:
exit
if which swiftlint >/dev/null; then
swiftlint
else
echo "warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint"
fi
Turn on:
打开:
#exit
if which swiftlint >/dev/null; then
swiftlint
else
echo "warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint"
fi
You just have to modify 1 character whether exit is commented out or not.
你只需要修改一个字符,不管退出是否被注释掉。