diff --git a/lib/cocoapods-binary-cache/pod-binary/Prebuild.rb b/lib/cocoapods-binary-cache/pod-binary/Prebuild.rb index 479426c..bd7f68d 100644 --- a/lib/cocoapods-binary-cache/pod-binary/Prebuild.rb +++ b/lib/cocoapods-binary-cache/pod-binary/Prebuild.rb @@ -32,10 +32,19 @@ def prebuild_pods_changes @prebuild_pods_changes end - def should_not_prebuild(lib_name) - Pod::Podfile::DSL.unbuilt_pods.include?(lib_name) || - Prebuild::CacheInfo.cache_hit_vendor_pods.include?(lib_name) || - Prebuild::CacheInfo.cache_hit_dev_pods_dic.include?(lib_name) + def blacklisted?(name) + Pod::Podfile::DSL.unbuilt_pods.include?(name) + end + + def cache_hit?(name) + Prebuild::CacheInfo.cache_hit_vendor_pods.include?(name) || + Prebuild::CacheInfo.cache_hit_dev_pods_dic.include?(name) + end + + def should_not_prebuild_vendor_pod(name) + return true if blacklisted?(name) + return false if Pod::Podfile::DSL.prebuild_all_vendor_pods + cache_hit?(name) end public @@ -71,7 +80,7 @@ def have_exact_prebuild_cache? if Pod::Podfile::DSL.enable_prebuild_dev_pod && Pod::Podfile::DSL.is_prebuild_job needed += Pod::Prebuild::CacheInfo.cache_miss_dev_pods_dic.keys end - needed = needed.reject { |name| should_not_prebuild(name) } + needed = needed.reject { |name| blacklisted?(name) || cache_hit?(name) } UI.puts "Need to rebuild: #{needed.count} #{needed}" return needed.empty? end @@ -95,7 +104,10 @@ def prebuild_frameworks! bitcode_enabled = Pod::Podfile::DSL.bitcode_enabled targets = [] - if local_manifest != nil + if Pod::Podfile::DSL.prebuild_all_vendor_pods + UI.puts "Rebuild all vendor frameworks" + targets = self.pod_targets + elsif local_manifest != nil UI.puts "Update some frameworks" changes = prebuild_pods_changes added = changes.added @@ -133,7 +145,8 @@ def prebuild_frameworks! UI.puts "Rebuild all frameworks" targets = self.pod_targets end - targets = targets.reject { |pod_target| should_not_prebuild(pod_target.name) } + + targets = targets.reject { |pod_target| should_not_prebuild_vendor_pod(pod_target.name) } if !Podfile::DSL.enable_prebuild_dev_pod targets = targets.reject {|pod_target| sandbox.local?(pod_target.pod_name) } end diff --git a/lib/cocoapods-binary-cache/pod-binary/prebuild_dsl.rb b/lib/cocoapods-binary-cache/pod-binary/prebuild_dsl.rb index 71f5a8d..16621cc 100644 --- a/lib/cocoapods-binary-cache/pod-binary/prebuild_dsl.rb +++ b/lib/cocoapods-binary-cache/pod-binary/prebuild_dsl.rb @@ -54,6 +54,10 @@ def set_custom_xcodebuild_options_for_prebuilt_frameworks(options) end end + def prebuild_all_vendor_pods! + DSL.prebuild_all_vendor_pods = true + end + def enable_devpod_prebuild DSL.enable_prebuild_dev_pod = true end @@ -104,6 +108,9 @@ def self.set_ignore_checksum_files(file_names) private + class_attr_accessor :prebuild_all_vendor_pods + self.prebuild_all_vendor_pods = false + class_attr_accessor :enable_prebuild_dev_pod self.enable_prebuild_dev_pod = false diff --git a/lib/cocoapods-binary-cache/pod-binary/prebuild_hook.rb b/lib/cocoapods-binary-cache/pod-binary/prebuild_hook.rb index a96b37e..79261a6 100644 --- a/lib/cocoapods-binary-cache/pod-binary/prebuild_hook.rb +++ b/lib/cocoapods-binary-cache/pod-binary/prebuild_hook.rb @@ -114,16 +114,24 @@ end binary_installer.clean_delta_file - if (binary_installer.have_exact_prebuild_cache? && !update) # If not in prebuild job, we never rebuild and just use cache - Pod::UI.puts "cache hit" - binary_installer.install_when_cache_hit! - else - Pod::UI.puts "cache miss -> need to update" + + installer_exec = lambda do binary_installer.update = update binary_installer.repo_update = repo_update binary_installer.install! end + if Pod::Podfile::DSL.prebuild_all_vendor_pods + Pod::UI.puts "Prebuild all vendor pods" + installer_exec.call + elsif (binary_installer.have_exact_prebuild_cache? && !update) # If not in prebuild job, we never rebuild and just use cache + Pod::UI.puts "Cache hit" + binary_installer.install_when_cache_hit! + else + Pod::UI.puts "Cache miss -> need to update" + installer_exec.call + end + # reset the environment Pod.is_prebuild_stage = false Pod::Installer.force_disable_integration false