Method: Pod::PodTarget#resource_paths

Defined in:
lib/cocoapods/target/pod_target.rb

#resource_pathsHash{String=>Array<String>}

Returns The resource and resource bundle paths this target depends upon keyed by spec name. Resource (not resource bundles) paths can vary depending on the type of spec:

- App specs _always_ get their resource paths added to "Copy Bundle Resources" phase from
  [PodTargetInstaller] therefore their resource paths are never included here.
- Test specs may have their resource paths added to "Copy Bundle Resources" if the target itself is
  built as a framework, which is again checked and handled by PodTargetInstaller. If that is true then
  the resource paths are not included, otherwise they are included and handled via the CocoaPods copy
  resources script phase.
- Library specs _do not_ have per-configuration CocoaPods copy resources script phase and their resource
  paths will be added to "Copy Bundle Resources" phase if the target is built as a framework because
  it supports it. We always include the resource paths for library specs because they are also
  integrated to the user target.

Returns:

  • (Hash{String=>Array<String>})

    The resource and resource bundle paths this target depends upon keyed by spec name. Resource (not resource bundles) paths can vary depending on the type of spec:

    - App specs _always_ get their resource paths added to "Copy Bundle Resources" phase from
      [PodTargetInstaller] therefore their resource paths are never included here.
    - Test specs may have their resource paths added to "Copy Bundle Resources" if the target itself is
      built as a framework, which is again checked and handled by PodTargetInstaller. If that is true then
      the resource paths are not included, otherwise they are included and handled via the CocoaPods copy
      resources script phase.
    - Library specs _do not_ have per-configuration CocoaPods copy resources script phase and their resource
      paths will be added to "Copy Bundle Resources" phase if the target is built as a framework because
      it supports it. We always include the resource paths for library specs because they are also
      integrated to the user target.
    


466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
# File 'lib/cocoapods/target/pod_target.rb', line 466

def resource_paths
  @resource_paths ||= begin
    file_accessors.each_with_object({}) do |file_accessor, hash|
      resource_paths = if file_accessor.spec.app_specification? || (file_accessor.spec.test_specification? && build_as_framework?)
                         []
                       else
                         file_accessor.resources.map do |res|
                           "${PODS_ROOT}/#{res.relative_path_from(sandbox.project_path.dirname)}"
                         end
                       end
      prefix = Pod::Target::BuildSettings::CONFIGURATION_BUILD_DIR_VARIABLE
      prefix = configuration_build_dir unless file_accessor.spec.test_specification?
      resource_bundle_paths = file_accessor.resource_bundles.keys.map { |name| "#{prefix}/#{name.shellescape}.bundle" }
      hash[file_accessor.spec.name] = (resource_paths + resource_bundle_paths).map(&:to_s)
    end
  end
end