MeetYouDevs / cocoapods-imy-bin

1.05k stars 244 forks source link

pod bin update时已制作成功的二进制组件库无法被替换 #136

Open y2kbug opened 3 years ago

y2kbug commented 3 years ago

我的podfile_local配置如下 ` plugin 'cocoapods-imy-bin' use_binaries!

需要替换Podfile里面的组件才写到这里

target 'Third-Binary-Demo' do platform :ios, '9.0' pod 'Masonry', '1.1.0' end `

通过调试发现在update.rb文件的131-136行代码

local_dependencies.each do |d|
UI.message "Development Pod #{d.to_yaml}"
if podfile.plugins.keys.include?('cocoapods-imy-bin')
    podfile.set_use_source_pods(d.keys.first) if (d.is_a?(Hash) && d.keys.first)
end
end

image 此处会将遍历出“Masonry”通过set方法写入到use_source_pod,导致use_source_pod返回数组不为空

最终导致在resolver.rb模块102-111代码

 specs_by_target.each do |target, rspecs|
          # use_binaries 并且 use_source_pods 不包含  本地可过滤
          use_binary_rspecs = if podfile.use_binaries? || podfile.use_binaries_selector
                                rspecs.select do |rspec|
                                  ([rspec.name, rspec.root.name] & use_source_pods).empty? &&
                                    (podfile.use_binaries_selector.nil? || podfile.use_binaries_selector.call(rspec.spec))
                                end
                              else
                                []
                              end

由于[rspec.name, rspec.root.name] & use_source_pods).empty? 将一直返回false, 根据podfile_local配置use_source_pods数组应该是为空的,调试时use_source_pods 有值导致[rspec.name, rspec.root.name] & use_source_pods).empty 并集不为空 specs_by_target迭代器中use_binary_rspecs数组 一直返回为空,导致二进制组件无法被替换

y2kbug commented 3 years ago
local_dependencies.each do |d|
UI.message "Development Pod #{d.to_yaml}"
if podfile.plugins.keys.include?('cocoapods-imy-bin')
    podfile.set_use_source_pods(d.keys.first) if (d.is_a?(Hash) && d.keys.first)
end
end

这里逻辑不清楚为何 不使用源码的库 也记录到use_source_pods中 @su350380433 @dabing1022 @iOSer-su350380433