cocoapods-tdf-bin 0.0.26 → 0.0.28

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: 87ed9c79da19168d3d799acb3e10665686872ea5f7b5d0180da27a1176f7f8d2
4
- data.tar.gz: 40d395b273425c1e8e24e71938635f092c784dec1678723ed280707639328847
3
+ metadata.gz: 9bdb076bb3b6e381790ebe749eb7c95ec28a50c80d9881dcdba36f2a65fc59b7
4
+ data.tar.gz: 68aad5923bd08c16e4ff9cacc08e8fdb41b4295504affbb306e08524cc65ac4f
5
5
  SHA512:
6
- metadata.gz: 4cb6a3cce2436e03b7010e5c5f94f286c342da9d6ee68dca686b86c80e8f74f6e2766d64bdc8d9585405c0bd0cf72677820078fe22671d44b36fbcbe962ac695
7
- data.tar.gz: 1f308b97e69f2a6fec68967ae563fcf5ba6cdd6326c538e7212c19acb22facf17a131bc25ee0997148c6303b9ba623328af92c93890d2482bd09cc0bd0e2ba3d
6
+ metadata.gz: 40db87d009cb7925f78947f40aa2bfaa32fe6bae59df182dab8ec99a61bb7a3cb906c4b43fb95dcb0adc7654709ac42933d7a1c6f65c955dee1ae2cd3a223107
7
+ data.tar.gz: ad74c200ef28f06b6f2f9cbf63dbb464c0ca628092b6b22be36bc2e85ede55c8a3ccb30125f4e2d3d9811a8ec1c22ba59c6cb89e56448e4fee3f5a6b99f0b349
data/README.md CHANGED
@@ -4,7 +4,7 @@ cocoapods-tdf-bin功能点:
4
4
 
5
5
  - 组件二进制化,`无入侵式`支持组件二进制化,完全自动化,无需手动操作。致力于解决Ci打包速度慢、研发编译慢等编译问题。
6
6
 
7
- cocoapods-imy-bin插件所关联的组件二进制化策略:
7
+ cocoapods-tdf-bin插件所关联的组件二进制化策略:
8
8
 
9
9
  - 预先将打包成 `.framework` 的组件保存到静态服务器上,并在 `install` 时,去下载组件对应的二进制版本,以减少组件编译时间,达到加快 App 打包、组件发布等操作的目的。
10
10
 
@@ -99,5 +99,18 @@ set_use_source_pods [
99
99
  ]
100
100
  ```
101
101
 
102
+ #### 5. 使用 batch 命令
103
+ ```ruby
104
+ batch_pod_local [
105
+ "TDFSunKitchenModule",
106
+ "TDFRetailStock",
107
+ ], "本地路径"
108
+
109
+ batch_pod_remote [
110
+ "TDFSunKitchenModule",
111
+ "TDFRetailStock",
112
+ ], "分支名"
113
+ ```
114
+
102
115
 
103
116
 
@@ -27,11 +27,13 @@ module Pod
27
27
  end
28
28
 
29
29
  def run
30
+
30
31
  podfile = File.join(Pathname.pwd, "Podfile")
31
32
  podfile_instance = Pod::Podfile.from_file(podfile)
32
33
  if podfile_instance.get_batch_local_pods == nil
33
34
  help! "没有本地依赖的组件"
34
35
  end
36
+
35
37
  if @arguments.size == 1 && @arguments[0] == "clone"
36
38
  clone_all(podfile_instance)
37
39
  elsif @arguments.size == 1 && @arguments[0] == "done"
@@ -59,6 +59,8 @@ module Pod
59
59
  end
60
60
  end
61
61
 
62
+ argvs << '--verbose'
63
+
62
64
  push = Pod::Command::Repo::Push.new(CLAide::ARGV.new(argvs))
63
65
  push.validate!
64
66
  push.run
@@ -1,6 +1,6 @@
1
1
 
2
2
  module CBin
3
- VERSION = '0.0.26'
3
+ VERSION = '0.0.28'
4
4
  end
5
5
 
6
6
  module Pod
@@ -55,7 +55,7 @@ module CBin
55
55
  source_dir = Dir.pwd
56
56
  file_accessor = Sandbox::FileAccessor.new(Pathname.new('.').expand_path, @spec.consumer(@platform))
57
57
  Dir.chdir(workspace_directory) do
58
- builder = CBin::Framework::Builder.new(@spec, file_accessor, @platform, source_dir, @isRootSpec, @build_model )
58
+ builder = CBin::Framework::Builder.new(@spec, file_accessor, @platform, source_dir, @isRootSpec, @build_model)
59
59
  @@build_defines = builder.build if @isRootSpec
60
60
  begin
61
61
  @framework_path = builder.lipo_build(@@build_defines) unless @skip_archive
@@ -118,7 +118,8 @@ module CBin
118
118
  end
119
119
 
120
120
  def framework_name
121
- CBin::Config::Builder.instance.framework_name(@spec)
121
+ @spec.name + ".xcframework"
122
+ # CBin::Config::Builder.instance.framework_name(@spec)
122
123
  end
123
124
 
124
125
  def framework_name_zip
@@ -7,6 +7,7 @@ module CBin
7
7
  class Utils
8
8
 
9
9
  def Utils.is_framework(spec)
10
+ # 目前全部打包成 静态 framework
10
11
  return true
11
12
  # if Utils.uses_frameworks?
12
13
  # return true
@@ -40,11 +40,13 @@ module CBin
40
40
  def lipo_build(defines)
41
41
  UI.section("Building static Library #{@spec}") do
42
42
 
43
- cp_framework_to_source_dir
44
- build_static_library_for_ios
43
+ # cp_framework_to_source_dir
44
+ build_xcframework_for_ios
45
+ # build_static_library_for_ios
45
46
 
46
47
  copy_resources
47
48
 
49
+ # link_header
48
50
  end
49
51
  framework
50
52
  end
@@ -53,7 +55,6 @@ module CBin
53
55
 
54
56
  def cp_framework_to_source_dir
55
57
  framework_name = "#{@spec.name}.framework"
56
- framework_dir = "./build-armv7/#{framework_name}" if File.exist?('./build-armv7')
57
58
  framework_dir = "./build-arm64/#{framework_name}" if File.exist?('./build-arm64')
58
59
  target_dir = File.join(CBin::Config::Builder.instance.zip_dir,framework_name)
59
60
 
@@ -81,7 +82,7 @@ module CBin
81
82
  # archs = %w[i386 x86_64]
82
83
  archs = ios_architectures_sim
83
84
  archs.map do |arch|
84
- xcodebuild(defines, "-sdk iphonesimulator ARCHS=\'#{arch}\' ", "build-#{arch}",@build_model)
85
+ xcodebuild(defines, "-sdk iphonesimulator ARCHS=\'#{arch}\' ", "build-#{arch}", @build_model)
85
86
  end
86
87
  end
87
88
 
@@ -94,6 +95,28 @@ module CBin
94
95
  file
95
96
  end
96
97
 
98
+ =begin
99
+ 制作 xcframework
100
+ =end
101
+ def build_xcframework_for_ios
102
+ UI.message "Building ios libraries with archs #{ios_architectures}"
103
+
104
+ framework_name = "#{@spec.name}.xcframework"
105
+ output = File.join(CBin::Config::Builder.instance.zip_dir,framework_name)
106
+
107
+ build_path = Pathname("build")
108
+ build_path.path unless build_path.exist?
109
+
110
+ # if is_debug_model
111
+ libs = (ios_architectures + ios_architectures_sim) .map do |arch|
112
+ library = "-framework build-#{arch}/#{@spec.name}.framework"
113
+ library
114
+ end
115
+
116
+ UI.message "xcodebuild -create-xcframework #{libs.join(' ')} -output #{output}"
117
+ `xcodebuild -create-xcframework #{libs.join(' ')} -output #{output}`
118
+ end
119
+
97
120
  =begin
98
121
  lipo合并 二进制
99
122
  =end
@@ -133,7 +156,7 @@ module CBin
133
156
  # iphone5,iphone5s以下的模拟器
134
157
  # >x86_64
135
158
  # iphone6以上的模拟器
136
- archs = %w[arm64 armv7]
159
+ archs = %w[arm64]
137
160
  # archs = %w[x86_64 arm64 armv7s i386]
138
161
  # @vendored_libraries.each do |library|
139
162
  # archs = `lipo -info #{library}`.split & archs
@@ -202,12 +225,22 @@ module CBin
202
225
  end
203
226
  end
204
227
 
228
+ def link_header
229
+ header_dir = "#{CBin::Config::Builder.instance.zip_dir}/#{@spec.name}.xcframework/ios-arm64/#{@spec.name}.framework/Headers"
230
+ target_headers_dir = "#{CBin::Config::Builder.instance.zip_dir}/#{@spec.name}.xcframework/Headers"
231
+ FileUtils.mkdir_p(target_headers_dir) unless File.exist?(target_headers_dir)
232
+ Dir.foreach(header_dir) do |file|
233
+ if file !="." and file !=".."
234
+ `ln -s #{header_dir}/#{file} #{target_headers_dir}`
235
+ end
236
+ end
237
+ end
238
+
205
239
  def copy_resources
206
240
  resource_dir = './build/*.bundle'
207
- resource_dir = './build-armv7/*.bundle' if File.exist?('./build-armv7')
208
241
  resource_dir = './build-arm64/*.bundle' if File.exist?('./build-arm64')
209
242
 
210
- framework_name = "#{@spec.name}.framework"
243
+ framework_name = "#{@spec.name}.xcframework"
211
244
  resource_target_dir = File.join(CBin::Config::Builder.instance.zip_dir,framework_name,"Resources")
212
245
 
213
246
  FileUtils.mkdir_p(resource_target_dir) unless File.exist?(resource_target_dir)
@@ -267,8 +300,11 @@ module CBin
267
300
  not expand_suffix(suffix)
268
301
  end
269
302
 
270
- UI.message "Copying resources #{escape_resource_arr}"
271
- `cp -rp #{escape_resource_arr.join(' ')} #{resource_target_dir}`
303
+ if escape_resource_arr.count > 0
304
+ UI.message "Copying resources #{escape_resource_arr}"
305
+ `cp -rp #{escape_resource_arr.join(' ')} #{resource_target_dir}`
306
+ end
307
+
272
308
  end
273
309
  end
274
310
 
@@ -59,7 +59,7 @@ module CBin
59
59
  # license | resource_bundles | vendored_libraries
60
60
 
61
61
  # Project Linkin
62
- @spec.vendored_frameworks = "#{code_spec.root.name}.framework"
62
+ @spec.vendored_frameworks = "#{code_spec.root.name}.xcframework"
63
63
 
64
64
  # Resources
65
65
  extnames = []
@@ -75,8 +75,8 @@ module CBin
75
75
  @spec.source = binary_source
76
76
 
77
77
  # Source Code
78
- @spec.source_files = framework_contents('Headers/*')
79
- @spec.public_header_files = framework_contents('Headers/*')
78
+ # @spec.source_files = framework_contents('Headers/*')
79
+ # @spec.public_header_files = framework_contents('Headers/*')
80
80
 
81
81
  # Unused for binary
82
82
  spec_hash = @spec.to_hash
@@ -131,7 +131,7 @@ module CBin
131
131
  end
132
132
 
133
133
  def framework_contents(name)
134
- ["#{code_spec.root.name}.framework"].map { |path| "#{path}/#{name}" }
134
+ ["#{code_spec.root.name}.xcframework"].map { |path| "#{path}/#{name}" }
135
135
  end
136
136
 
137
137
  def binary_source_files
@@ -63,9 +63,9 @@ module CBin
63
63
 
64
64
  # Resources
65
65
  extnames = []
66
- extnames << '*.bundle' if code_spec_consumer.resource_bundles.any?
67
- if code_spec_consumer.resources.any?
68
- extnames += code_spec_consumer.resources.map { |r| File.basename(r) }
66
+ extnames << '*.bundle' if contain_bundles
67
+ if code_spec_resource.any?
68
+ extnames += code_spec_resource.map { |r| File.basename(r) }
69
69
  end
70
70
  if extnames.any?
71
71
  @spec.resources = framework_contents('Resources').flat_map { |r| extnames.map { |e| "#{r}/#{e}" } }
@@ -132,13 +132,13 @@ module CBin
132
132
  # license | resource_bundles | vendored_libraries
133
133
 
134
134
  # Project Linkin
135
- @spec.vendored_frameworks = "#{code_spec.root.name}.framework"
135
+ @spec.vendored_frameworks = "#{code_spec.root.name}.xcframework"
136
136
 
137
137
  # Resources
138
138
  extnames = []
139
- extnames << '*.bundle' if code_spec_consumer.resource_bundles.any?
140
- if code_spec_consumer.resources.any?
141
- extnames += code_spec_consumer.resources.map { |r| File.basename(r) }
139
+ extnames << '*.bundle' if contain_bundles
140
+ if code_spec_resource.any?
141
+ extnames += code_spec_resource.map { |r| File.basename(r) }
142
142
  end
143
143
 
144
144
  extnames = extnames.select do | extname |
@@ -147,7 +147,7 @@ module CBin
147
147
 
148
148
  if extnames.any?
149
149
  resources = framework_contents('Resources').flat_map { |r| extnames.map { |e| "#{r}/#{e}" } }
150
- resources << "#{code_spec.root.name}.framework/*.{storyboardc,nib,mom,momd,cdm}"
150
+ resources << "#{code_spec.root.name}.xcframework/ios-arm64/#{code_spec.root.name}.framework/*.{storyboardc,nib,mom,momd,cdm}"
151
151
  @spec.resources = resources
152
152
  end
153
153
 
@@ -155,8 +155,9 @@ module CBin
155
155
  @spec.source = binary_source
156
156
 
157
157
  # Source Code
158
- @spec.source_files = framework_contents('Headers/*')
159
- @spec.public_header_files = framework_contents('Headers/*')
158
+ # @spec.source_files = framework_contents("Headers/*.h")
159
+ # @spec.public_header_files = framework_contents("ios-arm64/#{code_spec.root.name}.framework/Headers/*.h")
160
+ # @spec.header_mappings_dir = "#{code_spec.root.name}.xcframework/ios-arm64/#{code_spec.root.name}.framework/Headers"
160
161
 
161
162
  # Unused for binary
162
163
  spec_hash = @spec.to_hash
@@ -164,6 +165,7 @@ module CBin
164
165
  spec_hash.delete('resource_bundles')
165
166
  spec_hash.delete('exclude_files')
166
167
  spec_hash.delete('preserve_paths')
168
+ # spec_hash.delete('source_files')
167
169
  # 这里不确定 vendored_libraries 指定的时动态/静态库
168
170
  # 如果是静态库的话,需要移除,否则就不移除
169
171
  # 最好是静态库都独立成 Pod ,cocoapods-package 打静态库去 collect 目标文件时好做过滤
@@ -189,6 +191,18 @@ module CBin
189
191
  @spec
190
192
  end
191
193
 
194
+ def contain_bundles
195
+ consumers = [code_spec, *code_spec.recursive_subspecs].flat_map do |spec|
196
+ spec.consumer(:ios)
197
+ end
198
+ for consumer in consumers
199
+ if consumer.resource_bundles.any?
200
+ return true
201
+ end
202
+ end
203
+ return false
204
+ end
205
+
192
206
  def expand_suffix(suffix)
193
207
  if suffix.end_with?('.storyboard') ||
194
208
  suffix.end_with?('.xib') ||
@@ -204,12 +218,15 @@ module CBin
204
218
  { http: format(CBin.config.binary_download_url, code_spec.root.name, code_spec.version), type: CBin.config.download_file_type }
205
219
  end
206
220
 
207
- def code_spec_consumer(_platform = :ios)
208
- code_spec.consumer(:ios)
221
+ def code_spec_resource
222
+ resources = [code_spec, *code_spec.recursive_subspecs].flat_map do |spec|
223
+ spec.consumer(:ios).resources
224
+ end.compact.uniq
225
+ resources
209
226
  end
210
227
 
211
228
  def framework_contents(name)
212
- ["#{code_spec.root.name}.framework"].map { |path| "#{path}/#{name}" }
229
+ ["#{code_spec.root.name}.xcframework"].map { |path| "#{path}/#{name}" }
213
230
  end
214
231
 
215
232
  def binary_source_files
@@ -8,6 +8,7 @@ require 'cocoapods/generate'
8
8
  require 'cocoapods-tdf-bin/helpers/framework_builder'
9
9
  require 'cocoapods-tdf-bin/helpers/library_builder'
10
10
  require 'cocoapods-tdf-bin/helpers/sources_helper'
11
+ require 'cocoapods-tdf-bin/helpers/spec_source_creator'
11
12
  require 'cocoapods-tdf-bin/command/bin/spec/push'
12
13
 
13
14
  module CBin
@@ -47,7 +48,7 @@ module CBin
47
48
  # curl http://ci.xxx:9192/frameworks -F "name=IMYFoundation" -F "version=7.7.4.2" -F "annotate=IMYFoundation_7.7.4.2_log" -F "file=@bin-zip/bin_IMYFoundation_7.7.4.2.zip"
48
49
  def curl_framework
49
50
 
50
- zip_file = "#{CBin::Config::Builder.instance.zip_dir}/#{@spec.name}.framework.zip"
51
+ zip_file = "#{CBin::Config::Builder.instance.zip_dir}/#{@spec.name}.xcframework.zip"
51
52
  res = File.exist?(zip_file)
52
53
  if res
53
54
  command = "curl #{CBin.config.bin_upload_url} -F \"frameworkName=#{@spec.name}\" -F \"version=#{@spec.version}\" -F \"changelog=#{@spec.name}_#{@spec.version}_log\" -F \"framework=@#{zip_file}\""
@@ -119,8 +119,14 @@ module Pod
119
119
  sources_manager = Config.instance.sources_manager
120
120
  use_source_pods = podfile.use_source_pods
121
121
 
122
+ # 所有库的个数
123
+ all_spec_count = 0
124
+
122
125
  missing_binary_specs = []
123
126
  specs_by_target.each do |target, rspecs|
127
+
128
+ all_spec_count = all_spec_count + rspecs.count
129
+
124
130
  # use_binaries 并且 use_source_pods 不包含 本地可过滤
125
131
  use_binary_rspecs = if podfile.use_binaries? || podfile.use_binaries_selector
126
132
  rspecs.select do |rspec|
@@ -222,7 +228,7 @@ module Pod
222
228
  end
223
229
  next if spec_git_res
224
230
 
225
- #获取没有制作二进制版本的spec集合
231
+ # 获取没有制作二进制版本的spec集合
226
232
  sources_sepc << spec
227
233
  unless spec.defined_in_file.nil?
228
234
  FileUtils.cp("#{spec.defined_in_file}", "#{des_dir}")
@@ -230,6 +236,10 @@ module Pod
230
236
  end
231
237
  end
232
238
 
239
+ # 二进制库的个数
240
+ bin_spec_count = all_spec_count - sources_sepc.count
241
+ UI.message "组件二进制化比例 #{bin_spec_count}/#{all_spec_count}"
242
+
233
243
  specs_by_target
234
244
  end
235
245
  end
@@ -13,28 +13,70 @@ module Pod
13
13
  #
14
14
  # Perform analysis for a given spec (or subspec)
15
15
  #
16
- def perform_extensive_analysis(spec)
17
- return true
18
- end
16
+ # def perform_extensive_analysis(spec)
17
+ # return true
18
+ # end
19
19
 
20
20
  #覆盖
21
- def check_file_patterns
22
- FILE_PATTERNS.each do |attr_name|
23
- next if %i(source_files resources).include? attr_name
24
- if respond_to?("_validate_#{attr_name}", true)
25
- send("_validate_#{attr_name}")
26
- else
27
- validate_nonempty_patterns(attr_name, :error)
21
+ # def check_file_patterns
22
+ # FILE_PATTERNS.each do |attr_name|
23
+ # next if %i(source_files resources).include? attr_name
24
+ # if respond_to?("_validate_#{attr_name}", true)
25
+ # send("_validate_#{attr_name}")
26
+ # else
27
+ # validate_nonempty_patterns(attr_name, :error)
28
+ # end
29
+ # end
30
+ #
31
+ # _validate_header_mappings_dir
32
+ # if consumer.spec.root?
33
+ # _validate_license
34
+ # _validate_module_map
35
+ # end
36
+ # end
37
+
38
+ # def validate_source_url(spec); end
39
+
40
+ # 修改 验证 build 时的 ARCHS 配置
41
+ def xcodebuild(action, scheme, configuration, deployment_target:)
42
+ require 'fourflusher'
43
+ command = %W(clean #{action} -workspace #{File.join(validation_dir, 'App.xcworkspace')} -scheme #{scheme} -configuration #{configuration})
44
+ case consumer.platform_name
45
+ when :osx, :macos
46
+ command += %w(CODE_SIGN_IDENTITY=)
47
+ when :ios
48
+ command += %w(CODE_SIGN_IDENTITY=- -sdk iphonesimulator)
49
+ command += Fourflusher::SimControl.new.destination(:oldest, 'iOS', deployment_target)
50
+ command += %w(ARCHS=x86_64)
51
+ xcconfig = consumer.pod_target_xcconfig
52
+ if xcconfig
53
+ archs = xcconfig['VALID_ARCHS']
54
+ if archs && (archs.include? 'armv7') && !(archs.include? 'i386') && (archs.include? 'x86_64')
55
+ # Prevent Xcodebuild from testing the non-existent i386 simulator if armv7 is specified without i386
56
+ command += %w(ARCHS=x86_64)
28
57
  end
58
+ end
59
+ when :watchos
60
+ command += %w(CODE_SIGN_IDENTITY=- -sdk watchsimulator)
61
+ command += Fourflusher::SimControl.new.destination(:oldest, 'watchOS', deployment_target)
62
+ when :tvos
63
+ command += %w(CODE_SIGN_IDENTITY=- -sdk appletvsimulator)
64
+ command += Fourflusher::SimControl.new.destination(:oldest, 'tvOS', deployment_target)
65
+ end
66
+
67
+ if analyze
68
+ command += %w(CLANG_ANALYZER_OUTPUT=html CLANG_ANALYZER_OUTPUT_DIR=analyzer)
29
69
  end
30
70
 
31
- _validate_header_mappings_dir
32
- if consumer.spec.root?
33
- _validate_license
34
- _validate_module_map
71
+ begin
72
+ _xcodebuild(command, true)
73
+ rescue => e
74
+ message = 'Returned an unsuccessful exit code.'
75
+ message += ' You can use `--verbose` for more information.' unless config.verbose?
76
+ error('xcodebuild', message)
77
+ e.message
35
78
  end
36
79
  end
37
80
 
38
- def validate_source_url(spec); end
39
81
  end
40
82
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocoapods-tdf-bin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.26
4
+ version: 0.0.28
5
5
  platform: ruby
6
6
  authors:
7
7
  - gaijiaofan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-02-07 00:00:00.000000000 Z
11
+ date: 2022-03-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parallel