xcodebuild工作区和方案

Fer*_*ney 18 xcodebuild ios xcode4

当您指定工作空间和方案时,我对xcodebuild命令行工具会发生什么感到困惑.

我理解配置的方案如何在XCode IDE GUI中工作.构建操作列出了要构建的目标以及每个操作(分析,测试,运行,配置文件,存档),您可以选择要执行构建操作的目标.

因此,如果我在构建操作中选择了每个操作(分析,测试,运行,配置文件,存档),那么当我执行以下命令时会发生什么.

xcodebuild clean install -workspace MyWorkspace.xcworkspace -scheme MyScheme 
-configuration AdHoc SYMROOT=PATH DSTROOT=PATH...
Run Code Online (Sandbox Code Playgroud)

它在主xcodeproj中搜索MyScheme.xcscheme,它在XCode中编辑方案时指定了所有这些配置.

xcodebuild从这个文件中读取了什么?它是否仅使用AdHoc配置构建配置的目标并忽略其他所有内容?

Jon*_*Jon 13

你几乎就在那里,但你的语法有点偏.根据手册页:

xcodebuild -workspace workspacename -scheme schemename [-configuration configurationname] [-sdk [sdkfullpath | sdkname]] [buildaction ...] [setting = value ...] [-userdefault = value ...]

buildaction是以下之一:

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).
Run Code Online (Sandbox Code Playgroud)

在Xcode IDE中,您可以选择通过"产品"菜单运行的构建操作,或者单击并按住IDE左上角的圆形按钮(Run = Play三角形,Test =扳手图标等).

另外,请注意xcodebuild 在哪里寻找您的构建方案 - 它可以在您的.xcproj或您的.xcworkspace文件中,具体取决于您创建的文件.(如果未手动创建工作区,则将具有.xcproj文件).

您还可以通过Xcode中的"管理方案"设置确定您拥有的方案.