Class: Xcake::TargetLinkGenerator

Inherits:
Generator
  • Object
show all
Defined in:
lib/xcake/generator/target_link_generator.rb

Overview

This generator handles linking targets specified as being linked in the Cakefile

Instance Attribute Summary

Attributes inherited from Generator

#context

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Generator

#initialize, plugins_location

Methods included from CoreExtensions::ClassDescendants

#descendants

Methods included from Visitor

#item_name, #leave, #visit

Methods included from Plugin

included

Methods included from Dependency

included

Constructor Details

This class inherits a constructor from Xcake::Generator

Class Method Details

.dependenciesObject



6
7
8
# File 'lib/xcake/generator/target_link_generator.rb', line 6

def self.dependencies
  [TargetGenerator]
end

Instance Method Details

#visit_target(target) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/xcake/generator/target_link_generator.rb', line 10

def visit_target(target)
  return if target.linked_targets.empty?

  native_target = @context.native_object_for(target)
  frameworks_build_phase = native_target.frameworks_build_phase

  target.linked_targets.each do |linked_target|
    native_linked_target = @context.native_object_for(linked_target)
    target.target_dependencies << linked_target

    linked_product = native_linked_target.product_reference
    frameworks_build_phase.add_file_reference(linked_product)
  end
end