lib/cocoapods-ppbuild/Prebuild.rb in cocoapods-ppbuild-0.0.2 vs lib/cocoapods-ppbuild/Prebuild.rb in cocoapods-ppbuild-0.0.3
- old
+ new
@@ -133,26 +133,29 @@
if Pod::VERSION.start_with? "1.5"
target.resource_paths
else
# resource_paths is Hash{String=>Array<String>} on 1.6 and above
# (use AFNetworking to generate a demo data)
+ # https://github.com/leavez/cocoapods-binary/issues/50
target.resource_paths.values.flatten
end
end
raise "Wrong type: #{resources}" unless resources.kind_of? Array
-
- path_objects = resources.flat_map do |path|
- real_path = framework_path + File.basename(path)
+ path_objects = resources.map do |path|
+ object = Prebuild::Passer::ResourcePath.new
+ object.real_file_path = framework_path + File.basename(path)
# 静态库资源目录处理
if use_static_framework
- real_bundle_path = sandbox.real_bundle_path_for_pod(path)
- if File.exists?(real_bundle_path)
- FileUtils.cp_r(real_bundle_path, framework_path, :remove_destination => true)
+ object.real_file_path = path.gsub('${PODS_ROOT}', existed_framework_folder.to_s) if path.start_with? '${PODS_ROOT}'
+ object.real_file_path = path.gsub("${PODS_CONFIGURATION_BUILD_DIR}", existed_framework_folder.to_s) if path.start_with? "${PODS_CONFIGURATION_BUILD_DIR}"
+ real_bundle_path = path.gsub('${PODS_ROOT}', sandbox_path.to_s) if path.start_with? '${PODS_ROOT}'
+ real_bundle_path = path.gsub('${PODS_CONFIGURATION_BUILD_DIR}', sandbox_path.to_s) if path.start_with? '${PODS_CONFIGURATION_BUILD_DIR}'
+ real_origin_path = Pathname.new(real_bundle_path)
+ if real_origin_path.exist?
+ temp_path = Pathname.new(object.real_file_path)
+ temp_path.parent.mkpath unless temp_path.parent.exist?
+ FileUtils.cp_r(real_origin_path, temp_path, :remove_destination => true)
end
- end
- object = Prebuild::Passer::ResourcePath.new
- if File.exists?(real_path)
- object.real_file_path = real_path
end
object.target_file_path = path.gsub('${PODS_ROOT}', standard_sandbox_path.to_s) if path.start_with? '${PODS_ROOT}'
object.target_file_path = path.gsub("${PODS_CONFIGURATION_BUILD_DIR}", standard_sandbox_path.to_s) if path.start_with? "${PODS_CONFIGURATION_BUILD_DIR}"
object
end
\ No newline at end of file