ios xcodebuild 工作区和方案
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/16465696/
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
xcodebuild workspace and scheme
提问by Fergal Rooney
I am a little confused as to what happens with the xcodebuild command line tool when you specify a workspace and scheme.
当您指定工作区和方案时,我对 xcodebuild 命令行工具会发生什么感到有些困惑。
I understand how a configured scheme works in the XCode IDE GUI. The build action lists the targets to build and for each action (Analyze, Test, Run, Profile, Archive), you select which one you want the build action to execute for.
我了解配置的方案如何在 XCode IDE GUI 中工作。构建操作列出了要构建的目标,对于每个操作(分析、测试、运行、配置文件、存档),您可以选择要为其执行构建操作的目标。
So if I have each action (Analyze, Test, Run, Profile, Archive) selected in the build action for building, what happens when I execute the below command.
因此,如果我在用于构建的构建操作中选择了每个操作(分析、测试、运行、配置文件、存档),那么当我执行以下命令时会发生什么。
xcodebuild clean install -workspace MyWorkspace.xcworkspace -scheme MyScheme
-configuration AdHoc SYMROOT=PATH DSTROOT=PATH...
It searches for MyScheme.xcschemein the main xcodeproj which has all this configuration specified when editing the scheme in XCode.
它在主 xcodeproj 中搜索MyScheme.xcscheme,其中在 XCode 中编辑方案时指定了所有这些配置。
What does xcodebuild read in from this file? Does it just build the configured target with the AdHoc configuration and disregard everything else?
xcodebuild 从这个文件中读入了什么?它是否只是使用 AdHoc 配置构建配置的目标而忽略其他所有内容?
回答by Jon
You're almost there, but your syntax is a bit off. According to the man page:
你快到了,但你的语法有点不对。根据手册页:
xcodebuild -workspace workspacename -scheme schemename [-configuration configurationname] [-sdk [sdkfullpath | sdkname]] [buildaction ...] [setting=value ...] [-userdefault=value ...]
xcodebuild -workspace workspacename -scheme schemename [-configuration 配置名称] [-sdk [sdkfullpath | sdkname]] [buildaction ...] [setting=value ...] [-userdefault=value ...]
Where buildaction is one of the following:
其中 buildaction 是以下之一:
buildaction ... Specify a build action (or actions) to perform on the target. Available build actions are:
buildaction ... 指定要在目标上执行的构建操作(或多个操作)。可用的构建操作有:
build Build the target in the build root (SYMROOT). This is the default build action.
archive Archive a scheme from the build root (SYMROOT). This requires specifying a scheme.
test Test a scheme from the build root (SYMROOT). This requires specifying a scheme.
installsrc Copy the source of the project to the source root (SRCROOT).
install Build the target and install it into the target's installation directory in the dis-
tribution root (DSTROOT).
clean Remove build products and intermediate files from the build root (SYMROOT).
In the Xcode IDE, you choose the buildaction to run through the Product menu, or by clicking and holding the round button on the top left of the IDE (Run = Play triangle, Test = wrench icon, etc).
在 Xcode IDE 中,您可以通过 Product 菜单选择要运行的构建操作,或者单击并按住 IDE 左上角的圆形按钮(运行 = 播放三角形、测试 = 扳手图标等)。
Also, be careful to note wherexcodebuild is looking for your build scheme - it can either be in your .xcproj OR your .xcworkspace file, depending on which one you created. (If you didn't manually create a workspace, you will have a .xcproj file).
此外,请注意xcodebuild在哪里寻找您的构建方案 - 它可以在您的 .xcproj 或您的 .xcworkspace 文件中,具体取决于您创建的文件。(如果您没有手动创建工作区,您将拥有一个 .xcproj 文件)。
You can also ascertain which schemes you have via your 'Manage Schemes' setting in Xcode.
您还可以通过 Xcode 中的“管理方案”设置确定您拥有哪些方案。