cocoapods-bb-bin 0.2.1 → 0.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: a39abb3bb7a0878383ec7f7b2a475b6af98f0c01f99cb1d85af3c5290fbd1deb
4
+ data.tar.gz: a50b6bd120d0e08571e4ed59c1a3be63c43e1684edb64c2c2a694ce714e2c831
5
5
  SHA512:
6
- metadata.gz: 39a6e327cd12a99f317da290936820af7e680ecc5f29032fc3669a1059e54d3516091bf1c526b5239eb933784029d4fe1412e874460a77f997c94c9f2d7d2154
7
- data.tar.gz: 072b9c4c9f0d2dad89cd20b5b77d987ed42d2a977b1f60b4d95ce79ee43af9aeb636f9e550d25799a30a1444b696740cec769e09cbb39a2be611dc74fb6387ff
6
+ metadata.gz: '049d6a31b67b09bd3d4fcc24d408d6dbe1f778069c6230d61517038fd9d71584162d950e6b0de3a6609475e99de560e893d208709e742d25c99b771ac8399205'
7
+ data.tar.gz: 7ebb743aef0db3971d28250e7571edcda3fb3c7d27d1a9bb81c2f34d23e4fba5392b836aa84cee9109833fcd34648f8a0850ca8263157688597125f227ce9481
@@ -0,0 +1,136 @@
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
+
8
+ module Pod
9
+ class Command
10
+ class Bin < Command
11
+ class Tag < Bin
12
+ self.summary = '推送标签.'
13
+
14
+ self.arguments = [
15
+ CLAide::Argument.new('NAME.podspec', false)
16
+ ]
17
+ def self.options
18
+ [
19
+ ['--sources', '私有源地址,多个用分号区分'],
20
+ ['--no-clean', '保留构建中间产物'],
21
+ ].concat(Pod::Command::Gen.options).concat(super).uniq
22
+ end
23
+
24
+ def initialize(argv)
25
+ @help = argv.flag?('help', false )
26
+ if @help
27
+ else
28
+ @env = argv.option('env') || 'dev'
29
+ CBin.config.set_configuration_env(@env)
30
+
31
+ @podspec = argv.shift_argument || find_podspec
32
+ @sources = argv.option('sources') || []
33
+ @clean = argv.flag?('no-clean', false)
34
+ @platform = Platform.new(:ios)
35
+ end
36
+ super
37
+ end
38
+
39
+ def validate!
40
+ help! "未找到 podspec文件" unless @podspec
41
+ super
42
+ end
43
+
44
+ def run
45
+
46
+ # 清除之前的缓存
47
+ CBin::Config::Builder.instance.clean
48
+
49
+ @spec = Specification.from_file(@podspec)
50
+ generate_project
51
+ swift_pods_buildsetting
52
+ if build_root_spec
53
+ # 工程编译ok,进行标签推送
54
+ push_helper = CBin::Push::Helper.new()
55
+ push_helper.push_source_repo(@podspec)
56
+ end
57
+ end
58
+
59
+ #Dir.glob 可替代
60
+ def find_podspec
61
+ name = nil
62
+ Pathname.pwd.children.each do |child|
63
+ # puts child
64
+ if File.file?(child)
65
+ if child.extname == '.podspec'
66
+ name = File.basename(child)
67
+ unless name.include?("binary-template")
68
+ return name
69
+ end
70
+ end
71
+ end
72
+ end
73
+ raise Informative, "podspec File no exist, please check" unless name
74
+ return name
75
+ end
76
+
77
+ private
78
+ def build_root_spec
79
+ builder = CBin::Build::Helper.new(@spec,
80
+ @platform,
81
+ false,
82
+ false,
83
+ @sources,
84
+ true,
85
+ @spec,
86
+ CBin::Config::Builder.instance.white_pod_list.include?(@spec.name),
87
+ 'Release')
88
+ builder.build
89
+ builder.clean_workspace if @clean && !@all_make
90
+ return builder.is_build_finish
91
+ end
92
+ def swift_pods_buildsetting
93
+ # swift_project_link_header
94
+ worksppace_path = File.expand_path("#{CBin::Config::Builder.instance.gen_dir}/#{@spec.name}")
95
+ path = File.join(worksppace_path, "Pods.xcodeproj")
96
+ path = File.join(worksppace_path, "Pods/Pods.xcodeproj") unless File.exist?(path)
97
+ raise Informative, "#{path} File no exist, please check" unless File.exist?(path)
98
+ project = Xcodeproj::Project.open(path)
99
+ project.build_configurations.each do |x|
100
+ x.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = true #设置生成swift inter
101
+ end
102
+ project.save
103
+ end
104
+
105
+ def generate_project
106
+ Podfile.execute_with_bin_plugin do
107
+ Podfile.execute_with_use_binaries(!@code_dependencies) do
108
+ argvs = [
109
+ "--sources=#{sources_option(@code_dependencies, @sources)}",
110
+ "--gen-directory=#{CBin::Config::Builder.instance.gen_dir}",
111
+ '--clean',
112
+ "--verbose",
113
+ *@additional_args
114
+ ]
115
+ podfile_path = Pod::Config.instance.podfile_path
116
+ if podfile_path && File.exist?(podfile_path)
117
+ argvs += ['--use-podfile']
118
+ end
119
+
120
+ if CBin::Build::Utils.uses_frameworks? # 组件库重新生成pod工程引入静态库需要使用该选项,否则报cocoapods中verify_no_static_framework_transitive_dependencies验证无法通过 by hm 21/10/18
121
+ argvs += ['--use-libraries']
122
+ end
123
+
124
+ argvs << @podspec if @podspec
125
+ # UI.puts "argvs:#{argvs}"
126
+ gen = Pod::Command::Gen.new(CLAide::ARGV.new(argvs))
127
+ gen.validate!
128
+ gen.run
129
+ end
130
+ end
131
+ end
132
+
133
+ end
134
+ end
135
+ end
136
+ 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'
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
@@ -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,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.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - humin
@@ -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