cocoapods-bb-bin 0.2.6.1 → 0.2.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cocoapods-bb-bin/command/bin/auto.rb +1 -1
- data/lib/cocoapods-bb-bin/command/bin/code.rb +1 -1
- data/lib/cocoapods-bb-bin/command/bin/localPush.rb +131 -0
- data/lib/cocoapods-bb-bin/command/bin/tag.rb +1 -1
- data/lib/cocoapods-bb-bin/command/bin.rb +2 -1
- data/lib/cocoapods-bb-bin/gem_version.rb +1 -1
- data/lib/cocoapods-bb-bin/helpers/spec_source_creator.rb +9 -6
- data/lib/cocoapods-bb-bin/helpers/upload_helper.rb +27 -13
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a6d7ed2b021027dcd6f7ce5b5924e6527eae30107123250bff8bba761a5e5ec1
|
4
|
+
data.tar.gz: 9f7db13d3bdaecdf92aa5d41d3aaca05b543745ebcd9a6da729c45b9cfe93033
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 74f02d04acc23dc999f9bad0af3d4bd7c4073a18a7f997be946c025ae742340389d2b27959ac84ac210e59c39975fae353face18d0b9fd6cbc68f55258a7b189
|
7
|
+
data.tar.gz: 379aedee58963ceb87da4de8ac3d83627e00574b8f0a415e9ba3835276a7ec33dbed2489cfe868aa3a99246ee57c5a5348f932e78b3e727424436eecd1e14a4f
|
@@ -4,7 +4,7 @@ module Pod
|
|
4
4
|
class Command
|
5
5
|
class Bin < Command
|
6
6
|
class Code < Bin
|
7
|
-
self.summary = '
|
7
|
+
self.summary = '通过将二进制对应源码放置在临时目录中,让二进制出现断点时可以跳到对应的源码。切换源码调试 pod bin code <组件名称> -—source=<组件本地路径>'
|
8
8
|
|
9
9
|
self.description = <<-DESC
|
10
10
|
通过将二进制对应源码放置在临时目录中,让二进制出现断点时可以跳到对应的源码,方便调试。
|
@@ -0,0 +1,131 @@
|
|
1
|
+
require 'cocoapods-bb-bin/native/podfile'
|
2
|
+
require 'cocoapods/command/gen'
|
3
|
+
require 'cocoapods/generate'
|
4
|
+
require 'xcodeproj'
|
5
|
+
require 'cocoapods-bb-bin/helpers/push_spec_helper'
|
6
|
+
require 'cocoapods-bb-bin/helpers/build_helper'
|
7
|
+
require 'cocoapods-bb-bin/helpers/spec_source_creator'
|
8
|
+
|
9
|
+
module Pod
|
10
|
+
class Command
|
11
|
+
class Bin < Command
|
12
|
+
class LocalPush < Bin
|
13
|
+
self.summary = '本地推送,支持二进制文件上传.'
|
14
|
+
|
15
|
+
self.arguments = [
|
16
|
+
CLAide::Argument.new('NAME.podspec', false)
|
17
|
+
]
|
18
|
+
def self.options
|
19
|
+
[
|
20
|
+
['--sources', '私有源地址,多个用分号区分'],
|
21
|
+
['--path', '(必传)需要上传文件路径'],
|
22
|
+
['--vendored_framework_name', '(可选)组件库依赖framework名称,默认组件名称'],
|
23
|
+
['--dylib', '(可选)是否动态库,默认静态库'],
|
24
|
+
].concat(Pod::Command::Gen.options).concat(super).uniq
|
25
|
+
end
|
26
|
+
|
27
|
+
def initialize(argv)
|
28
|
+
@help = argv.flag?('help', false )
|
29
|
+
if @help
|
30
|
+
else
|
31
|
+
@env = argv.option('env') || 'dev'
|
32
|
+
CBin.config.set_configuration_env(@env)
|
33
|
+
|
34
|
+
@podspec = argv.shift_argument || find_podspec
|
35
|
+
@sources = argv.option('sources') || []
|
36
|
+
@localPath = argv.option('path') || nil
|
37
|
+
@vendored_framework_name = argv.option('vendored_framework_name') || nil
|
38
|
+
@is_dylib = argv.flag?('dylib', false )
|
39
|
+
end
|
40
|
+
super
|
41
|
+
end
|
42
|
+
|
43
|
+
def validate!
|
44
|
+
help! "未找到 podspec文件" unless @podspec
|
45
|
+
super
|
46
|
+
end
|
47
|
+
|
48
|
+
def run
|
49
|
+
# 配置二进制库环境,需要区分静态库还是动态库
|
50
|
+
isGenDylib = @is_dylib
|
51
|
+
sources_manager = Pod::Config.instance.sources_manager
|
52
|
+
sources_manager.initLibEnv(isGenDylib)
|
53
|
+
# 清除之前的缓存
|
54
|
+
CBin::Config::Builder.instance.clean
|
55
|
+
@spec = Specification.from_file(@podspec)
|
56
|
+
# 上传文件
|
57
|
+
localPath = update_uploadpath unless !@localPath
|
58
|
+
if File.file?(localPath)
|
59
|
+
# 生成podspec
|
60
|
+
sources_sepc = Array.new
|
61
|
+
sources_sepc << @spec
|
62
|
+
|
63
|
+
fail_push_specs = []
|
64
|
+
sources_sepc.uniq.each do |spec|
|
65
|
+
begin
|
66
|
+
fail_push_specs << spec unless CBin::Upload::Helper.new(spec,true,@sources,true).upload_binary_file(localPath, @is_dylib, @vendored_framework_name)
|
67
|
+
rescue Object => exception
|
68
|
+
UI.puts exception
|
69
|
+
fail_push_specs << spec
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
if fail_push_specs.any?
|
74
|
+
fail_push_specs.uniq.each do |spec|
|
75
|
+
UI.warn "【#{spec.name} | #{spec.version}】组件spec push失败 ."
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
success_specs = sources_sepc - fail_push_specs
|
80
|
+
if success_specs.any?
|
81
|
+
auto_success = ""
|
82
|
+
success_specs.uniq.each do |spec|
|
83
|
+
auto_success += "#{spec.name} | #{spec.version}\n"
|
84
|
+
UI.warn "===【 #{spec.name} | #{spec.version} 】二进制组件制作完成 !!! "
|
85
|
+
end
|
86
|
+
puts auto_success
|
87
|
+
ENV['auto_success'] = auto_success
|
88
|
+
end
|
89
|
+
#pod repo update
|
90
|
+
UI.section("\nUpdating Spec Repositories\n".yellow) do
|
91
|
+
Pod::Command::Bin::Repo::Update.new(CLAide::ARGV.new([])).run
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
#Dir.glob 可替代
|
97
|
+
def find_podspec
|
98
|
+
name = nil
|
99
|
+
Pathname.pwd.children.each do |child|
|
100
|
+
# puts child
|
101
|
+
if File.file?(child)
|
102
|
+
if child.extname == '.podspec'
|
103
|
+
name = File.basename(child)
|
104
|
+
unless name.include?("binary-template")
|
105
|
+
return name
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
110
|
+
raise Informative, "podspec File no exist, please check" unless name
|
111
|
+
return name
|
112
|
+
end
|
113
|
+
|
114
|
+
def update_uploadpath
|
115
|
+
worksppace_path = Dir.pwd
|
116
|
+
path = @localPath
|
117
|
+
if File.absolute_path?(path) # 判断文件绝对路径
|
118
|
+
return path
|
119
|
+
else
|
120
|
+
path = File.join(worksppace_path, @localPath)
|
121
|
+
if File.absolute_path?(path)
|
122
|
+
return path
|
123
|
+
end
|
124
|
+
end
|
125
|
+
return nil
|
126
|
+
end
|
127
|
+
|
128
|
+
end
|
129
|
+
end
|
130
|
+
end
|
131
|
+
end
|
@@ -8,6 +8,7 @@ require 'cocoapods-bb-bin/command/bin/update'
|
|
8
8
|
require 'cocoapods-bb-bin/command/bin/install'
|
9
9
|
require 'cocoapods-bb-bin/command/bin/imy'
|
10
10
|
require 'cocoapods-bb-bin/command/bin/tag'
|
11
|
+
require 'cocoapods-bb-bin/command/bin/localPush'
|
11
12
|
|
12
13
|
require 'cocoapods-bb-bin/helpers'
|
13
14
|
|
@@ -36,7 +37,7 @@ module Pod
|
|
36
37
|
|
37
38
|
self.abstract_command = true
|
38
39
|
|
39
|
-
self.default_subcommand = '
|
40
|
+
self.default_subcommand = 'auto'
|
40
41
|
self.summary = '组件二进制化插件.'
|
41
42
|
self.description = <<-DESC
|
42
43
|
组件二进制化插件。利用源码私有源与二进制私有源实现对组件依赖类型的切换。
|
@@ -19,13 +19,16 @@ module CBin
|
|
19
19
|
raise Pod::Informative, '源码 podspec 不能为空 .' unless code_spec
|
20
20
|
end
|
21
21
|
|
22
|
-
def create
|
22
|
+
def create(frameworkName=nil)
|
23
23
|
# spec = nil
|
24
24
|
if CBin::Build::Utils.is_framework(@code_spec)
|
25
|
-
Pod::UI::puts "make framework spec"
|
26
|
-
|
25
|
+
Pod::UI::puts "make framework spec. vendored_framework_name:#{frameworkName}"
|
26
|
+
if !frameworkName # 如果外部没有传入fk名称默认组件名称
|
27
|
+
frameworkName = code_spec.root.name
|
28
|
+
end
|
29
|
+
spec = create_framework_from_code_spec(frameworkName)
|
27
30
|
else
|
28
|
-
Pod::UI::puts "make source code spec"
|
31
|
+
Pod::UI::puts "make source code spec. vendored_framework_name:#{frameworkName}"
|
29
32
|
spec = create_from_code_spec
|
30
33
|
end
|
31
34
|
|
@@ -137,13 +140,13 @@ module CBin
|
|
137
140
|
@spec
|
138
141
|
end
|
139
142
|
|
140
|
-
def create_framework_from_code_spec
|
143
|
+
def create_framework_from_code_spec(frameworkName)
|
141
144
|
@spec = code_spec.dup
|
142
145
|
# vendored_frameworks | resources | source | source_files | public_header_files
|
143
146
|
# license | resource_bundles | vendored_libraries
|
144
147
|
|
145
148
|
# Project Linkin
|
146
|
-
@spec.vendored_frameworks = "#{
|
149
|
+
@spec.vendored_frameworks = "#{frameworkName}.{framework,xcframework}" # 支持framework、xcframework
|
147
150
|
|
148
151
|
# Resources
|
149
152
|
extnames = []
|
@@ -23,37 +23,42 @@ module CBin
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def upload(isGenDylib=false)
|
26
|
+
return upload_binary_file(own_source_binary_file, isGenDylib, @spec.name)
|
27
|
+
end
|
28
|
+
|
29
|
+
def upload_binary_file(zip_file, isGenDylib=false, vendored_framework_name=nil)
|
26
30
|
Dir.chdir(CBin::Config::Builder.instance.root_dir) do
|
27
31
|
# 创建binary-template.podsepc
|
28
32
|
# 上传二进制文件
|
29
33
|
# 上传二进制 podspec
|
30
|
-
|
31
|
-
if
|
32
|
-
filename = spec_creator
|
33
|
-
Pod::UI.
|
34
|
+
isupload = binary_upload(zip_file)
|
35
|
+
if isupload
|
36
|
+
filename = spec_creator(vendored_framework_name)
|
37
|
+
Pod::UI.puts "上传二进制 podspec: #{filename} 是否动态库: #{isGenDylib} vendored_framework_name:#{vendored_framework_name}"
|
34
38
|
push_helper = CBin::Push::Helper.new()
|
35
39
|
push_helper.push_binary_repo(filename,isGenDylib)
|
36
40
|
# 上传源码 podspec
|
37
41
|
if @pushsourcespec
|
38
|
-
Pod::UI.
|
42
|
+
Pod::UI.puts "上传源码 podspec: #{@spec_creator.sourceSpecFilePath}"
|
39
43
|
push_helper.push_source_repo(@spec_creator.sourceSpecFilePath)
|
40
44
|
end
|
41
45
|
end
|
42
|
-
|
46
|
+
isupload
|
43
47
|
end
|
44
48
|
end
|
45
49
|
|
46
|
-
|
50
|
+
private
|
51
|
+
def spec_creator(vendored_framework_name=nil)
|
47
52
|
spec_creator = CBin::SpecificationSource::Creator.new(@spec)
|
48
53
|
@spec_creator = spec_creator
|
49
|
-
spec_creator.create
|
54
|
+
spec_creator.create(vendored_framework_name)
|
50
55
|
spec_creator.write_spec_file
|
51
56
|
spec_creator.filename
|
52
57
|
end
|
53
58
|
|
54
|
-
|
55
|
-
|
56
|
-
def
|
59
|
+
private
|
60
|
+
#推送源码组件库二进制文件
|
61
|
+
def own_source_binary_file
|
57
62
|
# lib
|
58
63
|
zip_file = "#{CBin::Config::Builder.instance.library_file(@spec)}.zip"
|
59
64
|
res = File.exist?(zip_file)
|
@@ -67,14 +72,23 @@ module CBin
|
|
67
72
|
zip_file = CBin::Config::Builder.instance.xcframework_zip_file(@spec) + ".zip"
|
68
73
|
res = File.exist?(zip_file)
|
69
74
|
end
|
75
|
+
if res
|
76
|
+
return zip_file
|
77
|
+
end
|
78
|
+
return nil
|
79
|
+
end
|
80
|
+
|
81
|
+
# 上传二进制文件
|
82
|
+
private
|
83
|
+
def binary_upload(zip_file)
|
84
|
+
res = File.file?(zip_file)
|
70
85
|
if res
|
71
86
|
print <<EOF
|
72
|
-
|
87
|
+
上传二进制文件: #{@spec.name} (#{@spec.version})
|
73
88
|
curl #{CBin.config.binary_upload_url} -F "name=#{@spec.name}" -F "version=#{@spec.version}" -F "annotate=#{@spec.name}_#{@spec.version}_log" -F "file=@#{zip_file}"
|
74
89
|
EOF
|
75
90
|
`curl #{CBin.config.binary_upload_url} -F "name=#{@spec.name}" -F "version=#{@spec.version}" -F "annotate=#{@spec.name}_#{@spec.version}_log" -F "file=@#{zip_file}"` if res
|
76
91
|
end
|
77
|
-
|
78
92
|
res
|
79
93
|
end
|
80
94
|
|
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
|
+
version: 0.2.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- humin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-08-30 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.6.
|
73
|
+
version: 0.2.6.3
|
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.6.
|
83
|
+
version: 0.2.6.3
|
84
84
|
- - "<"
|
85
85
|
- !ruby/object:Gem::Version
|
86
86
|
version: '1.0'
|
@@ -134,6 +134,7 @@ files:
|
|
134
134
|
- lib/cocoapods-bb-bin/command/bin/initHotKey.rb
|
135
135
|
- lib/cocoapods-bb-bin/command/bin/install.rb
|
136
136
|
- lib/cocoapods-bb-bin/command/bin/lib/lint.rb
|
137
|
+
- lib/cocoapods-bb-bin/command/bin/localPush.rb
|
137
138
|
- lib/cocoapods-bb-bin/command/bin/repo/push.rb
|
138
139
|
- lib/cocoapods-bb-bin/command/bin/repo/update.rb
|
139
140
|
- lib/cocoapods-bb-bin/command/bin/spec/create.rb
|
@@ -205,7 +206,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
205
206
|
- !ruby/object:Gem::Version
|
206
207
|
version: '0'
|
207
208
|
requirements: []
|
208
|
-
rubygems_version: 3.4.
|
209
|
+
rubygems_version: 3.4.14
|
209
210
|
signing_key:
|
210
211
|
specification_version: 4
|
211
212
|
summary: cocoapods-bb-bin is a plugin which helps develpers switching pods between
|