Giter Site home page Giter Site logo

steps-xcode-build-for-simulator's Introduction

Xcode Build for Simulator

Step changelog

Runs xcodebuild commands for simulators

Description

This Step runs the xcodebuild command to build and deploy an app to an iOS, tvOS, or watchOS simulator. You can use this to perform quick tests of your app, or to show it off in a browser to your clients.

The Step generates the following outputs:

  • BITRISE_APP_DIR_PATH: The path to the generated .app file.
  • BITRISE_APP_DIR_PATH_LIST: The path to the generated .app file, and the paths to every dependent target app. (Paths are separated by the | (pipe) character.)
  • BITRISE_XCODE_BUILD_RAW_RESULT_TEXT_PATH: The path to the raw log file for the build.

The Step also creates an .xctestrun file which you can use to run tests.

Make sure to include this Step after the Steps that install the necessary dependencies — such as Run Cocoapods Install — in your Workflow.

Configuring the Step

Minimum configuration:

  1. In the Project path input, enter the path to your Xcode Project or Workspace. (Only necessary if you plan to use a different scheme than the one set in the BITRISE_PROJECT_PATH Environment Variable.)
  2. In the Scheme input, enter the name of the Scheme you'd like to use for building your project. (Only necessary if you plan to use a different scheme than the one set in the BITRISE_SCHEME Environment Variable.)

For more configuration options, see the descriptions of other inputs in the step.yml or in the Workflow Editor.

Useful links

Related Steps

🧩 Get started

Add this step directly to your workflow in the Bitrise Workflow Editor.

You can also run this step directly with Bitrise CLI.

⚙️ Configuration

Inputs
Key Description Flags Default
project_path Path of the Xcode Project (.xcodeproj) or Workspace (.xcworkspace) The input value sets xcodebuild's -project or -workspace option. required $BITRISE_PROJECT_PATH
scheme Xcode Scheme name. The input value sets xcodebuild's -scheme option. required $BITRISE_SCHEME
destination Destination specifier describes the device to use as a destination. The input value sets xcodebuild's -destination option. required generic/platform=iOS Simulator
xcconfig_content Build settings to override the project's build settings, using xcodebuild's -xcconfig option. Code signing allowed: Whether or not to allow code signing for this build When building an app for the simulator, code signing is not required and is set to "no" by default. On rare occasions, you may need to set the flag to "yes" — usually when working with certain test cases or third-party dependencies. You can't define -xcconfig option in Additional options for the xcodebuild command if this input is set. If empty, no setting is changed. When set it can be either: 1. Existing .xcconfig file path. Example: ./ios-sample/ios-sample/Configurations/Dev.xcconfig 2. The contents of a newly created temporary .xcconfig file. (This is the default.) Build settings must be separated by newline character (\n). Example: COMPILER_INDEX_STORE_ENABLE = NO ONLY_ACTIVE_ARCH[config=Debug][sdk=*][arch=*] = YES CODE_SIGNING_ALLOWED=NO COMPILER_INDEX_STORE_ENABLE = NO
configuration Xcode Build Configuration. If not specified, the default Build Configuration will be used. (Defined in the Scheme's archive action ) The input value sets xcodebuild's -configuration option. If the Configuration specified in this input does not exist in your project, the Step will silently ignore the value, and fall back to using the Configuration specified in the Scheme.
perform_clean_action If this input is set, clean xcodebuild action will be performed besides the build action. required no
xcodebuild_options Additional options to be added to the executed xcodebuild command. Prefer using Build settings (xcconfig) input for specifying -xcconfig option. You can't use both.
log_formatter Defines how xcodebuild command's log is formatted. Available options: - xcpretty: The xcodebuild command's output will be prettified by xcpretty. - xcodebuild: Only the last 20 lines of raw xcodebuild output will be visible in the build log. The raw xcodebuild log will be exported in all cases. required xcpretty
output_dir This directory will contain the generated artifacts. required $BITRISE_DEPLOY_DIR
cache_level Defines what cache content should be automatically collected. Available options: - none: Disable collecting cache content - swift_packages: Collect Swift PM packages added to the Xcode project required swift_packages
verbose_log If this input is set, the Step will print additional logs for debugging. required no
Outputs
Environment Variable Description
BITRISE_APP_DIR_PATH The path to the generated (and copied) app directory
BITRISE_APP_DIR_PATH_LIST This output will include the main target app's path, plus every dependent target's app path. The paths are separated by a | (pipe) character. (Example: /deploy109787178/sample-apps-ios-workspace-swift.app|/deploy109787178/bitfall.sample-apps-ios-workspace-swift-watch.app)
BITRISE_XCODE_BUILD_RAW_RESULT_TEXT_PATH This is the path to the raw build results log file. If output_tool is set to xcpretty and the build fails, this log will contain the build output.

🙋 Contributing

We welcome pull requests and issues against this repository.

For pull requests, work on your changes in a forked repository and use the Bitrise CLI to run step tests locally.

Learn more about developing steps:

steps-xcode-build-for-simulator's People

Contributors

birmacherakos avatar bitrise-coresteps-bot avatar danicsorba avatar davidmcraejr avatar fehersanyi-bitrise avatar godrei avatar hisaac avatar ileitch avatar lpusok avatar ofalvai avatar renovate[bot] avatar shams-ahmed avatar tothszabi avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

steps-xcode-build-for-simulator's Issues

[BLOCKER] Unable to find simulator build in the artifact

Troubleshooting

  • I've searched discuss.bitrise.io for possible solutions.
  • Which version of the step is effected? 2.0.0
  • Is the issue reproducible with the latest version? YES
  • Does the issue happen sporadically, or every time? EVERY TIME
  • Is the issue reproducible locally by following our local debug guide? NOT APPLICABLE

Useful information

Issue description

I'm building a simulator build for my application, however the logs shows it was built successfully, and the artifact is exported to the correct directory.

However, when I check the deploy to Bitrise.io logs, the .app build doesn't appear to be there.

Bitrise info

the log shows it's exporting artifact

      Copy artifacts from Derived Data to /Users/vagrant/deploy
      [REDACTED]Dev...
      Exporting outputs
      BITRISE_APP_DIR_PATH -> /Users/vagrant/deploy/[REDACTED]Dev.app
      BITRISE_APP_DIR_PATH_LIST -> /Users/vagrant/deploy/[REDACTED]Dev.app
      You can find the exported artifacts in: /Users/vagrant/deploy
  

but the deploy to bitrise doesn't show anything

      Build Artifact deployment mode: deploying the content of the deploy directory
      List of files to deploy (7):
      - /Users/vagrant/deploy/app-dev-debug.apk
      - /Users/vagrant/deploy/[REDACTED]Dev.dSYM.zip
      - /Users/vagrant/deploy/[REDACTED]Dev.ipa
      - /Users/vagrant/deploy/[REDACTED]Dev.xcarchive.zip
      - /Users/vagrant/deploy/export_options.plist
      - /Users/vagrant/deploy/xcodebuild-archive.log
      - /Users/vagrant/deploy/xcodebuild-export-archive.log
-   

Steps to reproduce

  1. build a normal react-native app
  2. add the Build for Simulator step in

Failed to export the artifacts, error: failed to fetch project's targets, error: Failed to found scheme (SOME SCHEME) in project

Trying to make a Simulator build of an Ionic app, but getting an error when exporting the build' Simulator app. The build of the IPA itself is successful (using the Ionic Archive step). But running the Xcode build for simulator results eventually in an error, although the building itself seems to succeed. Only in the final part of the step an error is raised about not finding the scheme in the project:

+------------------------------------------------------------------------------+
| (23) [email protected]                                        |
+------------------------------------------------------------------------------+
| id: xcode-build-for-simulator                                                |
| version: 0.10.0                                                              |
| collection: https://github.com/bitrise-io/bitrise-steplib.git                |
| toolkit: go                                                                  |
| time: 2019-05-23T08:32:34-07:00                                              |
+------------------------------------------------------------------------------+
|                                                                              |
�[36mINFO�[0m[08:32:34]  * �[32;1m[OK]�[0m Step dependency (xcode) installed, available. 
�[36mINFO�[0m[08:32:34]  * �[32;1m[OK]�[0m Step dependency (go) installed, available. 
�[34;1mConfig:
�[0m- ProjectPath: /Users/vagrant/git/platforms/ios/SOME PROJECT.xcworkspace
- Scheme: SOME SCHEME
- Configuration: Debug
- ArtifactName: 
- XcodebuildOptions: 
- Workdir: /Users/vagrant/git
- OutputDir: /Users/vagrant/deploy
- IsCleanBuild: false
- OutputTool: xcpretty
- SimulatorDevice: iPhone 8
- SimulatorOsVersion: latest
- SimulatorPlatform: iOS
- DisableIndexWhileBuilding: true
- VerboseLog: true

�[34;1mStep determined configs:�[0m
- xcodebuildVersion: Xcode 10.1 (Build version 10B61)

�[34;1mChecking if output tool (xcpretty) is installed�[0m
- xcprettyVersion: 0.3.0

�[34;1mSimulator info�[0m
Latest simulator for iPhone 8 = 8A1F9274-CD16-485A-A84C-6FCD603E2FAF

�[34;1mRunning build�[0m
[08:32:43] �[32;1m$ set -o pipefail && xcodebuild "-workspace" "/Users/vagrant/git/platforms/ios/SOME PROJECT.xcworkspace" "-scheme" "SOME SCHEME" "-configuration" "Debug" "CODE_SIGN_IDENTITY=" "CODE_SIGNING_REQUIRED=NO" "PROVISIONING_PROFILE_SPECIFIER=" "PROVISIONING_PROFILE=" "DEVELOPMENT_TEAM=" "-destination" "id=8A1F9274-CD16-485A-A84C-6FCD603E2FAF" "COMPILER_INDEX_STORE_ENABLE=NO" "build" | xcpretty�[0m
....
▸ Generating 'SOME\ PROJECT.app.dSYM'
▸ Touching SOME\ PROJECT.app (in target: SOME TARGET)
▸ Build Succeeded

Copy artifacts from Derived Data to /Users/vagrant/deploy
Scheme build dir: /Users/vagrant/Library/Developer/Xcode/DerivedData/SOME_PROJECT-aixhwmehymlkfgbulzpnmsjclgjm/Build/Products/Debug-iphonesimulator
Failed to export the artifacts, error: failed to fetch project's targets, error: Failed to found scheme (SOME SCHEME) in project

The input of the step:

    - [email protected]:
        is_skippable: true
        inputs:
        - project_path: "$BITRISE_SOURCE_DIR/platforms/ios/${APPLICATION_NAME}.xcworkspace"
        - scheme: "$APPLICATION_NAME"
        - xcodebuild_options: "-UseModernBuildSystem=0"
        - verbose_log: 'yes'
        - simulator_device: iPhone 8

Configuration defaults to Debug

In version 0.10.0 the description for the configuration input in workflow editor states "(optional) The configuration to use. By default your Scheme defines which configuration (Debug, Release, ...) should be used, but you can overwrite it with this option."

This doesn't seem to be the actual behavior though. If empty, the build defaults to Debug configuration (or possibly the first one defined in the project) although the scheme states otherwise.

Also the configuration input is marked as required in the workflow editor while it is described as optional.

Failed to get scheme (failed to fetch project's targets, error: Failed to found scheme (example) in project) build target dir, error: %!s(MISSING)

running on: bitrise.io
id: xcode-build-for-simulator
version: 0.9.2
collection: https://github.com/bitrise-io/bitrise-steplib.git
toolkit: go
time: 2018-12-14T02:00:56-08:00
xscheme is shared (project is able to build)

- ProjectPath: example/ios/example.xcodeproj
- Scheme: example
- Configuration: Debug
- ArtifactName: 
- XcodebuildOptions: 
- Workdir: /Users/vagrant/git
- OutputDir: /Users/vagrant/deploy
- IsCleanBuild: false
- OutputTool: xcpretty
- SimulatorDevice: iPhone 6s Plus
- SimulatorOsVersion: latest
- SimulatorPlatform: iOS
- VerboseLog: false

�[34;1mStep determined configs:�[0m
- xcodebuildVersion: Xcode 10.1 (Build version 10B61)

�[34;1mChecking if output tool (xcpretty) is installed�[0m
- xcprettyVersion: 0.3.0

�[34;1mSimulator info�[0m
Latest simulator for iPhone 6s Plus = B4953501-E313-4A8E-8012-452CEA2B4D01

�[34;1mRunning build�[0m
[02:01:10] �[32;1m$ set -o pipefail && xcodebuild "-project" "example/ios/example.xcodeproj" "-scheme" "example" "-configuration" "Debug" "CODE_SIGN_IDENTITY=" "CODE_SIGNING_REQUIRED=NO" "PROVISIONING_PROFILE_SPECIFIER=" "PROVISIONING_PROFILE=" "DEVELOPMENT_TEAM=" "-destination" "id=B4953501-E313-4A8E-8012-452CEA2B4D01" "build" | xcpretty�[0m

(...)

▸ Building library xxxx.a
▸ Linking ExampleApp
▸ Processing Info.plist
▸ Running script 'Bundle React Native code and images'
▸ Generating 'ExampleApp.app.dSYM'
▸ Copying /Users/vagrant/Library/Developer/Xcode/DerivedData/example-byuuzjvqjuqjwkeyxardezzwcbkf/Build/Products/Debug-iphonesimulator/xxxx.framework
▸ Touching ExampleApp.app (in target: example)
▸ Build Succeeded

�[34;1mCopy artifacts from Derived Data to /Users/vagrant/deploy�[0m
�[31;1mFailed to get scheme (failed to fetch project's targets, error: Failed to found scheme (example) in project) build target dir, error: %!s(MISSING)�[0m
|       

My iOS project is not a root level, does it could lead to this issue?
How to disable copy artifact to make it works?

Failed to create app with the error message: 'No such file or directory'

Troubleshooting

  • I've searched discuss.bitrise.io for possible solutions.
  • Which version of the step is effected? 1.2.1
  • Is the issue reproducible with the latest version? YES
  • Does the issue happen sporadically, or every time? EVERY TIME
  • Is the issue reproducible locally by following our local debug guide? NOT APPLICABLE

Useful information

Issue description

I updated the Xcode version from 14 to 15. This step works fine in Xcode 14 but fails in Xcode 15. It returns an error message stating No such file or directory. I found that the file created by this step is located at /Users/vagrant/git/ddata/Build/Products/Development-iphoneos, but the file it attempted to copy is located at /Users/vagrant/git/ddata/Build/Products/Development-iphonesimulator/ I hope this information helps. It's currently blocking us from integration testing. Please kindly advise.

Bitrise info

** BUILD SUCCEEDED **
+ cp -R '/Users/vagrant/git/ddata/Build/Products/Development-iphonesimulator/MY_APP.app' /Users/vagrant/deploy/
cp: /Users/vagrant/git/ddata/Build/Products/Development-iphonesimulator/MY_APP.app: No such file or directory
  

Steps to reproduce

  1. build a normal react-native app with XCode 15
  2. add the Build for Simulator step in

Configuration defaults to Debug

In version 0.10.0 the description for the configuration input in workflow editor states "(optional) The configuration to use. By default your Scheme defines which configuration (Debug, Release, ...) should be used, but you can overwrite it with this option."

This doesn't seem to be the actual behavior though. If empty, the build defaults to Debug configuration (or possibly the first one defined in the project) although the scheme states otherwise.

Also the configuration input is marked as required in the workflow editor while it is described as optional.

Xcode build log not available on build success

When the build fails, the log is available using BITRISE_XCODE_RAW_RESULT_TEXT_PATH. However, when the build is successful, the log is not available. This causes a problem when posting warnings & errors to the GitHub PR. It means PR's introducing warnings but that still compile don't have those warnings posted on the PR, reducing their discoverability before merging.

No option to toggle CODE_SIGNING_ALLOWED

Troubleshooting

  • I've searched discuss.bitrise.io for possible solutions.
  • Which version of the step is affected? 0.11.6
  • Is the issue reproducible with the latest version? YES
  • Does the issue happen sporadically, or every time? EVERY TIME
  • Is the issue reproducible locally by following our local debug guide? YES

Useful information

Issue description

Currently, there is no option to toggle "CODE_SIGNING_ALLOWED=NO", which is required by some CocoaPod frameworks such as Firebase Remote Config to work properly.

Bitrise info

Running build
$ set -o pipefail && xcodebuild "-workspace" "/Users/vagrant/git/MyProject.xcworkspace" "-scheme" "My Project" "-configuration" "QA" "CODE_SIGNING_ALLOWED=NO" "-destination" "id=5210DB4C-7CD4-4DE7-AC08-6E2F259F04B4" "COMPILER_INDEX_STORE_ENABLE=NO" "clean" "build" | xcpretty
  
It is possible to work around this limitation by adding "CODE_SIGNING_ALLOWED=YES" in the 'Additional options for xcodebuild call' under the 'Debug' section but I wouldn't rely on this as it produces a command that looks like this with two CODE_SIGNING_ALLOWED flags that may not always work:
xcodebuild "-workspace" "/Users/vagrant/git/MyProject.xcworkspace" "-scheme" "My Project" "-configuration" "QA" "CODE_SIGNING_ALLOWED=NO" "-destination" "id=5210DB4C-7CD4-4DE7-AC08-6E2F259F04B4" "COMPILER_INDEX_STORE_ENABLE=NO" "clean" "build" "CODE_SIGNING_ALLOWED=YES" | xcpretty

Steps to reproduce

Run the build for the simulator step on a project that uses Firebase Remote Config key values. The values should be fetched on app launch but are never called.

[Enhancement] Set Artifact name.

Right now the artifact is named after the Scheme.
Would it be possible to expose a field for setting the ArtifactName?

When I checked out the source, I could see where it was being loaded, but I'm not sure where to use it.

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.