Skip to content

Commit 02383b2

Browse files
committed
Merge pull request #47 from hardworker/update_options_passing
Update behaviour fixing (issue #38)
1 parent 551d99c commit 02383b2

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

lib/cocoapods-binary/Main.rb

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,18 @@ def keep_source_code_for_prebuilt_frameworks!
6464

6565
Pod::UI.puts "🚀 Prebuild frameworks"
6666

67+
# Fetch original installer (which is running this pre-install hook) options,
68+
# then pass them to our installer to perform update if needed
69+
# Looks like this is the most appropriate way to figure out that something should be updated
70+
71+
update = nil
72+
repo_update = nil
73+
74+
include ObjectSpace
75+
ObjectSpace.each_object(Pod::Installer) { |installer|
76+
update = installer.update
77+
repo_update = installer.repo_update
78+
}
6779

6880
# control features
6981
Pod.is_prebuild_stage = true
@@ -83,11 +95,11 @@ def keep_source_code_for_prebuilt_frameworks!
8395
lockfile = installer_context.lockfile
8496
binary_installer = Pod::Installer.new(prebuild_sandbox, prebuild_podfile, lockfile)
8597

86-
if binary_installer.have_exact_prebuild_cache?
98+
if binary_installer.have_exact_prebuild_cache? && !update
8799
binary_installer.install_when_cache_hit!
88100
else
89-
binary_installer.repo_update = false
90-
binary_installer.update = false
101+
binary_installer.update = update
102+
binary_installer.repo_update = repo_update
91103
binary_installer.install!
92104
end
93105

0 commit comments

Comments
 (0)