class XcodeArchiveCache::BuildGraph::Node

Constants

ACCEPTABLE_PRODUCT_TYPES

Attributes

build_settings[RW]

@return [XcodeArchiveCache::BuildSettings::Container]

dependencies[R]

@return [Array<XcodeArchiveCache::BuildGraph::Node>] dependency nodes

dependent[R]

@return [Array<XcodeArchiveCache::BuildGraph::Node>] dependent nodes

is_root[R]

@return [Boolean]

name[R]

@return [String] native target display name

native_target[R]

@return [Xcodeproj::Project::Object::PBXNativeTarget] corresponding native target

sha[RW]

@return [String] sha256 of (input files + build settings + dependency shas)

state[RW]

@return [Symbol] should target be rebuilt

targets_injected_to[R]

@return [Array<Xcodeproj::Project::Object::PBXNativeTarget>]

Public Class Methods

new(name, native_target, is_root = false) click to toggle source

@param [String] name @param [Xcodeproj::Project::Object::PBXNativeTarget] native_target @param [Boolean] is_root

# File lib/build_graph/node.rb, line 45
def initialize(name, native_target, is_root = false)
  @name = name
  @native_target = native_target
  @is_root = is_root
  @dependent = []
  @dependencies = []
  @targets_injected_to = []
  @state = :unknown
end

Public Instance Methods

==(other_node) click to toggle source
# File lib/build_graph/node.rb, line 161
def ==(other_node)
  other_node && native_target.uuid == other_node.native_target.uuid && native_target.project == other_node.native_target.project
end
all_dependent_nodes() click to toggle source

@return [Array<Node>]

Direct + transitive dependents
# File lib/build_graph/node.rb, line 145
def all_dependent_nodes
  (dependent + dependent.map(&:all_dependent_nodes)).flatten.uniq
end
dsym_file_name() click to toggle source

@return [String]

# File lib/build_graph/node.rb, line 93
def dsym_file_name
  build_settings ? build_settings[XcodeArchiveCache::BuildSettings::DWARF_DSYM_FILE_NAME_KEY] : nil
end
has_acceptable_product?() click to toggle source
# File lib/build_graph/node.rb, line 67
def has_acceptable_product?
  ACCEPTABLE_PRODUCT_TYPES.include?(native_target.product_type)
end
has_bundle_product?() click to toggle source
# File lib/build_graph/node.rb, line 63
def has_bundle_product?
  native_target.product_type == Xcodeproj::Constants::PRODUCT_TYPE_UTI[:bundle]
end
has_framework_product?() click to toggle source
# File lib/build_graph/node.rb, line 55
def has_framework_product?
  native_target.product_type == Xcodeproj::Constants::PRODUCT_TYPE_UTI[:framework]
end
has_static_library_product?() click to toggle source
# File lib/build_graph/node.rb, line 59
def has_static_library_product?
  native_target.product_type == Xcodeproj::Constants::PRODUCT_TYPE_UTI[:static_library]
end
module_name() click to toggle source

@return [String]

# File lib/build_graph/node.rb, line 132
def module_name
  build_settings[XcodeArchiveCache::BuildSettings::PRODUCT_MODULE_NAME_KEY]
end
modulemap_file_name() click to toggle source

@return [String]

# File lib/build_graph/node.rb, line 138
def modulemap_file_name
  build_settings[XcodeArchiveCache::BuildSettings::MODULEMAP_FILE_KEY]
end
original_modulemap_file_path() click to toggle source

@return [String]

# File lib/build_graph/node.rb, line 99
def original_modulemap_file_path
  modulemap_file = modulemap_file_name
  return unless modulemap_file

  Pathname.new(modulemap_file).absolute? ? modulemap_file : File.join(File.dirname(native_target.project.path), modulemap_file)
end
product_file_name() click to toggle source

@return [String]

# File lib/build_graph/node.rb, line 73
def product_file_name
  return nil unless build_settings

  product_name = build_settings[XcodeArchiveCache::BuildSettings::FULL_PRODUCT_NAME_KEY]
  return product_name if product_name

  product_name = native_target.product_reference.name
  if has_framework_product? && product_name
    product_file_name = product_name
  end

  unless product_file_name
    product_file_name = File.basename(native_target.product_reference.real_path)
  end

  product_file_name
end
resulting_modulemap_file_name() click to toggle source

@return [String]

# File lib/build_graph/node.rb, line 108
def resulting_modulemap_file_name
  if module_name
    module_name + ".modulemap"
  else
    File.basename(modulemap_file_name)
  end
end
subgraph() click to toggle source

@return [Array<Node>]

# File lib/build_graph/node.rb, line 151
def subgraph
  ([self] + dependencies + dependencies.map(&:subgraph)).flatten.uniq
end
swift_objc_interface_header_file() click to toggle source

@return [String]

# File lib/build_graph/node.rb, line 118
def swift_objc_interface_header_file
  header_file = build_settings[XcodeArchiveCache::BuildSettings::SWIFT_OBJC_INTERFACE_HEADER_NAME_KEY]
  if header_file == nil
    our_module_name = module_name
    return if our_module_name == nil

    header_file = our_module_name + "-Swift.h"
  end

  header_file
end
to_s() click to toggle source
# File lib/build_graph/node.rb, line 165
def to_s
  sha_string = sha ? sha : "<none>"
  dependent_names = dependent.length > 0 ? dependent.map(&:name).join(", ") : "<none>"
  dependency_names = dependencies.length > 0 ? dependencies.map(&:name).join(", ") : "<none>"
  "#{name}\n\troot: #{is_root}\n\tproduct: #{product_file_name}\n\tsha: #{sha_string}\n\tstate: #{state}\n\tdependent: #{dependent_names}\n\tdependencies: #{dependency_names}"
end
waiting_for_rebuild() click to toggle source

@return [Bool]

# File lib/build_graph/node.rb, line 157
def waiting_for_rebuild
  state == :waiting_for_rebuild
end