Class: XcodeArchiveCache::BuildGraph::Node
- Inherits:
-
Object
- Object
- XcodeArchiveCache::BuildGraph::Node
- Defined in:
- lib/build_graph/node.rb
Instance Attribute Summary collapse
- #build_settings ⇒ XcodeArchiveCache::BuildSettings::Container
-
#dependencies ⇒ Array<XcodeArchiveCache::BuildGraph::Node>
readonly
Dependency nodes.
-
#dependent ⇒ Array<XcodeArchiveCache::BuildGraph::Node>
readonly
Dependent nodes.
- #is_root ⇒ Boolean readonly
-
#name ⇒ String
readonly
Native target display name.
-
#native_target ⇒ Xcodeproj::Project::Object::PBXNativeTarget
readonly
Corresponding native target.
-
#rebuild ⇒ Bool
Should target be rebuilt.
-
#sha ⇒ String
Sha256 of (input files + build settings + dependency shas).
Instance Method Summary collapse
- #==(other_node) ⇒ Object
-
#all_dependent_nodes ⇒ Array<Node>
Direct + transitive dependents.
- #dsym_file_name ⇒ String
- #has_framework_product? ⇒ Boolean
- #has_static_library_product? ⇒ Boolean
-
#initialize(name, native_target, is_root = false) ⇒ Node
constructor
A new instance of Node.
- #product_file_name ⇒ String
- #to_s ⇒ Object
Constructor Details
#initialize(name, native_target, is_root = false) ⇒ Node
Returns a new instance of Node.
41 42 43 44 45 46 47 |
# File 'lib/build_graph/node.rb', line 41 def initialize(name, native_target, is_root = false) @name = name @native_target = native_target @is_root = is_root @dependent = [] @dependencies = [] end |
Instance Attribute Details
#build_settings ⇒ XcodeArchiveCache::BuildSettings::Container
35 36 37 |
# File 'lib/build_graph/node.rb', line 35 def build_settings @build_settings end |
#dependencies ⇒ Array<XcodeArchiveCache::BuildGraph::Node> (readonly)
Returns dependency nodes.
27 28 29 |
# File 'lib/build_graph/node.rb', line 27 def dependencies @dependencies end |
#dependent ⇒ Array<XcodeArchiveCache::BuildGraph::Node> (readonly)
Returns dependent nodes.
23 24 25 |
# File 'lib/build_graph/node.rb', line 23 def dependent @dependent end |
#is_root ⇒ Boolean (readonly)
11 12 13 |
# File 'lib/build_graph/node.rb', line 11 def is_root @is_root end |
#name ⇒ String (readonly)
Returns native target display name.
7 8 9 |
# File 'lib/build_graph/node.rb', line 7 def name @name end |
#native_target ⇒ Xcodeproj::Project::Object::PBXNativeTarget (readonly)
Returns corresponding native target.
31 32 33 |
# File 'lib/build_graph/node.rb', line 31 def native_target @native_target end |
#rebuild ⇒ Bool
Returns should target be rebuilt.
15 16 17 |
# File 'lib/build_graph/node.rb', line 15 def rebuild @rebuild end |
#sha ⇒ String
Returns sha256 of (input files + build settings + dependency shas).
19 20 21 |
# File 'lib/build_graph/node.rb', line 19 def sha @sha end |
Instance Method Details
#==(other_node) ⇒ Object
92 93 94 |
# File 'lib/build_graph/node.rb', line 92 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 ⇒ Array<Node>
Returns Direct + transitive dependents.
88 89 90 |
# File 'lib/build_graph/node.rb', line 88 def all_dependent_nodes (dependent + dependent.map(&:all_dependent_nodes)).flatten.uniq end |
#dsym_file_name ⇒ String
79 80 81 82 83 |
# File 'lib/build_graph/node.rb', line 79 def dsym_file_name return nil unless build_settings build_settings[XcodeArchiveCache::BuildSettings::DWARF_DSYM_FILE_NAME_KEY] end |
#has_framework_product? ⇒ Boolean
49 50 51 |
# File 'lib/build_graph/node.rb', line 49 def has_framework_product? native_target.product_type == Xcodeproj::Constants::PRODUCT_TYPE_UTI[:framework] end |
#has_static_library_product? ⇒ Boolean
53 54 55 |
# File 'lib/build_graph/node.rb', line 53 def has_static_library_product? native_target.product_type == Xcodeproj::Constants::PRODUCT_TYPE_UTI[:static_library] end |
#product_file_name ⇒ String
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/build_graph/node.rb', line 59 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 |
#to_s ⇒ Object
96 97 98 99 100 101 |
# File 'lib/build_graph/node.rb', line 96 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\trebuild: #{rebuild}\n\tdependent: #{dependent_names}\n\tdependencies: #{dependency_names}" end |