注册来自collabd的消息(如XCSBuildService)以接收Xcode Bots集成号 [英] Register for messages from collabd like XCSBuildService to receive Xcode Bots integration number

查看:327
本文介绍了注册来自collabd的消息(如XCSBuildService)以接收Xcode Bots集成号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Xcode Bots构建期间,每次运行都会分配集成号。此编号不会显示在构建日志中,但会方便地创建返回到CI环境或企业应用商店中构建的单个Xcode Bots的HTTP链接。

During an Xcode Bots build each run gets an integration number assigned. This number does not show in the build logs but would be convenient to create http links back to the individual Xcode Bots build in an CI environment or enterprise app store.

/Library/Server/Xcode/Logs/xcsbuildd.log 中,我发现 XCSBuildService

有一种方法可以注册到同一个(OSX)计划中的活动并接收此讯息/活动?

Is there a way to register to the same event in an own (OSX) program and receive this message/event?

只有丑陋的方式,我发现到目前为止,得到Xcode Bots集成数是通过解析xcsbuildd.log文件的缺点,我不能确定最新的集成号码对应于我当前的构建,几个构建并行执行。
这个日志文件也位于读取受保护的文件夹/文件,所以我必须改变权限(ugh!)或使用sudo(我真的不想这样做)!

The only ugly way I found so far to get the Xcode Bots integration number was by parsing the xcsbuildd.log file with the drawback that I can't be sure that the latest integration number corresponds with my current build when several builds are executing in parallel. This log file is also located in an read protected folder/file so that I have to either change the permissions (ugh!) or use sudo (I don't really want to do that)!?

示例:

sudo grep -r "integration =" /Library/Server/Xcode/Logs/xcsbuildd.log | tail -1 | cut -d'=' -f 2| cut -d';' -f 1 |tr -d '\040\011\012\015'

给我从空白处删除的最新集成号码

Gives me the latest integration number stripped from whitespace ...

编辑
只是发现如果实际上在您的方案中包括以下脚本作为Build-post-action,它将创建一个文件(例如/ Library / Server / Xcode / Data / BotRuns / Cache / 22016b1e-2f91-4757-b3b8-322233e87587 / source /integration_number.txt)
,而不需要sudo。 Xcode Bots似乎将不同的构建序列化,使得它们不会并行执行,因此可以使用文件中创建的集成数。

Just found out that if you actually include the following script in your scheme as Build-post-action it will create a file (e.g. /Library/Server/Xcode/Data/BotRuns/Cache/22016b1e-2f91-4757-b3b8-322233e87587/source/integration_number.txt) with the integration number without requiring sudo. Xcode Bots seems to serialize the different builds so that they are not executed in parallel and so the created integration number in the file could be used.

grep -r "integration =" /Library/Server/Xcode/Logs/xcsbuildd.log | tail -1 | cut -d'=' -f 2| cut -d';' -f 1 |tr -d '\040\011\012\015' >  ${PROJECT_DIR}/integration_number.txt


推荐答案

获得集成构建号的情况,我添加了一个简单的答案此处

For specifically the case of getting the integration build number, I've added a simple answer here.

要重复自己(并保持这一点不被投票为1行答案):

To repeat myself (and keep this from being down voted as a 1-line answer):

我在 Xcode 项目中使用 Shell脚本构建阶段在我的情况下,我使用积分数字来设置我的内置版本的内部版本。我的脚本看起来像这样:

I implemented this using a Shell Script Build Phase in my Xcode project. In my case, I used the integration number to set the internal version of my built product. My script looks like this:

if [ "the$XCS_INTEGRATION_NUMBER" == "the" ]; then
    echo "Not an integration build…"
    xcrun agvtool new-version "10.13"
else
    echo "Setting integration build number: $XCS_INTEGRATION_NUMBER"
    xcrun agvtool new-version "$XCS_INTEGRATION_NUMBER"
fi

请注意, XCS_INTEGRATION_NUMBER 默认情况下存在于 Xcode Server 构建环境中。如果您想要模拟集成构建(针对此脚本的目的),您只需将其作为自定义变量添加到构建设置中即可。

Note that XCS_INTEGRATION_NUMBER exists by default in the Xcode Server build environment. If you want to simulate an integration build (for the purposes of this script), you can simply add it to your build settings as a custom variable.

这篇关于注册来自collabd的消息(如XCSBuildService)以接收Xcode Bots集成号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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