-
-
Save claybridges/cea5d4afd24eda268164 to your computer and use it in GitHub Desktop.
| #!/bin/bash --login | |
| # Cf. http://stackoverflow.com/questions/33041109 | |
| # | |
| # Xcode 7 (incl. 7.0.1) seems to have a dependency on the system ruby. | |
| # xcodebuild is screwed up by using rvm to map to another non-system | |
| # ruby†. This script is a fix that allows you call xcodebuild in a | |
| # "safe" rvm environment, but will not (AFAIK) affect the "external" | |
| # rvm setting. | |
| # | |
| # The script is a drop in replacement for your xcodebuild call. | |
| # | |
| # xcodebuild arg1 ... argn | |
| # | |
| # would become | |
| # | |
| # path/to/xcbuild-safe.sh arg1 ... argn | |
| # | |
| # ----- | |
| # † Because, you know, that *never* happens when you are building | |
| # Xcode projects, say with abstruse tools like Rake or CocoaPods. | |
| # This allows you to use rvm in a script. Otherwise you get a BS | |
| # error along the lines of "cannot use rvm as function". Jeez. | |
| [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" | |
| # Cause rvm to use system ruby. AFAIK, this is effective only for | |
| # the scope of this script. | |
| rvm use system | |
| unset RUBYLIB | |
| unset RUBYOPT | |
| unset BUNDLE_BIN_PATH | |
| unset _ORIGINAL_GEM_PATH | |
| unset BUNDLE_GEMFILE | |
| set -x # echoes commands | |
| xcodebuild "$@" # calls xcodebuild with all the arguments passed to this |
Updated, thanks.
Answering a question from elsewhere, I release this into the public domain with no copyright attachments whatsoever.
I ran it but it failed with following errors, kindly help me
The following build commands failed:
CompileSwift normal arm64
CompileSwiftSources normal arm64 com.apple.xcode.tools.swift.compiler
CompileSwift normal armv7
CompileSwiftSources normal armv7 com.apple.xcode.tools.swift.compiler
Ditto build/<#AppName#>/Release-iphoneos/<#AppName#>/DerivedSources/<#AppName#>-Swift.h build/<#AppName#>/Release-iphoneos/<#AppName#>/Objects-normal/arm64/<#AppName#>-Swift.h
Ditto build/<#AppName#>/Release-iphoneos/<#AppName#>/DerivedSources/<#AppName#>-Swift.h build/<#AppName#>/Release-iphoneos/<#AppName#>/Objects-normal/armv7/<#AppName#>-Swift.h
CompileC build/<#AppName#>/Release-iphoneos/<#AppName#>/Objects-normal/armv7/UILabel+Helper.o <#AppName#>/Classes/Category/UILabel/UILabel+Helper.m normal armv7 objective-c com.apple.compilers.llvm.clang.1_0.compiler
CompileC build/<#AppName#>/Release-iphoneos/<#AppName#>/Objects-normal/armv7/UtilityFunctions.o <#AppName#>/Classes/UtilityFunctions/UtilityFunctions.m normal armv7 objective-c com.apple.compilers.llvm.clang.1_0.compiler
CompileC build/<#AppName#>/Release-iphoneos/<#AppName#>/Objects-normal/arm64/UILabel+Helper.o <#AppName#>/Classes/Category/UILabel/UILabel+Helper.m normal arm64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
CompileC build/<#AppName#>/Release-iphoneos/<#AppName#>/Objects-normal/arm64/UtilityFunctions.o <#AppName#>/Classes/UtilityFunctions/UtilityFunctions.m normal arm64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
Ditto build/Release-iphoneos/<#AppName#>.swiftmodule/arm.swiftmodule build/<#AppName#>/Release-iphoneos/<#AppName#>/Objects-normal/armv7/<#AppName#>.swiftmodule
Ditto build/Release-iphoneos/<#AppName#>.swiftmodule/arm.swiftdoc build/<#AppName#>/Release-iphoneos/<#AppName#>/Objects-normal/armv7/<#AppName#>.swiftdoc
Ditto build/Release-iphoneos/<#AppName#>.swiftmodule/arm64.swiftmodule build/<#AppName#>/Release-iphoneos/<#AppName#>/Objects-normal/arm64/<#AppName#>.swiftmodule
Ditto build/Release-iphoneos/<#AppName#>.swiftmodule/arm64.swiftdoc build/<#AppName#>/Release-iphoneos/<#AppName#>/Objects-normal/arm64/<#AppName#>.swiftdoc
Ld build/<#AppName#>.build/Release-iphoneos/<#AppName#>/Objects-normal/arm64/<#AppName#> normal arm64
Ld build/<#AppName#>/Release-iphoneos/<#AppName#>/Objects-normal/armv7/<#AppName#> normal armv7
CreateUniversalBinary build/Release-iphoneos/<#AppName#>.app/<#AppName#> normal armv7\ arm64
GenerateDSYMFile build/Release-iphoneos/<#AppName#>.app.dSYM build/Release-iphoneos/<#AppName#>.app/<#AppName#>
PhaseScriptExecution [CP]\ Embed\ Pods\ Frameworks build/<#AppName#>/Release-iphoneos/<#AppName#>/Script-BCDEC6F471C9E9C710CD7329.sh
(19 failures)
This wasn't sufficient for us. I had to unset more variables
before calling xcodebuild.