cocoapods-bb-bin 0.2.11.3 → 0.2.12.1

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: 2557c0e6e4b07fa15768d1876528509d5bbb917503c7d63bb41118c78471bafb
4
- data.tar.gz: cbb51d63b2e18c2725a3b1c807c5cb1c2417663c7e4e0e5780fcc15c4d78ff80
3
+ metadata.gz: 4d5c9dc9c33f4245e030d715d55e309678e375521e83a8259f45f036a3a3f088
4
+ data.tar.gz: e95605db07c04677b8fa12a7b8d370d6c43111de70a6756166b2a32f650e410e
5
5
  SHA512:
6
- metadata.gz: c514d24c75bdc9f09c890bdd40f9bdb7ab04c99582bcdf820cde95dd6745e7c0003b4a1aa85ab3cbf95c0f891a647bec9be194139e9573ec5e81d0d0a7297645
7
- data.tar.gz: 926e17d5de987e55b02b4a6ec7a1204af17a7ba302332c44481b1a1ae0b457ae47debfb421596f2f1711b56d522842e6e6c8c67d0471d284a61f7368ee9a5404
6
+ metadata.gz: '0389e757366131fd5f070d95f1e840e98aa15a9c024452837f094674e0d4b8c37198da28ed833be87f9bf41c9f96151c6f9ee65b44b46014ba12eb903c017d12'
7
+ data.tar.gz: 6e68f0bf5a61cc3527faf825be323c26c03f248a1afda1d84a06a43bd8331e5cfb3069a7edbe31d88819ab05c720b1d61125ebc7abaf76880f6b34f6a15b6cbb
@@ -90,6 +90,13 @@ module Pod
90
90
  return sources_sepc
91
91
  end
92
92
 
93
+ def build_workspace
94
+ worksppace_path = File.expand_path("#{CBin::Config::Builder.instance.gen_dir}/#{@spec.name}")
95
+ path = File.join(worksppace_path, "#{@spec.name}.xcworkspace")
96
+ raise Informative, "#{path} File no exist, please check" unless File.exist?(path)
97
+ return path
98
+ end
99
+
93
100
  def build_root_spec
94
101
  builder = CBin::Build::Helper.new(@spec,
95
102
  @platform,
@@ -101,7 +108,8 @@ module Pod
101
108
  @zip,
102
109
  @spec,
103
110
  CBin::Config::Builder.instance.white_pod_list.include?(@spec.name),
104
- @config)
111
+ @config,
112
+ build_workspace)
105
113
  builder.build
106
114
  builder.clean_workspace if @clean && !@all_make
107
115
  end
@@ -145,7 +153,8 @@ module Pod
145
153
  @zip,
146
154
  @spec,
147
155
  false ,
148
- @config)
156
+ @config,
157
+ build_workspace)
149
158
  builder.build
150
159
  rescue Object => exception
151
160
  UI.puts exception
@@ -188,7 +197,7 @@ module Pod
188
197
  end
189
198
 
190
199
  argvs << spec_file if spec_file
191
- # UI.puts "argvs:#{argvs}"
200
+ UI.puts "generate_project argvs:#{argvs}"
192
201
  gen = Pod::Command::Gen.new(CLAide::ARGV.new(argvs))
193
202
  gen.validate!
194
203
  gen.run
@@ -204,7 +213,7 @@ module Pod
204
213
  raise Informative, "#{path} File no exist, please check" unless File.exist?(path)
205
214
  project = Xcodeproj::Project.open(path)
206
215
  project.build_configurations.each do |x|
207
- x.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = true #设置生成swift inter
216
+ x.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES' #设置生成swift inter
208
217
  end
209
218
  project.save
210
219
  end
@@ -33,7 +33,17 @@ module Pod
33
33
  @simulator = argv.flag?('simulator', false )
34
34
 
35
35
  @config = Pod::Config.instance
36
-
36
+ puts "=== pod bin code initialize begin ===".green
37
+ puts "argv.class: #{argv.class}"
38
+ puts "argv.to_s: #{argv}"
39
+ puts "argv.arguments: #{argv.arguments.inspect}"
40
+ puts "argv.options: #{argv.options.inspect if argv.respond_to?(:options)}"
41
+ puts "argv.flags: #{argv.flags.inspect if argv.respond_to?(:flags)}"
42
+ puts "argv.option('source'): #{argv.option('source').inspect}"
43
+ puts "@codeSource: #{@codeSource.inspect}"
44
+ puts "@names: #{@names.inspect}"
45
+ puts "@list: #{@list}, @clean: #{@clean}, @all_clean: #{@all_clean}, @simulator: #{@simulator}"
46
+ puts "=== pod bin code initialize end ===".green
37
47
  super
38
48
  end
39
49
 
@@ -72,8 +82,13 @@ module Pod
72
82
  raise "找不到 #{lib_file}"
73
83
  end
74
84
  UI.puts "#{lib_file}"
75
-
76
- target_path = @codeSource || download_source(name)
85
+ if @codeSource
86
+ puts "add name:#{name} local path:#{@codeSource}"
87
+ target_path = @codeSource
88
+ else
89
+ puts "add name:#{name} download_source"
90
+ target_path = download_source(name)
91
+ end
77
92
  puts "====add lib_file: #{lib_file} target_path: #{target_path} name: #{name}"
78
93
  link(lib_file,target_path,name)
79
94
  end
@@ -110,7 +125,16 @@ module Pod
110
125
  # 获取external_source 下的仓库
111
126
  # @return spec
112
127
  def fetch_external_source(dependency ,podfile , lockfile, sandbox,use_lockfile_options)
113
- source = ExternalSources.from_dependency(dependency, podfile.defined_in_file, true)
128
+ # CocoaPods 内部会假定 external_source 是 Hash,这里兜底处理 nil 场景
129
+ if dependency.external_source.nil?
130
+ dependency.instance_variable_set(:@external_source, {})
131
+ end
132
+ installation_options = podfile.installation_options
133
+ source = if use_lockfile_options && lockfile && checkout_options = lockfile.checkout_options_for_pod_named(dependency.root_name)
134
+ ExternalSources.from_params(checkout_options, dependency, podfile.defined_in_file, installation_options.clean?)
135
+ else
136
+ ExternalSources.from_dependency(dependency, podfile.defined_in_file, installation_options.clean?)
137
+ end
114
138
  source.fetch(sandbox)
115
139
  end
116
140
 
@@ -124,13 +148,19 @@ module Pod
124
148
  `dwarfdump "#{lib_file}" | grep "AT_comp_dir" | head -1 | cut -d \\" -f2 `
125
149
  EOF
126
150
  dir = (`dwarfdump "#{lib_file}" | grep "AT_comp_dir" | head -1 | cut -d \\" -f2 `)
127
- UI.puts "dwarfdump dir = #{dir}"
151
+ UI.puts "lib_file = #{lib_file}"
152
+ UI.puts "dwarfdump dir = #{dir} type:#{dir.class}"
153
+ if dir.empty?
154
+ msg = "Unknown dwarfdump data for `#{basename}` 请找hm确认,当前组件是否二进制静态库?动态库不支持"
155
+ raise Informative, msg
156
+ end
128
157
  # if Pathname.new(lib_file).extname == ".a"
129
158
  # sub_path = "#{basename}/bin-archive/#{basename}"
130
159
  # else
131
160
  # sub_path = "#{basename}"
132
161
  # end
133
162
  sub_path = "#{basename}/bin-archive/#{basename}"
163
+ UI.puts "sub_path = #{sub_path}"
134
164
  dir = dir.gsub(sub_path, "").chomp
135
165
  UI.puts "Binary dir = #{dir}"
136
166
 
@@ -215,9 +245,9 @@ EOF
215
245
  # 构建xcframework架构需要根据实际二进制文件进行条件判断
216
246
  arm_name = ""
217
247
  if @simulator
218
- arm_name = "ios-arm64_i386_x86_64-simulator"
248
+ arm_name = "ios-arm64_x86_64-simulator" #"ios-arm64_i386_x86_64-simulator"
219
249
  else
220
- arm_name = "ios-arm64_armv7"
250
+ arm_name = "ios-arm64" #"ios-arm64_armv7"
221
251
  end
222
252
  temp_name = "#{arm_name}/#{name}.framework/#{name}"
223
253
  return File.join(filepath,temp_name) # TYSecKit.xcframework/ios-arm64_armv7/TYSecKit.framework/TYSecKit
@@ -116,7 +116,7 @@ module Pod
116
116
  raise Informative, "#{path} File no exist, please check" unless File.exist?(path)
117
117
  project = Xcodeproj::Project.open(path)
118
118
  project.build_configurations.each do |x|
119
- x.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = true #设置生成swift inter
119
+ x.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES' #设置生成swift inter
120
120
  end
121
121
  project.save
122
122
  end
@@ -1,7 +1,7 @@
1
1
  require 'cocoapods'
2
2
 
3
3
  module CBin
4
- VERSION = '0.2.11.3'
4
+ VERSION = '0.2.12.1'
5
5
  end
6
6
 
7
7
  module Pod
@@ -25,7 +25,8 @@ module CBin
25
25
  zip,
26
26
  rootSpec,
27
27
  skip_archive = false,
28
- build_model="Release")
28
+ build_model="Release",
29
+ workspace=nil)
29
30
  @spec = spec
30
31
  @platform = platform
31
32
  @build_model = build_model
@@ -38,10 +39,11 @@ module CBin
38
39
  @support_maccatalyst = support_maccatalyst
39
40
  @spec_sources = spec_sources
40
41
  @zip = zip
42
+ @workspace = workspace
41
43
 
42
44
  @framework_path
43
45
 
44
- UI.puts "build initialize...#{spec}"
46
+ UI.puts "build initialize...#{spec} rootSpec:#{rootSpec} build_model:#{build_model} workspace:#{workspace}"
45
47
  end
46
48
 
47
49
  # build framework
@@ -97,9 +99,9 @@ module CBin
97
99
  # build xcframework
98
100
  def build_static_xcframework
99
101
  source_dir = Dir.pwd
100
- UI.puts "xcframework source_dir=#{source_dir}"
102
+ UI.puts "xcframework source_dir=#{source_dir} workspace:#{@workspace}"
101
103
  isGenDylib = @xcframework_dylib_output
102
- builder = CBin::XCFramework::XCBuilder.new(@spec, @spec_sources, @support_maccatalyst, isGenDylib)
104
+ builder = CBin::XCFramework::XCBuilder.new(@spec, @spec_sources, @support_maccatalyst, isGenDylib, @workspace)
103
105
  builder.build
104
106
  end
105
107
 
@@ -9,9 +9,21 @@ module CBin
9
9
  attr_reader :code_spec
10
10
  attr_reader :spec
11
11
 
12
- def initialize(code_spec, platforms = 'ios')
12
+ def initialize(code_spec, platforms = nil) #'ios')
13
13
  @code_spec = code_spec
14
- @platforms = Array(platforms)
14
+ if platforms.nil? || Array(platforms).empty?
15
+ spec_hash = code_spec.to_hash
16
+ if spec_hash['platforms']
17
+ @platforms = spec_hash['platforms'].keys
18
+ elsif spec_hash['platform']
19
+ @platforms = [spec_hash['platform']]
20
+ else
21
+ @platforms = ['ios']
22
+ end
23
+ else
24
+ @platforms = Array(platforms).map(&:to_s)
25
+ end
26
+ puts "@platforms:#{@platforms}"
15
27
  validate!
16
28
  end
17
29
 
@@ -209,6 +221,8 @@ module CBin
209
221
  selected_platforms = platforms.select { |k, _v| @platforms.include?(k) }
210
222
  spec_hash['platforms'] = selected_platforms.empty? ? platforms : selected_platforms
211
223
 
224
+ puts "spec_hash:#{spec_hash}".yellow
225
+
212
226
  @spec = Pod::Specification.from_hash(spec_hash)
213
227
  @spec.description = <<-EOF
214
228
  converted automatically by plugin optimization
@@ -14,7 +14,7 @@ module CBin
14
14
  class XCBuilder
15
15
  include Pod
16
16
  include Pod::Config::Mixin
17
- def initialize(spec,spec_sources, support_maccatalyst=false,isGenDylib=false)
17
+ def initialize(spec, spec_sources, support_maccatalyst=false, isGenDylib=false, workspace=nil)
18
18
  @spec = spec
19
19
  @spec_sources = spec_sources.split(',') unless spec_sources.nil?
20
20
  @name = "#{@spec.name}.podspec"
@@ -28,23 +28,64 @@ module CBin
28
28
  @symbols = true
29
29
  @support_maccatalyst = support_maccatalyst # 默认不再支持MacCatalyst方式支持iOS应用在mac平台运行库生成
30
30
  @support_dynamic = isGenDylib
31
+ @workspace = workspace
31
32
 
32
33
  target_dir = "#{Dir.pwd}/#{@spec.name}-#{@spec.version}"
33
- UI.puts "build initialize...#{spec} target_dir:#{target_dir} 是否支持Mac Catalyst:#{support_maccatalyst} 是否生成动态库:#{isGenDylib}"
34
- UI.puts "spec_sources:#{spec_sources}"
35
- UI.puts "spec_sources:#{@spec_sources}"
34
+ UI.puts "build initialize...#{spec} spec_sources:#{spec_sources} target_dir:#{target_dir} 是否支持Mac Catalyst:#{support_maccatalyst} 是否生成动态库:#{isGenDylib} workspace:#{workspace}"
36
35
  end
37
36
 
38
37
  def build
39
38
  UI.section("Building xcframework #{@spec} 是否生成动态库:#{@support_dynamic}") do
40
39
  config.static_library_enable = @use_static_library # 一定要配置 true,否则调用xcframework生成命令无效
41
- frameworker = Frameworker.new(@name, @source, @spec_sources, @subspecs, @configuration, @force, @use_modular_headers, @enable_bitcode, @symbols, @support_maccatalyst, @support_dynamic)
42
- frameworker.run
40
+ # 废弃,run_xcframework替代实现
41
+ # frameworker = Frameworker.new(@name, @source, @spec_sources, @subspecs, @configuration, @force, @use_modular_headers, @enable_bitcode, @symbols, @support_maccatalyst, @support_dynamic)
42
+ # frameworker.run
43
+ # 生成二进制产物 by hm 26/2/4
44
+ run_xcframework
43
45
  # 拷贝
44
46
  cp_to_source_dir
45
47
  end
46
48
  end
47
49
 
50
+ def run_xcframework
51
+ spec_sources_str = if @spec_sources.is_a?(Array)
52
+ @spec_sources.join(',')
53
+ else
54
+ @spec_sources.to_s
55
+ end
56
+ argvs = [
57
+ "#{@name}", # name
58
+ "#{@source}", # spec
59
+ "--spec-sources=#{spec_sources_str}",
60
+ "--subspecs=#{@subspecs}",
61
+ "--configuration=#{@configuration}",
62
+ "--use-modular-headers=#{@use_modular_headers}",
63
+ "--archive-export", # 默认archive导出dylib
64
+ # "--no-archive-export",
65
+ "--workspace=#{@workspace}",
66
+ ]
67
+ if @force
68
+ argvs += ['--force']
69
+ end
70
+ if @enable_bitcode
71
+ argvs += ['--enable-bitcode']
72
+ end
73
+ if @symbols
74
+ argvs += ['--symbols']
75
+ end
76
+ if @support_maccatalyst
77
+ argvs += ['--support-maccatalyst']
78
+ end
79
+ if @support_dynamic
80
+ argvs += ['--support-dynamic']
81
+ end
82
+ puts "make xcframework argvs: #{argvs}".yellow
83
+ archive = Pod::Command::Bin::XCFramework.new(CLAide::ARGV.new(argvs))
84
+ archive.validate!
85
+ sources_sepc = archive.run
86
+ return sources_sepc
87
+ end
88
+
48
89
  private
49
90
 
50
91
  def framework_folder_path
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocoapods-bb-bin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.11.3
4
+ version: 0.2.12.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - humin
@@ -83,7 +83,7 @@ dependencies:
83
83
  requirements:
84
84
  - - ">="
85
85
  - !ruby/object:Gem::Version
86
- version: 0.2.6.4
86
+ version: 0.2.7.3
87
87
  - - "<"
88
88
  - !ruby/object:Gem::Version
89
89
  version: '1.0'
@@ -93,7 +93,7 @@ dependencies:
93
93
  requirements:
94
94
  - - ">="
95
95
  - !ruby/object:Gem::Version
96
- version: 0.2.6.4
96
+ version: 0.2.7.3
97
97
  - - "<"
98
98
  - !ruby/object:Gem::Version
99
99
  version: '1.0'
@@ -218,7 +218,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
218
218
  - !ruby/object:Gem::Version
219
219
  version: '0'
220
220
  requirements: []
221
- rubygems_version: 3.7.2
221
+ rubygems_version: 4.0.13
222
222
  specification_version: 4
223
223
  summary: cocoapods-bb-bin is a plugin which helps develpers switching pods between
224
224
  source code and binary.