Class: Pod::Installer::PodSourceInstaller

Inherits:
Object
  • Object
show all
Defined in:
lib/cocoapods-binary-matchup/Integration.rb

Instance Method Summary collapse

Instance Method Details

#install_for_prebuild!(standard_sanbox) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/cocoapods-binary-matchup/Integration.rb', line 25

def install_for_prebuild!(standard_sanbox)
    return if standard_sanbox.local? self.name
    UI.puts "install_for_prebuild! start: #{self.name}"
    
    # 获取pod版本信息
    prebuild_sandbox = Pod::PrebuildSandbox.from_standard_sandbox(standard_sanbox)

    target_folder = standard_sanbox.pod_dir(self.name)
    target_folder.rmtree if target_folder.exist?
    
    real_file_folder = prebuild_sandbox.framework_folder_path_for_pod_name(self.name)
    
    if real_file_folder.exist?
        # 拷贝到pods目录
        FileUtils.cp_r(real_file_folder, target_folder, :remove_destination => true)
        UI.puts "📦 Copied prebuilt files for #{self.name}: #{real_file_folder} -> #{target_folder}"
        
        # 3. 同时保存到缓存(如果缓存不存在)
        Pod::PrebuildCache::Cache.save_to_cache(self.name, target_folder.to_s)
    else
        UI.puts "⚠️  Warning: Prebuilt files not found for #{self.name} at #{real_file_folder}"
        # 如果预构建文件不存在,创建空目录避免错误
        target_folder.mkpath
    end
end