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

Parameters:



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

def rebuild_missing(target, graph)
  should_rebuild_anything = should_rebuild?(graph)
  if should_rebuild_anything
    rebuild_list = graph.nodes.select(&: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)


35
36
37
# File 'lib/build/performer.rb', line 35

def should_rebuild?(graph)
  graph.nodes.reduce(false) {|rebuild, node| rebuild || node.rebuild}
end