Skip to content

Commit

Permalink
fix(*): incorrect cocoapods cache
Browse files Browse the repository at this point in the history
  • Loading branch information
trinhngocthuyen committed Mar 16, 2021
1 parent cb0e7d7 commit b1896f3
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ module Pod
class Installer
def alter_specs_for_prebuilt_pods
cache = []

@original_specs = analysis_result.specifications
.map { |spec| [spec.name, Pod::Specification.from_file(spec.defined_in_file)] }
.to_h

analysis_result.specifications
.select { |spec| should_integrate_prebuilt_pod?(spec.root.name) }
.group_by(&:root)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,18 @@ def create_normal_source_installer(name)
original_create_pod_installer(name)
end

def original_specs_by_platform(name)
specs_for_pod(name).map do |platform, specs|
specs_ = specs.map { |spec| @original_specs[spec.name] }
[platform, specs_]
end.to_h
end

def create_prebuilt_source_installer(name)
source_installer = PodSourceInstaller.new(sandbox, podfile, specs_for_pod(name))
# A source installer needs to install with the original spec (instead of the altered spec).
# Otherwise, the cache will be corrupted because CocoaPods packs necessary dirs/files from temp dir
# to the cache dir based on the spec.
source_installer = PodSourceInstaller.new(sandbox, podfile, original_specs_by_platform(name))
pod_installer = PrebuiltSourceInstaller.new(
sandbox,
podfile,
Expand Down

0 comments on commit b1896f3

Please sign in to comment.