Class: Pod::Installer
- Inherits:
-
Object
show all
- Defined in:
- lib/cocoapods-mtxx-bin/native/analyzer.rb,
lib/cocoapods-mtxx-bin/native/installer.rb,
lib/cocoapods-mtxx-bin/native/sandbox_analyzer.rb,
lib/cocoapods-mtxx-bin/native/target_validator.rb,
lib/cocoapods-mtxx-bin/native/installation_options.rb,
lib/cocoapods-mtxx-bin/native/pod_source_installer.rb,
lib/cocoapods-mtxx-bin/native/pod_target_installer.rb
Defined Under Namespace
Classes: Analyzer, InstallationOptions, PodSourceInstaller, Xcode
Instance Method Summary
collapse
Instance Method Details
#cost_time_hash ⇒ Object
19
20
21
22
23
|
# File 'lib/cocoapods-mtxx-bin/native/installer.rb', line 19
def cost_time_hash
@cost_time_hash ||= begin
Hash.new
end
end
|
#create_analyzer(plugin_sources = nil) ⇒ Object
11
12
13
14
15
16
17
|
# File 'lib/cocoapods-mtxx-bin/native/installer.rb', line 11
def create_analyzer(plugin_sources = nil)
if !lockfile.nil? && lockfile.internal_data.empty?
@lockfile = Lockfile.from_file(config.lockfile_path) if config.lockfile_path
end
mtxx_create_analyzer(plugin_sources)
end
|
#create_pod_installer(pod_name) ⇒ Object
113
114
115
116
117
|
# File 'lib/cocoapods-mtxx-bin/native/installer.rb', line 113
def create_pod_installer(pod_name)
installer = old_create_pod_installer(pod_name)
installer.installation_options = installation_options
installer
end
|
#download_dependencies ⇒ Object
45
46
47
48
49
|
# File 'lib/cocoapods-mtxx-bin/native/installer.rb', line 45
def download_dependencies
start_time = Time.now
old_download_dependencies
cost_time_hash['download_dependencies'] = Time.now - start_time
end
|
#install_pod_sources ⇒ Object
120
121
122
123
124
125
126
|
# File 'lib/cocoapods-mtxx-bin/native/installer.rb', line 120
def install_pod_sources
if installation_options.install_with_multi_threads
install_pod_sources_with_multiple_threads
else
old_install_pod_sources
end
end
|
#install_pod_sources_with_multiple_threads ⇒ Object
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
|
# File 'lib/cocoapods-mtxx-bin/native/installer.rb', line 129
def install_pod_sources_with_multiple_threads
@installed_specs = []
pods_to_install = sandbox_state.added | sandbox_state.changed
title_options = { :verbose_prefix => '-> '.green }
thread_count = installation_options.multi_threads_count
Parallel.each(root_specs.sort_by(&:name), in_threads: thread_count) do |spec|
if pods_to_install.include?(spec.name)
if sandbox_state.changed.include?(spec.name) && sandbox.manifest
current_version = spec.version
previous_version = sandbox.manifest.version(spec.name)
has_changed_version = current_version != previous_version
current_repo = analysis_result.specs_by_source.detect { |key, values| break key if values.map(&:name).include?(spec.name) }
current_repo &&= (Pod::TrunkSource::TRUNK_REPO_NAME if current_repo.name == Pod::TrunkSource::TRUNK_REPO_NAME) || current_repo.url || current_repo.name
previous_spec_repo = sandbox.manifest.spec_repo(spec.name)
has_changed_repo = !previous_spec_repo.nil? && current_repo && !current_repo.casecmp(previous_spec_repo).zero?
title = "Installing #{spec.name} #{spec.version}"
title << " (was #{previous_version} and source changed to `#{current_repo}` from `#{previous_spec_repo}`)" if has_changed_version && has_changed_repo
title << " (was #{previous_version})" if has_changed_version && !has_changed_repo
title << " (source changed to `#{current_repo}` from `#{previous_spec_repo}`)" if !has_changed_version && has_changed_repo
else
title = "Installing #{spec}"
end
UI.titled_section(title.green, title_options) do
install_source_of_pod(spec.name)
end
else
UI.section("Using #{spec}", title_options[:verbose_prefix]) do
create_pod_installer(spec.name)
end
end
end
end
|
#integrate ⇒ Object
61
62
63
64
65
|
# File 'lib/cocoapods-mtxx-bin/native/installer.rb', line 61
def integrate
start_time = Time.now
old_integrate
cost_time_hash['integrate'] = Time.now - start_time
end
|
#mtxx_create_analyzer ⇒ Object
10
|
# File 'lib/cocoapods-mtxx-bin/native/installer.rb', line 10
alias mtxx_create_analyzer create_analyzer
|
#old_create_pod_installer ⇒ Object
112
|
# File 'lib/cocoapods-mtxx-bin/native/installer.rb', line 112
alias old_create_pod_installer create_pod_installer
|
#old_download_dependencies ⇒ Object
44
|
# File 'lib/cocoapods-mtxx-bin/native/installer.rb', line 44
alias old_download_dependencies download_dependencies
|
#old_install_pod_sources ⇒ Object
119
|
# File 'lib/cocoapods-mtxx-bin/native/installer.rb', line 119
alias old_install_pod_sources install_pod_sources
|
#old_integrate ⇒ Object
60
|
# File 'lib/cocoapods-mtxx-bin/native/installer.rb', line 60
alias old_integrate integrate
|
#old_perform_post_install_actions ⇒ Object
87
|
# File 'lib/cocoapods-mtxx-bin/native/installer.rb', line 87
alias old_perform_post_install_actions perform_post_install_actions
|
#old_prepare ⇒ Object
27
|
# File 'lib/cocoapods-mtxx-bin/native/installer.rb', line 27
alias old_prepare prepare
|
#old_resolve_dependencies ⇒ Object
35
|
# File 'lib/cocoapods-mtxx-bin/native/installer.rb', line 35
alias old_resolve_dependencies resolve_dependencies
|
#old_validate_targets ⇒ Object
52
|
# File 'lib/cocoapods-mtxx-bin/native/installer.rb', line 52
alias old_validate_targets validate_targets
|
#perform_post_install_actions ⇒ Object
88
89
90
91
92
93
94
95
96
|
# File 'lib/cocoapods-mtxx-bin/native/installer.rb', line 88
def perform_post_install_actions
start_time = Time.now
old_perform_post_install_actions
cost_time_hash['perform_post_install_actions'] = Time.now - start_time
print_cost_time
CBin::PodSize.print_pods
end
|
#prepare ⇒ Object
28
29
30
31
32
|
# File 'lib/cocoapods-mtxx-bin/native/installer.rb', line 28
def prepare
start_time = Time.now
old_prepare
cost_time_hash['prepare'] = Time.now - start_time
end
|
#print_cost_time ⇒ Object
99
100
101
102
103
104
105
106
107
108
109
110
|
# File 'lib/cocoapods-mtxx-bin/native/installer.rb', line 99
def print_cost_time
prefix = 'pod_time_profiler:'
UI.title "#{prefix} pod执行耗时:".green do
UI.info "#{prefix} ———————————————————————————————————————————————".green
UI.info "#{prefix} |#{'Stage'.center(30)}|#{'Time(s)'.center(15)}|".green
UI.info "#{prefix} ———————————————————————————————————————————————".green
cost_time_hash.each do |key, value|
UI.info "#{prefix} |#{key.center(30)}|#{('%.3f' % value).to_s.center(15)}|".green
end
UI.info "#{prefix} ———————————————————————————————————————————————".green
end
end
|
#resolve_dependencies ⇒ Object
36
37
38
39
40
41
|
# File 'lib/cocoapods-mtxx-bin/native/installer.rb', line 36
def resolve_dependencies
start_time = Time.now
analyzer = old_resolve_dependencies
cost_time_hash['resolve_dependencies'] = Time.now - start_time
analyzer
end
|
#validate_targets ⇒ Object
53
54
55
56
57
|
# File 'lib/cocoapods-mtxx-bin/native/installer.rb', line 53
def validate_targets
start_time = Time.now
old_validate_targets
cost_time_hash['validate_targets'] = Time.now - start_time
end
|
#write_lockfiles ⇒ Object
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
# File 'lib/cocoapods-mtxx-bin/native/installer.rb', line 68
def write_lockfiles
start_time = Time.now
@lockfile = generate_lockfile
UI.message "- Writing Lockfile in #{UI.path config.lockfile_path}" do
@lockfile.write_to_disk(config.lockfile_path)
end
UI.message "- Writing Manifest in #{UI.path sandbox.manifest_path}" do
@lockfile.write_to_disk(sandbox.manifest_path)
end
cost_time_hash['write_lockfiles'] = Time.now - start_time
end
|