cocoapods-bb-bin 0.2.0 → 0.2.2.1
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 +4 -3
- data/lib/cocoapods-bb-bin/command/bin/tag.rb +153 -0
- data/lib/cocoapods-bb-bin/command/bin.rb +1 -0
- data/lib/cocoapods-bb-bin/gem_version.rb +1 -1
- data/lib/cocoapods-bb-bin/helpers/build_helper.rb +15 -0
- data/lib/cocoapods-bb-bin/helpers/push_spec_helper.rb +64 -0
- data/lib/cocoapods-bb-bin/helpers/spec_source_creator.rb +3 -1
- data/lib/cocoapods-bb-bin/helpers/upload_helper.rb +12 -27
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5764ccefa6e25c275fc0e9568a321dc48152ceb9beb7e29517e996459e92fc9b
|
4
|
+
data.tar.gz: 30ef7305b4d2d3e442fa28a140006133f0a7582ac8e7133df451d2f5aea3dee6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 177349f9e7cfaba5e4682f11cc42d82ded7e6956f9ed763a87b7e5f886fb47f4b490adb671e864cf13b9a6d6a447105f0f1df9e4822f361af40a1945942e2a15
|
7
|
+
data.tar.gz: e32d51de357d063e9512696edfa3e0d435d4187443edf6363cbeb1c7057bf479a28fda379add3956bbd92deddc9ddf2ceff3e67583f14c862ad7709cd081a096
|
@@ -21,7 +21,8 @@ module Pod
|
|
21
21
|
['--no-zip', '不压缩静态 framework 为 zip'],
|
22
22
|
['--all-make', '对该组件的依赖库,全部制作为二进制组件'],
|
23
23
|
['--configuration', 'Build the specified configuration (e.g. Release ). Defaults to Debug'],
|
24
|
-
['--env', "该组件上传的环境 %w[dev debug_iphoneos release_iphoneos]"]
|
24
|
+
['--env', "该组件上传的环境 %w[dev debug_iphoneos release_iphoneos]"],
|
25
|
+
['--all-push', '上传二进制同时,允许同时推送源码索引'],
|
25
26
|
].concat(Pod::Command::Gen.options).concat(super).uniq
|
26
27
|
end
|
27
28
|
|
@@ -40,6 +41,7 @@ module Pod
|
|
40
41
|
@allow_prerelease = argv.flag?('allow-prerelease')
|
41
42
|
@framework_output = argv.flag?('framework-output', false )
|
42
43
|
@xcframework_output = argv.flag?('xcframework-output', false )
|
44
|
+
@pushsourcespec = argv.flag?('all-push', false )
|
43
45
|
@clean = argv.flag?('clean', true)
|
44
46
|
@zip = argv.flag?('zip', true)
|
45
47
|
@all_make = argv.flag?('all-make', false )
|
@@ -64,7 +66,7 @@ module Pod
|
|
64
66
|
fail_push_specs = []
|
65
67
|
sources_sepc.uniq.each do |spec|
|
66
68
|
begin
|
67
|
-
fail_push_specs << spec unless CBin::Upload::Helper.new(spec,@code_dependencies,@sources).upload
|
69
|
+
fail_push_specs << spec unless CBin::Upload::Helper.new(spec,@code_dependencies,@sources,@pushsourcespec).upload
|
68
70
|
rescue Object => exception
|
69
71
|
UI.puts exception
|
70
72
|
fail_push_specs << spec
|
@@ -84,7 +86,6 @@ module Pod
|
|
84
86
|
auto_success += "#{spec.name} | #{spec.version}\n"
|
85
87
|
UI.warn "===【 #{spec.name} | #{spec.version} 】二进制组件制作完成 !!! "
|
86
88
|
end
|
87
|
-
puts "============== auto_success"
|
88
89
|
puts auto_success
|
89
90
|
ENV['auto_success'] = auto_success
|
90
91
|
end
|
@@ -0,0 +1,153 @@
|
|
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 Tag < Bin
|
13
|
+
self.summary = '推送标签.'
|
14
|
+
|
15
|
+
self.arguments = [
|
16
|
+
CLAide::Argument.new('NAME.podspec', false)
|
17
|
+
]
|
18
|
+
def self.options
|
19
|
+
[
|
20
|
+
['--sources', '私有源地址,多个用分号区分'],
|
21
|
+
['--no-clean', '保留构建中间产物'],
|
22
|
+
['--skip-build-project', '跳过编译工程文件操作(直接推送假标签,操作慎重!!!)'],
|
23
|
+
['--debug', 'debug环境只是验证工程编译是否ok,不进行标签推送操作'],
|
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
|
+
@clean = argv.flag?('no-clean', false)
|
37
|
+
@skip_build_project = argv.flag?('skip-build-project', false)
|
38
|
+
@is_debug = argv.flag?('debug', false)
|
39
|
+
@platform = Platform.new(:ios)
|
40
|
+
end
|
41
|
+
super
|
42
|
+
end
|
43
|
+
|
44
|
+
def validate!
|
45
|
+
help! "未找到 podspec文件" unless @podspec
|
46
|
+
super
|
47
|
+
end
|
48
|
+
|
49
|
+
def run
|
50
|
+
# 清除之前的缓存
|
51
|
+
CBin::Config::Builder.instance.clean
|
52
|
+
@spec = Specification.from_file(@podspec)
|
53
|
+
|
54
|
+
if @skip_build_project
|
55
|
+
# 跳过工程编译
|
56
|
+
is_build_ok = true
|
57
|
+
Pod::UI.warn "请注意⚠️正在推送假标签!!!#{@podspec}==>#{@spec.name}(#{@spec.version})"
|
58
|
+
elsif
|
59
|
+
# step.1 工程编译
|
60
|
+
is_build_ok = check_build_workspace
|
61
|
+
end
|
62
|
+
if is_build_ok && !@is_debug
|
63
|
+
# step.2 工程编译ok,进行标签推送
|
64
|
+
push_helper = CBin::Push::Helper.new()
|
65
|
+
push_helper.push_source_repo(@podspec)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
#Dir.glob 可替代
|
70
|
+
def find_podspec
|
71
|
+
name = nil
|
72
|
+
Pathname.pwd.children.each do |child|
|
73
|
+
# puts child
|
74
|
+
if File.file?(child)
|
75
|
+
if child.extname == '.podspec'
|
76
|
+
name = File.basename(child)
|
77
|
+
unless name.include?("binary-template")
|
78
|
+
return name
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
raise Informative, "podspec File no exist, please check" unless name
|
84
|
+
return name
|
85
|
+
end
|
86
|
+
|
87
|
+
# 编译工程目录
|
88
|
+
def check_build_workspace
|
89
|
+
generate_project
|
90
|
+
swift_pods_buildsetting
|
91
|
+
return build_root_spec
|
92
|
+
end
|
93
|
+
|
94
|
+
private
|
95
|
+
def build_root_spec
|
96
|
+
builder = CBin::Build::Helper.new(@spec,
|
97
|
+
@platform,
|
98
|
+
false,
|
99
|
+
false,
|
100
|
+
@sources,
|
101
|
+
true,
|
102
|
+
@spec,
|
103
|
+
CBin::Config::Builder.instance.white_pod_list.include?(@spec.name),
|
104
|
+
'Release')
|
105
|
+
builder.build
|
106
|
+
builder.clean_workspace if @clean
|
107
|
+
return builder.is_build_finish
|
108
|
+
end
|
109
|
+
def swift_pods_buildsetting
|
110
|
+
# swift_project_link_header
|
111
|
+
worksppace_path = File.expand_path("#{CBin::Config::Builder.instance.gen_dir}/#{@spec.name}")
|
112
|
+
path = File.join(worksppace_path, "Pods.xcodeproj")
|
113
|
+
path = File.join(worksppace_path, "Pods/Pods.xcodeproj") unless File.exist?(path)
|
114
|
+
raise Informative, "#{path} File no exist, please check" unless File.exist?(path)
|
115
|
+
project = Xcodeproj::Project.open(path)
|
116
|
+
project.build_configurations.each do |x|
|
117
|
+
x.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = true #设置生成swift inter
|
118
|
+
end
|
119
|
+
project.save
|
120
|
+
end
|
121
|
+
|
122
|
+
def generate_project
|
123
|
+
Podfile.execute_with_bin_plugin do
|
124
|
+
Podfile.execute_with_use_binaries(!@code_dependencies) do
|
125
|
+
argvs = [
|
126
|
+
"--sources=#{sources_option(@code_dependencies, @sources)}",
|
127
|
+
"--gen-directory=#{CBin::Config::Builder.instance.gen_dir}",
|
128
|
+
'--clean',
|
129
|
+
"--verbose",
|
130
|
+
*@additional_args
|
131
|
+
]
|
132
|
+
podfile_path = Pod::Config.instance.podfile_path
|
133
|
+
if podfile_path && File.exist?(podfile_path)
|
134
|
+
argvs += ['--use-podfile']
|
135
|
+
end
|
136
|
+
|
137
|
+
if CBin::Build::Utils.uses_frameworks? # 组件库重新生成pod工程引入静态库需要使用该选项,否则报cocoapods中verify_no_static_framework_transitive_dependencies验证无法通过 by hm 21/10/18
|
138
|
+
argvs += ['--use-libraries']
|
139
|
+
end
|
140
|
+
|
141
|
+
argvs << @podspec if @podspec
|
142
|
+
# UI.puts "argvs:#{argvs}"
|
143
|
+
gen = Pod::Command::Gen.new(CLAide::ARGV.new(argvs))
|
144
|
+
gen.validate!
|
145
|
+
gen.run
|
146
|
+
end
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
150
|
+
end
|
151
|
+
end
|
152
|
+
end
|
153
|
+
end
|
@@ -7,6 +7,7 @@ require 'cocoapods-bb-bin/command/bin/code'
|
|
7
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
|
+
require 'cocoapods-bb-bin/command/bin/tag'
|
10
11
|
|
11
12
|
require 'cocoapods-bb-bin/helpers'
|
12
13
|
|
@@ -68,6 +68,21 @@ module CBin
|
|
68
68
|
|
69
69
|
end
|
70
70
|
|
71
|
+
def is_build_finish
|
72
|
+
if is_build_xcframework
|
73
|
+
path = xcframework_name_zip
|
74
|
+
else
|
75
|
+
path = framework_name_zip
|
76
|
+
end
|
77
|
+
output_path = File.join(zip_dir, path)
|
78
|
+
unless File.exist?(xcframework_name)
|
79
|
+
UI.puts "工程文件编译成功"
|
80
|
+
return true
|
81
|
+
end
|
82
|
+
UI.puts "工程文件编译失败"
|
83
|
+
return false
|
84
|
+
end
|
85
|
+
|
71
86
|
# 是否编译xcframework库
|
72
87
|
def is_build_xcframework
|
73
88
|
if @xcframework_output == true
|
@@ -0,0 +1,64 @@
|
|
1
|
+
require 'cocoapods-bb-bin/native/podfile'
|
2
|
+
require 'cocoapods/command/gen'
|
3
|
+
require 'cocoapods/generate'
|
4
|
+
require 'cocoapods-bb-bin/helpers/framework_builder'
|
5
|
+
require 'cocoapods-bb-bin/helpers/library_builder'
|
6
|
+
require 'cocoapods-bb-bin/helpers/sources_helper'
|
7
|
+
require 'cocoapods-bb-bin/command/bin/repo/push'
|
8
|
+
|
9
|
+
module CBin
|
10
|
+
class Push
|
11
|
+
class Helper
|
12
|
+
include CBin::SourcesHelper
|
13
|
+
|
14
|
+
def initialize()
|
15
|
+
end
|
16
|
+
|
17
|
+
# 上传二进制 podspec
|
18
|
+
def push_binary_repo(binary_podsepc_json)
|
19
|
+
argvs = [
|
20
|
+
"#{binary_source.name}", # repo
|
21
|
+
"#{binary_podsepc_json}", # spec
|
22
|
+
"--binary",
|
23
|
+
"--sources=#{binary_source},https:\/\/cdn.cocoapods.org",
|
24
|
+
"--skip-import-validation",
|
25
|
+
"--use-libraries",
|
26
|
+
"--allow-warnings",
|
27
|
+
"--verbose",
|
28
|
+
"--code-dependencies",
|
29
|
+
'--no-cocoapods-validator', #不采用cocoapods验证
|
30
|
+
]
|
31
|
+
if @verbose
|
32
|
+
argvs += ['--verbose']
|
33
|
+
end
|
34
|
+
Pod::UI.message "上传二进制 argvs: #{argvs}"
|
35
|
+
push = Pod::Command::Bin::Repo::Push.new(CLAide::ARGV.new(argvs))
|
36
|
+
push.validate!
|
37
|
+
push.run
|
38
|
+
end
|
39
|
+
|
40
|
+
# 上传源码podspec
|
41
|
+
def push_source_repo(source_podsepc_json)
|
42
|
+
argvs = [
|
43
|
+
"#{code_source.name}", # repo
|
44
|
+
"#{source_podsepc_json}", # spec
|
45
|
+
"--sources=#{code_source},https:\/\/cdn.cocoapods.org",
|
46
|
+
"--skip-import-validation",
|
47
|
+
"--use-libraries",
|
48
|
+
"--allow-warnings",
|
49
|
+
"--verbose",
|
50
|
+
"--code-dependencies",
|
51
|
+
'--no-cocoapods-validator', #不采用cocoapods验证
|
52
|
+
]
|
53
|
+
if @verbose
|
54
|
+
argvs += ['--verbose']
|
55
|
+
end
|
56
|
+
Pod::UI.message "上传源码 argvs: #{argvs}"
|
57
|
+
push = Pod::Command::Bin::Repo::Push.new(CLAide::ARGV.new(argvs))
|
58
|
+
push.validate!
|
59
|
+
push.run
|
60
|
+
end
|
61
|
+
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
@@ -43,6 +43,8 @@ module CBin
|
|
43
43
|
end
|
44
44
|
|
45
45
|
@filename = file
|
46
|
+
# Pod::UI::puts "===copy origin file: #{file}"
|
47
|
+
# Pod::UI::puts "===copy desc file: #{sourceSpecFilePath}"
|
46
48
|
# 拷贝二进制spec到源码spec by hm 22/1/19
|
47
49
|
`cp -fa #{file} #{sourceSpecFilePath}`
|
48
50
|
end
|
@@ -57,7 +59,7 @@ module CBin
|
|
57
59
|
end
|
58
60
|
# 源码spec路径(指向二进制库)
|
59
61
|
def sourceSpecFilePath
|
60
|
-
@
|
62
|
+
@sourcefilename ||= "#{CBin::Config::Builder.instance.binary_json_dir_name}/#{spec.name}.podspec.json"
|
61
63
|
end
|
62
64
|
|
63
65
|
private
|
@@ -8,17 +8,18 @@ require 'cocoapods/generate'
|
|
8
8
|
require 'cocoapods-bb-bin/helpers/framework_builder'
|
9
9
|
require 'cocoapods-bb-bin/helpers/library_builder'
|
10
10
|
require 'cocoapods-bb-bin/helpers/sources_helper'
|
11
|
-
require 'cocoapods-bb-bin/
|
11
|
+
require 'cocoapods-bb-bin/helpers/push_spec_helper'
|
12
12
|
|
13
13
|
module CBin
|
14
14
|
class Upload
|
15
15
|
class Helper
|
16
16
|
include CBin::SourcesHelper
|
17
17
|
|
18
|
-
def initialize(spec,code_dependencies,sources)
|
18
|
+
def initialize(spec,code_dependencies,sources, pushsourcespec = false)
|
19
19
|
@spec = spec
|
20
20
|
@code_dependencies = code_dependencies
|
21
21
|
@sources = sources
|
22
|
+
@pushsourcespec = pushsourcespec # 推送源码
|
22
23
|
end
|
23
24
|
|
24
25
|
def upload
|
@@ -29,7 +30,14 @@ module CBin
|
|
29
30
|
res_zip = curl_zip
|
30
31
|
if res_zip
|
31
32
|
filename = spec_creator
|
32
|
-
|
33
|
+
Pod::UI.message "上传二进制 podspec: #{filename}"
|
34
|
+
push_helper = CBin::Push::Helper.new()
|
35
|
+
push_helper.push_binary_repo(filename)
|
36
|
+
# 上传源码 podspec
|
37
|
+
if @pushsourcespec
|
38
|
+
Pod::UI.message "上传源码 podspec: #{@spec_creator.sourceSpecFilePath}"
|
39
|
+
push_helper.push_source_repo(@spec_creator.sourceSpecFilePath)
|
40
|
+
end
|
33
41
|
end
|
34
42
|
res_zip
|
35
43
|
end
|
@@ -37,6 +45,7 @@ module CBin
|
|
37
45
|
|
38
46
|
def spec_creator
|
39
47
|
spec_creator = CBin::SpecificationSource::Creator.new(@spec)
|
48
|
+
@spec_creator = spec_creator
|
40
49
|
spec_creator.create
|
41
50
|
spec_creator.write_spec_file
|
42
51
|
spec_creator.filename
|
@@ -69,30 +78,6 @@ EOF
|
|
69
78
|
res
|
70
79
|
end
|
71
80
|
|
72
|
-
|
73
|
-
# 上传二进制 podspec
|
74
|
-
def push_binary_repo(binary_podsepc_json)
|
75
|
-
argvs = [
|
76
|
-
"#{binary_source.name}", # repo
|
77
|
-
"#{binary_podsepc_json}", # spec
|
78
|
-
"--binary",
|
79
|
-
"--sources=#{sources_option(@code_dependencies, @sources)},https:\/\/cdn.cocoapods.org",
|
80
|
-
"--skip-import-validation",
|
81
|
-
"--use-libraries",
|
82
|
-
"--allow-warnings",
|
83
|
-
"--verbose",
|
84
|
-
"--code-dependencies",
|
85
|
-
'--no-cocoapods-validator', #不采用cocoapods验证
|
86
|
-
]
|
87
|
-
if @verbose
|
88
|
-
argvs += ['--verbose']
|
89
|
-
end
|
90
|
-
|
91
|
-
push = Pod::Command::Bin::Repo::Push.new(CLAide::ARGV.new(argvs))
|
92
|
-
push.validate!
|
93
|
-
push.run
|
94
|
-
end
|
95
|
-
|
96
81
|
end
|
97
82
|
end
|
98
83
|
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
|
+
version: 0.2.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- humin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-04-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: parallel
|
@@ -137,6 +137,7 @@ files:
|
|
137
137
|
- lib/cocoapods-bb-bin/command/bin/repo/push.rb
|
138
138
|
- lib/cocoapods-bb-bin/command/bin/repo/update.rb
|
139
139
|
- lib/cocoapods-bb-bin/command/bin/spec/create.rb
|
140
|
+
- lib/cocoapods-bb-bin/command/bin/tag.rb
|
140
141
|
- lib/cocoapods-bb-bin/command/bin/update.rb
|
141
142
|
- lib/cocoapods-bb-bin/config/config.rb
|
142
143
|
- lib/cocoapods-bb-bin/config/config_asker.rb
|
@@ -152,6 +153,7 @@ files:
|
|
152
153
|
- lib/cocoapods-bb-bin/helpers/framework_builder.rb
|
153
154
|
- lib/cocoapods-bb-bin/helpers/library.rb
|
154
155
|
- lib/cocoapods-bb-bin/helpers/library_builder.rb
|
156
|
+
- lib/cocoapods-bb-bin/helpers/push_spec_helper.rb
|
155
157
|
- lib/cocoapods-bb-bin/helpers/sources_helper.rb
|
156
158
|
- lib/cocoapods-bb-bin/helpers/spec_creator.rb
|
157
159
|
- lib/cocoapods-bb-bin/helpers/spec_files_helper.rb
|