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, workspace_path = nil) ⇒ Performer

Returns a new instance of Performer.

Parameters:

  • derived_data_path (String)


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

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

Instance Method Details

#rebuild_missing(target, graph) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# 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(&:waiting_for_rebuild)
                       .map(&:name)
                       .join(", ")
    info("going to rebuild:\n#{rebuild_list}")

    if workspace_path
      build_result = xcodebuild_executor.build_from_workspace(workspace_path, target.name, derived_data_path)
    else
      build_result = xcodebuild_executor.build_from_project(target.project.path, target.name, derived_data_path)
    end

    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)


43
44
45
# File 'lib/build/performer.rb', line 43

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