xcodebuild工作区和scheme

我有点困惑,当你指定一个工作区和scheme时,xcodebuild命令行工具会发生什么情况。

我了解在XCode IDE GUI中configuration的scheme是如何工作的。 构build操作列出了要构build的目标以及每个操作(分析,testing,运行,configuration文件,归档),您可以select要执行的构build操作。

因此,如果我在构build操作中select了每个操作(分析,testing,运行,configuration文件,归档),执行下面的命令时会发生什么。

xcodebuild clean install -workspace MyWorkspace.xcworkspace -scheme MyScheme -configuration AdHoc SYMROOT=PATH DSTROOT=PATH... 

它在XCode中编辑scheme时在主xcodeproj中search具有所有此configuration的MyScheme.xcscheme

xcodebuild从这个文件读入什么内容? 它只是用AdHocconfiguration构buildconfiguration的目标,并忽略其他一切吗?

你几乎在那里,但你的语法是有点closures。 根据手册页 :

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

在哪里buildaction是以下之一:

buildaction …指定要在目标上执行的构build操作(或多个操作)。 可用的构build操作是:

  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). 

在Xcode IDE中,您可以selectbuildaction来运行产品菜单,或者单击并按住IDE左上方的圆形button(运行=播放三angular形,testing=扳手图标等)。

另外,请注意xcodebuild 在哪里寻找您的构buildscheme – 它可以在您的.xcproj或.xcworkspace文件中,具体取决于您创build的是哪一个。 (如果您没有手动创build工作区,则会有一个.xcproj文件)。

您还可以通过Xcode中的“pipe理scheme”设置确定您拥有哪些scheme。