Class: XcodeArchiveCache::BuildSettings::Loader

Inherits:
Object
  • Object
show all
Defined in:
lib/build_settings/loader.rb

Instance Method Summary collapse

Constructor Details

#initialize(executor) ⇒ Loader

Returns a new instance of Loader.

Parameters:



51
52
53
54
# File 'lib/build_settings/loader.rb', line 51

def initialize(executor)
  @executor = executor
  @extractor = Extractor.new
end

Instance Method Details

#get_settings(project_path, target_name) ⇒ Hash{String => String}

Returns build settings for target or nil.

Parameters:

  • project_path (String)
  • target_name (String)

Returns:

  • (Hash{String => String})

    build settings for target or nil



82
83
84
85
86
87
# File 'lib/build_settings/loader.rb', line 82

def get_settings(project_path, target_name)
  project_settings = get_project_settings(project_path)
  return nil unless project_settings

  project_settings[target_name]
end

#load_settings(project_paths) ⇒ Object

Parameters:

  • project_paths (Array<String>)


58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/build_settings/loader.rb', line 58

def load_settings(project_paths)
  paths_without_settings = project_paths.select {|path| get_project_settings(path) == nil}

  threads = paths_without_settings.map do |path|
    Thread.new(path) do |project_path|
      Thread.current.abort_on_exception = true
      [project_path, executor.load_build_settings(project_path)]
    end
  end

  should_fix_settings = executor.set_up_for_simulator?

  threads.each do |thread|
    project_path, all_targets_settings = thread.value
    per_target_settings = extractor.extract_per_target(all_targets_settings, should_fix_settings)
    set_project_settings(project_path, per_target_settings)
  end
end