Class: Pod::Installer::Xcode::PodsProjectGenerator
- Inherits:
-
Object
- Object
- Pod::Installer::Xcode::PodsProjectGenerator
- Defined in:
- lib/cocoapods/installer/xcode/pods_project_generator.rb,
lib/cocoapods/installer/xcode/pods_project_generator/target_installer.rb,
lib/cocoapods/installer/xcode/pods_project_generator/app_host_installer.rb,
lib/cocoapods/installer/xcode/pods_project_generator/pod_target_installer.rb,
lib/cocoapods/installer/xcode/pods_project_generator/pod_target_integrator.rb,
lib/cocoapods/installer/xcode/pods_project_generator/target_installer_helper.rb,
lib/cocoapods/installer/xcode/pods_project_generator/file_references_installer.rb,
lib/cocoapods/installer/xcode/pods_project_generator/aggregate_target_installer.rb,
lib/cocoapods/installer/xcode/pods_project_generator/target_installation_result.rb
Overview
The PodsProjectGenerator handles generation of the ‘Pods/Pods.xcodeproj’
Defined Under Namespace
Modules: TargetInstallerHelper Classes: AggregateTargetInstaller, AppHostInstaller, AppHostKey, FileReferencesInstaller, InstallationResults, PodTargetInstaller, PodTargetIntegrator, TargetInstallationResult, TargetInstaller
Instance Attribute Summary collapse
-
#aggregate_targets ⇒ Array<AggregateTarget>
readonly
The model representations of an aggregation of pod targets generated for a target definition in the Podfile.
-
#analysis_result ⇒ Analyzer
readonly
The analyzer which provides the information about what needs to be installed.
-
#config ⇒ Config
readonly
The global CocoaPods configuration.
-
#installation_options ⇒ InstallationOptions
readonly
The installation options from the Podfile.
-
#pod_targets ⇒ Array<PodTarget>
readonly
The model representations of pod targets.
-
#project ⇒ Pod::Project
readonly
The ‘Pods/Pods.xcodeproj` project.
-
#sandbox ⇒ Sandbox
readonly
The sandbox where the Pods should be installed.
Instance Method Summary collapse
- #generate! ⇒ Object
-
#initialize(sandbox, aggregate_targets, pod_targets, analysis_result, installation_options, config) ⇒ PodsProjectGenerator
constructor
Initialize a new instance.
-
#share_development_pod_schemes ⇒ void
Shares schemes of development Pods.
- #write ⇒ Object
Constructor Details
#initialize(sandbox, aggregate_targets, pod_targets, analysis_result, installation_options, config) ⇒ PodsProjectGenerator
Initialize a new instance
56 57 58 59 60 61 62 63 |
# File 'lib/cocoapods/installer/xcode/pods_project_generator.rb', line 56 def initialize(sandbox, aggregate_targets, pod_targets, analysis_result, , config) @sandbox = sandbox @aggregate_targets = aggregate_targets @pod_targets = pod_targets @analysis_result = analysis_result @installation_options = @config = config end |
Instance Attribute Details
#aggregate_targets ⇒ Array<AggregateTarget> (readonly)
Returns The model representations of an aggregation of pod targets generated for a target definition in the Podfile.
28 29 30 |
# File 'lib/cocoapods/installer/xcode/pods_project_generator.rb', line 28 def aggregate_targets @aggregate_targets end |
#analysis_result ⇒ Analyzer (readonly)
Returns the analyzer which provides the information about what needs to be installed.
37 38 39 |
# File 'lib/cocoapods/installer/xcode/pods_project_generator.rb', line 37 def analysis_result @analysis_result end |
#config ⇒ Config (readonly)
Returns the global CocoaPods configuration.
45 46 47 |
# File 'lib/cocoapods/installer/xcode/pods_project_generator.rb', line 45 def config @config end |
#installation_options ⇒ InstallationOptions (readonly)
Returns the installation options from the Podfile.
41 42 43 |
# File 'lib/cocoapods/installer/xcode/pods_project_generator.rb', line 41 def @installation_options end |
#pod_targets ⇒ Array<PodTarget> (readonly)
Returns The model representations of pod targets.
32 33 34 |
# File 'lib/cocoapods/installer/xcode/pods_project_generator.rb', line 32 def pod_targets @pod_targets end |
#project ⇒ Pod::Project (readonly)
Returns the ‘Pods/Pods.xcodeproj` project.
22 23 24 |
# File 'lib/cocoapods/installer/xcode/pods_project_generator.rb', line 22 def project @project end |
#sandbox ⇒ Sandbox (readonly)
Returns The sandbox where the Pods should be installed.
18 19 20 |
# File 'lib/cocoapods/installer/xcode/pods_project_generator.rb', line 18 def sandbox @sandbox end |
Instance Method Details
#generate! ⇒ Object
65 66 67 68 69 70 71 72 73 |
# File 'lib/cocoapods/installer/xcode/pods_project_generator.rb', line 65 def generate! prepare install_file_references @target_installation_results = install_targets integrate_targets(@target_installation_results.pod_target_installation_results) app_hosts_by_host_key = install_app_hosts wire_target_dependencies(@target_installation_results, app_hosts_by_host_key) @target_installation_results end |
#share_development_pod_schemes ⇒ void
This method returns an undefined value.
Shares schemes of development Pods.
106 107 108 109 110 111 112 113 114 115 116 |
# File 'lib/cocoapods/installer/xcode/pods_project_generator.rb', line 106 def share_development_pod_schemes development_pod_targets.select(&:should_build?).each do |pod_target| next unless share_scheme_for_development_pod?(pod_target.pod_name) Xcodeproj::XCScheme.share_scheme(project.path, pod_target.label) if pod_target.contains_test_specifications? pod_target.supported_test_types.each do |test_type| Xcodeproj::XCScheme.share_scheme(project.path, pod_target.test_target_label(test_type)) end end end end |
#write ⇒ Object
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/cocoapods/installer/xcode/pods_project_generator.rb', line 75 def write UI. "- Writing Xcode project file to #{UI.path sandbox.project_path}" do project.pods.remove_from_project if project.pods.empty? project.development_pods.remove_from_project if project.development_pods.empty? project.sort(:groups_position => :below) if .deterministic_uuids? UI.('- Generating deterministic UUIDs') { project.predictabilize_uuids } end library_product_types = [:framework, :dynamic_library, :static_library] pod_target_installation_results = @target_installation_results.pod_target_installation_results results_by_native_target = Hash[pod_target_installation_results.map do |_, result| [result.native_target, result] end] project.recreate_user_schemes(false) do |scheme, target| next unless target.respond_to?(:symbol_type) next unless library_product_types.include? target.symbol_type installation_result = results_by_native_target[target] next unless installation_result installation_result.test_native_targets.each do |test_native_target| scheme.add_test_target(test_native_target) end end project.save end end |