cocoapods-bb-bin 0.2.4 → 0.2.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 80a611936a4bd31c7b59239796760fb1552400a158bef386aea81b6d87d8f59a
4
- data.tar.gz: d70c00af4815949f0aedbd840ff314e39800226eb350af19f67254d2e1285665
3
+ metadata.gz: 76f2ce8fcc1062dc2abe81a8284f8eedce188b1aa9e0bf2990d9b7d8a76fc0dc
4
+ data.tar.gz: 36824c60a9c04f42d860cd4207f0f05edc8a226971dab512fa4a476721db0468
5
5
  SHA512:
6
- metadata.gz: 1b58054947bc411400d6f01b72838b4538ad0422a8c9350ebbd670a84d936aef5605728d785c587a3435f03c58a5ba8960e06e0ca22d6fe5bfb6541183d3bb19
7
- data.tar.gz: 8d9b7e5f68be76954d5f358fc78ca0c43e726f5124ccc826ae6dd34dc7b05a3cab26c26fc656e35148c24297e770efcb31a95f8bce85d6798dfb6bf88cbaf5c0
6
+ metadata.gz: 5e57f12db8d797fa85238c9b3b4671a75d4d627e4bdb851d709f7fae67458ccbd757c06f2fd7cbbaee64d0041f80eb915644da0b16b2621b6a950fb513de136c
7
+ data.tar.gz: 0d744031084e801efe7c4c2f5d252abf35504ab36e065543223f350b51b4b3eadc7946f28d8afebe7e2400c8c3d72ee6fbcb36280ecfd1f0176bb8a219637a69
data/README.md CHANGED
@@ -19,6 +19,7 @@
19
19
  6. **支持 使用与不使用 use_frameworks!**
20
20
  7. **少数支持swift项目二进制化编译的开源项目之一**
21
21
  8. 静态库支持.a、.framework、.xcframework
22
+ 9. 动态库支持.xcframework
22
23
 
23
24
 
24
25
  关于 插件具体的架构部署实践和更详细的资源,可以参考
@@ -47,7 +48,8 @@
47
48
  ## Usage
48
49
  $ pod bin auto [NAME.podspec] # 根据use_frameworks判断生成.a还是.framework
49
50
  $ pod bin auto [NAME.podspec] --framework-output # 生成framework文件
50
- $ pod bin auto [NAME.podspec] --xcframework-output # 生成xcframework文件
51
+ $ pod bin auto [NAME.podspec] --xcframework-output # 生成静态xcframework文件
52
+ $ pod bin auto [NAME.podspec] --xcframework-dylib-output # 生成动态xcframework文件
51
53
  更多请看
52
54
  $pod bin auto --help
53
55
 
@@ -29,7 +29,9 @@ module Pod
29
29
  ['--no-clean', '保留构建中间产物'],
30
30
  ['--sources', '私有源地址,多个用分号区分'],
31
31
  ['--framework-output', '输出framework文件'],
32
- ['--xcframework-output', '输出xcframework文件'],
32
+ ['--xcframework-output', '输出静态xcframework文件'],
33
+ ['--xcframework-dylib-output', '输出动态xcframework文件'],
34
+ ['--support_maccatalyst', '输出xcframework文件是否支持Mac Catalyst'],
33
35
  ['--no-zip', '不压缩静态库 为 zip'],
34
36
  ['--configuration', 'Build the specified configuration (e.g. Debug). Defaults to Release'],
35
37
  ['--env', "该组件上传的环境 %w[dev debug_iphoneos release_iphoneos]"]
@@ -48,6 +50,8 @@ module Pod
48
50
  @code_dependencies = argv.flag?('code-dependencies')
49
51
  @framework_output = argv.flag?('framework-output', false )
50
52
  @xcframework_output = argv.flag?('xcframework-output', false )
53
+ @xcframework_dylib_output = argv.flag?('xcframework-dylib-output', false )
54
+ @support_maccatalyst = argv.flag?('support_maccatalyst', false )
51
55
  @clean = argv.flag?('no-clean', false)
52
56
  @zip = argv.flag?('zip', true)
53
57
  @all_make = argv.flag?('all-make', false )
@@ -62,7 +66,7 @@ module Pod
62
66
  @additional_args = argv.remainder!
63
67
  @build_finshed = false
64
68
  @spec_sources = @sources
65
- if @xcframework_output == true
69
+ if @xcframework_output || @xcframework_dylib_output
66
70
  # 生存xcframework优先使用源码仓库\二进制仓库
67
71
  @spec_sources = "#{sources_optionV2(@code_dependencies, nil)},https:\/\/cdn.cocoapods.org"
68
72
  end
@@ -91,6 +95,8 @@ module Pod
91
95
  @platform,
92
96
  @framework_output,
93
97
  @xcframework_output,
98
+ @xcframework_dylib_output,
99
+ @support_maccatalyst,
94
100
  @spec_sources,
95
101
  @zip,
96
102
  @spec,
@@ -133,6 +139,8 @@ module Pod
133
139
  @platform,
134
140
  @framework_output,
135
141
  @xcframework_output,
142
+ @xcframework_dylib_output,
143
+ @support_maccatalyst,
136
144
  @sources,
137
145
  @zip,
138
146
  @spec,
@@ -1,6 +1,7 @@
1
1
 
2
2
  require 'cocoapods-bb-bin/command/bin/auto'
3
3
  require 'cocoapods-bb-bin/helpers/upload_helper'
4
+ require 'cocoapods-bb-bin/native/sources_manager'
4
5
 
5
6
  module Pod
6
7
  class Command
@@ -17,7 +18,9 @@ module Pod
17
18
  ['--allow-prerelease', '允许使用 prerelease 的版本'],
18
19
  ['--no-clean', '保留构建中间产物'],
19
20
  ['--framework-output', '输出framework文件'],
20
- ['--xcframework-output', '输出xcframework文件'],
21
+ ['--xcframework-output', '输出静态xcframework文件'],
22
+ ['--xcframework-dylib-output', '输出动态xcframework文件'],
23
+ ['--support_maccatalyst', '输出xcframework文件是否支持Mac Catalyst'],
21
24
  ['--no-zip', '不压缩静态 framework 为 zip'],
22
25
  ['--all-make', '对该组件的依赖库,全部制作为二进制组件'],
23
26
  ['--configuration', 'Build the specified configuration (e.g. Release ). Defaults to Debug'],
@@ -41,6 +44,8 @@ module Pod
41
44
  @allow_prerelease = argv.flag?('allow-prerelease')
42
45
  @framework_output = argv.flag?('framework-output', false )
43
46
  @xcframework_output = argv.flag?('xcframework-output', false )
47
+ @xcframework_dylib_output = argv.flag?('xcframework-dylib-output', false )
48
+ @support_maccatalyst = argv.flag?('support_maccatalyst', true )
44
49
  @pushsourcespec = argv.flag?('all-push', false )
45
50
  @clean = argv.flag?('clean', true)
46
51
  @zip = argv.flag?('zip', true)
@@ -59,6 +64,15 @@ module Pod
59
64
  end
60
65
 
61
66
  def run
67
+ # 配置二进制库环境,需要区分静态库还是动态库
68
+ if @xcframework_output || @xcframework_dylib_output
69
+ isGenDylib = @xcframework_dylib_output
70
+ sources_manager = Pod::Config.instance.sources_manager
71
+ sources_manager.initLibEnv(isGenDylib)
72
+ source = sources_manager.binary_source
73
+ UI.puts "push run source:#{source}"
74
+ end
75
+
62
76
  @specification = Specification.from_file(@podspec)
63
77
 
64
78
  sources_sepc = run_archive
@@ -66,7 +80,7 @@ module Pod
66
80
  fail_push_specs = []
67
81
  sources_sepc.uniq.each do |spec|
68
82
  begin
69
- fail_push_specs << spec unless CBin::Upload::Helper.new(spec,@code_dependencies,@sources,@pushsourcespec).upload
83
+ fail_push_specs << spec unless CBin::Upload::Helper.new(spec,@code_dependencies,@sources,@pushsourcespec).upload(@xcframework_dylib_output)
70
84
  rescue Object => exception
71
85
  UI.puts exception
72
86
  fail_push_specs << spec
@@ -125,6 +139,12 @@ module Pod
125
139
  if @xcframework_output
126
140
  argvs += ['--xcframework-output']
127
141
  end
142
+ if @xcframework_dylib_output
143
+ argvs += ['--xcframework-dylib-output']
144
+ end
145
+ if @support_maccatalyst
146
+ argvs += ['--support_maccatalyst']
147
+ end
128
148
  if @all_make
129
149
  argvs += ['--all-make']
130
150
  end
@@ -19,7 +19,8 @@ module Pod
19
19
 
20
20
  def self.options
21
21
  [
22
- ['--binary', '发布组件的二进制版本'],
22
+ ['--binary', '发布组件的二进制库版本'],
23
+ ['--dylib', '是否生成动态库,默认生成静态库'],
23
24
  ['--template-podspec=A.binary-template.podspec', '生成拥有 subspec 的二进制 spec 需要的模版 podspec, 插件会更改 version 和 source'],
24
25
  ['--reserve-created-spec', '保留生成的二进制 spec 文件'],
25
26
  ['--code-dependencies', '使用源码依赖进行 lint'],
@@ -34,6 +35,7 @@ module Pod
34
35
  @repo = argv.shift_argument
35
36
  @podspec = argv.shift_argument
36
37
  @binary = argv.flag?('binary')
38
+ @dylib = argv.flag?('dylib', false)
37
39
  @loose_options = argv.flag?('loose-options')
38
40
  @code_dependencies = argv.flag?('code-dependencies', true)
39
41
  @sources = argv.option('sources') || []
@@ -97,6 +97,8 @@ module Pod
97
97
  @platform,
98
98
  false,
99
99
  false,
100
+ false,
101
+ false,
100
102
  @sources,
101
103
  true,
102
104
  @spec,
@@ -13,7 +13,8 @@ module CBin
13
13
  {
14
14
  'configuration_env' => { description: '编译环境', default: 'dev', selection: %w[dev debug_iphoneos release_iphoneos] },
15
15
  'code_repo_url' => { description: '源码私有源 Git 地址', default: 'https://github.com/CocoaPods/Specs.git' },
16
- 'binary_repo_url' => { description: '二进制私有源 Git 地址', default: 'https://github.com/CocoaPods/Specs.git' },
16
+ 'binary_repo_url' => { description: '二进制静态库私有源 Git 地址', default: 'https://github.com/CocoaPods/Specs.git' },
17
+ 'dylib_repo_url' => { description: '动态链接库私有源 Git 地址', default: 'https://github.com/CocoaPods/Specs.git' },
17
18
  'binary_download_url' => { description: '二进制下载地址,内部会依次传入组件名称与版本,替换字符串中的 %s ', default: 'http://localhost:8080/frameworks/%s/%s/zip' },
18
19
  # 'binary_type' => { description: '二进制打包类型', default: 'framework', selection: %w[framework library] },
19
20
  'download_file_type' => { description: '下载二进制文件类型', default: 'zip', selection: %w[zip tgz tar tbz txz dmg] }
@@ -1,6 +1,6 @@
1
1
 
2
2
  module CBin
3
- VERSION = '0.2.4'
3
+ VERSION = '0.2.6'
4
4
  end
5
5
 
6
6
  module Pod
@@ -19,6 +19,8 @@ module CBin
19
19
  platform,
20
20
  framework_output,
21
21
  xcframework_output,
22
+ xcframework_dylib_output,
23
+ support_maccatalyst,
22
24
  spec_sources,
23
25
  zip,
24
26
  rootSpec,
@@ -32,6 +34,8 @@ module CBin
32
34
  @skip_archive = skip_archive
33
35
  @framework_output = framework_output
34
36
  @xcframework_output = xcframework_output
37
+ @xcframework_dylib_output = xcframework_dylib_output
38
+ @support_maccatalyst = support_maccatalyst
35
39
  @spec_sources = spec_sources
36
40
  @zip = zip
37
41
 
@@ -85,7 +89,7 @@ module CBin
85
89
 
86
90
  # 是否编译xcframework库
87
91
  def is_build_xcframework
88
- if @xcframework_output == true
92
+ if @xcframework_output || @xcframework_dylib_output
89
93
  return true
90
94
  end
91
95
  return false
@@ -94,7 +98,8 @@ module CBin
94
98
  def build_static_xcframework
95
99
  source_dir = Dir.pwd
96
100
  UI.puts "xcframework source_dir=#{source_dir}"
97
- builder = CBin::XCFramework::XCBuilder.new(@spec, @spec_sources)
101
+ isGenDylib = @xcframework_dylib_output
102
+ builder = CBin::XCFramework::XCBuilder.new(@spec, @spec_sources, @support_maccatalyst, isGenDylib)
98
103
  builder.build
99
104
  end
100
105
 
@@ -15,7 +15,7 @@ module CBin
15
15
  end
16
16
 
17
17
  # 上传二进制 podspec
18
- def push_binary_repo(binary_podsepc_json)
18
+ def push_binary_repo(binary_podsepc_json,isGenDylib=false)
19
19
  argvs = [
20
20
  "#{binary_source.name}", # repo
21
21
  "#{binary_podsepc_json}", # spec
@@ -31,6 +31,9 @@ module CBin
31
31
  if @verbose
32
32
  argvs += ['--verbose']
33
33
  end
34
+ if isGenDylib # 生成动态库
35
+ argvs += ['--dylib']
36
+ end
34
37
  Pod::UI.message "上传二进制 argvs: #{argvs}"
35
38
  push = Pod::Command::Bin::Repo::Push.new(CLAide::ARGV.new(argvs))
36
39
  push.validate!
@@ -22,7 +22,7 @@ module CBin
22
22
  @pushsourcespec = pushsourcespec # 推送源码
23
23
  end
24
24
 
25
- def upload
25
+ def upload(isGenDylib=false)
26
26
  Dir.chdir(CBin::Config::Builder.instance.root_dir) do
27
27
  # 创建binary-template.podsepc
28
28
  # 上传二进制文件
@@ -30,9 +30,9 @@ module CBin
30
30
  res_zip = curl_zip
31
31
  if res_zip
32
32
  filename = spec_creator
33
- Pod::UI.message "上传二进制 podspec: #{filename}"
33
+ Pod::UI.message "上传二进制 podspec: #{filename} 是否动态库: #{isGenDylib}"
34
34
  push_helper = CBin::Push::Helper.new()
35
- push_helper.push_binary_repo(filename)
35
+ push_helper.push_binary_repo(filename,isGenDylib)
36
36
  # 上传源码 podspec
37
37
  if @pushsourcespec
38
38
  Pod::UI.message "上传源码 podspec: #{@spec_creator.sourceSpecFilePath}"
@@ -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)
17
+ def initialize(spec,spec_sources, support_maccatalyst=false,isGenDylib=false)
18
18
  @spec = spec
19
19
  @spec_sources = spec_sources.split(',') unless spec_sources.nil?
20
20
  @name = "#{@spec.name}.podspec"
@@ -26,18 +26,19 @@ module CBin
26
26
  @use_static_library = true
27
27
  @enable_bitcode = false
28
28
  @symbols = true
29
- @support_maccatalyst = false # 默认不再支持MacCatalyst方式支持iOS应用在mac平台运行库生成
29
+ @support_maccatalyst = support_maccatalyst # 默认不再支持MacCatalyst方式支持iOS应用在mac平台运行库生成
30
+ @support_dynamic = isGenDylib
30
31
 
31
32
  target_dir = "#{Dir.pwd}/#{@spec.name}-#{@spec.version}"
32
- UI.puts "build initialize...#{spec} target_dir:#{target_dir}"
33
+ UI.puts "build initialize...#{spec} target_dir:#{target_dir} 是否支持Mac Catalyst:#{support_maccatalyst} 是否生成动态库:#{isGenDylib}"
33
34
  UI.puts "spec_sources:#{spec_sources}"
34
35
  UI.puts "spec_sources:#{@spec_sources}"
35
36
  end
36
37
 
37
38
  def build
38
- UI.section("Building static xcframework #{@spec}") do
39
+ UI.section("Building xcframework #{@spec} 是否生成动态库:#{@support_dynamic}") do
39
40
  config.static_library_enable = @use_static_library # 一定要配置 true,否则调用xcframework生成命令无效
40
- frameworker = Frameworker.new(@name, @source, @spec_sources, @subspecs, @configuration, @force, @use_modular_headers, @enable_bitcode, @symbols, @support_maccatalyst)
41
+ frameworker = Frameworker.new(@name, @source, @spec_sources, @subspecs, @configuration, @force, @use_modular_headers, @enable_bitcode, @symbols, @support_maccatalyst, @support_dynamic)
41
42
  frameworker.run
42
43
  # 拷贝
43
44
  cp_to_source_dir
@@ -6,14 +6,23 @@ require 'cocoapods-bb-bin/config/config'
6
6
  module Pod
7
7
  class Source
8
8
  class Manager
9
+
10
+ def initLibEnv(isGenDylib=false)
11
+ @dylib = isGenDylib
12
+ end
13
+
9
14
  # 源码 source
10
15
  def code_source
11
16
  source_with_name_or_url(CBin.config.code_repo_url)
12
17
  end
13
18
 
14
- # 二进制 source
19
+ # 二进制 source (区分动态库还是静态库)
15
20
  def binary_source
16
- source_with_name_or_url(CBin.config.binary_repo_url)
21
+ if @dylib # 动态库
22
+ source_with_name_or_url(CBin.config.dylib_repo_url)
23
+ else # 静态库
24
+ source_with_name_or_url(CBin.config.binary_repo_url)
25
+ end
17
26
  end
18
27
  end
19
28
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocoapods-bb-bin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - humin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-03-27 00:00:00.000000000 Z
11
+ date: 2023-07-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parallel
@@ -70,7 +70,7 @@ dependencies:
70
70
  requirements:
71
71
  - - ">="
72
72
  - !ruby/object:Gem::Version
73
- version: 0.2.4
73
+ version: 0.2.6
74
74
  - - "<"
75
75
  - !ruby/object:Gem::Version
76
76
  version: '1.0'
@@ -80,7 +80,7 @@ dependencies:
80
80
  requirements:
81
81
  - - ">="
82
82
  - !ruby/object:Gem::Version
83
- version: 0.2.4
83
+ version: 0.2.6
84
84
  - - "<"
85
85
  - !ruby/object:Gem::Version
86
86
  version: '1.0'
@@ -205,7 +205,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
205
205
  - !ruby/object:Gem::Version
206
206
  version: '0'
207
207
  requirements: []
208
- rubygems_version: 3.4.9
208
+ rubygems_version: 3.4.16
209
209
  signing_key:
210
210
  specification_version: 4
211
211
  summary: cocoapods-bb-bin is a plugin which helps develpers switching pods between