Xcodebuild fails in jenkins with cocoapods
Asked Answered
I

1

13

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
Incensory answered 5/9, 2014 at 16:7 Comment(0)
E
19

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.

Ec answered 5/9, 2014 at 16:26 Comment(6)
Should the scheme be in the container Project project or Pods project?Incensory
It belongs in the Project project as the Pods project only manages pods and the Project project manages all the source files and settings for your project.Ec
Shouldn't this "Scheme" information be in the workspace already?Incensory
@ignat980: The Scheme information is generated by Xcode the first time you open your project. So you should just check it in into your source control to use it with Jenkins.Pes
Is there a way to make a "global scheme" thats not tied to a user?Garlan
"The scheme you want to build with Jenkins is shared to all users by checking the "Shared" box on the right." Awsm ! it worked !!! Thanks.Monohydric

© 2022 - 2024 — McMap. All rights reserved.