Method: Pod::PodUtil#fix_bundle_file

Defined in:
lib/cocoapods-xcframework/util/pod_util.rb

#fix_bundle_file(origin_spec, spec_hash, project_dir, xcframework_path) ⇒ Object

脚本不会针对podspec中配置resources、resource_bundles动态生成bundle,故手动进行bundle路径修复



310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
# File 'lib/cocoapods-xcframework/util/pod_util.rb', line 310

def fix_bundle_file(origin_spec, spec_hash, project_dir, xcframework_path)
  puts "fix_bundle_file".yellow
  origin_spec_hash = origin_spec.to_hash
  res_bundle=origin_spec_hash["resource_bundles"]
  if res_bundle
    puts "二进制库不支持动态生成bundle文件,请手动存放bundle文件 参照:s.resources = 'xx.bundle' ".red
    raise "#{res_bundle}"
  end
  res_bundle=origin_spec_hash["resources"]
  if res_bundle
    puts "s.resources:#{res_bundle}"
    bundle_path="#{project_dir}/#{res_bundle}"
    FileUtils.cp_r(bundle_path,xcframework_path)
    xcframework_comp = File.basename(xcframework_path)
    bundle_comp = File.basename(res_bundle)
    spec_hash["resources"] = "#{xcframework_comp}/#{bundle_comp}" # bundle资源存放规则,xcframework根目录
  end
  puts spec_hash.to_json
  spec_hash
end