cocoapods-freezer 1.0.6 → 1.0.7

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
  SHA1:
3
- metadata.gz: beabd9ae3fe3c6b4c2273db5b17720eccb71d74b
4
- data.tar.gz: 0b488040d271093e925ae2124686a72abfe85ae5
3
+ metadata.gz: 21166efd3df3dbcfdacf250b9c679f996f16f481
4
+ data.tar.gz: 8719db832ee221b5995e411508a0b347ed5dbd91
5
5
  SHA512:
6
- metadata.gz: 0546101bc1fc939debfb0521f3d2f9b5e0ccba5807b165f9cc59188fcd9c3bf72578fb4336e042013c733f2676b8c56a44803ed5d855ed6445ec755b98791b35
7
- data.tar.gz: c2fd2e22ec588ae40bd45ae854c55864ca4d0c5c7cf81cc571545652a36378f786df31eba6d304ed2c5738d9dac0ee96c81f1cb119e36044835c56b1725fa759
6
+ metadata.gz: eba6c6144d398fab7a60ea551a3698bb55a5154f21177fd6fd734581d42c72dd7cb8f83935ea629291270df86643abbb80a3663e3a9f44b49237a479db18a8e9
7
+ data.tar.gz: 114d4fc5e6075506ce076aa8d4a572e887d6e9208ca8f3395c404b147401daebf88c2db8c9438baf5184c3f22bde8df6b0b83cccedfb59039fb31e695501e5d2
data/README_CH.md CHANGED
@@ -31,17 +31,17 @@ $ pod install --user-freezer
31
31
  ## 计划
32
32
 
33
33
  - 预编译相关
34
- [] 支持多subspecs编译
35
- [] 支持全平台(Platform)、全配置(Configuration)缓存
36
- [] 支持Framework(Dynamic\Static)方式构建
37
- [] 支持local类型
38
- [] 支持swift类型
39
- [] 缓存路径定制
40
- [] 打包脚本定制?
41
- [] Configuration定制?
34
+ - [] 支持全平台(Platform)、全配置(Configuration)缓存
35
+ - [] 支持Framework(Dynamic\Static)方式构建
36
+ - [] 支持local类型
37
+ - [] 支持swift类型
38
+ - [] 缓存路径定制
39
+ - [] 打包脚本定制?
40
+ - [] Configuration定制?
41
+ - [] 多Target使用相同Pod但不同subspec相应缓存
42
42
 
43
43
  - 命令相关
44
- [] 支持'pod update'命令工作
45
- [] 支持'pod freeze'命令的查询、缓存操作
44
+ - [] 支持'pod update'命令工作
45
+ - [] 支持'pod freeze'命令的查询、缓存操作
46
46
 
47
47
  如果你喜欢这个插件,请留下🌟!欢迎提出遇到的问题,以及希望增加的功能!
@@ -56,12 +56,6 @@ module Pod
56
56
  # freeze!
57
57
  specs_for_freezing.each do |spec|
58
58
 
59
- # subspec not support;
60
- if spec.subspecs.count > 0
61
- Pod::UI.puts "`#{spec.name}` can't freeze because it has subspecs!".red
62
- next
63
- end
64
-
65
59
  # local not support;
66
60
  if sandbox.local?(spec.name)
67
61
  Pod::UI.puts "`#{spec.name}` can't freeze because it is local!".red
@@ -73,93 +67,87 @@ module Pod
73
67
  target.root_spec.name == spec.name
74
68
  end || []
75
69
 
76
- unless pod_targets.count > 0
77
- Pod::UI.puts "`#{spec.name}` can't freeze because it nil!".red
70
+ # todo(ca1md0wn)
71
+ # Pod has only one target in one platform.
72
+ # 1. pod has multi target beacause of multi platforms in workspace!
73
+ # 2. pod has multi target beacause it define in diffenent targets with diffenent subspec!
74
+ unless pod_targets.count == 1
75
+ Pod::UI.puts "`#{spec.name}` can't freeze because it has multi targets in workspace!".red
78
76
  next
79
77
  end
80
78
 
81
- not_support = false
82
- pod_targets.each do |target|
83
- # todo(ca1md0wn)
84
- # should_not_build not support
85
- if !target.should_build?
86
- Pod::UI.puts "`#{spec.name}` can't freeze because it should not build!".red
87
- not_support = true
88
- break
89
- end
79
+ pod_target = pod_targets.first
90
80
 
91
- # todo(ca1md0wn)
92
- # swift not support;
93
- if target.uses_swift?
94
- Pod::UI.puts "`#{spec.name}` can't freeze because it use swift!".red
95
- not_support = true
96
- break
97
- end
81
+ # target should not build;
82
+ if !pod_target.should_build?
83
+ Pod::UI.puts "`#{spec.name}` can't freeze because it should not build!".red
84
+ next
85
+ end
98
86
 
99
- # todo(ca1md0wn)
100
- # build_as_framework not support;
101
- if target.requires_frameworks?
102
- Pod::UI.puts "`#{spec.name}` don't support to freeze because it will build as framework!".red
103
- not_support = true
104
- break
105
- end
87
+ # todo(ca1md0wn)
88
+ # freezer not support swift;
89
+ if pod_target.uses_swift?
90
+ Pod::UI.puts "`#{spec.name}` can't freeze because it use swift!".red
91
+ next
92
+ end
106
93
 
107
- # todo(ca1md0wn)
108
- # multiplatform not support(just support ios now!)
109
- if target.platform.name != :ios
110
- Pod::UI.puts "`#{spec.name}` don't support to freeze because it is not ios!".red
111
- not_support = true
112
- break
113
- end
94
+ # todo(ca1md0wn)
95
+ # freezer not support to build as framework;
96
+ if pod_target.requires_frameworks?
97
+ Pod::UI.puts "`#{spec.name}` don't support to freeze because it will build as framework!".red
98
+ next
114
99
  end
115
- next if not_support
116
100
 
117
- frozen_pod = FrozenPod.new(spec.name)
101
+ # todo(ca1md0wn)
102
+ # freezer just support to build at ios; (just support ios now!)
103
+ if pod_target.platform.name != :ios
104
+ Pod::UI.puts "`#{spec.name}` don't support to freeze because it is not ios!".red
105
+ next
106
+ end
118
107
 
119
108
  # setup!
120
- pod_targets.each do |target|
121
- # target build when
122
- # 1.spec change/add 2.product not exist
123
- if !unchange_spec_names.include?(spec.name) || !(root + target.product_name).exist?
124
-
125
- product_path = nil
126
- case target.platform.name
127
- when :ios then
128
- # build iphonesimulator!
129
- iphonesimulator_paths = Pod::Xcodebuild::build_iphonesimulator!(installer.sandbox.project_path.realdirpath, target.name, target.product_name)
130
- if !iphonesimulator_paths || iphonesimulator_paths.count == 0
131
- next
132
- end
133
-
134
- # build iphoneos!
135
- iphoneos_paths = Pod::Xcodebuild::build_iphoneos!(installer.sandbox.project_path.realdirpath, target.name, target.product_name)
136
- if !iphoneos_paths || iphoneos_paths.count == 0
137
- next
138
- end
139
-
140
- # lipo!
141
- product_path = Pod::Lipo::create!(iphoneos_paths + iphonesimulator_paths, target.product_name)
142
-
143
- when :osx then
144
- # todo
145
- when :watchos then
146
- # todo
147
- when :tvos then
148
- # todo
109
+ # pod_target build when
110
+ # 1.spec change/add 2.product not exist
111
+ if !unchange_spec_names.include?(spec.name) || !(root + pod_target.product_name).exist?
112
+ product_path = nil
113
+ case pod_target.platform.name
114
+ when :ios then
115
+ # build iphonesimulator!
116
+ iphonesimulator_paths = Pod::Xcodebuild::build_iphonesimulator!(installer.sandbox.project_path.realdirpath, pod_target.name, pod_target.product_name)
117
+ if !iphonesimulator_paths || iphonesimulator_paths.count == 0
118
+ Pod::UI.puts "`#{spec.name}` don't support to freeze because it build failed!".red
119
+ next
149
120
  end
150
121
 
151
- next unless product_path
152
-
153
- FileUtils.cp_r(product_path, root + target.product_name, :remove_destination => true)
154
- end
122
+ # build iphoneos!
123
+ iphoneos_paths = Pod::Xcodebuild::build_iphoneos!(installer.sandbox.project_path.realdirpath, pod_target.name, pod_target.product_name)
124
+ if !iphoneos_paths || iphoneos_paths.count == 0
125
+ Pod::UI.puts "`#{spec.name}` don't support to freeze because it build failed!".red
126
+ next
127
+ end
155
128
 
156
- frozen_pod.mark!(target.product_name)
157
- end
129
+ # lipo!
130
+ product_path = Pod::Lipo::create!(iphoneos_paths + iphonesimulator_paths, pod_target.product_name)
131
+
132
+ when :osx then
133
+ # todo
134
+ when :watchos then
135
+ # todo
136
+ when :tvos then
137
+ # todo
138
+ end
158
139
 
159
- unless frozen_pod.empty?
160
- @frozen_pods += [frozen_pod]
140
+ if !product_path
141
+ Pod::UI.puts "`#{spec.name}` don't support to freeze because it build failed!".red
142
+ next
143
+ end
144
+
145
+ FileUtils.cp_r(product_path, root + pod_target.product_name, :remove_destination => true)
161
146
  end
162
147
 
148
+ frozen_pod = FrozenPod.new(pod_target.pod_name, pod_target.product_name)
149
+ @frozen_pods += [frozen_pod]
150
+
163
151
  Pod::UI.puts "`#{spec.name}` freeze!".green
164
152
  end
165
153
 
@@ -189,54 +177,32 @@ module Pod
189
177
  return false
190
178
  end
191
179
 
192
- def freezed_product?(product_name)
193
- @frozen_pods.each do |frozen_pod|
194
- frozen_pod.product_names.each do |name|
195
- if name == product_name
196
- return true
197
- end
180
+ def export!(pod_name, path)
181
+ @frozen_pods.select do |frozen_pod|
182
+ if frozen_pod.pod_name == pod_name
183
+ FileUtils.cp_r(root + frozen_pod.product_name, path + frozen_pod.product_name, :remove_destination => true)
184
+ break;
198
185
  end
199
186
  end
200
-
201
- return false
202
- end
203
-
204
- def export!(product_name, path)
205
- if !path || !freezed_product?(product_name)
206
- return
207
- end
208
-
209
- FileUtils.cp_r(root + product_name, path.to_s, :remove_destination => true)
210
187
  end
211
188
 
212
189
  private
213
190
 
214
191
  class FrozenPod
215
- # String
192
+ # [String]
216
193
  attr_reader :pod_name
217
194
 
218
- # Array<String>
219
- attr_reader :product_names
195
+ # [String]
196
+ attr_reader :product_name
220
197
 
221
- def initialize(pod_name)
198
+ def initialize(pod_name, product_name)
199
+ raise "Params error" unless pod_name.length > 0 && product_name.length > 0
222
200
  @pod_name = pod_name
223
- @product_names = []
224
- end
225
-
226
- def mark!(product_name)
227
- @product_names += [product_name]
228
- end
229
-
230
- def empty?
231
- if @product_names.count > 0
232
- return false
233
- end
234
-
235
- return true
201
+ @product_name = product_name
236
202
  end
237
203
  end
238
204
 
239
- # Array<FrozenPod>
205
+ # [Array<FrozenPod>]
240
206
  @frozen_pods
241
207
 
242
208
  def root
@@ -1,3 +1,3 @@
1
1
  module CocoapodsFreezer
2
- VERSION = "1.0.6"
2
+ VERSION = "1.0.7"
3
3
  end
@@ -20,39 +20,34 @@ module Pod
20
20
  end
21
21
 
22
22
  def resolve_dependencies_about_freezed
23
- major_specs.each do |spec|
24
- next unless Pod::Freezer.shared.freezed_pod?(spec.root.name)
23
+ major_specs.each do |major_spec|
24
+ next unless Pod::Freezer.shared.freezed_pod?(major_spec.name)
25
25
 
26
26
  targets = pod_targets.select do |target|
27
- target.pod_name == spec.root.name
27
+ target.pod_name == major_spec.name
28
28
  end
29
29
 
30
- if !targets || targets.count == 0
30
+ # Pod has only one target
31
+ unless targets.count == 1
31
32
  next
32
33
  end
33
34
 
34
- targets.each do |target|
35
+ target = targets.first
36
+
37
+ # Pod maybe include multi subspecs,
38
+ all_specs = analysis_result.specifications.select do |spec|
39
+ spec.root.name == major_spec.name
40
+ end.each do |spec|
35
41
  spec.prepare_to_store_freezed(target.platform.name.to_s)
36
- if Pod::Freezer.shared.freezed_product?(target.product_name)
37
- spec.store_freezed(target.platform.name.to_s, target.product_name, target.product_type)
38
- else # not freezed product in platform
39
- spec.store_freezed_none(target.platform.name.to_s)
40
- end
42
+ spec.store_freezed(target.platform.name.to_s, target.product_name, target.product_type)
43
+ spec.done_for_store_freezed
41
44
  end
42
-
43
- spec.done_for_store_freezed
44
45
  end
45
46
  end
46
47
 
47
48
  def install_source_of_pod_about_freezed(pod_name)
48
49
  if Pod::Freezer.shared.freezed_pod?(pod_name)
49
- pod_targets.select do |target|
50
- target.pod_name == pod_name
51
- end.map do |target|
52
- target.product_name
53
- end.each do |product_name|
54
- Pod::Freezer.shared.export!(product_name, self.sandbox.pod_dir(pod_name) + product_name)
55
- end
50
+ Pod::Freezer.shared.export!(pod_name, self.sandbox.pod_dir(pod_name))
56
51
  end
57
52
  end
58
53
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocoapods-freezer
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.6
4
+ version: 1.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - ca1md0wn
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-01-10 00:00:00.000000000 Z
11
+ date: 2019-01-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cocoapods