Skip to content

Commit 79c3145

Browse files
Merge branch 'chris.thuyen/chore/exclude_deleted_when_check_cachehit' into 'master'
chore(*): exclude deleted frameworks when checking cachehit + fix cache miss fallback See merge request mobile/dax-ios/cocoapods-binary-cache!18
2 parents 39b2849 + ab630b5 commit 79c3145

File tree

5 files changed

+34
-8
lines changed

5 files changed

+34
-8
lines changed

.rubocop.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,4 @@ inherit_from:
44
AllCops:
55
Exclude:
66
- 'PodBinaryCacheExample/**/*'
7-
- 'lib/cocoapods-binary-cache/pod-binary/**/*'
87
- 'lib/cocoapods-binary-cache/pod-rome/**/*'

Gemfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,7 @@ end
1414
group :test do
1515
gem 'rspec'
1616
end
17+
18+
group :lint do
19+
gem 'rubocop'
20+
end

Gemfile.lock

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ GEM
1919
algoliasearch (1.27.1)
2020
httpclient (~> 2.8, >= 2.8.3)
2121
json (>= 1.5.1)
22+
ast (2.4.0)
2223
atomos (0.1.3)
2324
bacon (1.2.0)
2425
claide (1.0.3)
@@ -67,6 +68,7 @@ GEM
6768
httpclient (2.8.3)
6869
i18n (0.9.5)
6970
concurrent-ruby (~> 1.0)
71+
jaro_winkler (1.5.4)
7072
json (2.3.0)
7173
lazy_priority_queue (0.1.1)
7274
minitest (5.13.0)
@@ -77,9 +79,14 @@ GEM
7779
nanaimo (0.2.6)
7880
nap (1.1.0)
7981
netrc (0.11.0)
82+
parallel (1.19.1)
83+
parser (2.7.1.1)
84+
ast (~> 2.4.0)
8085
prettybacon (0.0.2)
8186
bacon (~> 1.2)
87+
rainbow (3.0.0)
8288
rake (10.5.0)
89+
rexml (3.2.4)
8390
rgl (0.5.6)
8491
lazy_priority_queue (~> 0.1.0)
8592
stream (~> 0.5.2)
@@ -97,11 +104,21 @@ GEM
97104
diff-lcs (>= 1.2.0, < 2.0)
98105
rspec-support (~> 3.9.0)
99106
rspec-support (3.9.2)
107+
rubocop (0.82.0)
108+
jaro_winkler (~> 1.5.1)
109+
parallel (~> 1.10)
110+
parser (>= 2.7.0.1)
111+
rainbow (>= 2.2.2, < 4.0)
112+
rexml
113+
ruby-progressbar (~> 1.7)
114+
unicode-display_width (>= 1.4.0, < 2.0)
100115
ruby-macho (1.4.0)
116+
ruby-progressbar (1.10.1)
101117
stream (0.5.2)
102118
thread_safe (0.3.6)
103119
tzinfo (1.2.5)
104120
thread_safe (~> 0.1)
121+
unicode-display_width (1.7.0)
105122
xcodeproj (1.13.0)
106123
CFPropertyList (>= 2.3.3, < 4.0)
107124
atomos (~> 0.1.3)
@@ -124,6 +141,7 @@ DEPENDENCIES
124141
prettybacon
125142
rake (~> 10.0)
126143
rspec
144+
rubocop
127145

128146
BUNDLED WITH
129147
1.17.3

lib/cocoapods-binary-cache/pod-binary/Prebuild.rb renamed to lib/cocoapods-binary-cache/pod-binary/prebuild.rb

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,7 @@ def prebuild_output
5656
@prebuild_output
5757
end
5858

59-
# check if need to prebuild
60-
def have_exact_prebuild_cache?
61-
# check if need build frameworks
59+
def cache_miss
6260
return false if local_manifest == nil
6361

6462
changes = prebuild_pods_changes
@@ -76,16 +74,15 @@ def have_exact_prebuild_cache?
7674
UI.puts "Changed frameworks: #{changed.to_a}"
7775
UI.puts "Deleted frameworks: #{deleted.to_a}"
7876
UI.puts "Missing frameworks: #{missing.to_a}"
79-
needed = (added + changed + deleted + missing)
77+
needed = (added + changed + missing)
8078
if Pod::Podfile::DSL.enable_prebuild_dev_pod && Pod::Podfile::DSL.is_prebuild_job
8179
needed += Pod::Prebuild::CacheInfo.cache_miss_dev_pods_dic.keys
8280
end
8381
needed = needed.reject { |name| blacklisted?(name) || cache_hit?(name) }
8482
UI.puts "Need to rebuild: #{needed.count} #{needed}"
85-
return needed.empty?
83+
return needed
8684
end
8785

88-
8986
# The install method when have completed cache
9087
def install_when_cache_hit!
9188
# just print log

lib/cocoapods-binary-cache/pod-binary/prebuild_hook.rb

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,18 @@
121121
binary_installer.install!
122122
end
123123

124+
# Currently, `binary_installer.cache_miss` depends on the output of `Pod::Podfile::DSL.unbuilt_pods`
125+
# -> indirectly depends on:
126+
# - `PodCacheValidator.verify_prebuilt_vendor_pods`
127+
# - `PodCacheValidator.verify_devpod_checksum`
128+
# TODO (thuyen): Simplify this logic
129+
cache_miss = binary_installer.cache_miss
130+
Pod::Podfile::DSL.add_unbuilt_pods(cache_miss)
131+
124132
if Pod::Podfile::DSL.prebuild_all_vendor_pods
125133
Pod::UI.puts "Prebuild all vendor pods"
126134
installer_exec.call
127-
elsif (binary_installer.have_exact_prebuild_cache? && !update) # If not in prebuild job, we never rebuild and just use cache
135+
elsif !update && cache_miss.empty? # If not in prebuild job, we never rebuild and just use cache
128136
Pod::UI.puts "Cache hit"
129137
binary_installer.install_when_cache_hit!
130138
else

0 commit comments

Comments
 (0)