Mac xcworkspace xcodebuild

Source: Internet
Author: User
Xcodebuild

Before introducing xcodebuild, you need to figure out some concepts in the xcode Environment [4 ]:

  • Workspace: To put it simply, workspace is a container that stores multiple xcode projects you have created and files to be used in other projects. Benefits of using Workspace: 1) extend the project's visibility, that is, you can jump between multiple projects and refactor them. One project can use the output of another project. Workspace is responsible for providing various dependencies between projects. 2) multiple projects share the build directory.
  • ProjectA project is a project that manages all the files and configurations of one or more software products. A project can contain multiple targets.
  • Target: A target is a product built in a project. It contains all the files for building the product and how to configure the product.
  • Scheme: A target that defines the build process becomes a scheme. Target construction processes that can be defined in scheme include: build/run/test/profile/analyze/archive
  • Buildsetting: Configure the build settings of the product. For example, which ubuntures is used? Which SDK version is used ?. In xcode project, there are both project-level build setting and target-level build setting. Build a product for a specific target. Therefore, in xcode, the build setting of target is always preferred. If the target is not configured, the build setting of the project will be used.

After figuring out the above concepts, xcodebuild can be well understood. The functions of xcodebuild on the official website are described as follows:

xcodebuild builds one or more targets contained in an Xcode project, or builds a scheme contained in an Xcode workspace or Xcode project.

Xcodebuild is a command line tool used to build the product. Its usage can be divided into three parts:

  • Objects that can be built
  • Build Behavior
  • Other auxiliary commands

The following objects can be constructed: by default, the first target under the project is run:

  • Workspace: it must be used with "-Scheme" to build a scheme under the workspace.
  • Project: when there are multiple projects under the root directory, you must use "-project" to specify the project, and then run
  • Target: Build a target
  • Scheme: used with "-workspace" to specify the constructed scheme.
  • ......

Building behaviors include:

  • Clean: Clear
  • Build: Build
  • Test: test a scheme. It must be used with "-Scheme ".
  • Archive: Package, which must be used with "-Scheme"
  • ......

Auxiliary Commands include:

  • -SDK: Specifies the SDK used for building.
  • -List: list all target and scheme in the current project.
  • -Version: Version Information
  • ......

For more details about xcodebuild, see: https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/xcodebuild.1.html

Is the result of running a scheme build using xcodebuild:

  

After understanding the usage of xcodebuild, analyze the main defects of xcodebuild:

  • The Script output is very readable,
  • Only one target or scheme can be fully run, or none can be run. You cannot specify a specific test for running target.
  • The most terrible thing is that xcodebuild in xcode 4 does not support the target [5] of iosunittest. When I try to run the target test of an iOS app, the following error is returned:

      

Source:

Http://jishu.zol.com.cn/12244.html? Qq-PF-To = pcqq. C2C

Xcodebuild command:

Usage: xcodebuild [-project <projectname>] [[-target <targetname>]... |-alltargets] [-configuration <configurationname>] [-arch <architecture>]... [-SDK [<sdkname> | <sdkpath>] [-showbuildsettings] [<buildsetting >=< value>]... [<buildaction>]...

Xcodebuild [-project <projectname>]-scheme <schemename> [-destination <destinationspecifier>]... [-configuration <configurationname>] [-arch <architecture>]... [-SDK [<sdkname> | <sdkpath>] [-showbuildsettings] [<buildsetting >=< value>]... [<buildaction>]...

Xcodebuild-workspace <workspacename>-scheme <schemename> [-destination <destinationspecifier>]... [-configuration <configurationname>] [-arch <architecture>]... [-SDK [<sdkname> | <sdkpath>] [-showbuildsettings] [<buildsetting >=< value>]... [<buildaction>]...

Xcodebuild-version [-SDK [<sdkfullpath> | <sdkname>] [<infoitem>]

Xcodebuild-list [[-project <projectname>] | [-workspace <workspacename>]

Xcodebuild-showsdks

Xcodebuild-exportarchive-exportformat <format>-archivepath <export>-exportpath <destinationpath> [-export <profilename>] [-exportsigningidentity <identityname>] [-exportinstalleridentity <identityname>]

Options:

-Usage print brief usage

-Help print complete usage

-Verbose provide additional status output

-License show the xcode and SDK license agreements

-Checkfirstlaunchstatus check if any first launch tasks need to be completed MED

-Project name build the project name

-Target name build the target name

-Alltargets build all targets

-Workspace name build the workspace name

-Scheme name build the scheme name

-Configuration name use the build configuration name for building each target

-Xcconfig path apply the build settings defined in the file at path as overrides

-Arch build each target for the architecture arch; this will override ubuntures defined in the project

-SDK use SDK as the name or path of the base SDK when building the project

-Toolchain name use the toolchain with identifier or name

-Destination destinationspecifier use the destination described by destinationspecifier (a comma-separated set of key = value pairs describing the destination to use)

-Destination-Timeout timeout wait for timeout seconds while searching for the destination device

-Parallpolicetargets build independent targets in parallel

-Jobs number specify the maximum number of concurrent build operations

-Dry-run do everything into t actually running the commands

-Showsdks display a compact list of the installed sdks

-Showbuildsetaskdisplay a list of build settings and values

-List lists the targets and mappings in a project, or the schemes in a workspace

-Find-executable name display the full path to executable name in the provided SDK and toolchain

-Find-library name display the full path to library name in the provided SDK and toolchain

-Version display the version of xcode; with-SDK will display info about one or all installed sdks

-Resultbundlepath path specifies the directory where a result bundle describing what occurred will be placed

-Deriveddatapath path specifies the directory where build products and other derived data will go

-Archivepath path specifies the directory where any created archives will be placed, or the archive that shoshould be exported

-Exportarchive specifies that an archive shoshould be exported

-Exportformat format specifies the format that the archive shocould be exported as (e.g. IPA, PKG, APP)

-Exportpath path specifies the destination for the product exported from an archive

-Exportprovisioningprofile profile name specifies the provisioning profile that shocould be used when re-signing the exported archive; if possible, implies a signing identity

-Exportsigningidentity identity name specifies the codesigning identity that shoshould be used to re-sign the exported Archive

-Exportinstalleridentity identity name specifies the installer signing identity that shocould be used during export; this may be inferable from-exportsigningidentity

-Exportwithoriginalsigningidentity specifies that the signing identity used to create the archive shocould be used to sign the exported product

-Skipunavailableactions specifies that scheme actions that cannot be stored med shocould be skipped instead of causing a failure

Xcodebuild: Error: If you specify a workspace then you must also specify a scheme. Use-list to see the schemes in this workspace.

Xcodebuild-workspace XX. xcworkspace-list: View All Scheme

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.