Skip to content

Create main target scheme before installing pods. #848

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 2, 2015

Conversation

e2l3n
Copy link
Contributor

@e2l3n e2l3n commented Sep 2, 2015

Changes: Create .xcscheme for the main target before installing pods.
Reason: xcodebuild fails to build workspaces without scheme in the main target.
Addresses issue #831.

@ns-bot
Copy link

ns-bot commented Sep 2, 2015

Can one of the admins verify this patch?

let pbxprojFilePath = path.join(this.platformData.projectRoot, this.$projectData.projectName + IOSProjectService.XCODE_PROJECT_EXT_NAME, "xcuserdata");
if(!this.$fs.exists(pbxprojFilePath).wait()) {
this.$logger.info("Creating project scheme...");
let createScheme_rb = `echo \"require 'xcodeproj'; xcproj = Xcodeproj::Project.open('${this.$projectData.projectName}.xcodeproj'); xcproj.recreate_user_schemes; xcproj.save\" | ruby`;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We use only camelCase for variables. Consider naming it something like createSchemeRubyScript

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've tested on a clean machine with only Xcode 6.4, node and nativescript installed. In my case, the following error was shown:

require "xcodeproj"
LoadError: cannot load such file -- xcodeproj

Do we need to install some additional dependencies?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we go ruby way, you can consider using the one-liners syntax: ruby -e "our code here", which will save us some nasty escaping.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ruby gem cocoapods depends on xcodeproj so it is automatically installed. Do you have the latest cocoapods v.0.38.2 ? Users can manually uninstall gem xcodeproj. However doing so will cause a few lines down the execution of pod install command to fail as well although there would be installed cocoapods (with missing xcodeproj). Here is a snippet of the error message:
`/Library/Ruby/Site/2.0.0/rubygems/dependency.rb:315:into_specs': Could not find 'xcodeproj' (~> 0.26.3) among 35 total gem(s) (Gem::LoadError)

Perhaps there should be a check for installed xcodeproj gem as well. I've added it in the latest commit.

@e2l3n e2l3n force-pushed the tpopov/generate-scheme branch 4 times, most recently from 1a875b7 to 174185a Compare September 2, 2015 11:51
@e2l3n e2l3n force-pushed the tpopov/generate-scheme branch from 174185a to dd8708e Compare September 2, 2015 13:48
@teobugslayer
Copy link
Contributor

👍

e2l3n added a commit that referenced this pull request Sep 2, 2015
Create main target scheme before installing pods.
@e2l3n e2l3n merged commit 10b2216 into master Sep 2, 2015
@teobugslayer teobugslayer deleted the tpopov/generate-scheme branch September 4, 2015 10:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants