Class: Pod::Installer::UserProjectIntegrator::TargetIntegrator

Inherits:
Object
  • Object
show all
Defined in:
lib/cocoapods/installer/user_project_integrator/target_integrator.rb,
lib/cocoapods/installer/user_project_integrator/target_integrator/xcconfig_integrator.rb

Overview

This class is responsible for integrating the library generated by a TargetDefinition with its destination project.

Defined Under Namespace

Classes: XCConfigIntegrator

Constant Summary collapse

EMBED_FRAMEWORK_TARGET_TYPES =

frameworks are embedded in the output directory / product bundle.

Returns:

  • (Array<Symbol>)

    the symbol types, which require that the pod

[:application, :unit_test_bundle].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(target) ⇒ TargetIntegrator

Init a new TargetIntegrator

Parameters:



25
26
27
# File 'lib/cocoapods/installer/user_project_integrator/target_integrator.rb', line 25

def initialize(target)
  @target = target
end

Instance Attribute Details

#targetAggregateTarget (readonly)

Returns the target that should be integrated.

Returns:



19
20
21
# File 'lib/cocoapods/installer/user_project_integrator/target_integrator.rb', line 19

def target
  @target
end

Instance Method Details

#inspectString

Returns a string representation suitable for debugging.

Returns:

  • (String)

    a string representation suitable for debugging.



69
70
71
# File 'lib/cocoapods/installer/user_project_integrator/target_integrator.rb', line 69

def inspect
  "#<#{self.class} for target `#{target.label}'>"
end

#integrate!void

This method returns an undefined value.

Integrates the user project targets. Only the targets that do not already have the Pods library in their frameworks build phase are processed.



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/cocoapods/installer/user_project_integrator/target_integrator.rb', line 35

def integrate!
  UI.section(integration_message) do
    # TODO: refactor into Xcodeproj https://github.com/CocoaPods/Xcodeproj/issues/202
    project_is_dirty = [
      XCConfigIntegrator.integrate(target, native_targets),
      update_to_cocoapods_0_34,
      remove_embed_frameworks_script_phases,
      unless native_targets_to_integrate.empty?
        add_pods_library
        add_embed_frameworks_script_phase if target.requires_frameworks?
        add_copy_resources_script_phase
        add_check_manifest_lock_script_phase
        true
      end,
    ].any?

    if project_is_dirty
      user_project.save
    else
      # There is a bug in Xcode where the process of deleting and
      # re-creating the xcconfig files used in the build
      # configuration cause building the user project to fail until
      # Xcode is relaunched.
      #
      # Touching/saving the project causes Xcode to reload these.
      #
      # https://github.com/CocoaPods/CocoaPods/issues/2665
      FileUtils.touch(user_project.path + 'project.pbxproj')
    end
  end
end