cocoapods-bb-bin 0.2.1 → 0.2.2.2

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: 9c3db228010949a3ee9a1029358a1ed29026a1e2ac100ea2eae52afe9a0c0843
4
- data.tar.gz: cf85159135d5e2f16a6cd025cc1bbcfce786becf639e239ed832145cc62d91aa
3
+ metadata.gz: 4f787451d6932076c5b8349d83b1c6dd8fa1a6721ae55f7d9fa6bb8364d82d90
4
+ data.tar.gz: '00817f2a55057afef1d6d2c6e7b1e8ba5899dc258cd7d606ab8ceb52129a0b67'
5
5
  SHA512:
6
- metadata.gz: 39a6e327cd12a99f317da290936820af7e680ecc5f29032fc3669a1059e54d3516091bf1c526b5239eb933784029d4fe1412e874460a77f997c94c9f2d7d2154
7
- data.tar.gz: 072b9c4c9f0d2dad89cd20b5b77d987ed42d2a977b1f60b4d95ce79ee43af9aeb636f9e550d25799a30a1444b696740cec769e09cbb39a2be611dc74fb6387ff
6
+ metadata.gz: fe72bb8f5fc7cf45e5b47af44117378407bf68ca4cf91f97ad2b40e7a62c6baac93f904385f4b50e3e0bef7e62d079afc89383cf9d815fc657b6323951d9e945
7
+ data.tar.gz: 861b6079b705cc0a37edf8e1bc3e1c114f5d07d76451ed8ad0d95e44684f3c36dbdc700612da90ede301f67b4dd6236d66c3a34bd0c1466bc52aaf08a9cf4acc
@@ -61,6 +61,11 @@ module Pod
61
61
 
62
62
  @additional_args = argv.remainder!
63
63
  @build_finshed = false
64
+ @spec_sources = @sources
65
+ if @xcframework_output == true
66
+ # 生存xcframework优先使用源码仓库\二进制仓库
67
+ @spec_sources = "#{sources_optionV2(@code_dependencies, nil)},https:\/\/cdn.cocoapods.org"
68
+ end
64
69
  end
65
70
 
66
71
  def run
@@ -86,7 +91,7 @@ module Pod
86
91
  @platform,
87
92
  @framework_output,
88
93
  @xcframework_output,
89
- @sources,
94
+ @spec_sources,
90
95
  @zip,
91
96
  @spec,
92
97
  CBin::Config::Builder.instance.white_pod_list.include?(@spec.name),
@@ -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
 
@@ -1,6 +1,6 @@
1
1
 
2
2
  module CBin
3
- VERSION = '0.2.1'
3
+ VERSION = '0.2.2.2'
4
4
  end
5
5
 
6
6
  module Pod
@@ -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
@@ -29,8 +29,24 @@ module CBin
29
29
  sources
30
30
  end
31
31
 
32
+ def valid_sourcesV2(code_dependencies = false)
33
+ sources = [binary_source]
34
+ unless code_dependencies
35
+ sources << code_source
36
+ sources.reverse!
37
+ end
38
+ sources
39
+ end
40
+
41
+ # 二进制优先
32
42
  def sources_option(code_dependencies, additional_sources)
33
43
  (valid_sources(code_dependencies).map(&:url) + Array(additional_sources)).join(',')
34
44
  end
45
+
46
+ # 源码优先
47
+ def sources_optionV2(code_dependencies, additional_sources)
48
+ (valid_sourcesV2(code_dependencies).map(&:url) + Array(additional_sources)).join(',')
49
+ end
50
+
35
51
  end
36
52
  end
@@ -8,7 +8,7 @@ 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/command/bin/repo/push'
11
+ require 'cocoapods-bb-bin/helpers/push_spec_helper'
12
12
 
13
13
  module CBin
14
14
  class Upload
@@ -31,11 +31,12 @@ module CBin
31
31
  if res_zip
32
32
  filename = spec_creator
33
33
  Pod::UI.message "上传二进制 podspec: #{filename}"
34
- push_binary_repo(filename)
34
+ push_helper = CBin::Push::Helper.new()
35
+ push_helper.push_binary_repo(filename)
35
36
  # 上传源码 podspec
36
37
  if @pushsourcespec
37
38
  Pod::UI.message "上传源码 podspec: #{@spec_creator.sourceSpecFilePath}"
38
- push_source_repo(@spec_creator.sourceSpecFilePath)
39
+ push_helper.push_source_repo(@spec_creator.sourceSpecFilePath)
39
40
  end
40
41
  end
41
42
  res_zip
@@ -77,51 +78,6 @@ EOF
77
78
  res
78
79
  end
79
80
 
80
-
81
- # 上传二进制 podspec
82
- def push_binary_repo(binary_podsepc_json)
83
- argvs = [
84
- "#{binary_source.name}", # repo
85
- "#{binary_podsepc_json}", # spec
86
- "--binary",
87
- "--sources=#{binary_source},https:\/\/cdn.cocoapods.org",
88
- "--skip-import-validation",
89
- "--use-libraries",
90
- "--allow-warnings",
91
- "--verbose",
92
- "--code-dependencies",
93
- '--no-cocoapods-validator', #不采用cocoapods验证
94
- ]
95
- if @verbose
96
- argvs += ['--verbose']
97
- end
98
- Pod::UI.message "上传二进制 argvs: #{argvs}"
99
- push = Pod::Command::Bin::Repo::Push.new(CLAide::ARGV.new(argvs))
100
- push.validate!
101
- push.run
102
- end
103
-
104
- # 上传源码podspec
105
- def push_source_repo(source_podsepc_json)
106
- argvs = [
107
- "#{code_source.name}", # repo
108
- "#{source_podsepc_json}", # spec
109
- "--sources=#{code_source},https:\/\/cdn.cocoapods.org",
110
- "--skip-import-validation",
111
- "--use-libraries",
112
- "--allow-warnings",
113
- "--verbose",
114
- "--code-dependencies",
115
- '--no-cocoapods-validator', #不采用cocoapods验证
116
- ]
117
- if @verbose
118
- argvs += ['--verbose']
119
- end
120
- Pod::UI.message "上传源码 argvs: #{argvs}"
121
- push = Pod::Command::Bin::Repo::Push.new(CLAide::ARGV.new(argvs))
122
- push.validate!
123
- push.run
124
- end
125
81
  end
126
82
  end
127
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.1
4
+ version: 0.2.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - humin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-04-02 00:00:00.000000000 Z
11
+ date: 2022-07-26 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
@@ -203,7 +205,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
203
205
  - !ruby/object:Gem::Version
204
206
  version: '0'
205
207
  requirements: []
206
- rubygems_version: 3.3.5
208
+ rubygems_version: 3.3.18
207
209
  signing_key:
208
210
  specification_version: 4
209
211
  summary: cocoapods-bb-bin is a plugin which helps develpers switching pods between