Module: EarlGrey::AnalyzerExtension

Defined in:
lib/earlgrey/extensions/analyzer_extensions.rb

Instance Method Summary collapse

Instance Method Details

#analyze(*_) ⇒ Object


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
# File 'lib/earlgrey/extensions/analyzer_extensions.rb', line 22

def analyze(*_)
  result = super
  earlgrey_yaml = EarlGreyYaml.new(result, podfile)
  eg_targets = result.targets.select(&:is_earlgrey?).each do |target|
    target.user_targets.each do |native_target|
      config = earlgrey_yaml.lookup_target native_target

      if config[EarlGreyYaml::ADD_SWIFT]
        EarlGrey.copy_swift_files(target.user_project, native_target,
                                  target.target_definition.swift_version)
      end

      framework_ref = EarlGrey.add_earlgrey_product target.user_project, false
      EarlGrey.add_earlgrey_copy_files_script native_target, framework_ref if config[EarlGreyYaml::ADD_BUILD_PHASE]
      EarlGrey.add_earlgrey_framework native_target, framework_ref if config[EarlGreyYaml::ADD_FRAMEWORK]
    end
  end

  schemes = eg_targets.map(&:schemes_for_native_targets).flatten(1).uniq do |name, _|
    name
  end
  schemes.each do |name, scheme|
    EarlGrey.add_environment_variables_to_test_scheme(name, scheme)
  end
  result
end