如何判断 Xcode 是否正在执行“构建和归档”操作?在脚本中?

发布于 2024-10-09 07:39:58 字数 264 浏览 4 评论 0原文

我有一个脚本,在 Xcode 中实际构建之前进行一些预处理。有没有办法知道 Xcode 何时进行“构建和存档”?我想执行“svn commit”作为存档步骤的一部分。我转储了构建期间存在的环境变量,但它们对于存档来说与正常构建相同。

还有什么可以检查来判断它是否正在构建存档?

还有其他方法可以在构建存档之前自动进行提交吗?我不想为每个构建都进行提交,因为这使得 svn 树更难在 IMO 中导航。

我正在使用 Xcode 3.2.5。

谢谢! 规范

I have a script that does some preprocessing before the actual build in Xcode. Is there a way to tell when Xcode is doing a "Build and Archive"? I want to do an "svn commit" as part of the archive step. I dumped the environment variables that are there during a build, but they look the same for an archive as a normal build.

Anything else that can be checked to tell if it is building an archive?

Any other way to automatically do a commit before it builds the archive? I don't want to do a commit for every build as this makes the svn tree harder to navigate IMO.

I'm using Xcode 3.2.5.

Thanks!
Norm

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

寂寞清仓 2024-10-16 07:39:58

我想避免命令行构建和存档,因为我读到它不会构建嵌入配置文件的 .ipa 文件。使用它可以更轻松地将其发送给测试人员。

我所做的如下:

我有 4 个配置。调试、发布、临时发布和 App Store 发布。

我使用“调试”和“发布”来构建而不进行提交。当我想发送给 Beta 测试人员时,我使用 Ad Hoc,并使用 App Store 进行最终测试和 App Store 提交。

这是我添加到预构建脚本中的代码。

# Get the version number from the .plist file
VER_NUM=`cat "${SRCROOT}/${INFOPLIST_FILE}" | grep -A 1 CFBundleVersion | grep string | sed 's/]*>//g' | sed 's/^[  ]*//'`

# Check build type to see if svn commit should be done
if [ "${BUILD_STYLE}" == "App Store Distribution" ] 
then 
SVN_COMMIT=yes
fi

if [ "${BUILD_STYLE}" == "Ad Hoc Distribution" ] 
then 
SVN_COMMIT=yes
fi

if [ "${SVN_COMMIT}" == "yes" ]
then
echo "Commiting the project to SVN"
BUILD_TIME=`date`
svn commit -m "\"Version ${VER_NUM} for ${BUILD_STYLE} ${BUILD_TIME}\""
fi 

这是我对这个问题的快速而肮脏的回答。必须有一个更优雅的解决方案,但这目前可行。如果苹果只是添加一个环境变量来表明它是一个存档版本,就可以解决这个问题。

I wanted to avoid the command line build and archive since I read that it does not build a .ipa file with the provisioning profile embedded in it. Using that makes sending it out to testers much easier.

What I did was the following:

I have 4 configurations. Debug, Release, Ad Hoc Release, and App Store Release.

I use Debug and Release to build without doing a commit. I use the Ad Hoc when I want to send to beta testers, and the App Store for final testing and App Store submittal.

Here is the code that I added to my pre-build script.

# Get the version number from the .plist file
VER_NUM=`cat "${SRCROOT}/${INFOPLIST_FILE}" | grep -A 1 CFBundleVersion | grep string | sed 's/]*>//g' | sed 's/^[  ]*//'`

# Check build type to see if svn commit should be done
if [ "${BUILD_STYLE}" == "App Store Distribution" ] 
then 
SVN_COMMIT=yes
fi

if [ "${BUILD_STYLE}" == "Ad Hoc Distribution" ] 
then 
SVN_COMMIT=yes
fi

if [ "${SVN_COMMIT}" == "yes" ]
then
echo "Commiting the project to SVN"
BUILD_TIME=`date`
svn commit -m "\"Version ${VER_NUM} for ${BUILD_STYLE} ${BUILD_TIME}\""
fi 

This was my quick and dirty answer to the problem. There has to be a more elegant solution, but this will work for now. If Apple would just add an environment variable to show that it is an archive build that would solve it.

追星践月 2024-10-16 07:39:58

我建议您从 Xcode GUI 获取带有独立脚本的日常构建系统。这将使 svn commit 触发构建、存档和分发。您可以使用 xcrun 命令运行构建和存档,如下所述:

Xcode 从命令行“构建并存档”

I recommend you to get daily build system with independent script from Xcode GUI. This will make just svn commit trigger Build and Archive and distribution. You can run Build and Archive with xcrun command like described in here:

Xcode "Build and Archive" from command line

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文