Bot集成号添加到构建脚本中

Bot集成号添加到构建脚本中

本文介绍了如何将Xcode Bot集成号添加到构建脚本中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

我正在创建一个带有Settings.bundle文件的iPad应用程序。我编写构建脚本来显示应用程序版本号和xcode bot集成号(而不是bundle build number)。我搜索了网络,找不到任何解决方案。这里是我还有:

I'm creating an iPad application with a Settings.bundle file. I'm writing build scripts to display the application version number and the xcode bot integration number (not the bundle build number). I've searched the web and couldn't find any solution. Here's what I got yet:

-- Add the app version number
cd $PROJECT_DIR
cd "$BUILT_PRODUCTS_DIR/$PRODUCT_NAME.app"

RELEASE_VERSION=$(/usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" Info.plist)
/usr/libexec/PlistBuddy -c "Set :PreferenceSpecifiers:1:DefaultValue $RELEASE_VERSION" Settings.bundle/Root.plist

-- Add the build version number
BUILD_NUMBER=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" Info.plist)
/usr/libexec/PlistBuddy -c "Set :PreferenceSpecifiers:2:DefaultValue $BUILD_NUMBER" Settings.bundle/Root.plist

在构建版本号中,我想用xcode bot集成号替换CFBundleVersion。

In the build version number, I would like to replace the CFBundleVersion with the xcode bot Integration number.

推荐答案

我在 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.

这篇关于如何将Xcode Bot集成号添加到构建脚本中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-07 00:25