Xcodebuild command line hanging

The following command hangs on my osx:

xcodebuild -scheme myscheme clean archive -archivePath /tmp 

This command gives two output lines and then freezes:

 User defaults from command line: IDEArchivePathOverride = /tmp 

Now this project has NOT created a workspace created from the cordova command line ( cordova build ios ). The only way is to open xcode and close it. this creates a workspace and then the command above.

Has anyone experienced something like this and knew a way out of this? Any way to generate this workspace from the command line?

+5
source share
4 answers

I had the same problem, and the only way to fix it was to open the project from the command line, wait and close it again after a certain time.

 open "My Project.xcodeproj" sleep 10 killall Xcode xcodebuild -scheme "My Project" clean archive "build/MyProject" 

Not like it, but it works for me.

+14
source

Try to set the circuit as general.

This can be done by going to "Schema Management ..." and check the "General" box.

Apple documents this process here: https://developer.apple.com/library/ios/recipes/xcode_help-scheme_editor/Articles/SchemeShare.html

+9
source

If you already have or are ready to make Ruby available for your build system, you can use this solution .

Install xcodeproj gem on your build system

 sudo gem install xcodeproj 

and then integrate the following ruby ​​script (renaming the xcodeproj path) into your project.

 #!/usr/bin/env ruby require 'xcodeproj' xcproj = Xcodeproj::Project.open("platforms/ios/schemedemo.xcodeproj") xcproj.recreate_user_schemes xcproj.save 

The article explains how to make it part of the cordon hook, if you do, I just called the ruby ​​directly from my Jenkins build.

This works because when you recreate proj files, you destroy the schemas, so you need to recreate them.

+2
source

I believe xcodebuild freezes because some data is missing from the project. You can create a template for how this data looks and use a hook to fill it if necessary.

  • cordova add ios platform
  • Cordoba to build ...
  • open platforms /ios/Whatever.xcodeproj in xcode
  • create xcuserdata_template
  • cp -R platform / ios / Whatever.xcodeproj / xcuserdata xcuserdata_template /
  • replace the unique identifier in this template with XXXXXXXXXX
  • update your hook that launches xcodebuild

Example example 7:

 XCODE_PROJ=path/to/Whatever.xcodeproj # get the mysterious id ID=`grep "Whatever \*\/ = {" $XCODE_PROJ/project.pbxproj | \ grep -io "[-A-Z0-9]\{24\}"` mkdir -p $XCODE_PROJ/xcuserdata XCUSERDATAD=$XCODE_PROJ/xcuserdata/`whoami`.xcuserdatad if [ ! -d "$XCUSERDATAD" ]; then cp -R path/to/xcuserdata_template/username.xcuserdatad \ $XCUSERDATAD find $XCUSERDATAD -type f -exec sed -i '' -e "s/XXXXXXXXXX/$ID/g" {} \; fi xcodebuild ... 
0
source

Source: https://habr.com/ru/post/1237527/


All Articles