如何将旧版构建系统与 Xcode 10 的 `xcodebuild` 结合使用?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/51205221/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How can I use the legacy build system with Xcode 10's `xcodebuild`?
提问by DarkDust
I'd like to use the new build system of Xcode 10 for development, but our build in our continuous integration system fails since the xcarchive
produced has an issue: the Info.plist
in the xcarchive
is missing the ApplicationProperties
key and the information therein!
我想使用 Xcode 10 的新构建系统进行开发,但是我们在持续集成系统中的构建失败了,因为xcarchive
生产者有一个问题:Info.plist
中xcarchive
缺少ApplicationProperties
密钥和其中的信息!
It turns out switching back to the legacy build system fixes this. This can be done in the workspace settings (File > Workspace Settings… > Build System). But I would prefer to keep the new build system for development and only use the legacy build system for CI builds.
事实证明,切换回旧版构建系统可以解决此问题。这可以在工作区设置(文件 > 工作区设置... > 构建系统)中完成。但我更愿意保留新的构建系统进行开发,只使用旧的构建系统进行 CI 构建。
Is there a way to make xcodebuild
use the legacy build system without modifying the workspace?
有没有办法在xcodebuild
不修改工作区的情况下使用旧版构建系统?
回答by DarkDust
There is an (as of yet undocumented) flag in xcodebuild
: -UseModernBuildSystem=<value>
. The value can be either 0
or NO
to use the legacy ("original") build system, or 1
or YES
to use the new build system.
有一个(尚未无证的)标志xcodebuild
:-UseModernBuildSystem=<value>
。该值可以是0
or NO
to use the legacy ("original") build system, 1
or YES
to use the new build system.
For example:
例如:
xcodebuild -workspace Foo.xcworkspace -scheme Bar -configuration Release -archivePath /path/to/Foo.xcarchive clean archive -UseModernBuildSystem=NO
(-UseNewBuildSystem=<value>
seems to work as well; this flags was introduced in Xcode 9 but I suspect UseModernBuildSystem
is going to be the "official" flag for this.)
(-UseNewBuildSystem=<value>
似乎也有效;这个标志是在 Xcode 9 中引入的,但我怀疑UseModernBuildSystem
这将成为“官方”标志。)
回答by niko.mikulicic
To extend DarkDust's answer, in case you're using fastlanefor automated builds, additional parameters such as UseModernBuildSystem
can be passed through xcargs
:
为了扩展 DarkDust 的答案,如果您使用fastlane进行自动构建,UseModernBuildSystem
则可以传递其他参数,例如xcargs
:
build_app(
// ... other necessary parameters,
xcargs: "-UseModernBuildSystem=NO"
)
回答by CrazyOne
To select Xcode 10's build system:
要选择 Xcode 10 的构建系统:
In Xcode, go to: File -> Project Settings (or Workspace Settings)-> Build System
在 Xcode 中,转到:文件 -> 项目设置(或工作区设置)-> 构建系统
From there you can select New Build System (Default)
or Legacy Build System
从那里您可以选择New Build System (Default)
或Legacy Build System
Hope this help makes this easier.
希望这个帮助使这更容易。
回答by iOS
Change build system to Legacy Build System
from New Build System
and vice versa.
将构建系统更改为Legacy Build System
from New Build System
,反之亦然。
Open Xcode --> Select File -->Select Workspace Settings
打开 Xcode --> 选择文件 --> 选择工作区设置
Change Build System to Legacy Build System from New Build System --> Click Done.
将构建系统从新构建系统更改为旧构建系统 --> 单击完成。