Class: Xcodeproj::Project::Object::AbstractBuildPhase Abstract
- Inherits:
-
AbstractObject
- Object
- AbstractObject
- Xcodeproj::Project::Object::AbstractBuildPhase
- Defined in:
- lib/xcodeproj/project/object/build_phase.rb
Overview
This class is abstract and it doesn’t appear in the project document.
Direct Known Subclasses
PBXCopyFilesBuildPhase, PBXFrameworksBuildPhase, PBXHeadersBuildPhase, PBXResourcesBuildPhase, PBXRezBuildPhase, PBXShellScriptBuildPhase, PBXSourcesBuildPhase
Attributes collapse
-
#build_action_mask ⇒ String
Some kind of magic number which usually is ‘2147483647’ (can be also ‘8` and `12` in PBXCopyFilesBuildPhase, one of the masks is run_only_for_deployment_postprocessing).
-
#comments ⇒ String
Comments associated with this build phase.
-
#run_only_for_deployment_postprocessing ⇒ String
Whether or not this should only be processed before deployment.
Attributes inherited from AbstractObject
Attributes collapse
-
#files ⇒ ObjectList<PBXBuildFile>
The files processed by this build configuration.
Helpers collapse
-
#add_file_reference(file_ref, avoid_duplicates = false) ⇒ PBXBuildFile
Adds a new build file, initialized with the given file reference, to the phase.
- #ascii_plist_annotation ⇒ Object
-
#build_file(file_ref) ⇒ PBXBuildFile
The first build file associated with the given file reference if one exists.
-
#clear ⇒ void
(also: #clear_build_files)
Removes all the build files from the phase and clears their relationship to the file reference.
- #display_name ⇒ Object
-
#file_display_names ⇒ Array<String>
The display name of the build files.
-
#files_references ⇒ Array<PBXFileReference>
The list of all the files referenced by this build phase.
-
#include?(file_ref) ⇒ Bool
Returns whether a build file for the given file reference exists.
-
#remove_build_file(build_file) ⇒ void
Removes a build file from the phase and clears its relationship to the file reference.
-
#remove_file_reference(file_ref) ⇒ void
Removes the build file associated with the given file reference from the phase.
Methods inherited from AbstractObject
#<=>, #==, #inspect, isa, #nested_object_for_hash, #pretty_print, #remove_from_project, #sort, #sort_recursively, #to_ascii_plist, #to_hash
Instance Attribute Details
#build_action_mask ⇒ String
Returns some kind of magic number which usually is ‘2147483647’ (can be also ‘8` and `12` in PBXCopyFilesBuildPhase, one of the masks is run_only_for_deployment_postprocessing).
21 |
# File 'lib/xcodeproj/project/object/build_phase.rb', line 21 attribute :build_action_mask, String, '2147483647' |
#comments ⇒ String
This is apparently no longer used by Xcode.
Returns Comments associated with this build phase.
37 |
# File 'lib/xcodeproj/project/object/build_phase.rb', line 37 attribute :comments, String |
#run_only_for_deployment_postprocessing ⇒ String
This option is exposed in Xcode in the UI of PBXCopyFilesBuildPhase as ‘Copy only when installing` or in PBXShellScriptBuildPhase as `Run script only when installing`.
Returns whether or not this should only be processed before deployment. Can be either ‘0’, or ‘1’.
31 |
# File 'lib/xcodeproj/project/object/build_phase.rb', line 31 attribute :run_only_for_deployment_postprocessing, String, '0' |
Instance Method Details
#add_file_reference(file_ref, avoid_duplicates = false) ⇒ PBXBuildFile
Adds a new build file, initialized with the given file reference, to the phase.
83 84 85 86 87 88 89 90 91 92 |
# File 'lib/xcodeproj/project/object/build_phase.rb', line 83 def add_file_reference(file_ref, avoid_duplicates = false) if avoid_duplicates && existing = build_file(file_ref) existing else build_file = project.new(PBXBuildFile) build_file.file_ref = file_ref files << build_file build_file end end |
#ascii_plist_annotation ⇒ Object
135 136 137 |
# File 'lib/xcodeproj/project/object/build_phase.rb', line 135 def ascii_plist_annotation " #{display_name} " end |
#build_file(file_ref) ⇒ PBXBuildFile
Returns the first build file associated with the given file reference if one exists.
61 62 63 |
# File 'lib/xcodeproj/project/object/build_phase.rb', line 61 def build_file(file_ref) (file_ref.referrers & files).first end |
#clear ⇒ void Also known as: clear_build_files
This method returns an undefined value.
Removes all the build files from the phase and clears their relationship to the file reference.
124 125 126 127 128 |
# File 'lib/xcodeproj/project/object/build_phase.rb', line 124 def clear files.objects.each do |bf| remove_build_file(bf) end end |
#display_name ⇒ Object
131 132 133 |
# File 'lib/xcodeproj/project/object/build_phase.rb', line 131 def display_name super.gsub(/BuildPhase$/, '') end |
#file_display_names ⇒ Array<String>
Returns The display name of the build files.
54 55 56 |
# File 'lib/xcodeproj/project/object/build_phase.rb', line 54 def file_display_names files.map(&:display_name) end |
#files ⇒ ObjectList<PBXBuildFile>
Returns the files processed by this build configuration.
14 |
# File 'lib/xcodeproj/project/object/build_phase.rb', line 14 has_many :files, PBXBuildFile |
#files_references ⇒ Array<PBXFileReference>
Returns the list of all the files referenced by this build phase.
48 49 50 |
# File 'lib/xcodeproj/project/object/build_phase.rb', line 48 def files_references files.map(&:file_ref) end |
#include?(file_ref) ⇒ Bool
Returns whether a build file for the given file reference exists.
71 72 73 |
# File 'lib/xcodeproj/project/object/build_phase.rb', line 71 def include?(file_ref) !build_file(file_ref).nil? end |
#remove_build_file(build_file) ⇒ void
This method returns an undefined value.
Removes a build file from the phase and clears its relationship to the file reference.
114 115 116 117 |
# File 'lib/xcodeproj/project/object/build_phase.rb', line 114 def remove_build_file(build_file) build_file.file_ref = nil build_file.remove_from_project end |
#remove_file_reference(file_ref) ⇒ void
This method returns an undefined value.
Removes the build file associated with the given file reference from the phase.
102 103 104 105 |
# File 'lib/xcodeproj/project/object/build_phase.rb', line 102 def remove_file_reference(file_ref) build_file = files.find { |bf| bf.file_ref == file_ref } remove_build_file(build_file) if build_file end |