Skip to content

Commit fb57492

Browse files
committed
fix #20 correctly
1 parent d0ed1ec commit fb57492

File tree

3 files changed

+23
-2
lines changed

3 files changed

+23
-2
lines changed

lib/cocoapods-binary/Integration.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,9 +154,11 @@ def remove_target_files_if_needed
154154
prebuilt_specs.each do |spec|
155155
# `spec` may be a subspec, so we use the root's name
156156
root_name = spec.root.name
157+
158+
target = name_to_target_hash[root_name]
159+
next if Prebuild::Passer.target_names_to_skip_integration_framework.include? target.pod_name
157160

158161
# use the prebuilt framework
159-
target = name_to_target_hash[root_name]
160162
original_vendored_frameworks = spec.attributes_hash["vendored_frameworks"] || []
161163
if original_vendored_frameworks.kind_of?(String)
162164
original_vendored_frameworks = [original_vendored_frameworks]

lib/cocoapods-binary/Prebuild.rb

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,14 +153,25 @@ def prebuild_frameworks!
153153
# copy vendored libraries and frameworks
154154
targets.each do |target|
155155
root_path = self.sandbox.pod_dir(target.name)
156+
target_folder = sandbox.framework_folder_path_for_pod_name(target.name)
157+
158+
# If target shouldn't build, we copy all the original files
159+
# This is for target with only .a and .h files
160+
if not target.should_build?
161+
Prebuild::Passer.target_names_to_skip_integration_framework ||= []
162+
Prebuild::Passer.target_names_to_skip_integration_framework << target.pod_name
163+
FileUtils.cp_r(root_path, target_folder, :remove_destination => true)
164+
next
165+
end
166+
156167
target.spec_consumers.each do |consumer|
157168
file_accessor = Sandbox::FileAccessor.new(root_path, consumer)
158169
lib_paths = file_accessor.vendored_frameworks || []
159170
lib_paths += file_accessor.vendored_libraries
160171
# @TODO dSYM files
161172
lib_paths.each do |lib_path|
162173
relative = lib_path.relative_path_from(root_path)
163-
destination = sandbox.framework_folder_path_for_pod_name(target.name) + relative
174+
destination = target_folder + relative
164175
destination.dirname.mkpath unless destination.dirname.exist?
165176
FileUtils.cp_r(lib_path, destination, :remove_destination => true)
166177
end

lib/cocoapods-binary/helper/passer.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,14 @@ class ResourcePath
2626
#
2727
# @return [Hash<String, [Passer::ResourcePath]>]
2828
class_attr_accessor :resources_to_copy_for_static_framework
29+
30+
# Some pod won't be build in prebuild stage even if it have `binary=>true`.
31+
# The targets of this pods have `should_build? == true`.
32+
# We should skip integration (patch spec) for this pods
33+
#
34+
# @return [Array<String>]
35+
class_attr_accessor :target_names_to_skip_integration_framework
36+
2937
end
3038
end
3139
end

0 commit comments

Comments
 (0)