Class: Xcodeproj::Project::Object::PBXBuildRule

Inherits:
AbstractObject show all
Defined in:
lib/xcodeproj/project/object/build_rule.rb

Overview

This class represents a custom build rule of a Target.

Instance Attribute Summary

Attributes inherited from AbstractObject

#isa, #project, #uuid

Attributes collapse

Helpers collapse

Methods inherited from AbstractObject

#<=>, #==, #display_name, #inspect, isa, #nested_object_for_hash, #pretty_print, #remove_from_project, #sort, #sort_recursively, #to_ascii_plist, #to_hash

Instance Method Details

#add_output_file(file, compiler_flags = '') ⇒ Void

Adds an output file with the specified compiler flags.

Parameters:

  • file (PBXFileReference)

    the file to add.

  • compiler_flags (String) (defaults to: '')

    the compiler flags for the file.

Returns:

  • (Void)


90
91
92
93
# File 'lib/xcodeproj/project/object/build_rule.rb', line 90

def add_output_file(file, compiler_flags = '')
  (self.output_files ||= []) << file
  (self.output_files_compiler_flags ||= []) << compiler_flags
end

#ascii_plist_annotationObject



103
104
105
# File 'lib/xcodeproj/project/object/build_rule.rb', line 103

def ascii_plist_annotation
  " #{isa} "
end

#compiler_specString

Returns a string representing what compiler to use.

Examples:

`com.apple.compilers.proxy.script`.

Returns:

  • (String)

    a string representing what compiler to use.



18
# File 'lib/xcodeproj/project/object/build_rule.rb', line 18

attribute :compiler_spec, String

#dependency_fileString

Returns the discovered dependency file to use.

Examples:

`$(DERIVED_FILES_DIR)/$(INPUT_FILE_NAME).d`.

Returns:

  • (String)

    the discovered dependency file to use.



25
# File 'lib/xcodeproj/project/object/build_rule.rb', line 25

attribute :dependency_file, String

#file_patternsString

Returns the pattern of the files that should be processed by this rule. This attribute is an alternative to to ‘file_type`.

Examples:

`*.css`.

Returns:

  • (String)

    the pattern of the files that should be processed by this rule. This attribute is an alternative to to ‘file_type`.



42
# File 'lib/xcodeproj/project/object/build_rule.rb', line 42

attribute :file_patterns, String

#file_typeString

Returns the type of the files that should be processed by this rule.

Examples:

`pattern.proxy`.

Returns:

  • (String)

    the type of the files that should be processed by this rule.



33
# File 'lib/xcodeproj/project/object/build_rule.rb', line 33

attribute :file_type, String

#input_filesObjectList<PBXFileReference>

Returns the file references for the input files files.

Returns:



54
# File 'lib/xcodeproj/project/object/build_rule.rb', line 54

attribute :input_files, Array

#is_editableString

Returns whether the rule is editable.

Examples:

`1`.

Returns:

  • (String)

    whether the rule is editable.



49
# File 'lib/xcodeproj/project/object/build_rule.rb', line 49

attribute :is_editable, String, '1'

#nameString

Returns the name of the rule.

Returns:

  • (String)

    the name of the rule.



11
# File 'lib/xcodeproj/project/object/build_rule.rb', line 11

attribute :name, String

#output_filesObjectList<PBXFileReference>

Returns the file references for the output files.

Returns:



59
# File 'lib/xcodeproj/project/object/build_rule.rb', line 59

attribute :output_files, Array

#output_files_and_flagsArray<[PBXFileReference, String]>

Returns An array containing tuples of output files and their compiler flags.

Returns:

  • (Array<[PBXFileReference, String]>)

    An array containing tuples of output files and their compiler flags.



99
100
101
# File 'lib/xcodeproj/project/object/build_rule.rb', line 99

def output_files_and_flags
  (output_files || []).zip(output_files_compiler_flags || [])
end

#output_files_compiler_flagsObjectList<String>

Returns the compiler flags used when creating the respective output files.

Returns:

  • (ObjectList<String>)

    the compiler flags used when creating the respective output files.



64
# File 'lib/xcodeproj/project/object/build_rule.rb', line 64

attribute :output_files_compiler_flags, Array

#run_once_per_architectureString

Returns whether the rule should be run once per architecture.

Examples:

`0`.

Returns:

  • (String)

    whether the rule should be run once per architecture.



71
# File 'lib/xcodeproj/project/object/build_rule.rb', line 71

attribute :run_once_per_architecture, String

#scriptString

Note:

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.

Returns:

  • (String)

    the content of the script to use for the build rule.



78
# File 'lib/xcodeproj/project/object/build_rule.rb', line 78

attribute :script, String