class Xcake::BuildRule

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`.

Attributes

file_type[RW]

@return [String] the type of the files that should be processed by

this rule.

@example

`pattern.proxy`.
name[RW]

@return [String] the name of the rule.

output_files[RW]

@return [ObjectList<PBXFileReference>] the file references for the

output files.
output_files_compiler_flags[RW]

@return [ObjectList<String>] the compiler flags used when creating the

respective output files.
script[RW]

@return [String] the content of the script to use for the build rule.

@note This attribute is present if the #{#compiler_spec} is

`com.apple.compilers.proxy.script`

Public Class Methods

new() { |self| ... } click to toggle source

@param [Proc] block

an optional block that configures the build rule through the DSL.

@example Creating a Build Rule.

BuildRule.new do |p|
  p.name "test"
end
# File lib/xcake/dsl/build_rule.rb, line 45
def initialize
  @output_files = []
  @output_files_compiler_flags = []

  yield(self) if block_given?
end

Public Instance Methods

configure_native_build_rule(native_build_rule, _context) click to toggle source

This method is called when generating the build rules subclasses should implement this to handle the configuration of the build phase

# 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() click to toggle source
# File lib/xcake/dsl/build_rule.rb, line 72
def to_s
  "BuildRule<#{name}>"
end