class XcodeArchiveCache::Build::Performer

Attributes

derived_data_path[R]

@return [String]

xcodebuild_executor[R]

@return [XcodeArchiveCache::Xcodebuild::Executor]

Public Class Methods

new(xcodebuild_executor, derived_data_path) click to toggle source

@param [String] derived_data_path

# 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

Public Instance Methods

rebuild_missing(target, graph) click to toggle source

@param [Xcodeproj::Project::Object::PBXNativeTarget] target @param [XcodeArchiveCache::BuildGraph::Graph] graph

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

@param [XcodeArchiveCache::BuildGraph::Graph] graph

# File lib/build/performer.rb, line 37
def should_rebuild?(graph)
  graph.root_node.state != :unpacked
end