Class: XcodeArchiveCache::Build::Performer

Inherits:
Object
  • Object
show all
Includes:
Logs
Defined in:
lib/build/performer.rb

Instance Method Summary collapse

Methods included from Logs

#debug, #error, #info, #set_log_level

Constructor Details

#initialize(xcodebuild_executor, derived_data_path) ⇒ Performer

Returns a new instance of Performer.

Parameters:

  • derived_data_path (String)


9
10
11
12
# File 'lib/build/performer.rb', line 9

def initialize(xcodebuild_executor, derived_data_path)
  @xcodebuild_executor = xcodebuild_executor
  @derived_data_path = derived_data_path
end

Instance Method Details

#rebuild_missing(target, graph) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/build/performer.rb', line 17

def rebuild_missing(target, graph)
  should_rebuild_anything = should_rebuild?(graph)
  if should_rebuild_anything
    rebuild_list = graph.nodes
                       .select(&:waiting_for_rebuild)
                       .map(&:name)
                       .join(", ")
    info("going to rebuild:\n#{rebuild_list}")

    build_result = xcodebuild_executor.build(target.project.path, target.name, derived_data_path)
    unless build_result
      raise StandardError.new, "Failed to perform rebuild"
    end
  else
    info("no need to rebuild anything")
  end
end

#should_rebuild?(graph) ⇒ Boolean

Parameters:

Returns:

  • (Boolean)


37
38
39
# File 'lib/build/performer.rb', line 37

def should_rebuild?(graph)
  graph.root_node.state != :unpacked
end