Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcodebuild fails in jenkins with cocoapods

I am using the xcode plugin. I had looked around, but most of the "solutions" did not work.

My main issue is that in the xcworkspace that is generated, there is no scheme for the project I am trying to build. The plugin does the command

$ /usr/bin/xcodebuild -list -workspace Project.xcworkspace

and the output only shows the Pod's schemes, not the main project scheme.

Information about workspace "Project": Schemes: Pods Pods-AFNetworking Pods-Bolts Pods-Facebook-iOS-SDK

I have the cocoapods buildstep with pod install

I put this as the Xcode plugin configs: Target: Project, clean before build, Configuration: Debug, Xcode schema file: Project, Xcode workspace file: Project, Build output directory: ${WORKSPACE}/build.

This is the error that gets printed out:

Going to invoke xcodebuild:, scheme: Project, sdk: DEFAULT, workspace: Project, configuration: Debug, clean: YES, archive:NO, symRoot: DEFAULT, configurationBuildDir: /Users/ignat/.jenkins/workspace/Project/build, codeSignIdentity: DEFAULT
[Project] $ /usr/bin/xcodebuild -scheme Project -workspace Project.xcworkspace -configuration Debug clean build CONFIGURATION_BUILD_DIR=/Users/ignat/.jenkins/workspace/Project/build
Build settings from command line:
    CONFIGURATION_BUILD_DIR = /Users/ignat/.jenkins/workspace/Project/build

xcodebuild: error: The workspace 'Project' does not contain a scheme named 'Project'.
FATAL: Build directory does not exist at /Users/ignat/.jenkins/workspace/Project/build. Potential configuration issue.
Build step 'Xcode' marked build as failure
Finished: FAILURE
like image 882
Ignat Avatar asked Sep 05 '14 16:09

Ignat


1 Answers

As the output of xcodebuild -list says, your workspace only has schemes for the Pods.

If your Jenkins instance pulls your project from a repository, it's likely you don't share your Project scheme to everyone.

To fix this, you will need to share your scheme for all users using the repo. In Xcode, click on the Scheme name to open the scheme menu (upper left corner), and choose "Manage Schemes..."

Manage schemes menu

In the Manage Scheme dialog, make sure that the scheme you want to build with Jenkins is shared to all users by checking the "Shared" box on the right.

Manage Schemes dialog

Your Project scheme should be listed on Jenkins after that.

like image 80
LodeRunner Avatar answered Oct 02 '22 13:10

LodeRunner