从终端构建/运行 iOS Xcode 项目 [英] Build/run iOS Xcode project from Terminal

查看:47
本文介绍了从终端构建/运行 iOS Xcode 项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从终端构建一个 Xcode 项目,然后根据需要运行它,也从终端运行.

I want to build a Xcode project from Terminal and then run it as required, also from Terminal.

我一直在寻找一种方法来做到这一点,但只找到了一种适用于 iPhone 模拟器的方法,而不适用于它本身的实际设备.

I have been looking for a way to do this for a while now but only managed to find a method which works for the iPhone Simulator, not for the actual device it self.

这甚至可能吗?我想从终端在设备上创建 Xcode 项目的原因是该应用程序运行一系列自动化测试,我更喜欢使用 bash 脚本自动化此过程.

Is this even possible? The reason I want to a Xcode project on a device from Terminal is because the application runs a series of automated tests and I would prefer to automate this process using a bash script.

谢谢

推荐答案

要使用 bash 脚本从命令行构建 xcode 项目,请使用:

To build your xcode project from the command line using a bash script use:

/usr/bin/xcodebuild -target TargetYouWantToBuild -configuration Debug

查看 xcodebuild 的手册页了解更多选项.

Look at the man page for xcodebuild for more options.

我们为单元测试套件目标执行此操作,并使用 GHUnit.

We do this for our unit test suite target, and we use GHUnit.

这是用于运行测试的构建脚本部分:

This is the section of our build script for running the tests:

export GHUNIT_CLI=1
export WRITE_JUNIT_XML=1
clean
echo "Building Bamboo GHUnit Tests..."
OUTPUT=`/usr/bin/xcodebuild -target BambooAutomatedUnitTest -configuration Debug -sdk iphonesimulator4.3 build`
RESULT=`echo "$OUTPUT" | grep "\*\* BUILD "`
if [ "$RESULT" != "** BUILD SUCCEEDED **" ]
then
    echo "$OUTPUT"
    exit 1
fi
echo "${RESULT}
"

这篇关于从终端构建/运行 iOS Xcode 项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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