class Pod::Validator

Attributes

only_x64[RW]

Public Instance Methods

xcodebuild(action, scheme, configuration) click to toggle source
# File lib/cocoapods-lint-onlyx64/command/onlyx64.rb, line 4
def xcodebuild(action, scheme, configuration)
  require 'fourflusher'
  command = %W(clean #{action} -workspace #{File.join(validation_dir, 'App.xcworkspace')} -scheme #{scheme} -configuration #{configuration})
  case consumer.platform_name
  when :osx, :macos
    command += %w(CODE_SIGN_IDENTITY=)
  when :ios
    command += %w(CODE_SIGN_IDENTITY=- -sdk iphonesimulator)
    command += Fourflusher::SimControl.new.destination(:oldest, 'iOS', deployment_target)
    xcconfig = consumer.pod_target_xcconfig
    if xcconfig
      archs = xcconfig['VALID_ARCHS']
      if archs && (archs.include? 'armv7') && !(archs.include? 'i386') && (archs.include? 'x86_64')
        # Prevent Xcodebuild from testing the non-existent i386 simulator if armv7 is specified without i386
        command += %w(ARCHS=x86_64)
      end
      if @only_x64 && !(command.include? 'ARCHS=x86_64')
        command += %w(ARCHS=x86_64)
      end
    end
  when :watchos
    command += %w(CODE_SIGN_IDENTITY=- -sdk watchsimulator)
    command += Fourflusher::SimControl.new.destination(:oldest, 'watchOS', deployment_target)
  when :tvos
    command += %w(CODE_SIGN_IDENTITY=- -sdk appletvsimulator)
    command += Fourflusher::SimControl.new.destination(:oldest, 'tvOS', deployment_target)
  end

  if analyze
    command += %w(CLANG_ANALYZER_OUTPUT=html CLANG_ANALYZER_OUTPUT_DIR=analyzer)
  end

  begin
    _xcodebuild(command, true)
  rescue => e
    message = 'Returned an unsuccessful exit code.'
    message += ' You can use `--verbose` for more information.' unless config.verbose?
    error('xcodebuild', message)
    e.message
  end
end