Class: Xcake::BuildRule
- Inherits:
-
Object
- Object
- Xcake::BuildRule
- Defined in:
- lib/xcake/dsl/build_rule.rb
Overview
This class is used to describe a build rule for a
Xcode project; This forms part of the DSL
and is usually stored in files named Cakefile
.
Instance Attribute Summary collapse
-
#file_type ⇒ String
The type of the files that should be processed by this rule.
-
#name ⇒ String
The name of the rule.
-
#output_files ⇒ ObjectList<PBXFileReference>
The file references for the output files.
-
#output_files_compiler_flags ⇒ ObjectList<String>
The compiler flags used when creating the respective output files.
-
#script ⇒ String
The content of the script to use for the build rule.
Instance Method Summary collapse
-
#configure_native_build_rule(native_build_rule, _context) ⇒ Object
This method is called when generating the build rules subclasses should implement this to handle the configuration of the build phase.
-
#initialize {|_self| ... } ⇒ BuildRule
constructor
A new instance of BuildRule.
- #to_s ⇒ Object
Constructor Details
#initialize {|_self| ... } ⇒ BuildRule
Returns a new instance of BuildRule.
45 46 47 48 49 50 |
# File 'lib/xcake/dsl/build_rule.rb', line 45 def initialize @output_files = [] @output_files_compiler_flags = [] yield(self) if block_given? end |
Instance Attribute Details
#file_type ⇒ String
Returns the type of the files that should be processed by this rule.
17 18 19 |
# File 'lib/xcake/dsl/build_rule.rb', line 17 def file_type @file_type end |
#name ⇒ String
Returns the name of the rule.
9 10 11 |
# File 'lib/xcake/dsl/build_rule.rb', line 9 def name @name end |
#output_files ⇒ ObjectList<PBXFileReference>
Returns the file references for the output files.
22 23 24 |
# File 'lib/xcake/dsl/build_rule.rb', line 22 def output_files @output_files end |
#output_files_compiler_flags ⇒ ObjectList<String>
Returns the compiler flags used when creating the respective output files.
27 28 29 |
# File 'lib/xcake/dsl/build_rule.rb', line 27 def output_files_compiler_flags @output_files_compiler_flags end |
#script ⇒ String
This attribute is present if the ##compiler_spec is
com.apple.compilers.proxy.script
Returns the content of the script to use for the build rule.
34 35 36 |
# File 'lib/xcake/dsl/build_rule.rb', line 34 def script @script end |
Instance Method Details
#configure_native_build_rule(native_build_rule, _context) ⇒ Object
This method is called when generating the build rules subclasses should implement this to handle the configuration of the build phase
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/xcake/dsl/build_rule.rb', line 56 def configure_native_build_rule(native_build_rule, _context) native_build_rule.name = name native_build_rule.compiler_spec = 'com.apple.compilers.proxy.script' native_build_rule.file_type = file_type native_build_rule.script = script.strip_heredoc if output_files_compiler_flags.empty? output_files.each do |file| native_build_rule.add_output_file(file) end else output_files.zip(output_files_compiler_flags).each do |file, flag| native_build_rule.add_output_file(file, flag) end end end |
#to_s ⇒ Object
72 73 74 |
# File 'lib/xcake/dsl/build_rule.rb', line 72 def to_s "BuildRule<#{name}>" end |