Class: Pod::Validator

Inherits:
Object
  • Object
show all
Defined in:
lib/cocoapods-tdf-bin/native/validator.rb

Instance Method Summary collapse

Instance Method Details

#xcodebuild(action, scheme, configuration, deployment_target:) ⇒ Object

修改 验证 build 时的 ARCHS 配置



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
67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/cocoapods-tdf-bin/native/validator.rb', line 41

def xcodebuild(action, scheme, configuration, deployment_target:)
  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)
    command += %w(ARCHS=x86_64)
    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
    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