Top Level Namespace

Defined Under Namespace

Modules: Pod, PodPrebuild, RGL Classes: BenchmarkShow, DependenciesGraph, FolderChecksum, PathUtils, SchemeEditor, XcodebuildCommand

Constant Summary collapse

PLATFORM_OF_SDK =
{
  "iphonesimulator" => "iOS",
  "appletvsimulator" => "tvOS",
  "watchsimulator" => "watchOS"
}.freeze

Instance Method Summary collapse

Instance Method Details

#xcodebuild(options) ⇒ Object



9
10
11
12
13
14
15
16
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
# File 'lib/cocoapods-binary-cache/pod-rome/xcodebuild_raw.rb', line 9

def xcodebuild(options)
  sdk = options[:sdk] || "iphonesimulator"
  platform = PLATFORM_OF_SDK[sdk]

  cmd = ["xcodebuild"]
  cmd << "-project" << options[:sandbox].project_path.realdirpath
  cmd << "-scheme" << options[:target]
  cmd << "-configuration" << options[:configuration]
  cmd << "-sdk" << sdk
  cmd << Fourflusher::SimControl.new.destination(:oldest, platform, options[:deployment_target]) unless platform.nil?
  cmd += options[:args] if options[:args]
  cmd << "2>&1"
  cmd = cmd.join(" ")

  Pod::UI.puts_indented "$ #{cmd}"
  log = `#{cmd}`

  succeeded = $?.exitstatus.zero? # rubocop:disable Style/SpecialGlobalVars
  unless succeeded
    begin
      raise "Unexpected error" unless log.include?("** BUILD FAILED **")

      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
    end
  end
  [succeeded, log]
end