Xcode 构建后复制文件操作 [英] Xcode Post Build Copy File Actions

查看:41
本文介绍了Xcode 构建后复制文件操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 Xcode 中,我如何调用shell 脚本",它是一个将 .app.dsym 文件复制到不同目录的 Perl 脚本?

我想将项目的名称和/或项目的根目录传递给脚本.我希望每次在发布和分发模式下而不是在调试模式下构建时都调用该脚本.

解决方案

右键单击您的目标并选择 Add->New Build Phase->New Run Script Build Phase.

在脚本"文本区域内,添加:

if [ ${CONFIGURATION} != "Debug" ]然后/usr/bin/perl "${PROJECT_DIR}/myperlscript.pl" "${PRODUCT_NAME}" "${PROJECT_DIR}"菲

myperlscript.pl 的位置和名称更改为脚本的位置和名称.

确保将 Run Script 步骤移到 Link Binary With Libraries 之后,因为您正在复制构建的 .app.

(可能还想在问题中添加perl"标签)

In Xcode, how can I call a 'shell script' which is a Perl script that copies the .app and .dsym files to a different directory?

I want to pass the name of the project and/or the project's root directory to the script. I want to have the script called every time I build in release and distribution modes but not in debug mode.

解决方案

Right-click on your target and choose Add->New Build Phase->New Run Script Build Phase.

Inside the "Script" text area, add:

if [ ${CONFIGURATION} != "Debug" ]
then
    /usr/bin/perl "${PROJECT_DIR}/myperlscript.pl" "${PRODUCT_NAME}" "${PROJECT_DIR}"
fi

Change the location and name of myperlscript.pl to be the location and name of your script.

Make sure to move the Run Script step to be after Link Binary With Libraries, since you're copying the built .app.

(Might also want to add the "perl" tag to the question)

这篇关于Xcode 构建后复制文件操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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