Skip to content

Commit c0dfbb1

Browse files
authored
Merge pull request leavez#45 from leavez/fix#29
Fix leavez#29
2 parents ef8c551 + 537e855 commit c0dfbb1

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

lib/cocoapods-binary/Integration.rb

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,19 @@ def empty_source_files(spec)
199199
# platform and not for another platform.'
200200
empty_source_files(spec)
201201

202+
# to remove the resurce bundle target.
203+
# When specify the "resource_bundles" in podspec, xcode will generate a bundle
204+
# target after pod install. But the bundle have already built when the prebuit
205+
# phase and saved in the framework folder. We will treat it as a normal resource
206+
# file.
207+
# https://github.com/leavez/cocoapods-binary/issues/29
208+
if spec.attributes_hash["resource_bundles"]
209+
bundle_names = spec.attributes_hash["resource_bundles"].keys
210+
spec.attributes_hash["resource_bundles"] = nil
211+
spec.attributes_hash["resources"] ||= []
212+
spec.attributes_hash["resources"] += bundle_names.map{|n| n+".bundle"}
213+
end
214+
202215
# to avoid the warning of missing license
203216
spec.attributes_hash["license"] = {}
204217
end

lib/cocoapods-binary/Prebuild.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,11 @@ def prebuild_frameworks!
121121
if target.static_framework? and !target.resource_paths.empty?
122122
framework_path = output_path + target.framework_name
123123
standard_sandbox_path = sandbox.standard_sanbox_path
124-
path_objects = target.resource_paths.select{|f| f.start_with? "${PODS_ROOT}"}.map do |path|
124+
path_objects = target.resource_paths.map do |path|
125125
object = Prebuild::Passer::ResourcePath.new
126126
object.real_file_path = framework_path + File.basename(path)
127-
object.target_file_path = path.gsub('${PODS_ROOT}', standard_sandbox_path.to_s)
127+
object.target_file_path = path.gsub('${PODS_ROOT}', standard_sandbox_path.to_s) if path.start_with? '${PODS_ROOT}'
128+
object.target_file_path = path.gsub("${PODS_CONFIGURATION_BUILD_DIR}", standard_sandbox_path.to_s) if path.start_with? "${PODS_CONFIGURATION_BUILD_DIR}"
128129
object
129130
end
130131
Prebuild::Passer.resources_to_copy_for_static_framework[target.name] = path_objects

0 commit comments

Comments
 (0)