Skip to content

Commit b1896f3

Browse files
fix(*): incorrect cocoapods cache
1 parent cb0e7d7 commit b1896f3

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

lib/cocoapods-binary-cache/pod-binary/integration/alter_specs.rb

+5
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@ module Pod
22
class Installer
33
def alter_specs_for_prebuilt_pods
44
cache = []
5+
6+
@original_specs = analysis_result.specifications
7+
.map { |spec| [spec.name, Pod::Specification.from_file(spec.defined_in_file)] }
8+
.to_h
9+
510
analysis_result.specifications
611
.select { |spec| should_integrate_prebuilt_pod?(spec.root.name) }
712
.group_by(&:root)

lib/cocoapods-binary-cache/pod-binary/integration/patch/source_installation.rb

+11-1
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,18 @@ def create_normal_source_installer(name)
1818
original_create_pod_installer(name)
1919
end
2020

21+
def original_specs_by_platform(name)
22+
specs_for_pod(name).map do |platform, specs|
23+
specs_ = specs.map { |spec| @original_specs[spec.name] }
24+
[platform, specs_]
25+
end.to_h
26+
end
27+
2128
def create_prebuilt_source_installer(name)
22-
source_installer = PodSourceInstaller.new(sandbox, podfile, specs_for_pod(name))
29+
# A source installer needs to install with the original spec (instead of the altered spec).
30+
# Otherwise, the cache will be corrupted because CocoaPods packs necessary dirs/files from temp dir
31+
# to the cache dir based on the spec.
32+
source_installer = PodSourceInstaller.new(sandbox, podfile, original_specs_by_platform(name))
2333
pod_installer = PrebuiltSourceInstaller.new(
2434
sandbox,
2535
podfile,

0 commit comments

Comments
 (0)