lib/cocoapods-ppbuild/Prebuild.rb in cocoapods-ppbuild-0.0.5 vs lib/cocoapods-ppbuild/Prebuild.rb in cocoapods-ppbuild-1.0.0
- old
+ new
@@ -60,48 +60,11 @@
# just print log
self.sandbox.exsited_framework_target_names.each do |name|
UI.puts "Using #{name}"
end
end
-
- def save_change_targets!
- sandbox_path = sandbox.root
- existed_framework_folder = sandbox.generate_framework_path
-
- if local_manifest != nil
- changes = prebuild_pods_changes
- added = changes.added
- changed = changes.changed
- unchanged = changes.unchanged
- deleted = changes.deleted.to_a
-
- existed_framework_folder.mkdir unless existed_framework_folder.exist?
- exsited_framework_pod_names = sandbox.exsited_framework_pod_names
-
- # additions
- missing = unchanged.select do |pod_name|
- not exsited_framework_pod_names.include?(pod_name)
- end
- # 保存有改变的target列表
- root_names_to_update = (added + changed + missing).uniq
- updates_target_names = (root_names_to_update + deleted).uniq
- cache = []
- updates_targets = []
- updates_target_names.each do |pod_name|
- tars = Pod.fast_get_targets_for_pod_name(pod_name, self.pod_targets, cache)
- if tars.nil? || tars.empty?
- Pod::UI.puts "There's no target named (#{pod_name}) in Pod.xcodeproj." if t.nil?
- else
- updates_targets = (updates_targets + tars).uniq
- end
- end
- updates_dependency_targets = updates_targets.map {|t| t.recursive_dependent_targets }.flatten.uniq || []
- Pod::Prebuild::Passer.prebuild_pod_targets_changes = (updates_targets + updates_dependency_targets).uniq
- end
- end
-
# Build the needed framework files
def prebuild_frameworks!
# build options
sandbox_path = sandbox.root
existed_framework_folder = sandbox.generate_framework_path
@@ -126,12 +89,12 @@
root_names_to_update = (added + changed + missing).uniq
# 生成预编译target
cache = []
targets = root_names_to_update.map do |pod_name|
tars = Pod.fast_get_targets_for_pod_name(pod_name, self.pod_targets, cache)
- if tars.nil? || tars.empty?
- raise "There's no target named (#{pod_name}) in Pod.xcodeproj.\n #{self.pod_targets.map(&:name)}" if t.nil?
+ if tars.nil?
+ tars = []
end
tars
end.flatten
# 添加依赖
@@ -259,16 +222,13 @@
path.rmtree if path.exist?
end
end
end
- # patch the post install hook
- old_method2 = instance_method(:run_plugins_post_install_hooks)
+ # hook run_plugins_post_install_hooks 方法
+ install_hooks_method = instance_method(:run_plugins_post_install_hooks)
define_method(:run_plugins_post_install_hooks) do
- if Pod::is_prebuild_stage
- self.save_change_targets!
- end
- old_method2.bind(self).()
+ install_hooks_method.bind(self).()
if Pod::is_prebuild_stage
self.prebuild_frameworks!
end
end
end
\ No newline at end of file