Skip to content

Commit 950433e

Browse files
committed
fix dependency framework missing
it happens when turning one pod to source code and there's another pod who have a dependency
1 parent 62eb348 commit 950433e

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

lib/cocoapods-binary/Prebuild.rb

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -83,17 +83,6 @@ def prebuild_frameworks!
8383

8484
existed_framework_folder.mkdir unless existed_framework_folder.exist?
8585
exsited_framework_names = sandbox.exsited_framework_names
86-
87-
# deletions
88-
# remove all frameworks except ones to remain
89-
unchange_framework_names = (added + unchanged)
90-
to_delete = exsited_framework_names.select do |framework_name|
91-
not unchange_framework_names.include?(framework_name)
92-
end
93-
to_delete.each do |framework_name|
94-
path = sandbox.framework_folder_path_for_pod_name(framework_name)
95-
path.rmtree if path.exist?
96-
end
9786

9887
# additions
9988
missing = unchanged.select do |pod_name|
@@ -177,7 +166,7 @@ def prebuild_frameworks!
177166
end
178167

179168
# Remove useless files
180-
# only keep manifest.lock and framework folder
169+
# only keep manifest.lock and framework folder in _Prebuild
181170
to_remain_files = ["Manifest.lock", File.basename(existed_framework_folder)]
182171
to_delete_files = sandbox_path.children.select do |file|
183172
filename = File.basename(file)
@@ -186,6 +175,15 @@ def prebuild_frameworks!
186175
to_delete_files.each do |path|
187176
path.rmtree if path.exist?
188177
end
178+
# remove useless pods
179+
all_needed_names = self.pod_targets.map(&:name).uniq
180+
useless_names = sandbox.exsited_framework_names.reject do |name|
181+
all_needed_names.include? name
182+
end
183+
useless_names.each do |name|
184+
path = sandbox.framework_folder_path_for_pod_name(name)
185+
path.rmtree if path.exist?
186+
end
189187

190188
end
191189

0 commit comments

Comments
 (0)