Class: Xcake::TargetFileReferenceGenerator
- Inherits:
-
Generator
show all
- Defined in:
- lib/xcake/generator/target_file_reference_generator.rb
Instance Attribute Summary collapse
Attributes inherited from Generator
#context
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Generator
plugins_location
Methods included from Visitor
#item_name, #leave, #visit
Methods included from Plugin
included
Methods included from Dependency
included
Constructor Details
Returns a new instance of TargetFileReferenceGenerator.
6
7
8
9
10
11
|
# File 'lib/xcake/generator/target_file_reference_generator.rb', line 6
def initialize(context)
@context = context
@root_node = Node.new
@dependency_provider = DependencyProvider.new(FileReferenceInstaller)
end
|
Instance Attribute Details
#dependency_provider ⇒ Object
Returns the value of attribute dependency_provider.
4
5
6
|
# File 'lib/xcake/generator/target_file_reference_generator.rb', line 4
def dependency_provider
@dependency_provider
end
|
#root_node ⇒ Object
Returns the value of attribute root_node.
3
4
5
|
# File 'lib/xcake/generator/target_file_reference_generator.rb', line 3
def root_node
@root_node
end
|
Class Method Details
.dependencies ⇒ Object
13
14
15
|
# File 'lib/xcake/generator/target_file_reference_generator.rb', line 13
def self.dependencies
[TargetGenerator]
end
|
Instance Method Details
#process_files_for_target(target) ⇒ Object
17
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/xcake/generator/target_file_reference_generator.rb', line 17
def process_files_for_target(target)
native_target = @context.native_object_for(target)
Dir.glob(target.include_files).each do |file|
@root_node.create_children_with_path(file, native_target)
end if target.include_files
Dir.glob(target.exclude_files).each do |file|
@root_node.remove_children_with_path(file, native_target)
end if target.exclude_files
end
|
#visit_node(node) ⇒ Object
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
# File 'lib/xcake/generator/target_file_reference_generator.rb', line 37
def visit_node(node)
return unless node.path
EventHooks.run_hook :before_adding_file, node
installer_class = @dependency_provider.tsort.detect do |i|
i.can_install_node(node)
end
unless installer_class.nil?
installer = installer_class.new(context)
node.accept(installer)
end
end
|
#visit_project(project) ⇒ Object
29
30
31
32
33
34
35
|
# File 'lib/xcake/generator/target_file_reference_generator.rb', line 29
def visit_project(project)
project.targets.each do |target|
process_files_for_target(target)
end
root_node.accept(self)
end
|