Method: DeployGate::Xcode::Ios.build

Defined in:
lib/deploygate/xcode/ios.rb

.build(ios_analyze, target_scheme, codesigning_identity, provisioning_profile_info = nil, build_configuration = nil, export_method = DeployGate::Xcode::Export::AD_HOC, allow_provisioning_updates = false) ⇒ String

Parameters:

  • (defaults to: nil)
  • (defaults to: nil)
  • (defaults to: DeployGate::Xcode::Export::AD_HOC)
  • (defaults to: false)

Returns:

Raises:



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
# File 'lib/deploygate/xcode/ios.rb', line 20

def build(ios_analyze,
          target_scheme,
          codesigning_identity,
          provisioning_profile_info = nil,
          build_configuration = nil,
          export_method = DeployGate::Xcode::Export::AD_HOC,
          allow_provisioning_updates = false)
  raise NotSupportExportMethodError, 'Not support export' unless DeployGate::Xcode::Export::SUPPORT_EXPORT_METHOD.include?(export_method)

  values = {
      export_method: export_method,
      configuration: build_configuration || DeployGate::Xcode::Analyze::DEFAULT_BUILD_CONFIGURATION,
      scheme: target_scheme
  }

  if ios_analyze.build_workspace
    values[:workspace] = ios_analyze.build_workspace
  else
    values[:project] = ios_analyze.xcodeproj
  end

  values[:codesigning_identity] = codesigning_identity if codesigning_identity
  if allow_provisioning_updates
    values[:xcargs]        = '-allowProvisioningUpdates'
    values[:export_xcargs] = '-allowProvisioningUpdates'
  end
  values[:export_options] = provisioning_profile_info if provisioning_profile_info

  v = FastlaneCore::Configuration.create(Gym::Options.available_options, values)

  begin
    absolute_ipa_path = File.expand_path(Gym::Manager.new.work(v))
  rescue => e
    # TODO: build error handling
    use_xcode_path = `xcode-select -p`
    puts HighLine.color(I18n.t('xcode.ios.build.error.use_xcode', use_xcode_path: use_xcode_path), HighLine::RED)
    raise e
  end
  absolute_dsym_path = absolute_ipa_path.gsub(".ipa", ".app.dSYM.zip") # TODO: upload to deploygate

  absolute_ipa_path
end