cocoapods-mtxx-bin 0.0.7 → 0.0.8

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: df7e5b2628a85abdfb8c632ce10affd45eceef978f17030cc8fa587a55937052
4
- data.tar.gz: 8ce6a4a89a75c32075f406d9ec8c929eac12b9b3b63e114f61b37ab56112a576
3
+ metadata.gz: 00c25aad1e1bb13ef8c88e50faf60801931532128a902ab72d40415c6f74809f
4
+ data.tar.gz: 59e39e2c15ea57d12940f89dc13760155a663aeb22ed7077bb6bcc8e0d4c7e43
5
5
  SHA512:
6
- metadata.gz: 6bb9deccb62a75ca54db13fb02f2b1c43b0a0cd5f945fd18bcfd34858b1a16c35df4d4214f5942dd1480fe9bfae9035687989db60c53e1d000ebc51654749491
7
- data.tar.gz: dff8ecc36300ffd1e885d1f968f43276a9c055b24fb8dc791b4d568ac985928e468ae2e46d198d1589bfabf17fc0f390557ee083b3377de10e5a34b08d263de2
6
+ metadata.gz: b6f9e5f92d9a260f67fe3f94ecd695314fcb523defdb9d407a5398be6984c2d1d672cc7a54e47c0d031ee158d91075c8da5a6cc27a9d53c1588fc1cc5a6f639d
7
+ data.tar.gz: 3c678a0494d56ac065707adb58470f33ac94590087b9b2957fd901e23dfd1bcd589214ef42ce5df285ed2511d11af1481202f211faffa4628ac5a39f5a42a072
@@ -19,7 +19,7 @@ module Pod
19
19
 
20
20
  self.summary = '根据壳工程打包所有依赖组件为静态库(static framework)'
21
21
  self.description = <<-DESC
22
- #{self.summary}
22
+ #{summary}
23
23
  DESC
24
24
 
25
25
  def self.options
@@ -31,9 +31,9 @@ module Pod
31
31
  end
32
32
 
33
33
  def initialize(argv)
34
- @clean = argv.flag?('clean', false )
35
- @repo_update = argv.flag?('repo-update', false )
36
- @full_build = argv.flag?('full-build', false )
34
+ @clean = argv.flag?('clean', false)
35
+ @repo_update = argv.flag?('repo-update', false)
36
+ @full_build = argv.flag?('full-build', false)
37
37
  @base_dir = "#{Pathname.pwd}/build_pods"
38
38
  super
39
39
  end
@@ -71,10 +71,10 @@ module Pod
71
71
 
72
72
  # 读取配置文件
73
73
  def read_config
74
- UI.title "Read config from file `BinConfig.yaml`".green do
74
+ UI.title 'Read config from file `BinConfig.yaml`'.green do
75
75
  config_file = File.join(CBin.config.binary_dir, 'BinConfig.yaml')
76
76
  return unless File.exist?(config_file)
77
- config = YAML.load(File.open(config_file))
77
+ config = YAML.safe_load(File.open(config_file))
78
78
  return if config.nil?
79
79
  build_config = config['build_config']
80
80
  return if build_config.nil?
@@ -87,38 +87,44 @@ module Pod
87
87
 
88
88
  # 更新repo仓库
89
89
  def repo_update
90
- UI.title "Repo update".green do
91
- return if podfile.nil?
92
- sources_manager = Pod::Config.instance.sources_manager
93
- podfile.sources.uniq.map { |src|
94
- # next if src.include?(CDN) || src.include?(MASTER_HTTP) || src.include?(MASTER_SSH)
95
- next unless src.include?(MT_REPO)
96
- UI.message "Update repo: #{src}"
97
- source = sources_manager.source_with_name_or_url(src)
98
- source.update(false )
99
- }
100
- end if @repo_update
90
+ if @repo_update
91
+ UI.title 'Repo update'.green do
92
+ return if podfile.nil?
93
+ sources_manager = Pod::Config.instance.sources_manager
94
+ podfile.sources.uniq.map do |src|
95
+ # next if src.include?(CDN) || src.include?(MASTER_HTTP) || src.include?(MASTER_SSH)
96
+ next unless src.include?(MT_REPO)
97
+ UI.message "Update repo: #{src}"
98
+ source = sources_manager.source_with_name_or_url(src)
99
+ source.update(false)
100
+ end
101
+ end
102
+ end
101
103
  end
102
104
 
103
105
  # 执行pre build
104
106
  def pre_build
105
- UI.title "Execute the command of pre build".green do
106
- system(@pre_build)
107
- end if @pre_build
107
+ if @pre_build
108
+ UI.title 'Execute the command of pre build'.green do
109
+ system(@pre_build)
110
+ end
111
+ end
108
112
  end
109
113
 
110
114
  # 执行post build
111
- def post_build(results)
112
- UI.title "Execute the command of post build".green do
113
- system(@post_build)
114
- end if @post_build
115
+ def post_build(_results)
116
+ if @post_build
117
+ UI.title 'Execute the command of post build'.green do
118
+ system(@post_build)
119
+ end
120
+ end
115
121
  end
116
122
 
117
123
  # 获取 podfile
118
124
  def podfile
119
125
  @podfile ||= begin
120
- podfile_path = File.join(Pathname.pwd,"Podfile")
121
- raise "Podfile不存在" unless File.exist?(podfile_path)
126
+ podfile_path = File.join(Pathname.pwd, 'Podfile')
127
+ raise 'Podfile不存在' unless File.exist?(podfile_path)
122
128
  sources_manager = Pod::Config.instance.sources_manager
123
129
  podfile = Podfile.from_file(Pathname.new(podfile_path))
124
130
  podfile_hash = podfile.to_hash
@@ -132,8 +138,8 @@ module Pod
132
138
  # 获取 podfile.lock
133
139
  def lockfile
134
140
  @lockfile ||= begin
135
- lock_path = File.join(Pathname.pwd,"Podfile.lock")
136
- raise "Podfile.lock不存在,请执行pod install" unless File.exist?(lock_path)
141
+ lock_path = File.join(Pathname.pwd, 'Podfile.lock')
142
+ raise 'Podfile.lock不存在,请执行pod install' unless File.exist?(lock_path)
137
143
  Lockfile.from_file(Pathname.new(lock_path))
138
144
  end
139
145
  end
@@ -141,30 +147,30 @@ module Pod
141
147
  # 获取 sandbox
142
148
  def sandbox
143
149
  @sandbox ||= begin
144
- sandbox_path = File.join(Pathname.pwd, "Pods")
145
- raise "Pods文件夹不存在,请执行pod install" unless File.exist?(sandbox_path)
150
+ sandbox_path = File.join(Pathname.pwd, 'Pods')
151
+ raise 'Pods文件夹不存在,请执行pod install' unless File.exist?(sandbox_path)
146
152
  Pod::Sandbox.new(sandbox_path)
147
153
  end
148
154
  end
149
155
 
150
156
  # 根据podfile和podfile.lock分析依赖
151
157
  def analyse
152
- UI.title "Analyze dependencies".green do
158
+ UI.title 'Analyze dependencies'.green do
153
159
  analyzer = Pod::Installer::Analyzer.new(
154
160
  sandbox,
155
161
  podfile,
156
162
  lockfile
157
163
  )
158
- analyzer.analyze(true )
164
+ analyzer.analyze(true)
159
165
  end
160
166
  end
161
167
 
162
168
  # 删除编译产物
163
169
  def clean_build_pods
164
- UI.title "Clean build pods".green do
165
- build_path = Dir.pwd + "/build"
170
+ UI.title 'Clean build pods'.green do
171
+ build_path = Dir.pwd + '/build'
166
172
  FileUtils.rm_rf(build_path) if File.exist?(build_path)
167
- build_pods_path = Dir.pwd + "/build_pods"
173
+ build_pods_path = Dir.pwd + '/build_pods'
168
174
  FileUtils.rm_rf(build_pods_path) if File.exist?(build_pods_path)
169
175
  end
170
176
  end
@@ -269,14 +275,14 @@ module Pod
269
275
 
270
276
  # 展示结果
271
277
  def show_results(results)
272
- UI.title "打包结果:".green do
273
- UI.info "——————————————————————————————————".green
274
- UI.info "|#{"Type".center(20)}|#{"Count".center(11)}|".green
275
- UI.info "——————————————————————————————————".green
278
+ UI.title '打包结果:'.green do
279
+ UI.info '——————————————————————————————————'.green
280
+ UI.info "|#{'Type'.center(20)}|#{'Count'.center(11)}|".green
281
+ UI.info '——————————————————————————————————'.green
276
282
  results.each do |key, value|
277
283
  UI.info "|#{key.center(20)}|#{value.size.to_s.center(11)}|".green
278
284
  end
279
- UI.info "——————————————————————————————————".green
285
+ UI.info '——————————————————————————————————'.green
280
286
 
281
287
  # 打印出失败的 target
282
288
  unless results['Fail'].empty?
@@ -304,7 +310,6 @@ module Pod
304
310
  end
305
311
  result
306
312
  end
307
-
308
313
  end
309
314
  end
310
315
  end
@@ -0,0 +1,141 @@
1
+ require 'cocoapods-mtxx-bin/helpers/buildAll/builder'
2
+ require 'cocoapods-mtxx-bin/helpers/buildAll/podspec_util'
3
+ require 'cocoapods-mtxx-bin/helpers/buildAll/zip_file_helper'
4
+ require 'cocoapods-mtxx-bin/helpers/buildAll/bin_helper'
5
+ require 'cocoapods-mtxx-bin/config/config'
6
+ require 'yaml'
7
+ require 'digest'
8
+
9
+ module Pod
10
+ class Command
11
+ class Bin < Command
12
+ class OutputSource < Bin
13
+ self.summary = '输出各个组件的source源,默认输出全部组件的source'
14
+ self.description = <<-DESC
15
+ #{summary}
16
+ DESC
17
+
18
+ def self.options
19
+ [
20
+ %w[--error-source 过滤异常的source,比如http的,CI打包只支持SSH认证]
21
+ ].concat(super).uniq
22
+ end
23
+
24
+ def initialize(argv)
25
+ @error_source = argv.flag?('error-source', false)
26
+ super
27
+ end
28
+
29
+ def run
30
+ # 开始时间
31
+ @start_time = Time.now.to_i
32
+ # 更新repo仓库
33
+ repo_update
34
+ # 分析依赖
35
+ @analyze_result = analyse
36
+ # 打印source
37
+ show_cost_source
38
+ # 计算耗时
39
+ show_cost_time
40
+ end
41
+
42
+ private
43
+
44
+ # 打印source
45
+ def show_cost_source
46
+ all_source_list = []
47
+ error_source_list = []
48
+ @analyze_result.specifications.each do |specification|
49
+ next if specification.subspec?
50
+ all_source_list << specification.source
51
+ if @error_source && verified_git_address(specification)
52
+ error_source_list << specification.name + ' ' + specification.source[:git] + + ' ' + specification.source[:tag]
53
+ end
54
+ end
55
+ if @error_source
56
+ UI.info '问题组件,source 为http CI打包不支持http认证,应修改为ssh'.red
57
+ UI.info error_source_list.to_s.red
58
+ else
59
+ UI.info '输出所有pod组件source'.green
60
+ UI.info error_source_list.to_s.green
61
+ end
62
+ end
63
+
64
+ # git clone 地址 是否非法
65
+ def verified_git_address(specification)
66
+ return false if specification.source[:git].nil?
67
+ git = specification.source[:git]
68
+ git.include?('http://techgit.meitu.com') || git.include?('https://techgit.meitu.com')
69
+ end
70
+
71
+ # 打印耗时
72
+ def show_cost_time
73
+ return if @start_time.nil?
74
+ UI.info "总耗时:#{Time.now.to_i - @start_time}s".green
75
+ end
76
+
77
+ # 更新repo仓库
78
+ def repo_update
79
+ if @repo_update
80
+ UI.title 'Repo update'.green do
81
+ return if podfile.nil?
82
+ sources_manager = Pod::Config.instance.sources_manager
83
+ podfile.sources.uniq.map do |src|
84
+ # next if src.include?(CDN) || src.include?(MASTER_HTTP) || src.include?(MASTER_SSH)
85
+ next unless src.include?(MT_REPO)
86
+ UI.message "Update repo: #{src}"
87
+ source = sources_manager.source_with_name_or_url(src)
88
+ source.update(false)
89
+ end
90
+ end
91
+ end
92
+ end
93
+
94
+ # 获取 podfile
95
+ def podfile
96
+ @podfile ||= begin
97
+ podfile_path = File.join(Pathname.pwd, 'Podfile')
98
+ raise 'Podfile不存在' unless File.exist?(podfile_path)
99
+ sources_manager = Pod::Config.instance.sources_manager
100
+ podfile = Podfile.from_file(Pathname.new(podfile_path))
101
+ podfile_hash = podfile.to_hash
102
+ podfile_hash['sources'] = (podfile_hash['sources'] || []).concat(sources_manager.code_source_list.map(&:url))
103
+ podfile_hash['sources'] << sources_manager.binary_source.url
104
+ podfile_hash['sources'].uniq!
105
+ Podfile.from_hash(podfile_hash)
106
+ end
107
+ end
108
+
109
+ # 获取 podfile.lock
110
+ def lockfile
111
+ @lockfile ||= begin
112
+ lock_path = File.join(Pathname.pwd, 'Podfile.lock')
113
+ raise 'Podfile.lock不存在,请执行pod install' unless File.exist?(lock_path)
114
+ Lockfile.from_file(Pathname.new(lock_path))
115
+ end
116
+ end
117
+
118
+ # 获取 sandbox
119
+ def sandbox
120
+ @sandbox ||= begin
121
+ sandbox_path = File.join(Pathname.pwd, 'Pods')
122
+ raise 'Pods文件夹不存在,请执行pod install' unless File.exist?(sandbox_path)
123
+ Pod::Sandbox.new(sandbox_path)
124
+ end
125
+ end
126
+
127
+ # 根据podfile和podfile.lock分析依赖
128
+ def analyse
129
+ UI.title 'Analyze dependencies'.green do
130
+ analyzer = Pod::Installer::Analyzer.new(
131
+ sandbox,
132
+ podfile,
133
+ lockfile
134
+ )
135
+ analyzer.analyze(true)
136
+ end
137
+ end
138
+ end
139
+ end
140
+ end
141
+ end
@@ -9,6 +9,7 @@ require 'cocoapods-mtxx-bin/command/bin/install'
9
9
  require 'cocoapods-mtxx-bin/command/bin/repo'
10
10
  require 'cocoapods-mtxx-bin/command/bin/spec'
11
11
  require 'cocoapods-mtxx-bin/command/bin/buildAll'
12
+ require 'cocoapods-mtxx-bin/command/bin/outputSource'
12
13
  require 'cocoapods-mtxx-bin/command/bin/upload'
13
14
  require 'cocoapods-mtxx-bin/helpers'
14
15
  # require 'cocoapods-mtxx-bin/native'
@@ -42,7 +43,7 @@ module Pod
42
43
  self.summary = '组件二进制化插件'
43
44
  self.description = <<-DESC.strip_heredoc
44
45
  组件二进制化插件
45
-
46
+
46
47
  利用源码私有源与二进制私有源实现对组件依赖类型的切换
47
48
  DESC
48
49
 
@@ -1,5 +1,5 @@
1
1
  module CBin
2
- VERSION = "0.0.7"
2
+ VERSION = "0.0.8"
3
3
  end
4
4
 
5
5
  module Pod
@@ -10,6 +10,8 @@ module CBin
10
10
  specs = specifications.map(&:name).select { |spec|
11
11
  spec.include?(pod_name) && !spec.include?('/Binary')
12
12
  }.sort!
13
+ xcode_version = `xcodebuild -version`.split(' ').join('')
14
+ specs << xcode_version
13
15
  specs_str = specs.join('')
14
16
  "#{original_version}.bin#{Digest::MD5.hexdigest(specs_str)[0,6]}"
15
17
  end
@@ -94,12 +94,16 @@ module CBin
94
94
  "#{@base_dir}/#{@pod_target}/Temp"
95
95
  end
96
96
 
97
+ def configuration
98
+ "Debug"
99
+ end
100
+
97
101
  def iphoneos
98
- "Release-iphoneos"
102
+ "#{configuration}-iphoneos"
99
103
  end
100
104
 
101
105
  def iphonesimulator
102
- "Release-iphonesimulator"
106
+ "#{configuration}-iphonesimulator"
103
107
  end
104
108
 
105
109
  # 需要排除的资源文件后缀
@@ -130,7 +134,7 @@ CONFIGURATION_TEMP_DIR=#{temp_dir} \
130
134
  BUILD_ROOT=#{product_dir} \
131
135
  BUILD_DIR=#{product_dir} \
132
136
  clean build \
133
- -configuration Release \
137
+ -configuration #{configuration} \
134
138
  -target #{@pod_target} \
135
139
  -project #{project}
136
140
  BUILD
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocoapods-mtxx-bin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jensen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-05-30 00:00:00.000000000 Z
11
+ date: 2022-06-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parallel
@@ -108,6 +108,7 @@ files:
108
108
  - lib/cocoapods-mtxx-bin/command/bin/initHotKey.rb
109
109
  - lib/cocoapods-mtxx-bin/command/bin/install.rb
110
110
  - lib/cocoapods-mtxx-bin/command/bin/lib/lint.rb
111
+ - lib/cocoapods-mtxx-bin/command/bin/outputSource.rb
111
112
  - lib/cocoapods-mtxx-bin/command/bin/repo.rb
112
113
  - lib/cocoapods-mtxx-bin/command/bin/repo/push.rb
113
114
  - lib/cocoapods-mtxx-bin/command/bin/repo/update.rb