Class: PodPrebuild::XcodebuildCommand
- Inherits:
-
Object
- Object
- PodPrebuild::XcodebuildCommand
- Defined in:
- lib/cocoapods-binary-ht/pod-rome/xcodebuild_command.rb,
lib/cocoapods-binary-ht/pod-rome/xcodebuild_raw.rb
Overview
rubocop:disable Metrics/ClassLength
Constant Summary collapse
- PLATFORM_OF_SDK =
{ # "iphonesimulator" => "iOS", "iphoneos" => "iOS", "appletvsimulator" => "tvOS", "watchsimulator" => "watchOS" }.freeze
- DESTINATION_OF_SDK =
{ "iphoneos" => "\"generic/platform=iOS\"", "iphonesimulator" => "\"generic/platform=iOS Simulator\"" }.freeze
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(options) ⇒ XcodebuildCommand
constructor
A new instance of XcodebuildCommand.
- #run ⇒ Object
Constructor Details
#initialize(options) ⇒ XcodebuildCommand
Returns a new instance of XcodebuildCommand.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/cocoapods-binary-ht/pod-rome/xcodebuild_command.rb', line 5 def initialize() @options = case [:targets][0].platform.name when :ios @options[:device] = "iphoneos" # @options[:simulator] = "iphonesimulator" @options[:simulator] = "iphoneos" when :tvos @options[:device] = "appletvos" @options[:simulator] = "appletvsimulator" when :watchos @options[:device] = "watchos" @options[:simulator] = "watchsimulator" end @build_args = make_up_build_args([:args] || {}) end |
Class Method Details
.xcodebuild(options) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/cocoapods-binary-ht/pod-rome/xcodebuild_raw.rb', line 17 def self.xcodebuild() # sdk = options[:sdk] || "iphonesimulator" sdk = [:sdk] || "iphoneos" targets = [:targets] || [[:target]] platform = PLATFORM_OF_SDK[sdk] cmd = ["xcodebuild"] cmd << "-project" << [:sandbox].project_path.realdirpath.shellescape targets.each { |target| cmd << "-target" << target } cmd << "-configuration" << [:configuration].shellescape cmd << "-sdk" << sdk if DESTINATION_OF_SDK.key?(sdk) cmd << "-destination" << DESTINATION_OF_SDK[sdk] else unless platform.nil? cmd << Fourflusher::SimControl.new.destination(:oldest, platform, [:deployment_target]) end end cmd += [:args] if [:args] # cmd << "clean" cmd << "build" # cmd << "-UseModernBuildSystem=NO" if [:log_path].nil? cmd << "2>&1" else FileUtils.mkdir_p(File.dirname([:log_path])) cmd << "> #{[:log_path].shellescape}" end cmd = cmd.join(" ") Pod::UI.puts_indented "$ #{cmd}" unless PodPrebuild.config.silent_build? log = `#{cmd}` return if $?.exitstatus.zero? # rubocop:disable Style/SpecialGlobalVars begin require "xcpretty" # TODO (thuyen): Revise this dependency # use xcpretty to print build log # 64 represent command invalid. http://www.manpagez.com/man/3/sysexits/ printer = XCPretty::Printer.new({:formatter => XCPretty::Simple, :colorize => "auto"}) log.each_line do |line| printer.pretty_print(line) end rescue Pod::UI.puts log.red ensure raise "Fail to build targets: #{targets}" end end |
Instance Method Details
#run ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/cocoapods-binary-ht/pod-rome/xcodebuild_command.rb', line 22 def run sdks.each { |sdk| build_for_sdk(sdk) } targets.each do |target| if PodPrebuild.config.xcframework? create_xcframework(target) elsif sdks.count > 1 create_fat_framework(target) else collect_output(target, Dir[target_products_dir_of(target, sdks[0]) + "/*"]) end end end |