cocoapods-bb-bin 0.1.4 → 0.1.8

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: 6b89f001104ecdb85f0dd860945910ad39e9f571f6a6cf6bfb80d7dbcb3651b5
4
- data.tar.gz: 7b8527d71339c4c3eb0e44037e96e402578c524abe32e4a6e5656a251acbf87c
3
+ metadata.gz: d6bfe1244ff7ee292516ac3f497b988ccfcc7db6cbed08617ec46dc2af558886
4
+ data.tar.gz: 036b33803b77ebd6281ebe98639100fc8bb92c20f7448faec758a42ea2706e82
5
5
  SHA512:
6
- metadata.gz: 0efa752e40ced20e12331a10c9257b6af2699b3c113120f4fc03a1de0a232d0b4773ede729133bf420ad98f09c185a7a917356a969cf4206c9667eca01f609d6
7
- data.tar.gz: f2c304f7f7cd5d8e547ddba78c00e2057d2c12de701c2699e700b94c1465bb65a97edb53d4d0b7e9d0bab1c348334d2ab9e0e88095290bb53ab7f0d31c1449c4
6
+ metadata.gz: 4b3e12f0e1f5fac44c4fe96315838254ad4cb69b083c224d46a13782fad2537d78c73c88a0dffd6dda7f59e69c9183160a9d67fe9815f1e4fbc6f7187769b1e6
7
+ data.tar.gz: 5d7e079146176eb2c0a9b68e4d2f68cf47286acb5d5a8dd8c81f4bb1a655c29a8981fb1bf6b322ebc47f067fa097aef4bce517b79cc8e276e66464ded1993b73
@@ -165,8 +165,8 @@ module Pod
165
165
  "--verbose",
166
166
  *@additional_args
167
167
  ]
168
-
169
- if File.exist?(Pod::Config.instance.podfile_path)
168
+ podfile_path = Pod::Config.instance.podfile_path
169
+ if podfile_path && File.exist?(podfile_path)
170
170
  argvs += ['--use-podfile']
171
171
  end
172
172
 
@@ -175,7 +175,7 @@ module Pod
175
175
  end
176
176
 
177
177
  argvs << spec_file if spec_file
178
- UI.puts "argvs:#{argvs}"
178
+ # UI.puts "argvs:#{argvs}"
179
179
  gen = Pod::Command::Gen.new(CLAide::ARGV.new(argvs))
180
180
  gen.validate!
181
181
  gen.run
@@ -29,12 +29,10 @@ module Pod
29
29
  @help = argv.flag?('help', false )
30
30
  if @help
31
31
  else
32
- puts "开始执行自动推送操作,"
33
- podfile_path = link_podfile # 创建软链接
34
-
35
32
  @env = argv.option('env') || 'dev'
36
33
  CBin.config.set_configuration_env(@env)
37
34
 
35
+ podfile_path = link_podfile # 创建软链接
38
36
  @podspec = argv.shift_argument || find_podspec
39
37
  @specification = Specification.from_file(@podspec)
40
38
 
@@ -133,7 +131,7 @@ module Pod
133
131
  argvs += ["--env=#{@env}"]
134
132
  end
135
133
  argvs += ["--configuration=#{@config}"]
136
- puts "===auto argvs: #{argvs}"
134
+ # puts "===auto argvs: #{argvs}"
137
135
  archive = Pod::Command::Bin::Archive.new(CLAide::ARGV.new(argvs))
138
136
  archive.validate!
139
137
  sources_sepc = archive.run
@@ -190,7 +188,7 @@ module Pod
190
188
  def find_podspec
191
189
  name = nil
192
190
  Pathname.pwd.children.each do |child|
193
- puts child
191
+ # puts child
194
192
  if File.file?(child)
195
193
  if child.extname == '.podspec'
196
194
  name = File.basename(child)
@@ -200,6 +198,7 @@ module Pod
200
198
  end
201
199
  end
202
200
  end
201
+ raise Informative, "podspec File no exist, please check" unless name
203
202
  return name
204
203
  end
205
204
 
@@ -221,6 +220,8 @@ module Pod
221
220
  if filename == 'Podfile'
222
221
  podfile_path = File.join(filepath,"#{filename}")
223
222
  create_link(podfile_path, current_path)
223
+ # pods_path = File.join(filepath,"Pods")
224
+ # create_link(pods_path, current_path)
224
225
  return podfile_path
225
226
  end
226
227
  end
@@ -232,14 +233,14 @@ module Pod
232
233
  podfile_path = File.join(current_path,"Example/Podfile")
233
234
  if File.file?(podfile_path)
234
235
  create_link(podfile_path, current_path)
236
+ # pods_path = File.join(current_path,"Example/Pods")
237
+ # create_link(pods_path, current_path)
235
238
  end
236
239
  end
237
240
 
238
241
  def create_link(source_file, dest_file)
239
- if File.file?(source_file)
240
- system("ln -s #{source_file} #{dest_file}")
241
- UI.puts "创建软链接 source:#{source_file} link:#{dest_file}"
242
- end
242
+ system("ln -s #{source_file} #{dest_file}")
243
+ UI.puts "create link source:#{source_file} dest:#{dest_file}"
243
244
  end
244
245
  end
245
246
  end
@@ -1,18 +1,21 @@
1
1
  require 'cocoapods-bb-bin/config/config'
2
2
  require 'cocoapods-bb-bin/native/podfile'
3
+ require 'cocoapods/command/lib/lint'
4
+ require 'cocoapods'
3
5
 
4
6
  module Pod
5
7
  class Command
6
8
  class Bin < Command
7
9
  class Lib < Bin
8
10
  class Lint < Lib
9
- self.summary = 'lint 组件.'
11
+ self.summary = 'Validates a Pod'
12
+
10
13
  self.description = <<-DESC
11
- lint 二进制组件 / 源码组件
14
+ Validates the Pod using the files in the working directory.
12
15
  DESC
13
16
 
14
17
  self.arguments = [
15
- CLAide::Argument.new('NAME.podspec', false)
18
+ CLAide::Argument.new('NAME.podspec', false),
16
19
  ]
17
20
 
18
21
  # lib lint 不会下载 source,所以不能进行二进制 lint
@@ -21,46 +24,100 @@ module Pod
21
24
  [
22
25
  ['--code-dependencies', '使用源码依赖进行 lint'],
23
26
  ['--loose-options', '添加宽松的 options, 包括 --use-libraries (可能会造成 entry point (start) undefined)'],
24
- ['--allow-prerelease', '允许使用 prerelease 的版本 lint']
27
+ ['--allow-prerelease', '允许使用 prerelease 的版本 lint'],
28
+ ['--bb-env', 'bb Company environment(Internal use),support oc、swift project']
25
29
  ].concat(Pod::Command::Lib::Lint.options).concat(super).uniq
26
30
  end
27
31
 
28
32
  def initialize(argv)
29
33
  @loose_options = argv.flag?('loose-options')
30
- @code_dependencies = argv.flag?('code-dependencies')
34
+ @code_dependencies = argv.flag?('code-dependencies', true)
31
35
  @sources = argv.option('sources') || []
32
36
  @allow_prerelease = argv.flag?('allow-prerelease')
37
+ @bb_env = argv.flag?('bb-env', false)
33
38
  @podspec = argv.shift_argument
34
39
  super
35
-
36
40
  @additional_args = argv.remainder!
41
+ @verbose = argv.flag?('verbose', false)
37
42
  end
38
43
 
39
44
  def run
40
- Podfile.execute_with_bin_plugin do
41
- Podfile.execute_with_allow_prerelease(@allow_prerelease) do
45
+ # @bb_env = false
46
+ if @bb_env
47
+ Podfile.execute_with_bin_plugin do
42
48
  Podfile.execute_with_use_binaries(!@code_dependencies) do
43
- argvs = [
44
- @podspec || code_spec_files.first,
45
- "--sources=#{sources_option(@code_dependencies, @sources)}",
46
- *@additional_args
47
- ]
49
+ build_bb_lint
50
+ end
51
+ end
52
+ else
53
+ Podfile.execute_with_bin_plugin do
54
+ Podfile.execute_with_allow_prerelease(@allow_prerelease) do
55
+ Podfile.execute_with_use_binaries(!@code_dependencies) do
56
+ argvs = [
57
+ @podspec || code_spec_files.first,
58
+ "--sources=#{sources_option(@code_dependencies, @sources)}",
59
+ *@additional_args
60
+ ]
48
61
 
49
- if @loose_options
50
- argvs << '--allow-warnings'
51
- if code_spec&.all_dependencies&.any?
52
- argvs << '--use-libraries'
62
+ if @loose_options
63
+ argvs << '--allow-warnings'
64
+ if code_spec&.all_dependencies&.any?
65
+ argvs << '--use-libraries'
66
+ end
53
67
  end
54
- end
55
68
 
56
- lint = Pod::Command::Lib::Lint.new(CLAide::ARGV.new(argvs))
57
- lint.validate!
58
- lint.run
69
+ lint = Pod::Command::Lib::Lint.new(CLAide::ARGV.new(argvs))
70
+ lint.validate!
71
+ lint.run
72
+ end
59
73
  end
60
74
  end
61
75
  end
62
76
  end
63
77
 
78
+ private
79
+
80
+ def build_bb_lint
81
+ UI.section("\npod bin lib lint\n".yellow) do
82
+ begin
83
+ if @podspec && !@podspec.empty?
84
+ argvs = [
85
+ @podspec, # 业务方传入podspec,对于业务方没有传入podspec,内部由podspecs_to_lint进行遍历
86
+ # '--verbose',
87
+ '--allow-warnings',
88
+ '--use-static-frameworks',
89
+ '--no-clean',
90
+ '--skip-import-validation',
91
+ '--use-modular-headers',
92
+ "--sources=#{sources_option(@code_dependencies, @sources)}",
93
+ '--swift-version=5.0',
94
+ *@additional_args
95
+ ]
96
+ argvs += ['--verbose'] if @verbose
97
+ else
98
+ argvs = [
99
+ # '--verbose',
100
+ '--allow-warnings',
101
+ '--use-static-frameworks',
102
+ '--no-clean',
103
+ '--skip-import-validation',
104
+ '--use-modular-headers',
105
+ "--sources=#{sources_option(@code_dependencies, @sources)}",
106
+ '--swift-version=5.0',
107
+ *@additional_args
108
+ ]
109
+ argvs += ['--verbose'] if @verbose
110
+ end
111
+
112
+ # puts "pod lib lint argvs:#{argvs}"
113
+ lint = Pod::Command::Lib::Lint.new(CLAide::ARGV.new(argvs))
114
+ lint.validate!
115
+ lint.run
116
+ rescue Object => exception
117
+ UI.puts exception
118
+ end
119
+ end
120
+ end
64
121
 
65
122
  end
66
123
  end
@@ -0,0 +1,169 @@
1
+ require 'cocoapods-bb-bin/config/config'
2
+ require 'cocoapods-bb-bin/native/podfile'
3
+ require 'cocoapods-bb-bin/native/push'
4
+
5
+ module Pod
6
+ class Command
7
+ class Bin < Command
8
+ class Repo < Bin
9
+ class Push < Repo
10
+ self.summary = '发布组件.'
11
+ self.description = <<-DESC
12
+ 发布二进制组件 / 源码组件
13
+ DESC
14
+
15
+ self.arguments = [
16
+ CLAide::Argument.new('NAME.podspec', false)
17
+ ]
18
+
19
+ def self.options
20
+ [
21
+ ['--binary', '发布组件的二进制版本'],
22
+ ['--template-podspec=A.binary-template.podspec', '生成拥有 subspec 的二进制 spec 需要的模版 podspec, 插件会更改 version 和 source'],
23
+ ['--reserve-created-spec', '保留生成的二进制 spec 文件'],
24
+ ['--code-dependencies', '使用源码依赖进行 lint'],
25
+ ['--loose-options', '添加宽松的 options, 包括 --use-libraries (可能会造成 entry point (start) undefined)'],
26
+ ['--allow-prerelease', '允许使用 prerelease 的版本 lint'],
27
+ ['--use-static-frameworks', 'Lint uses static frameworks during installation,support modulemap'],
28
+ ['--bb-env', 'bb Company environment(Internal use),support oc、swift project']
29
+ ].concat(Pod::Command::Repo::Push.options).concat(super).uniq
30
+ end
31
+
32
+ def initialize(argv)
33
+ @podspec = argv.shift_argument
34
+ @binary = argv.flag?('binary')
35
+ @loose_options = argv.flag?('loose-options')
36
+ @code_dependencies = argv.flag?('code-dependencies', true)
37
+ @sources = argv.option('sources') || []
38
+ @reserve_created_spec = argv.flag?('reserve-created-spec')
39
+ @template_podspec = argv.option('template-podspec')
40
+ @allow_prerelease = argv.flag?('allow-prerelease')
41
+ @use_static_frameworks = argv.flag?('use-static-frameworks', true)
42
+ @bb_env = argv.flag?('bb-env', false)
43
+ super
44
+ @additional_args = argv.remainder!
45
+ @message = argv.option('commit-message')
46
+ @commit_message = argv.flag?('commit-message', false)
47
+ @use_json = argv.flag?('use-json')
48
+ @verbose = argv.flag?('verbose', false)
49
+ @local_only = argv.flag?('local-only')
50
+ end
51
+
52
+ def run
53
+ # @bb_env = false
54
+ if @bb_env
55
+ Podfile.execute_with_bin_plugin do
56
+ Podfile.execute_with_use_binaries(!@code_dependencies) do
57
+ build_bb_push
58
+ end
59
+ end
60
+ else
61
+ Podfile.execute_with_bin_plugin do
62
+ Podfile.execute_with_allow_prerelease(@allow_prerelease) do
63
+ Podfile.execute_with_use_binaries(!@code_dependencies) do
64
+ argvs = [
65
+ repo,
66
+ "--sources=#{sources_option(@code_dependencies, @sources)}",
67
+ *@additional_args
68
+ ]
69
+
70
+ argvs << spec_file if spec_file
71
+
72
+ if @loose_options
73
+ argvs += ['--allow-warnings', '--use-json']
74
+ if code_spec&.all_dependencies&.any?
75
+ argvs << '--use-libraries'
76
+ end
77
+ end
78
+
79
+ push = Pod::Command::Repo::Push.new(CLAide::ARGV.new(argvs))
80
+ push.validate!
81
+ push.run
82
+ end
83
+ end
84
+ end
85
+ end
86
+ ensure
87
+ clear_binary_spec_file_if_needed unless @reserve_created_spec
88
+ end
89
+
90
+ private
91
+ def build_bb_push
92
+ UI.section("\npod bin repo push\n".yellow) do
93
+ begin
94
+ unless @podspec && !@podspec.empty? # 遍历当前目录下podspec文件
95
+ podspecs = Pathname.glob(Pathname.pwd + '*.podspec{.json,}')
96
+ if podspecs.count.zero?
97
+ raise Informative, 'Unable to find a podspec in the working ' \
98
+ 'directory'
99
+ end
100
+ @podspec = podspecs.first
101
+ end
102
+ argvs = [
103
+ repo, # 内部判断区源码还是二进制
104
+ @podspec,
105
+ "--sources=#{sources_option(@code_dependencies, @sources)}",
106
+ # '--verbose'
107
+ '--allow-warnings',
108
+ '--use-static-frameworks',
109
+ '--skip-import-validation',
110
+ '--use-modular-headers',
111
+ '--swift-version=5.0',
112
+ *@additional_args
113
+ ]
114
+ argvs += ['--verbose'] if @verbose
115
+ argvs += ['--commit-message'] if @message
116
+ argvs += ['--use-json'] if @use_json
117
+ argvs += ['--local-only'] if @local_only
118
+
119
+ # UI.puts "pod repo push argvs:#{argvs}"
120
+ push = Pod::Command::Repo::Push.new(CLAide::ARGV.new(argvs))
121
+ push.validate!
122
+ push.run
123
+ rescue Object => exception
124
+ UI.puts exception
125
+ end
126
+ end
127
+ end
128
+
129
+ def template_spec_file
130
+ @template_spec_file ||= begin
131
+ if @template_podspec
132
+ find_spec_file(@template_podspec)
133
+ else
134
+ binary_template_spec_file
135
+ end
136
+ end
137
+ end
138
+
139
+ def spec_file
140
+ @spec_file ||= begin
141
+ if @podspec
142
+ find_spec_file(@podspec)
143
+ else
144
+ if code_spec_files.empty?
145
+ raise Informative, '当前目录下没有找到可用源码 podspec.'
146
+ end
147
+
148
+ spec_file = if @binary
149
+ code_spec = Pod::Specification.from_file(code_spec_files.first)
150
+ if template_spec_file
151
+ template_spec = Pod::Specification.from_file(template_spec_file)
152
+ end
153
+ create_binary_spec_file(code_spec, template_spec)
154
+ else
155
+ code_spec_files.first
156
+ end
157
+ spec_file
158
+ end
159
+ end
160
+ end
161
+
162
+ def repo
163
+ @binary ? binary_source.name : code_source.name
164
+ end
165
+ end
166
+ end
167
+ end
168
+ end
169
+ end
@@ -24,12 +24,12 @@ module CBin
24
24
  file = config_dev_file
25
25
  if configuration_env == "release_iphoneos"
26
26
  file = config_release_iphoneos_file
27
- puts "\n====== #{configuration_env} 环境 ========"
27
+ # puts "\n====== #{configuration_env} 环境 ========"
28
28
  elsif configuration_env == "debug_iphoneos"
29
29
  file = config_debug_iphoneos_file
30
- puts "\n====== #{configuration_env} 环境 ========"
30
+ # puts "\n====== #{configuration_env} 环境 ========"
31
31
  elsif configuration_env == "dev"
32
- puts "\n====== #{configuration_env} 环境 ========"
32
+ # puts "\n====== #{configuration_env} 环境 ========"
33
33
  else
34
34
  raise "\n===== #{configuration_env} 参数有误,请检查%w[dev debug_iphoneos release_iphoneos]===="
35
35
  end
@@ -94,7 +94,7 @@ module CBin
94
94
 
95
95
  def config
96
96
  @config ||= begin
97
- @config = OpenStruct.new load_config
97
+ @config = OpenStruct.new load_config
98
98
  validate!
99
99
  @config
100
100
  end
@@ -131,6 +131,4 @@ module CBin
131
131
  def self.config
132
132
  @config ||= Config.new
133
133
  end
134
-
135
-
136
134
  end
@@ -27,7 +27,7 @@ module CBin
27
27
  if File.exist?(path)
28
28
  config = JSON.parse(File.read(path))
29
29
  @white_pod_list = config['archive-white-pod-list']
30
- UI.warn "====== archive-white-pod-list = #{@white_pod_list}" if @white_pod_list
30
+ UI.warn "====== white_pod_list = #{@white_pod_list}" if @white_pod_list
31
31
  @ignore_git_list = config['ignore-git-list']
32
32
  UI.warn "====== ignore_git_list = #{@ignore_git_list}" if @ignore_git_list
33
33
  @ignore_http_list = config['ignore-http-list']
@@ -143,6 +143,10 @@ module CBin
143
143
 
144
144
  #编译target名,如 seeyou
145
145
  def target_name
146
+ podfile_path = Pod::Config.instance.podfile_path
147
+ unless podfile_path
148
+ return ""
149
+ end
146
150
  @target_name ||= begin
147
151
  target_name_str = Pod::Config.instance.podfile.root_target_definitions.first.children.first.to_s
148
152
  target_name_str[5,target_name_str.length]
@@ -1,6 +1,6 @@
1
1
 
2
2
  module CBin
3
- VERSION = '0.1.4'
3
+ VERSION = '0.1.8'
4
4
  end
5
5
 
6
6
  module Pod
@@ -56,6 +56,7 @@ module CBin
56
56
  build_static_framework
57
57
  unless @skip_archive
58
58
  unless CBin::Build::Utils.is_framework(@spec)
59
+ UI.puts "build static library"
59
60
  build_static_library
60
61
  zip_static_library
61
62
  else
@@ -48,6 +48,10 @@ module CBin
48
48
 
49
49
  def Utils.uses_frameworks?
50
50
  uses_frameworks = false
51
+ podfile_path = Pod::Config.instance.podfile_path
52
+ unless podfile_path
53
+ return true
54
+ end
51
55
  Pod::Config.instance.podfile.target_definitions.each do |key,value|
52
56
  if key != "Pods"
53
57
  uses_frameworks = value.uses_frameworks?
@@ -10,9 +10,10 @@ module CBin
10
10
  attr_reader :swift_module_path
11
11
  attr_reader :fwk_path
12
12
 
13
- def initialize(name, platform)
13
+ def initialize(name, platform, embedded=false)
14
14
  @name = name
15
15
  @platform = platform
16
+ @embedded = embedded
16
17
  end
17
18
 
18
19
  def make
@@ -79,6 +80,11 @@ module CBin
79
80
 
80
81
  def make_root
81
82
  @root_path = Pathname.new(@platform)
83
+
84
+ if @embedded
85
+ @root_path += Pathname.new(@name + '.embeddedframework')
86
+ end
87
+
82
88
  @root_path.mkpath unless @root_path.exist?
83
89
  end
84
90
  end
@@ -42,10 +42,11 @@ module CBin
42
42
 
43
43
  UI.puts "framework lipo build"
44
44
 
45
- if CBin::Build::Utils.is_swift_module(@spec) || !CBin::Build::Utils.uses_frameworks?
45
+ # if CBin::Build::Utils.is_swift_module(@spec) || !CBin::Build::Utils.uses_frameworks?
46
+ if CBin::Build::Utils.is_framework(@spec) # 默认生成framework为静态库.a
46
47
  UI.section("Building static Library #{@spec}") do
47
48
  # defines = compile
48
- UI.puts "swift framework lipo build"
49
+ UI.puts "static framework lipo build"
49
50
  # build_sim_libraries(defines)
50
51
  output = framework.versions_path + Pathname.new(@spec.name)
51
52
 
@@ -185,7 +186,8 @@ module CBin
185
186
  archs = ios_architectures
186
187
  # archs = %w[arm64 armv7 armv7s]
187
188
  archs.map do |arch|
188
- xcodebuild(defines, "ARCHS=\'#{arch}\' OTHER_CFLAGS=\'-fembed-bitcode -Qunused-arguments\'","build-#{arch}",@build_model)
189
+ xcodebuild(defines, "-sdk iphoneos ARCHS=\'#{arch}\' OTHER_CFLAGS=\'-fembed-bitcode -Qunused-arguments\'","build-#{arch}",@build_model)
190
+ # xcodebuild(defines, "-sdk iphoneos ARCHS=\'#{arch}\' ","build-#{arch}",@build_model)
189
191
  end
190
192
  # else
191
193
  # xcodebuild(defines,options)
@@ -208,12 +210,12 @@ module CBin
208
210
  end
209
211
  end
210
212
 
211
- def xcodebuild(defines = '', args = '', build_dir = 'build', build_model = 'Debug')
212
-
213
+ def xcodebuild(defines = '', args = '', build_dir = 'build', build_model = 'Debug', configuration = 'Release')
214
+
213
215
  unless File.exist?("Pods.xcodeproj") #cocoapods-generate v2.0.0
214
- command = "xcodebuild #{defines} #{args} CONFIGURATION_BUILD_DIR=#{File.join(File.expand_path("..", build_dir), File.basename(build_dir))} clean build -configuration #{build_model} -target #{target_name} -project ./Pods/Pods.xcodeproj 2>&1"
216
+ command = "xcodebuild #{defines} #{args} CONFIGURATION_BUILD_DIR=#{File.join(File.expand_path("..", build_dir), File.basename(build_dir))} clean build -configuration #{configuration} -target #{target_name} -project ./Pods/Pods.xcodeproj 2>&1"
215
217
  else
216
- command = "xcodebuild #{defines} #{args} CONFIGURATION_BUILD_DIR=#{build_dir} clean build -configuration #{build_model} -target #{target_name} -project ./Pods.xcodeproj 2>&1"
218
+ command = "xcodebuild #{defines} #{args} CONFIGURATION_BUILD_DIR=#{build_dir} clean build -configuration #{configuration} -target #{target_name} -project ./Pods.xcodeproj 2>&1"
217
219
  end
218
220
 
219
221
  UI.message "command = #{command}"
@@ -264,14 +266,33 @@ module CBin
264
266
  module_map = File.read(module_map_file)
265
267
  end
266
268
  elsif public_headers.map(&:basename).map(&:to_s).include?("#{@spec.name}-umbrella.h")
267
- module_map = <<-MAP
268
- framework module #{@spec.name} {
269
- umbrella header "#{@spec.name}-umbrella.h"
270
-
271
- export *
272
- module * { export * }
273
- }
274
- MAP
269
+ archs = ios_architectures + ios_architectures_sim
270
+ swift_Compatibility_Header = "build-#{archs.first}/Swift\ Compatibility\ Header/#{@spec.name}-Swift.h"
271
+ # 策略:针对混编组件,modulemap写入-Swift.h by hm 21.11.15
272
+ if File.exist?(swift_Compatibility_Header) # swift或swift与oc混编工程
273
+ module_map = <<-MAP
274
+ framework module #{@spec.name} {
275
+ umbrella header "#{@spec.name}-umbrella.h"
276
+
277
+ export *
278
+ module * { export * }
279
+ }
280
+
281
+ module #{@spec.name}.Swift {
282
+ header "#{@spec.name}-Swift.h"
283
+ requires objc
284
+ }
285
+ MAP
286
+ else
287
+ module_map = <<-MAP
288
+ framework module #{@spec.name} {
289
+ umbrella header "#{@spec.name}-umbrella.h"
290
+
291
+ export *
292
+ module * { export * }
293
+ }
294
+ MAP
295
+ end
275
296
  end
276
297
 
277
298
  unless module_map.nil?
@@ -332,6 +353,8 @@ module CBin
332
353
  if bundles.count > 0
333
354
  UI.message "Copying bundle files #{bundles}"
334
355
  bundle_files = bundles.join(' ')
356
+ raise Informative, "source resource bundle no exist #{bundle_files}" unless File.exist?(bundle_files)
357
+ UI.message "[build dir]Copying resources current_path:#{Dir.pwd} bundle_files:#{bundle_files} res_path:#{framework.resources_path}"
335
358
  `cp -rp #{bundle_files} #{framework.resources_path} 2>&1`
336
359
  end
337
360
 
@@ -343,7 +366,7 @@ module CBin
343
366
  end
344
367
  raise "copy_resources #{spec_source_dir} no exist " unless File.exist?(spec_source_dir)
345
368
 
346
- spec_source_dir = File.join(Dir.pwd,"#{@spec.name}")
369
+ # spec_source_dir = File.join(Dir.pwd,"#{@spec.name}") # 去除重复赋值,有些资源放在pods/组件目录下
347
370
  real_source_dir = spec_source_dir
348
371
  end
349
372
 
@@ -362,8 +385,10 @@ module CBin
362
385
  resources.each do |source|
363
386
  escape_resource << Shellwords.join(source)
364
387
  end
365
- UI.message "Copying resources #{escape_resource}"
366
- `cp -rp #{escape_resource.join(' ')} #{framework.resources_path}`
388
+ bundle_files = escape_resource.join(' ')
389
+ raise Informative, "source resource bundle no exist #{bundle_files}" unless File.exist?(bundle_files)
390
+ UI.message "[search dir]Copying resources current_path:#{Dir.pwd} bundle_files:#{bundle_files} res_path:#{framework.resources_path}"
391
+ `cp -rp #{bundle_files} #{framework.resources_path} 2>&1`
367
392
  end
368
393
  end
369
394
 
@@ -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/spec/push'
11
+ require 'cocoapods-bb-bin/command/bin/repo/push'
12
12
 
13
13
  module CBin
14
14
  class Upload
@@ -22,9 +22,10 @@ module Pod
22
22
  def podfile_for_spec(spec)
23
23
  generator = self
24
24
  dir = configuration.gen_dir_for_pod(spec.name)
25
+ project_name = configuration.project_name_for_spec(spec)
25
26
 
26
27
  Pod::Podfile.new do
27
- project "#{spec.name}.xcodeproj"
28
+ project "#{project_name}.xcodeproj"
28
29
  workspace "#{spec.name}.xcworkspace"
29
30
 
30
31
  plugin 'cocoapods-generate'
@@ -34,7 +35,7 @@ module Pod
34
35
  generator.podfile_plugins.each do |name, options|
35
36
  plugin(*[name, options].compact)
36
37
  end
37
-
38
+ # Pod::UI::puts "====use_frameworks:#{generator.configuration.use_frameworks?}"
38
39
  use_frameworks!(generator.configuration.use_frameworks?)
39
40
 
40
41
  if (supported_swift_versions = generator.supported_swift_versions)
@@ -101,16 +102,20 @@ module Pod
101
102
 
102
103
 
103
104
  inhibit_all_warnings! if generator.inhibit_all_warnings?
104
- use_modular_headers! if generator.use_modular_headers?
105
+ # use_modular_headers! if generator.use_modular_headers?
106
+ # podfile 配置 use_frameworks! :linkage => :static 支持modulemap by hm 21/10/19
107
+ # Pod::UI::puts "====use_frameworks_value:#{generator.use_frameworks_value}"
108
+ unless generator.use_frameworks_value
109
+ use_modular_headers! # 默认组件没有配置或者没有podfile,支持modulemap by hm 21/10/20
110
+ end
111
+ if generator.use_modular_headers? || generator.use_frameworks_value.to_s == '{:linkage=>:static}'
112
+ use_modular_headers!
113
+ end
105
114
 
106
115
  # This is the pod declaration for the local pod,
107
116
  # it will be inherited by the concrete target definitions below
108
-
109
117
  pod_options = generator.dependency_compilation_kwargs(spec.name)
110
118
  pod_options[:path] = spec.defined_in_file.relative_path_from(dir).to_s
111
- # generator.configuration.podfile.dependencies[0].external_source
112
-
113
-
114
119
  { testspecs: test_specs, appspecs: app_specs }.each do |key, specs|
115
120
  pod_options[key] = specs.map { |s| s.name.sub(%r{^#{Regexp.escape spec.root.name}/}, '') }.sort unless specs.empty?
116
121
  end
@@ -196,4 +201,3 @@ module Pod
196
201
  end
197
202
  end
198
203
  end
199
-
@@ -0,0 +1,59 @@
1
+ require 'tempfile'
2
+ require 'fileutils'
3
+ require 'active_support/core_ext/string/inflections'
4
+
5
+ module Pod
6
+ class Command
7
+ class Repo < Command
8
+ class Push < Repo
9
+
10
+ def initialize(argv)
11
+ @allow_warnings = argv.flag?('allow-warnings')
12
+ @local_only = argv.flag?('local-only')
13
+ @repo = argv.shift_argument
14
+ @source = source_for_repo
15
+ @source_urls = argv.option('sources', config.sources_manager.all.map(&:url).append(Pod::TrunkSource::TRUNK_REPO_URL).uniq.join(',')).split(',')
16
+ @update_sources = argv.flag?('update-sources')
17
+ @podspec = argv.shift_argument
18
+ @use_frameworks = !argv.flag?('use-libraries')
19
+ @use_modular_headers = argv.flag?('use-modular-headers', false)
20
+ @use_static_frameworks = argv.flag?('use-static-frameworks')
21
+ @private = argv.flag?('private', true)
22
+ @message = argv.option('commit-message')
23
+ @commit_message = argv.flag?('commit-message', false)
24
+ @use_json = argv.flag?('use-json')
25
+ @swift_version = argv.option('swift-version', nil)
26
+ @skip_import_validation = argv.flag?('skip-import-validation', false)
27
+ @skip_tests = argv.flag?('skip-tests', false)
28
+ @allow_overwrite = argv.flag?('overwrite', true)
29
+ super
30
+ end
31
+
32
+ # Performs a full lint against the podspecs.
33
+ #
34
+ def validate_podspec_files
35
+ UI.puts "\nValidating #{'spec'.pluralize(count)}".yellow
36
+ podspec_files.each do |podspec|
37
+ validator = Validator.new(podspec, @source_urls)
38
+ validator.allow_warnings = @allow_warnings
39
+ validator.use_frameworks = @use_frameworks
40
+ validator.use_static_frameworks = @use_static_frameworks
41
+ validator.use_modular_headers = @use_modular_headers
42
+ validator.ignore_public_only_results = @private
43
+ validator.swift_version = @swift_version
44
+ validator.skip_import_validation = @skip_import_validation
45
+ validator.skip_tests = @skip_tests
46
+ begin
47
+ validator.validate
48
+ rescue => e
49
+ raise Informative, "The `#{podspec}` specification does not validate." \
50
+ "\n\n#{e.message}"
51
+ end
52
+ raise Informative, "The `#{podspec}` specification does not validate." unless validator.validated?
53
+ end
54
+ end
55
+
56
+ end
57
+ end
58
+ end
59
+ end
@@ -12,12 +12,13 @@ if Pod.match_version?('~> 1.4')
12
12
  require 'cocoapods-bb-bin/native/linter'
13
13
  require 'cocoapods-bb-bin/native/resolver'
14
14
  require 'cocoapods-bb-bin/native/source'
15
- require 'cocoapods-bb-bin/native/validator'
15
+ # require 'cocoapods-bb-bin/native/validator' #移除使用cocoapods默认自带
16
16
  require 'cocoapods-bb-bin/native/acknowledgements'
17
17
  require 'cocoapods-bb-bin/native/sandbox_analyzer'
18
18
  require 'cocoapods-bb-bin/native/podspec_finder'
19
19
  require 'cocoapods-bb-bin/native/file_accessor'
20
20
  require 'cocoapods-bb-bin/native/pod_target_installer'
21
21
  require 'cocoapods-bb-bin/native/target_validator'
22
+ require 'cocoapods-bb-bin/native/push' # 支持modulemap & swift与oc工程混编
22
23
 
23
24
  end
@@ -6,7 +6,7 @@ Pod::HooksManager.register('cocoapods-bb-bin', :pre_install) do |_context, _|
6
6
  require 'cocoapods-bb-bin/native'
7
7
 
8
8
  #pod bin update || install 不走这里
9
- if $ARGV[1] = 'update' || $ARGV[1] != 'install'
9
+ if $ARGV[1] == 'update' || $ARGV[1] != 'install'
10
10
 
11
11
  else
12
12
  # pod bin repo update 更新二进制私有源
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.1.4
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - humin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-10-18 00:00:00.000000000 Z
11
+ date: 2021-11-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parallel
@@ -62,6 +62,9 @@ dependencies:
62
62
  name: cocoapods-bb-xcframework
63
63
  requirement: !ruby/object:Gem::Requirement
64
64
  requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: 0.2.2
65
68
  - - "<"
66
69
  - !ruby/object:Gem::Version
67
70
  version: '1.0'
@@ -69,6 +72,9 @@ dependencies:
69
72
  prerelease: false
70
73
  version_requirements: !ruby/object:Gem::Requirement
71
74
  requirements:
75
+ - - ">="
76
+ - !ruby/object:Gem::Version
77
+ version: 0.2.2
72
78
  - - "<"
73
79
  - !ruby/object:Gem::Version
74
80
  version: '1.0'
@@ -122,9 +128,9 @@ files:
122
128
  - lib/cocoapods-bb-bin/command/bin/initHotKey.rb
123
129
  - lib/cocoapods-bb-bin/command/bin/install.rb
124
130
  - lib/cocoapods-bb-bin/command/bin/lib/lint.rb
131
+ - lib/cocoapods-bb-bin/command/bin/repo/push.rb
125
132
  - lib/cocoapods-bb-bin/command/bin/repo/update.rb
126
133
  - lib/cocoapods-bb-bin/command/bin/spec/create.rb
127
- - lib/cocoapods-bb-bin/command/bin/spec/push.rb
128
134
  - lib/cocoapods-bb-bin/command/bin/update.rb
129
135
  - lib/cocoapods-bb-bin/config/config.rb
130
136
  - lib/cocoapods-bb-bin/config/config_asker.rb
@@ -160,13 +166,13 @@ files:
160
166
  - lib/cocoapods-bb-bin/native/podfile_env.rb
161
167
  - lib/cocoapods-bb-bin/native/podfile_generator.rb
162
168
  - lib/cocoapods-bb-bin/native/podspec_finder.rb
169
+ - lib/cocoapods-bb-bin/native/push.rb
163
170
  - lib/cocoapods-bb-bin/native/resolver.rb
164
171
  - lib/cocoapods-bb-bin/native/sandbox_analyzer.rb
165
172
  - lib/cocoapods-bb-bin/native/source.rb
166
173
  - lib/cocoapods-bb-bin/native/sources_manager.rb
167
174
  - lib/cocoapods-bb-bin/native/specification.rb
168
175
  - lib/cocoapods-bb-bin/native/target_validator.rb
169
- - lib/cocoapods-bb-bin/native/validator.rb
170
176
  - lib/cocoapods-bb-bin/source_provider_hook.rb
171
177
  - lib/cocoapods_plugin.rb
172
178
  - spec/command/bin_spec.rb
@@ -190,7 +196,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
190
196
  - !ruby/object:Gem::Version
191
197
  version: '0'
192
198
  requirements: []
193
- rubygems_version: 3.1.4
199
+ rubygems_version: 3.2.30
194
200
  signing_key:
195
201
  specification_version: 4
196
202
  summary: cocoapods-bb-bin is a plugin which helps develpers switching pods between
@@ -1,114 +0,0 @@
1
- require 'cocoapods-bb-bin/config/config'
2
- require 'cocoapods-bb-bin/native/podfile'
3
-
4
- module Pod
5
- class Command
6
- class Bin < Command
7
- class Repo < Bin
8
- class Push < Repo
9
- self.summary = '发布组件.'
10
- self.description = <<-DESC
11
- 发布二进制组件 / 源码组件
12
- DESC
13
-
14
- self.arguments = [
15
- CLAide::Argument.new('NAME.podspec', false)
16
- ]
17
-
18
- def self.options
19
- [
20
- ['--binary', '发布组件的二进制版本'],
21
- ['--template-podspec=A.binary-template.podspec', '生成拥有 subspec 的二进制 spec 需要的模版 podspec, 插件会更改 version 和 source'],
22
- ['--reserve-created-spec', '保留生成的二进制 spec 文件'],
23
- ['--code-dependencies', '使用源码依赖进行 lint'],
24
- ['--loose-options', '添加宽松的 options, 包括 --use-libraries (可能会造成 entry point (start) undefined)'],
25
- ['--allow-prerelease', '允许使用 prerelease 的版本 lint']
26
- ].concat(Pod::Command::Repo::Push.options).concat(super).uniq
27
- end
28
-
29
- def initialize(argv)
30
- @podspec = argv.shift_argument
31
- @binary = argv.flag?('binary')
32
- @loose_options = argv.flag?('loose-options')
33
- @code_dependencies = argv.flag?('code-dependencies')
34
- @sources = argv.option('sources') || []
35
- @reserve_created_spec = argv.flag?('reserve-created-spec')
36
- @template_podspec = argv.option('template-podspec')
37
- @allow_prerelease = argv.flag?('allow-prerelease')
38
- super
39
-
40
- @additional_args = argv.remainder!
41
- end
42
-
43
- def run
44
- Podfile.execute_with_bin_plugin do
45
- Podfile.execute_with_allow_prerelease(@allow_prerelease) do
46
- Podfile.execute_with_use_binaries(!@code_dependencies) do
47
- argvs = [
48
- repo,
49
- "--sources=#{sources_option(@code_dependencies, @sources)}",
50
- *@additional_args
51
- ]
52
-
53
- argvs << spec_file if spec_file
54
-
55
- if @loose_options
56
- argvs += ['--allow-warnings', '--use-json']
57
- if code_spec&.all_dependencies&.any?
58
- argvs << '--use-libraries'
59
- end
60
- end
61
-
62
- push = Pod::Command::Repo::Push.new(CLAide::ARGV.new(argvs))
63
- push.validate!
64
- push.run
65
- end
66
- end
67
- end
68
- ensure
69
- clear_binary_spec_file_if_needed unless @reserve_created_spec
70
- end
71
-
72
- private
73
-
74
- def template_spec_file
75
- @template_spec_file ||= begin
76
- if @template_podspec
77
- find_spec_file(@template_podspec)
78
- else
79
- binary_template_spec_file
80
- end
81
- end
82
- end
83
-
84
- def spec_file
85
- @spec_file ||= begin
86
- if @podspec
87
- find_spec_file(@podspec)
88
- else
89
- if code_spec_files.empty?
90
- raise Informative, '当前目录下没有找到可用源码 podspec.'
91
- end
92
-
93
- spec_file = if @binary
94
- code_spec = Pod::Specification.from_file(code_spec_files.first)
95
- if template_spec_file
96
- template_spec = Pod::Specification.from_file(template_spec_file)
97
- end
98
- create_binary_spec_file(code_spec, template_spec)
99
- else
100
- code_spec_files.first
101
- end
102
- spec_file
103
- end
104
- end
105
- end
106
-
107
- def repo
108
- @binary ? binary_source.name : code_source.name
109
- end
110
- end
111
- end
112
- end
113
- end
114
- end
@@ -1,40 +0,0 @@
1
-
2
-
3
- module Pod
4
- class Validator
5
- # def validate_source_url(spec)
6
- # return if spec.source.nil? || spec.source[:http].nil?
7
- # url = URI(spec.source[:http])
8
- # return if url.scheme == 'https' || url.scheme == 'file'
9
- # warning('http', "The URL (`#{url}`) doesn't use the encrypted HTTPs protocol. " \
10
- # 'It is crucial for Pods to be transferred over a secure protocol to protect your users from man-in-the-middle attacks. '\
11
- # 'This will be an error in future releases. Please update the URL to use https.')
12
- # end
13
- #
14
- # Perform analysis for a given spec (or subspec)
15
- #
16
- def perform_extensive_analysis(spec)
17
- return true
18
- end
19
-
20
- #覆盖
21
- def check_file_patterns
22
- FILE_PATTERNS.each do |attr_name|
23
- next if %i(source_files resources).include? attr_name
24
- if respond_to?("_validate_#{attr_name}", true)
25
- send("_validate_#{attr_name}")
26
- else
27
- validate_nonempty_patterns(attr_name, :error)
28
- end
29
- end
30
-
31
- _validate_header_mappings_dir
32
- if consumer.spec.root?
33
- _validate_license
34
- _validate_module_map
35
- end
36
- end
37
-
38
- def validate_source_url(spec); end
39
- end
40
- end