class XcodeArchiveCache::BuildSettings::Loader

Constants

SETTINGS

Attributes

executor[R]

@return [XcodeArchiveCache::Xcodebuild::Executor]

extractor[R]

@return [XcodeArchiveCache::BuildSettings::Extractor]

Public Class Methods

new(executor) click to toggle source

@param [Xcodebuild::Executor] executor

# File lib/build_settings/loader.rb, line 51
def initialize(executor)
  @executor = executor
  @extractor = Extractor.new
end

Public Instance Methods

get_settings(project_path, target_name) click to toggle source

@param [String] project_path @param [String] target_name

@return [Hash{String => String}] build settings for target or nil

# 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) click to toggle source

@param [Array<String>] project_paths

# 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

Private Instance Methods

get_project_key(project_path) click to toggle source

@param [String] project_path

@return [String]

# File lib/build_settings/loader.rb, line 120
def get_project_key(project_path)
  "#{project_path}-#{executor.arguments_state}"
end
get_project_settings(path) click to toggle source

@param [String] path

@return [Hash]

# File lib/build_settings/loader.rb, line 105
def get_project_settings(path)
  SETTINGS[get_project_key(path)]
end
set_project_settings(path, per_target_settings) click to toggle source

@param [String] path @param [Hash] per_target_settings

# File lib/build_settings/loader.rb, line 112
def set_project_settings(path, per_target_settings)
  SETTINGS[get_project_key(path)] = per_target_settings
end