Class: Xcodeproj::Project::Object::PBXCopyFilesBuildPhase

Inherits:
AbstractBuildPhase show all
Defined in:
lib/xcodeproj/project/object/build_phase.rb

Overview

Note:

This phase can appear multiple times in a target.

Phase that copies the files to the bundle of the target (aka ‘Copy Files`).

Attributes collapse

Attributes inherited from AbstractBuildPhase

#always_out_of_date, #build_action_mask, #comments, #run_only_for_deployment_postprocessing

Attributes inherited from AbstractObject

#isa, #project, #uuid

Attributes collapse

Methods inherited from AbstractBuildPhase

#add_file_reference, #ascii_plist_annotation, #build_file, #clear, #display_name, #file_display_names, #files, #files_references, #include?, #remove_build_file, #remove_file_reference, #sort

Methods inherited from AbstractObject

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

Instance Attribute Details

#dst_pathString

Note:

Can accept environment variables like ‘$(PRODUCT_NAME)`.

Returns the subpath of ‘dst_subfolder_spec` where this file should be copied to.

Returns:

  • (String)

    the subpath of ‘dst_subfolder_spec` where this file should be copied to.



231
# File 'lib/xcodeproj/project/object/build_phase.rb', line 231

attribute :dst_path, String, ''

#dst_subfolder_specString

Returns the path (destination) where the files should be copied to.

Returns:

  • (String)

    the path (destination) where the files should be copied to.



236
# File 'lib/xcodeproj/project/object/build_phase.rb', line 236

attribute :dst_subfolder_spec, String, Constants::COPY_FILES_BUILD_PHASE_DESTINATIONS[:resources]

#nameString

Returns the name of the build phase.

Returns:

  • (String)

    the name of the build phase.



224
# File 'lib/xcodeproj/project/object/build_phase.rb', line 224

attribute :name, String

Instance Method Details

#pretty_printHash{String => Hash}

Returns A hash suitable to display the build phase to the user.

Returns:

  • (Hash{String => Hash})

    A hash suitable to display the build phase to the user.



241
242
243
244
245
246
247
248
249
# File 'lib/xcodeproj/project/object/build_phase.rb', line 241

def pretty_print
  {
    display_name => {
      'Destination Path' => dst_path,
      'Destination Subfolder' => Constants::COPY_FILES_BUILD_PHASE_DESTINATIONS.key(dst_subfolder_spec).to_s,
      'Files' => files.map(&:pretty_print),
    },
  }
end

#symbol_dst_subfolder_specSymbol

Alias method for #dst_subfolder_spec, which returns symbol values instead of numeric string values.

Returns:

  • (Symbol)


271
272
273
274
# File 'lib/xcodeproj/project/object/build_phase.rb', line 271

def symbol_dst_subfolder_spec
  key = Constants::COPY_FILES_BUILD_PHASE_DESTINATIONS.find { |_, num| num == dst_subfolder_spec }
  key ? key.first : nil
end

#symbol_dst_subfolder_spec=(value) ⇒ Object

Alias method for #dst_subfolder_spec=, which accepts symbol values instead of numeric string values.

Parameters:

  • value (Symbol)

    one of ‘COPY_FILES_BUILD_PHASE_DESTINATIONS.keys`

Raises:

  • (StandardError)

    if value is not a valid known key



259
260
261
262
263
264
# File 'lib/xcodeproj/project/object/build_phase.rb', line 259

def symbol_dst_subfolder_spec=(value)
  numeric_value = Constants::COPY_FILES_BUILD_PHASE_DESTINATIONS[value]
  raise "[Xcodeproj] Value checking error: got `#{value.inspect}` for" \
      ' attribute: dst_subfolder_spec' if numeric_value.nil?
  self.dst_subfolder_spec = numeric_value
end