cocoapods-imy-bin 0.2.5 → 0.2.6

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
  SHA1:
3
- metadata.gz: 976392ef661c708c539726796304a39f9c7898d8
4
- data.tar.gz: e9d45a6bd34f8bf2e13a9278f9fc54ae40168619
3
+ metadata.gz: bcb63ef530c6ebfb4e17dd2678c7accf04c62b21
4
+ data.tar.gz: 4b2c8dd37d15b0fd3c6f0a449767f3e10d891e10
5
5
  SHA512:
6
- metadata.gz: d364c9e6ea4b03bb16d4587d5da01b16524ff705220655494e3112485e8a5eaa36e7857c6657bb06aaebee2116a3547f0451a8a6c9d0fb483c799055498ab7b2
7
- data.tar.gz: 91e2ccc215a8f3a4803041feba29356054e9a52231fe90699ce6c6b9ac081f19fe8b09bfd69eed13705f1018dbca6339276e98501732846e5f294c77cb8d5f9e
6
+ metadata.gz: 72dd406415ec81288859a7804c87f62d53ddf0af353b3f57462eb87d8f45cf56fe424787e0ee8131d2f8469e401fb36bb2fe885ac33585f5393acaedeeabe58c
7
+ data.tar.gz: f19462b39382125c4bc9ee0bf4ebcfb71c1b8ff4418b9d9739a154c2c35a85b727b3f214eebf72a434ac3b48507673346cb7799228d6376f5cea8031eeffdb10
@@ -29,6 +29,7 @@ module Pod
29
29
  ['--sources', '私有源地址,多个用分号区分'],
30
30
  ['--framework-output', '输出framework文件'],
31
31
  ['--no-zip', '不压缩静态库 为 zip'],
32
+ ['--configuration', 'Build the specified configuration (e.g. Debug). Defaults to Release'],
32
33
  ['--env', "该组件上传的环境 %w[dev debug_iphoneos release_iphoneos]"]
33
34
  ].concat(Pod::Command::Gen.options).concat(super).uniq
34
35
  end
@@ -51,6 +52,8 @@ module Pod
51
52
  @sources = argv.option('sources') || []
52
53
  @platform = Platform.new(:ios)
53
54
 
55
+ @config = argv.option('configuration', 'Release')
56
+
54
57
  @framework_path
55
58
  super
56
59
 
@@ -81,7 +84,8 @@ module Pod
81
84
  @framework_output,
82
85
  @zip,
83
86
  @spec,
84
- CBin::Config::Builder.instance.white_pod_list.include?(@spec.name))
87
+ CBin::Config::Builder.instance.white_pod_list.include?(@spec.name),
88
+ @config)
85
89
  builder.build
86
90
  builder.clean_workspace if @clean && !@all_make
87
91
  end
@@ -119,7 +123,9 @@ module Pod
119
123
  @platform,
120
124
  @framework_output,
121
125
  @zip,
122
- @spec)
126
+ @spec,
127
+ false ,
128
+ @config)
123
129
  builder.build
124
130
  rescue
125
131
  fail_build_specs << spec
@@ -19,6 +19,7 @@ module Pod
19
19
  ['--framework-output', '输出framework文件'],
20
20
  ['--no-zip', '不压缩静态 framework 为 zip'],
21
21
  ['--all-make', '对该组件的依赖库,全部制作为二进制组件'],
22
+ ['--configuration', 'Build the specified configuration (e.g. Debug). Defaults to Release'],
22
23
  ['--env', "该组件上传的环境 %w[dev debug_iphoneos release_iphoneos]"]
23
24
  ]
24
25
  end
@@ -38,6 +39,9 @@ module Pod
38
39
  @zip = argv.flag?('zip', true)
39
40
  @all_make = argv.flag?('all-make', false )
40
41
  @verbose = argv.flag?('verbose',true)
42
+
43
+ @config = argv.option('configuration', 'Release')
44
+
41
45
  super
42
46
  end
43
47
 
@@ -113,7 +117,7 @@ module Pod
113
117
  if @env
114
118
  argvs += ["--env=#{@env}"]
115
119
  end
116
-
120
+ argvs += ["--configuration=#{@config}"]
117
121
 
118
122
  archive = Pod::Command::Bin::Archive.new(CLAide::ARGV.new(argvs))
119
123
  archive.validate!
@@ -1,6 +1,6 @@
1
1
 
2
2
  module CBin
3
- VERSION = '0.2.5'
3
+ VERSION = '0.2.6'
4
4
  end
5
5
 
6
6
  module Pod
@@ -51,7 +51,7 @@ module CBin
51
51
  source_dir = Dir.pwd
52
52
  file_accessor = Sandbox::FileAccessor.new(Pathname.new('.').expand_path, @spec.consumer(@platform))
53
53
  Dir.chdir(workspace_directory) do
54
- builder = CBin::Framework::Builder.new(@spec, file_accessor, @platform, source_dir,@isRootSpec)
54
+ builder = CBin::Framework::Builder.new(@spec, file_accessor, @platform, source_dir, @isRootSpec, @build_model )
55
55
  @@build_defines = builder.build if @isRootSpec
56
56
  begin
57
57
  @framework_path = builder.lipo_build(@@build_defines) unless @skip_archive
@@ -38,7 +38,7 @@ module CBin
38
38
  end
39
39
 
40
40
  def lipo_build(defines)
41
- UI.section("Building static framework #{@spec}") do
41
+ UI.section("Building static Library #{@spec}") do
42
42
  # defines = compile
43
43
 
44
44
  # build_sim_libraries(defines)
@@ -68,118 +68,22 @@ module CBin
68
68
  `cp -fa #{@platform}/#{framework_name} #{target_dir}`
69
69
  end
70
70
 
71
+ #模拟器,目前只支持 debug x86-64
71
72
  def build_sim_libraries(defines)
72
73
  UI.message 'Building simulator libraries'
73
74
 
74
75
  if is_debug_model
75
76
  # archs = %w[i386 x86_64]
76
- archs = %w[x86_64]
77
+ archs = ios_architectures_sim
77
78
  archs.map do |arch|
78
79
  xcodebuild(defines, "-sdk iphonesimulator ARCHS=\'#{arch}\' ", "build-#{arch}","Debug")
79
80
  end
80
81
  else
81
- xcodebuild(defines, "-sdk iphonesimulator ", 'build-simulator')
82
+ xcodebuild(defines, "-sdk iphonesimulator ", 'build-simulator', "Release")
82
83
  end
83
84
 
84
85
  end
85
86
 
86
- def copy_headers
87
- #走 podsepc中的public_headers
88
- public_headers = Array.new
89
-
90
- #by slj 如果没有头文件,去 "Headers/Public"拿
91
- # if public_headers.empty?
92
- Dir.chdir("./Headers/Public/#{@spec.name}") do
93
- headers = Dir.glob('*.h')
94
- headers.each do |h|
95
- public_headers << Pathname.new(File.join(Dir.pwd,h))
96
- end
97
- end
98
- # end
99
-
100
- # UI.message "Copying public headers #{public_headers.map(&:basename).map(&:to_s)}"
101
-
102
- public_headers.each do |h|
103
- `ditto #{h} #{framework.headers_path}/#{h.basename}`
104
- end
105
-
106
- # If custom 'module_map' is specified add it to the framework distribution
107
- # otherwise check if a header exists that is equal to 'spec.name', if so
108
- # create a default 'module_map' one using it.
109
- if !@spec.module_map.nil?
110
- module_map_file = @file_accessor.module_map
111
- if Pathname(module_map_file).exist?
112
- module_map = File.read(module_map_file)
113
- end
114
- elsif public_headers.map(&:basename).map(&:to_s).include?("#{@spec.name}.h")
115
- module_map = <<-MAP
116
- framework module #{@spec.name} {
117
- umbrella header "#{@spec.name}.h"
118
-
119
- export *
120
- module * { export * }
121
- }
122
- MAP
123
- end
124
-
125
- unless module_map.nil?
126
- UI.message "Writing module map #{module_map}"
127
- unless framework.module_map_path.exist?
128
- framework.module_map_path.mkpath
129
- end
130
- File.write("#{framework.module_map_path}/module.modulemap", module_map)
131
- end
132
- end
133
-
134
- def copy_license
135
- UI.message 'Copying license'
136
- license_file = @spec.license[:file] || 'LICENSE'
137
- `cp "#{license_file}" .` if Pathname(license_file).exist?
138
- end
139
-
140
- def copy_resources
141
-
142
- bundles = Dir.glob('./build/*.bundle')
143
-
144
- bundle_names = [@spec, *@spec.recursive_subspecs].flat_map do |spec|
145
- consumer = spec.consumer(@platform)
146
- consumer.resource_bundles.keys +
147
- consumer.resources.map do |r|
148
- File.basename(r, '.bundle') if File.extname(r) == 'bundle'
149
- end
150
- end.compact.uniq
151
-
152
- bundles.select! do |bundle|
153
- bundle_name = File.basename(bundle, '.bundle')
154
- bundle_names.include?(bundle_name)
155
- end
156
-
157
- if bundles.count > 0
158
- UI.message "Copying bundle files #{bundles}"
159
- bundle_files = bundles.join(' ')
160
- `cp -rp #{bundle_files} #{framework.resources_path} 2>&1`
161
- end
162
-
163
- real_source_dir = @isRootSpec ? @source_dir : Pathname.new(File.join(Dir.pwd,"#{@spec.name}"))
164
- resources = [@spec, *@spec.recursive_subspecs].flat_map do |spec|
165
- expand_paths(real_source_dir, spec.consumer(@platform).resources)
166
- end.compact.uniq
167
-
168
- if resources.count == 0 && bundles.count == 0
169
- framework.delete_resources
170
- return
171
- end
172
-
173
- if resources.count > 0
174
- #把 路径转义。 避免空格情况下拷贝失败
175
- escape_resource = []
176
- resources.each do |source|
177
- escape_resource << Shellwords.join(source)
178
- end
179
- UI.message "Copying resources #{escape_resource}"
180
- `cp -rp #{escape_resource.join(' ')} #{framework.resources_path}`
181
- end
182
- end
183
87
 
184
88
  def static_libs_in_sandbox(build_dir = 'build')
185
89
  file = Dir.glob("#{build_dir}/lib#{target_name}.a")
@@ -194,21 +98,32 @@ module CBin
194
98
  static_libs = static_libs_in_sandbox('build') + static_libs_in_sandbox('build-simulator') + @vendored_libraries
195
99
  if is_debug_model
196
100
  ios_architectures.map do |arch|
197
- static_libs += static_libs_in_sandbox("build-#{arch}") + static_libs_in_sandbox('build-simulator') + @vendored_libraries
101
+ static_libs += static_libs_in_sandbox("build-#{arch}") + @vendored_libraries
102
+ end
103
+ ios_architectures_sim do |arch|
104
+ static_libs += static_libs_in_sandbox("build-#{arch}") + @vendored_libraries
198
105
  end
199
106
  end
200
107
 
201
108
  build_path = Pathname("build")
202
109
  build_path.mkpath unless build_path.exist?
203
110
 
204
- libs = ios_architectures.map do |arch|
205
- library = "build/package-#{@spec.name}-#{arch}.a"
206
- # libtool -arch_only arm64 -static -o build/package-armv64.a build/libIMYFoundation.a build-simulator/libIMYFoundation.a
207
- # 从liBFoundation.a 文件中,提取出 arm64 架构的文件,命名为build/package-armv64.a
208
- UI.message "libtool -arch_only #{arch} -static -o #{library} #{static_libs.join(' ')}"
209
- `libtool -arch_only #{arch} -static -o #{library} #{static_libs.join(' ')}`
210
- library
111
+ if is_debug_model
112
+ libs = (ios_architectures + ios_architectures_sim) .map do |arch|
113
+ library = "build-#{arch}/lib#{@spec.name}.a"
114
+ library
115
+ end
116
+ else
117
+ libs = ios_architectures.map do |arch|
118
+ library = "build/package-#{@spec.name}-#{arch}.a"
119
+ # libtool -arch_only arm64 -static -o build/package-armv64.a build/libIMYFoundation.a build-simulator/libIMYFoundation.a
120
+ # 从liBFoundation.a 文件中,提取出 arm64 架构的文件,命名为build/package-armv64.a
121
+ UI.message "libtool -arch_only #{arch} -static -o #{library} #{static_libs.join(' ')}"
122
+ `libtool -arch_only #{arch} -static -o #{library} #{static_libs.join(' ')}`
123
+ library
124
+ end
211
125
  end
126
+
212
127
  UI.message "lipo -create -output #{output} #{libs.join(' ')}"
213
128
  `lipo -create -output #{output} #{libs.join(' ')}`
214
129
  end
@@ -230,11 +145,18 @@ module CBin
230
145
  # iphone5,iphone5s以下的模拟器
231
146
  # >x86_64
232
147
  # iphone6以上的模拟器
233
- archs = %w[x86_64 arm64 armv7]
148
+ archs = %w[arm64 armv7]
234
149
  # archs = %w[x86_64 arm64 armv7s i386]
235
- @vendored_libraries.each do |library|
236
- archs = `lipo -info #{library}`.split & archs
237
- end
150
+ # @vendored_libraries.each do |library|
151
+ # archs = `lipo -info #{library}`.split & archs
152
+ # end
153
+ archs
154
+ end
155
+
156
+ def ios_architectures_sim
157
+
158
+ archs = %w[x86_64]
159
+ # TODO 处理是否需要 i386
238
160
  archs
239
161
  end
240
162
 
@@ -245,7 +167,7 @@ module CBin
245
167
 
246
168
  options = ios_build_options
247
169
  if is_debug_model
248
- archs = %w[arm64 armv7]
170
+ archs = ios_architectures
249
171
  # archs = %w[arm64 armv7 armv7s]
250
172
  archs.map do |arch|
251
173
  xcodebuild(defines, "ARCHS=\'#{arch}\' OTHER_CFLAGS=\'-fembed-bitcode -Qunused-arguments\'","build-#{arch}",@build_model)
@@ -271,7 +193,7 @@ module CBin
271
193
  # end
272
194
  end
273
195
 
274
- def xcodebuild(defines = '', args = '', build_dir = 'build',build_model = 'Release')
196
+ def xcodebuild(defines = '', args = '', build_dir = 'build',build_model = 'Debug')
275
197
  #xcodebuild GCC_PREPROCESSOR_DEFINITIONS='$(inherited)' ARCHS='x86_64 arm64 armv7 armv7s i386' OTHER_CFLAGS='-fembed-bitcode -Qunused-arguments' CONFIGURATION_BUILD_DIR=build clean build -configuration Debug -target IMYTCP -project ./Pods.xcodeproj 2>&1
276
198
  # xcodebuild GCC_PREPROCESSOR_DEFINITIONS='$(inherited)' -sdk iphoneos CONFIGURATION_BUILD_DIR=build-simulator clean build -configuration Release -target IMYFoundation -project ./Pods/Pods.xcodeproj 2>&1
277
199
  command = "xcodebuild #{defines} #{args} CONFIGURATION_BUILD_DIR=#{build_dir} clean build -configuration #{build_model} -target #{target_name} -project ./Pods.xcodeproj 2>&1"
@@ -289,6 +211,104 @@ module CBin
289
211
  end
290
212
  end
291
213
 
214
+ def copy_headers
215
+ #走 podsepc中的public_headers
216
+ public_headers = Array.new
217
+
218
+ #by slj 如果没有头文件,去 "Headers/Public"拿
219
+ # if public_headers.empty?
220
+ Dir.chdir("./Headers/Public/#{@spec.name}") do
221
+ headers = Dir.glob('*.h')
222
+ headers.each do |h|
223
+ public_headers << Pathname.new(File.join(Dir.pwd,h))
224
+ end
225
+ end
226
+ # end
227
+
228
+ # UI.message "Copying public headers #{public_headers.map(&:basename).map(&:to_s)}"
229
+
230
+ public_headers.each do |h|
231
+ `ditto #{h} #{framework.headers_path}/#{h.basename}`
232
+ end
233
+
234
+ # If custom 'module_map' is specified add it to the framework distribution
235
+ # otherwise check if a header exists that is equal to 'spec.name', if so
236
+ # create a default 'module_map' one using it.
237
+ if !@spec.module_map.nil?
238
+ module_map_file = @file_accessor.module_map
239
+ if Pathname(module_map_file).exist?
240
+ module_map = File.read(module_map_file)
241
+ end
242
+ elsif public_headers.map(&:basename).map(&:to_s).include?("#{@spec.name}.h")
243
+ module_map = <<-MAP
244
+ framework module #{@spec.name} {
245
+ umbrella header "#{@spec.name}.h"
246
+
247
+ export *
248
+ module * { export * }
249
+ }
250
+ MAP
251
+ end
252
+
253
+ unless module_map.nil?
254
+ UI.message "Writing module map #{module_map}"
255
+ unless framework.module_map_path.exist?
256
+ framework.module_map_path.mkpath
257
+ end
258
+ File.write("#{framework.module_map_path}/module.modulemap", module_map)
259
+ end
260
+ end
261
+
262
+ def copy_license
263
+ UI.message 'Copying license'
264
+ license_file = @spec.license[:file] || 'LICENSE'
265
+ `cp "#{license_file}" .` if Pathname(license_file).exist?
266
+ end
267
+
268
+ def copy_resources
269
+
270
+ bundles = Dir.glob('./build/*.bundle')
271
+
272
+ bundle_names = [@spec, *@spec.recursive_subspecs].flat_map do |spec|
273
+ consumer = spec.consumer(@platform)
274
+ consumer.resource_bundles.keys +
275
+ consumer.resources.map do |r|
276
+ File.basename(r, '.bundle') if File.extname(r) == 'bundle'
277
+ end
278
+ end.compact.uniq
279
+
280
+ bundles.select! do |bundle|
281
+ bundle_name = File.basename(bundle, '.bundle')
282
+ bundle_names.include?(bundle_name)
283
+ end
284
+
285
+ if bundles.count > 0
286
+ UI.message "Copying bundle files #{bundles}"
287
+ bundle_files = bundles.join(' ')
288
+ `cp -rp #{bundle_files} #{framework.resources_path} 2>&1`
289
+ end
290
+
291
+ real_source_dir = @isRootSpec ? @source_dir : Pathname.new(File.join(Dir.pwd,"#{@spec.name}"))
292
+ resources = [@spec, *@spec.recursive_subspecs].flat_map do |spec|
293
+ expand_paths(real_source_dir, spec.consumer(@platform).resources)
294
+ end.compact.uniq
295
+
296
+ if resources.count == 0 && bundles.count == 0
297
+ framework.delete_resources
298
+ return
299
+ end
300
+
301
+ if resources.count > 0
302
+ #把 路径转义。 避免空格情况下拷贝失败
303
+ escape_resource = []
304
+ resources.each do |source|
305
+ escape_resource << Shellwords.join(source)
306
+ end
307
+ UI.message "Copying resources #{escape_resource}"
308
+ `cp -rp #{escape_resource.join(' ')} #{framework.resources_path}`
309
+ end
310
+ end
311
+
292
312
  def expand_paths(source_dir, path_specs)
293
313
  path_specs.map do |path_spec|
294
314
  Dir.glob(File.join(source_dir, path_spec))
@@ -302,6 +322,8 @@ module CBin
302
322
  framework
303
323
  end
304
324
  end
325
+
326
+
305
327
  end
306
328
  end
307
329
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocoapods-imy-bin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 0.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - 苏良锦
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-06-15 00:00:00.000000000 Z
11
+ date: 2020-06-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parallel