cocoapods-ppbuild 0.0.4 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7a60801b88a3a65f9772965dbb9f3902abb9359af6d13f22417f14b7e8473843
4
- data.tar.gz: cccc9a3f322b92e85832435a7b3deae1a79afc36d5651c9bdc48e174bd3453fc
3
+ metadata.gz: c5573fd6b439b3b7f14cd3af40775271c6adb2df5d2694ea06a052b765e7bca7
4
+ data.tar.gz: 34ff8d8e4212d82b442b950191569c232b4abbcc4e2767520d579c9be8ba940c
5
5
  SHA512:
6
- metadata.gz: ed89338e7ec4b7a6695b2679c6ebe092550c51ad89b9c56b8b99bdfe6638f510ae58feb3528f8ff14c0ea5c02c3a3a559d746e9108f0b0eab1020f96a91c7e57
7
- data.tar.gz: 3722e1443ad0cdf5e0aebf029c3fd1cdd4cac946e5d8f17dc81fdbac16af96deef2f02ff9f067a1f5cd87e4140e76e8a7b0dedc5ed24ccded17b191b0481343c
6
+ metadata.gz: 16dc03357ff651e30773a1b12a2c166e0c30316f85662265ed553eb483302a6fec5f48fc3a75eaf23958db718c1b6a1259cca9285f90bddbaf1ab197a69b699b
7
+ data.tar.gz: 3bd1ae9b7287f11c96eea8969c23e07125d8d820ad7cd147973920bf39c3a466b4a612c07fd67f2a08c4db88cf19ed84da36262ac70cf84a4548435000d8f546
@@ -62,6 +62,7 @@ module Pod
62
62
 
63
63
  target_names.each do |name|
64
64
 
65
+ Pod::UI.puts "........... oname: #{name}"
65
66
  # symbol link copy all substructure
66
67
  real_file_folder = prebuild_sandbox.framework_folder_path_for_target_name(name)
67
68
 
@@ -111,6 +112,7 @@ module Pod
111
112
  if object.real_file_path != nil
112
113
  real_path = Pathname.new(object.target_file_path)
113
114
  real_path.rmtree if real_path.exist?
115
+ Pod::UI.puts "........... object.target_file_path: #{object.target_file_path}"
114
116
  make_link(object.real_file_path, object.target_file_path, false)
115
117
  end
116
118
  end
@@ -135,15 +137,13 @@ module Pod
135
137
  # Remove the old target files if prebuild frameworks changed
136
138
  def remove_target_files_if_needed
137
139
 
138
- changes = Pod::Prebuild::Passer.prebuild_pods_changes
140
+ changes = Pod::Prebuild::Passer.prebuild_pod_targets_changes
139
141
  updated_names = []
140
142
  if changes == nil
141
143
  updated_names = PrebuildSandbox.from_standard_sandbox(self.sandbox).exsited_framework_pod_names
142
144
  else
143
- added = changes.added
144
- changed = changes.changed
145
- deleted = changes.deleted
146
- updated_names = added + changed + deleted
145
+ t_names = changes.map { |e| e.pod_name }
146
+ updated_names = (updated_names + t_names).uniq
147
147
  end
148
148
 
149
149
  updated_names.each do |name|
@@ -164,7 +164,6 @@ module Pod
164
164
  # Modify specification to use only the prebuild framework after analyzing
165
165
  old_method2 = instance_method(:resolve_dependencies)
166
166
  define_method(:resolve_dependencies) do
167
-
168
167
  # Remove the old target files, else it will not notice file changes
169
168
  self.remove_target_files_if_needed
170
169
 
@@ -25,6 +25,7 @@ module Pod
25
25
  DSL.dont_remove_source_code = true
26
26
  end
27
27
 
28
+ # 设置是否保存源码,默认 true
28
29
  def remove_source_code_for_prebuilt_frameworks!
29
30
  DSL.dont_remove_source_code = false
30
31
  end
@@ -62,7 +62,43 @@ module Pod
62
62
  UI.puts "Using #{name}"
63
63
  end
64
64
  end
65
+
66
+ def save_change_targets!
67
+ sandbox_path = sandbox.root
68
+ existed_framework_folder = sandbox.generate_framework_path
69
+
70
+ if local_manifest != nil
71
+ changes = prebuild_pods_changes
72
+ added = changes.added
73
+ changed = changes.changed
74
+ unchanged = changes.unchanged
75
+ deleted = changes.deleted.to_a
76
+
77
+ existed_framework_folder.mkdir unless existed_framework_folder.exist?
78
+ exsited_framework_pod_names = sandbox.exsited_framework_pod_names
65
79
 
80
+ # additions
81
+ missing = unchanged.select do |pod_name|
82
+ not exsited_framework_pod_names.include?(pod_name)
83
+ end
84
+
85
+ # 保存有改变的target列表
86
+ root_names_to_update = (added + changed + missing).uniq
87
+ updates_target_names = (root_names_to_update + deleted).uniq
88
+ cache = []
89
+ updates_targets = []
90
+ updates_target_names.each do |pod_name|
91
+ tars = Pod.fast_get_targets_for_pod_name(pod_name, self.pod_targets, cache)
92
+ if tars.nil? || tars.empty?
93
+ Pod::UI.puts "There's no target named (#{pod_name}) in Pod.xcodeproj." if t.nil?
94
+ else
95
+ updates_targets = (updates_targets + tars).uniq
96
+ end
97
+ end
98
+ updates_dependency_targets = updates_targets.map {|t| t.recursive_dependent_targets }.flatten.uniq || []
99
+ Pod::Prebuild::Passer.prebuild_pod_targets_changes = (updates_targets + updates_dependency_targets).uniq
100
+ end
101
+ end
66
102
 
67
103
  # Build the needed framework files
68
104
  def prebuild_frameworks!
@@ -87,11 +123,8 @@ module Pod
87
123
  missing = unchanged.select do |pod_name|
88
124
  not exsited_framework_pod_names.include?(pod_name)
89
125
  end
90
-
91
-
92
- root_names_to_update = (added + changed + missing)
93
-
94
- # transform names to targets
126
+ root_names_to_update = (added + changed + missing).uniq
127
+ # 生成预编译target
95
128
  cache = []
96
129
  targets = root_names_to_update.map do |pod_name|
97
130
  tars = Pod.fast_get_targets_for_pod_name(pod_name, self.pod_targets, cache)
@@ -101,8 +134,11 @@ module Pod
101
134
  tars
102
135
  end.flatten
103
136
 
104
- # add the dendencies
137
+ # 添加依赖
105
138
  dependency_targets = targets.map {|t| t.recursive_dependent_targets }.flatten.uniq || []
139
+ dependency_targets = dependency_targets.select do |tar|
140
+ sandbox.existed_target_version_for_pod_name(tar.pod_name) != tar.version
141
+ end
106
142
  targets = (targets + dependency_targets).uniq
107
143
  else
108
144
  targets = self.pod_targets
@@ -228,12 +264,13 @@ module Pod
228
264
  # patch the post install hook
229
265
  old_method2 = instance_method(:run_plugins_post_install_hooks)
230
266
  define_method(:run_plugins_post_install_hooks) do
267
+ if Pod::is_prebuild_stage
268
+ self.save_change_targets!
269
+ end
231
270
  old_method2.bind(self).()
232
271
  if Pod::is_prebuild_stage
233
272
  self.prebuild_frameworks!
234
273
  end
235
274
  end
236
-
237
-
238
275
  end
239
276
  end
@@ -1,3 +1,3 @@
1
1
  module CocoapodsPpbuild
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
@@ -14,7 +14,7 @@ module Pod
14
14
  # @return [Analyzer::SpecsState]
15
15
  #
16
16
  class_attr_accessor :prebuild_pods_changes
17
-
17
+ class_attr_accessor :prebuild_pod_targets_changes
18
18
 
19
19
  # represent the path of resurces to copy
20
20
  class ResourcePath
@@ -77,9 +77,10 @@ module Pod
77
77
 
78
78
  # filter prebuild
79
79
  prebuild_names = target_definition.prebuild_framework_pod_names
80
- if not Podfile::DSL.prebuild_all
81
- targets = targets.select { |pod_target| prebuild_names.include?(pod_target.pod_name) }
82
- end
80
+ # if not Podfile::DSL.prebuild_all
81
+ # targets = targets.select { |pod_target| prebuild_names.include?(pod_target.pod_name) }
82
+ # end
83
+ targets = targets.select { |pod_target| prebuild_names.include?(pod_target.pod_name) }
83
84
  dependency_targets = targets.map {|t| t.recursive_dependent_targets }.flatten.uniq || []
84
85
  targets = (targets + dependency_targets).uniq
85
86
 
@@ -67,13 +67,21 @@ module Pod
67
67
  exsited_framework_name_pairs.select {|pair| pair[1] == pod_name }.map { |pair| pair[0]}
68
68
  end
69
69
 
70
-
70
+ def existed_target_version_for_pod_name(pod_name)
71
+ folder = framework_folder_path_for_target_name(pod_name)
72
+ return "" unless folder.exist?
73
+ flag_file_path = folder + "#{pod_name}.pod_name"
74
+ return "" unless flag_file_path.exist?
75
+ version = File.read(flag_file_path)
76
+ Pod::UI.puts "............ version: #{version}"
77
+ version
78
+ end
71
79
 
72
80
  def save_pod_name_for_target(target)
73
81
  folder = framework_folder_path_for_target_name(target.name)
74
82
  return unless folder.exist?
75
83
  flag_file_path = folder + "#{target.pod_name}.pod_name"
76
- File.write(flag_file_path.to_s, "")
84
+ File.write(flag_file_path.to_s, "#{target.version}")
77
85
  end
78
86
 
79
87
  def real_bundle_path_for_pod(path)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocoapods-ppbuild
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - 彭懂
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-09-27 00:00:00.000000000 Z
11
+ date: 2021-09-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -61,7 +61,7 @@ files:
61
61
  - lib/cocoapods-ppbuild/rome/build_framework.rb
62
62
  - lib/cocoapods-ppbuild/tool/tool.rb
63
63
  - lib/cocoapods_plugin.rb
64
- homepage: https://github.com/EXAMPLE/cocoapods-ppbuild
64
+ homepage: https://github.com/pdcodeunder/cocoapods-ppbuild.git
65
65
  licenses:
66
66
  - MIT
67
67
  metadata: {}