cocoapods-imy-bin 0.2.6 → 0.3.0.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +0 -540
- data/lib/cocoapods-imy-bin/command/bin/archive.rb +43 -4
- data/lib/cocoapods-imy-bin/command/bin/auto.rb +9 -7
- data/lib/cocoapods-imy-bin/command/bin/code.rb +1 -6
- data/lib/cocoapods-imy-bin/command/bin/local.rb +16 -7
- data/lib/cocoapods-imy-bin/config/config.rb +1 -1
- data/lib/cocoapods-imy-bin/config/config_builder.rb +39 -2
- data/lib/cocoapods-imy-bin/gem_version.rb +1 -1
- data/lib/cocoapods-imy-bin/helpers.rb +1 -0
- data/lib/cocoapods-imy-bin/helpers/Info.plist +0 -0
- data/lib/cocoapods-imy-bin/helpers/build_helper.rb +15 -7
- data/lib/cocoapods-imy-bin/helpers/build_utils.rb +63 -0
- data/lib/cocoapods-imy-bin/helpers/framework.rb +25 -2
- data/lib/cocoapods-imy-bin/helpers/framework_builder.rb +172 -57
- data/lib/cocoapods-imy-bin/helpers/library.rb +2 -2
- data/lib/cocoapods-imy-bin/helpers/local/local_build_helper.rb +38 -6
- data/lib/cocoapods-imy-bin/helpers/local/local_framework.rb +20 -0
- data/lib/cocoapods-imy-bin/helpers/local/local_framework_builder.rb +91 -38
- data/lib/cocoapods-imy-bin/helpers/sources_helper.rb +5 -2
- data/lib/cocoapods-imy-bin/helpers/spec_source_creator.rb +65 -8
- data/lib/cocoapods-imy-bin/helpers/upload_helper.rb +8 -3
- data/lib/cocoapods-imy-bin/native.rb +4 -0
- data/lib/cocoapods-imy-bin/native/analyzer.rb +2 -0
- data/lib/cocoapods-imy-bin/native/file_accessor.rb +28 -0
- data/lib/cocoapods-imy-bin/native/pod_target_installer.rb +94 -0
- data/lib/cocoapods-imy-bin/native/podfile_generator.rb +11 -2
- data/lib/cocoapods-imy-bin/native/target_validator.rb +41 -0
- data/lib/cocoapods-imy-bin/native/validator.rb +1 -38
- metadata +7 -2
@@ -4,13 +4,14 @@ require 'cocoapods-imy-bin/helpers/framework.rb'
|
|
4
4
|
require 'English'
|
5
5
|
require 'cocoapods-imy-bin/config/config_builder'
|
6
6
|
require 'shellwords'
|
7
|
+
require 'cocoapods-imy-bin/helpers/build_utils'
|
7
8
|
|
8
9
|
module CBin
|
9
10
|
class Framework
|
10
11
|
class Builder
|
11
12
|
include Pod
|
12
13
|
#Debug下还待完成
|
13
|
-
def initialize(spec, file_accessor, platform, source_dir, isRootSpec = true, build_model="
|
14
|
+
def initialize(spec, file_accessor, platform, source_dir, isRootSpec = true, build_model="Debug")
|
14
15
|
@spec = spec
|
15
16
|
@source_dir = source_dir
|
16
17
|
@file_accessor = file_accessor
|
@@ -38,26 +39,54 @@ module CBin
|
|
38
39
|
end
|
39
40
|
|
40
41
|
def lipo_build(defines)
|
41
|
-
UI.section("Building static Library #{@spec}") do
|
42
|
-
# defines = compile
|
43
42
|
|
44
|
-
|
45
|
-
|
43
|
+
if CBin::Build::Utils.is_swift_module(@spec) || !CBin::Build::Utils.uses_frameworks?
|
44
|
+
UI.section("Building static Library #{@spec}") do
|
45
|
+
# defines = compile
|
46
46
|
|
47
|
-
|
47
|
+
# build_sim_libraries(defines)
|
48
|
+
output = framework.versions_path + Pathname.new(@spec.name)
|
48
49
|
|
49
|
-
|
50
|
-
copy_license
|
51
|
-
copy_resources
|
50
|
+
build_static_library_for_ios(output)
|
52
51
|
|
53
|
-
|
52
|
+
copy_headers
|
53
|
+
copy_license
|
54
|
+
copy_resources
|
55
|
+
|
56
|
+
cp_to_source_dir
|
57
|
+
end
|
58
|
+
else
|
59
|
+
# begin
|
60
|
+
UI.section("Building framework #{@spec}") do
|
61
|
+
# defines = compile
|
62
|
+
|
63
|
+
# build_sim_libraries(defines)
|
64
|
+
output = framework.fwk_path + Pathname.new(@spec.name)
|
65
|
+
|
66
|
+
copy_static_framework_dir_for_ios
|
67
|
+
|
68
|
+
build_static_framework_machO_for_ios(output)
|
69
|
+
|
70
|
+
# copy_license
|
71
|
+
copy_framework_resources
|
72
|
+
|
73
|
+
#cp_to_source_dir#
|
74
|
+
|
75
|
+
# rescue Object => exception
|
76
|
+
# UI.puts exception
|
77
|
+
# end
|
78
|
+
end
|
54
79
|
end
|
80
|
+
|
55
81
|
framework
|
56
82
|
end
|
57
83
|
|
58
84
|
private
|
59
85
|
|
60
86
|
def cp_to_source_dir
|
87
|
+
# 删除Versions 软链接
|
88
|
+
framework.remove_current_version if CBin::Build::Utils.is_swift_module(@spec)
|
89
|
+
|
61
90
|
framework_name = "#{@spec.name}.framework"
|
62
91
|
target_dir = File.join(CBin::Config::Builder.instance.zip_dir,framework_name)
|
63
92
|
FileUtils.rm_rf(target_dir) if File.exist?(target_dir)
|
@@ -72,14 +101,10 @@ module CBin
|
|
72
101
|
def build_sim_libraries(defines)
|
73
102
|
UI.message 'Building simulator libraries'
|
74
103
|
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
xcodebuild(defines, "-sdk iphonesimulator ARCHS=\'#{arch}\' ", "build-#{arch}","Debug")
|
80
|
-
end
|
81
|
-
else
|
82
|
-
xcodebuild(defines, "-sdk iphonesimulator ", 'build-simulator', "Release")
|
104
|
+
# archs = %w[i386 x86_64]
|
105
|
+
archs = ios_architectures_sim
|
106
|
+
archs.map do |arch|
|
107
|
+
xcodebuild(defines, "-sdk iphonesimulator ARCHS=\'#{arch}\' ", "build-#{arch}",@build_model)
|
83
108
|
end
|
84
109
|
|
85
110
|
end
|
@@ -96,32 +121,20 @@ module CBin
|
|
96
121
|
def build_static_library_for_ios(output)
|
97
122
|
UI.message "Building ios libraries with archs #{ios_architectures}"
|
98
123
|
static_libs = static_libs_in_sandbox('build') + static_libs_in_sandbox('build-simulator') + @vendored_libraries
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
end
|
124
|
+
|
125
|
+
ios_architectures.map do |arch|
|
126
|
+
static_libs += static_libs_in_sandbox("build-#{arch}") + @vendored_libraries
|
127
|
+
end
|
128
|
+
ios_architectures_sim do |arch|
|
129
|
+
static_libs += static_libs_in_sandbox("build-#{arch}") + @vendored_libraries
|
106
130
|
end
|
107
131
|
|
108
132
|
build_path = Pathname("build")
|
109
133
|
build_path.mkpath unless build_path.exist?
|
110
134
|
|
111
|
-
|
112
|
-
|
113
|
-
|
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
|
135
|
+
libs = (ios_architectures + ios_architectures_sim) .map do |arch|
|
136
|
+
library = "build-#{arch}/lib#{@spec.name}.a"
|
137
|
+
library
|
125
138
|
end
|
126
139
|
|
127
140
|
UI.message "lipo -create -output #{output} #{libs.join(' ')}"
|
@@ -166,15 +179,15 @@ module CBin
|
|
166
179
|
defines += @spec.consumer(@platform).compiler_flags.join(' ')
|
167
180
|
|
168
181
|
options = ios_build_options
|
169
|
-
if is_debug_model
|
182
|
+
# if is_debug_model
|
170
183
|
archs = ios_architectures
|
171
184
|
# archs = %w[arm64 armv7 armv7s]
|
172
185
|
archs.map do |arch|
|
173
186
|
xcodebuild(defines, "ARCHS=\'#{arch}\' OTHER_CFLAGS=\'-fembed-bitcode -Qunused-arguments\'","build-#{arch}",@build_model)
|
174
187
|
end
|
175
|
-
else
|
176
|
-
xcodebuild(defines,options)
|
177
|
-
end
|
188
|
+
# else
|
189
|
+
# xcodebuild(defines,options)
|
190
|
+
# end
|
178
191
|
|
179
192
|
defines
|
180
193
|
end
|
@@ -186,17 +199,21 @@ module CBin
|
|
186
199
|
def target_name
|
187
200
|
#区分多平台,如配置了多平台,会带上平台的名字
|
188
201
|
# 如libwebp-iOS
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
202
|
+
if @spec.available_platforms.count > 1
|
203
|
+
"#{@spec.name}-#{Platform.string_name(@spec.consumer(@platform).platform_name)}"
|
204
|
+
else
|
205
|
+
@spec.name
|
206
|
+
end
|
194
207
|
end
|
195
208
|
|
196
|
-
def xcodebuild(defines = '', args = '', build_dir = 'build',build_model = 'Debug')
|
197
|
-
|
198
|
-
|
199
|
-
|
209
|
+
def xcodebuild(defines = '', args = '', build_dir = 'build', build_model = 'Debug')
|
210
|
+
|
211
|
+
unless File.exist?("Pods.xcodeproj") #cocoapods-generate v2.0.0
|
212
|
+
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"
|
213
|
+
else
|
214
|
+
command = "xcodebuild #{defines} #{args} CONFIGURATION_BUILD_DIR=#{build_dir} clean build -configuration #{build_model} -target #{target_name} -project ./Pods.xcodeproj 2>&1"
|
215
|
+
end
|
216
|
+
|
200
217
|
UI.message "command = #{command}"
|
201
218
|
output = `#{command}`.lines.to_a
|
202
219
|
|
@@ -217,7 +234,12 @@ module CBin
|
|
217
234
|
|
218
235
|
#by slj 如果没有头文件,去 "Headers/Public"拿
|
219
236
|
# if public_headers.empty?
|
220
|
-
|
237
|
+
spec_header_dir = "./Headers/Public/#{@spec.name}"
|
238
|
+
unless File.exist?(spec_header_dir)
|
239
|
+
spec_header_dir = "./Pods/Headers/Public/#{@spec.name}"
|
240
|
+
end
|
241
|
+
raise "copy_headers #{spec_header_dir} no exist " unless File.exist?(spec_header_dir)
|
242
|
+
Dir.chdir(spec_header_dir) do
|
221
243
|
headers = Dir.glob('*.h')
|
222
244
|
headers.each do |h|
|
223
245
|
public_headers << Pathname.new(File.join(Dir.pwd,h))
|
@@ -239,10 +261,10 @@ module CBin
|
|
239
261
|
if Pathname(module_map_file).exist?
|
240
262
|
module_map = File.read(module_map_file)
|
241
263
|
end
|
242
|
-
elsif public_headers.map(&:basename).map(&:to_s).include?("#{@spec.name}.h")
|
264
|
+
elsif public_headers.map(&:basename).map(&:to_s).include?("#{@spec.name}-umbrella.h")
|
243
265
|
module_map = <<-MAP
|
244
266
|
framework module #{@spec.name} {
|
245
|
-
umbrella header "#{@spec.name}.h"
|
267
|
+
umbrella header "#{@spec.name}-umbrella.h"
|
246
268
|
|
247
269
|
export *
|
248
270
|
module * { export * }
|
@@ -256,9 +278,29 @@ module CBin
|
|
256
278
|
framework.module_map_path.mkpath
|
257
279
|
end
|
258
280
|
File.write("#{framework.module_map_path}/module.modulemap", module_map)
|
281
|
+
|
282
|
+
# unless framework.swift_module_path.exist?
|
283
|
+
# framework.swift_module_path.mkpath
|
284
|
+
# end
|
285
|
+
# todo 所有架构的swiftModule拷贝到 framework.swift_module_path
|
286
|
+
archs = ios_architectures + ios_architectures_sim
|
287
|
+
archs.map do |arch|
|
288
|
+
swift_module = "build-#{arch}/#{@spec.name}.swiftmodule"
|
289
|
+
if File.directory?(swift_module)
|
290
|
+
FileUtils.cp_r("#{swift_module}/.", framework.swift_module_path)
|
291
|
+
end
|
292
|
+
end
|
293
|
+
swift_Compatibility_Header = "build-#{archs.first}/Swift\ Compatibility\ Header/#{@spec.name}-Swift.h"
|
294
|
+
FileUtils.cp(swift_Compatibility_Header,framework.headers_path) if File.exist?(swift_Compatibility_Header)
|
295
|
+
info_plist_file = File.join(File.dirname(__FILE__),"info.plist")
|
296
|
+
FileUtils.cp(info_plist_file,framework.fwk_path)
|
259
297
|
end
|
260
298
|
end
|
261
299
|
|
300
|
+
def copy_swift_header
|
301
|
+
|
302
|
+
end
|
303
|
+
|
262
304
|
def copy_license
|
263
305
|
UI.message 'Copying license'
|
264
306
|
license_file = @spec.license[:file] || 'LICENSE'
|
@@ -266,8 +308,11 @@ module CBin
|
|
266
308
|
end
|
267
309
|
|
268
310
|
def copy_resources
|
311
|
+
resource_dir = './build/*.bundle'
|
312
|
+
resource_dir = './build-armv7/*.bundle' if File.exist?('./build-armv7')
|
313
|
+
resource_dir = './build-arm64/*.bundle' if File.exist?('./build-arm64')
|
269
314
|
|
270
|
-
bundles = Dir.glob(
|
315
|
+
bundles = Dir.glob(resource_dir)
|
271
316
|
|
272
317
|
bundle_names = [@spec, *@spec.recursive_subspecs].flat_map do |spec|
|
273
318
|
consumer = spec.consumer(@platform)
|
@@ -288,7 +333,18 @@ module CBin
|
|
288
333
|
`cp -rp #{bundle_files} #{framework.resources_path} 2>&1`
|
289
334
|
end
|
290
335
|
|
291
|
-
real_source_dir = @
|
336
|
+
real_source_dir = @source_dir
|
337
|
+
unless @isRootSpec
|
338
|
+
spec_source_dir = File.join(Dir.pwd,"#{@spec.name}")
|
339
|
+
unless File.exist?(spec_source_dir)
|
340
|
+
spec_source_dir = File.join(Dir.pwd,"Pods/#{@spec.name}")
|
341
|
+
end
|
342
|
+
raise "copy_resources #{spec_source_dir} no exist " unless File.exist?(spec_source_dir)
|
343
|
+
|
344
|
+
spec_source_dir = File.join(Dir.pwd,"#{@spec.name}")
|
345
|
+
real_source_dir = spec_source_dir
|
346
|
+
end
|
347
|
+
|
292
348
|
resources = [@spec, *@spec.recursive_subspecs].flat_map do |spec|
|
293
349
|
expand_paths(real_source_dir, spec.consumer(@platform).resources)
|
294
350
|
end.compact.uniq
|
@@ -315,6 +371,65 @@ module CBin
|
|
315
371
|
end
|
316
372
|
end
|
317
373
|
|
374
|
+
#---------------------------------swift--------------------------------------#
|
375
|
+
# lipo -create .a
|
376
|
+
def build_static_framework_machO_for_ios(output)
|
377
|
+
UI.message "Building ios framework with archs #{ios_architectures}"
|
378
|
+
|
379
|
+
static_libs = static_libs_in_sandbox('build') + @vendored_libraries
|
380
|
+
ios_architectures.map do |arch|
|
381
|
+
static_libs += static_libs_in_sandbox("build-#{arch}") + @vendored_libraries
|
382
|
+
end
|
383
|
+
|
384
|
+
ios_architectures_sim do |arch|
|
385
|
+
static_libs += static_libs_in_sandbox("build-#{arch}") + @vendored_libraries
|
386
|
+
end
|
387
|
+
|
388
|
+
build_path = Pathname("build")
|
389
|
+
build_path.mkpath unless build_path.exist?
|
390
|
+
|
391
|
+
libs = (ios_architectures + ios_architectures_sim) .map do |arch|
|
392
|
+
library = "build-#{arch}/#{@spec.name}.framework/#{@spec.name}"
|
393
|
+
library
|
394
|
+
end
|
395
|
+
|
396
|
+
UI.message "lipo -create -output #{output} #{libs.join(' ')}"
|
397
|
+
`lipo -create -output #{output} #{libs.join(' ')}`
|
398
|
+
end
|
399
|
+
|
400
|
+
def copy_static_framework_dir_for_ios
|
401
|
+
|
402
|
+
archs = ios_architectures + ios_architectures_sim
|
403
|
+
framework_dir = "build-#{ios_architectures_sim.first}/#{@spec.name}.framework"
|
404
|
+
framework_dir = "build-#{ios_architectures.first}/#{@spec.name}.framework" unless File.exist?(framework_dir)
|
405
|
+
unless File.exist?(framework_dir)
|
406
|
+
raise "#{framework_dir} path no exist"
|
407
|
+
end
|
408
|
+
File.join(Dir.pwd, "build-#{ios_architectures_sim.first}/#{@spec.name}.framework")
|
409
|
+
FileUtils.cp_r(framework_dir, framework.root_path)
|
410
|
+
|
411
|
+
# todo 所有架构的swiftModule拷贝到 framework.swift_module_path
|
412
|
+
archs.map do |arch|
|
413
|
+
swift_module = "build-#{arch}/#{@spec.name}.framework/Modules/#{@spec.name}.swiftmodule"
|
414
|
+
if File.directory?(swift_module)
|
415
|
+
FileUtils.cp_r("#{swift_module}/.", framework.swift_module_path)
|
416
|
+
end
|
417
|
+
end
|
418
|
+
|
419
|
+
# 删除Versions 软链接
|
420
|
+
framework.remove_current_version
|
421
|
+
end
|
422
|
+
|
423
|
+
def copy_framework_resources
|
424
|
+
resources = Dir.glob("#{framework.fwk_path + Pathname.new('Resources')}/*")
|
425
|
+
if resources.count == 0
|
426
|
+
framework.delete_resources
|
427
|
+
end
|
428
|
+
end
|
429
|
+
|
430
|
+
|
431
|
+
#---------------------------------getter and setter--------------------------------------#
|
432
|
+
|
318
433
|
def framework
|
319
434
|
@framework ||= begin
|
320
435
|
framework = Framework.new(@spec.name, @platform.name.to_s)
|
@@ -38,12 +38,12 @@ module CBin
|
|
38
38
|
|
39
39
|
def make_headers
|
40
40
|
@headers_path = @versions_path + Pathname.new('Headers')
|
41
|
-
|
41
|
+
@headers_path.mkpath unless @headers_path.exist?
|
42
42
|
end
|
43
43
|
|
44
44
|
def make_resources
|
45
45
|
@resources_path = @versions_path + Pathname.new('Resources')
|
46
|
-
|
46
|
+
@resources_path.mkpath unless @resources_path.exist?
|
47
47
|
end
|
48
48
|
|
49
49
|
def make_root
|
@@ -34,15 +34,20 @@ module CBin
|
|
34
34
|
@local_build_dir = local_build_dir
|
35
35
|
@clean = clean
|
36
36
|
@framework_path
|
37
|
+
@is_library = !is_framework
|
37
38
|
end
|
38
39
|
|
39
40
|
def build
|
40
41
|
UI.section("Building static framework #{@spec}") do
|
41
42
|
|
42
43
|
build_static_framework
|
43
|
-
|
44
|
-
|
45
|
-
|
44
|
+
if @is_library
|
45
|
+
build_static_library
|
46
|
+
zip_static_framework if @zip &&= @framework_output
|
47
|
+
zip_static_library
|
48
|
+
else
|
49
|
+
zip_static_framework
|
50
|
+
end
|
46
51
|
|
47
52
|
clean_workspace if @clean
|
48
53
|
end
|
@@ -52,7 +57,7 @@ module CBin
|
|
52
57
|
def build_static_framework
|
53
58
|
file_accessor = Sandbox::FileAccessor.new(Pathname.new('.').expand_path, @spec.consumer(@platform))
|
54
59
|
Dir.chdir(workspace_directory) do
|
55
|
-
builder = CBin::LocalFramework::Builder.new(@spec, file_accessor, @platform, @local_build_dir_name,@local_build_dir)
|
60
|
+
builder = CBin::LocalFramework::Builder.new(@spec, file_accessor, @platform, @local_build_dir_name,@local_build_dir, @is_library, frameWork_dir)
|
56
61
|
@framework_path = builder.create
|
57
62
|
end
|
58
63
|
end
|
@@ -68,9 +73,10 @@ module CBin
|
|
68
73
|
|
69
74
|
def zip_static_framework
|
70
75
|
Dir.chdir(zip_dir) do
|
71
|
-
output_name = "#{framework_name}.zip"
|
76
|
+
# output_name = "#{framework_name}.zip"
|
77
|
+
output_name = File.join(zip_dir, framework_name_zip)
|
72
78
|
unless File.exist?(framework_name)
|
73
|
-
|
79
|
+
UI.warn "没有需要压缩的 framework 文件:#{framework_name}"
|
74
80
|
end
|
75
81
|
|
76
82
|
UI.puts "Compressing #{framework_name} into #{output_name}"
|
@@ -110,6 +116,10 @@ module CBin
|
|
110
116
|
CBin::Config::Builder.instance.framework_name(@spec)
|
111
117
|
end
|
112
118
|
|
119
|
+
def framework_name_zip
|
120
|
+
CBin::Config::Builder.instance.framework_name_version(@spec) + ".zip"
|
121
|
+
end
|
122
|
+
|
113
123
|
def library_name
|
114
124
|
CBin::Config::Builder.instance.library_name(@spec)
|
115
125
|
end
|
@@ -126,6 +136,28 @@ module CBin
|
|
126
136
|
CBin::Config::Builder.instance.gen_name
|
127
137
|
end
|
128
138
|
|
139
|
+
def is_library
|
140
|
+
File.exist?(File.join(@local_build_dir, "lib#{@spec.name}.a"))
|
141
|
+
end
|
142
|
+
|
143
|
+
# 使用了user_framework 会有#{@spec.name}.framework
|
144
|
+
# 未使用的 需要判断文件
|
145
|
+
def is_framework
|
146
|
+
res = File.exist?(File.join(@local_build_dir, "#{@spec.name}.framework"))
|
147
|
+
unless res
|
148
|
+
res = File.exist?(File.join(CBin::Config::Builder.instance.xcode_BuildProductsPath_dir, "#{@spec.name}","Swift Compatibility Header"))
|
149
|
+
end
|
150
|
+
res
|
151
|
+
end
|
152
|
+
|
153
|
+
def frameWork_dir
|
154
|
+
dir = File.join(@local_build_dir, "#{@spec.name}.framework")
|
155
|
+
unless File.exist?(dir)
|
156
|
+
dir = File.join(CBin::Config::Builder.instance.xcode_BuildProductsPath_dir, "#{@spec.name}")
|
157
|
+
end
|
158
|
+
dir
|
159
|
+
end
|
160
|
+
|
129
161
|
def spec_file
|
130
162
|
@spec_file ||= begin
|
131
163
|
if @podspec
|
@@ -9,6 +9,8 @@ module CBin
|
|
9
9
|
attr_reader :resources_path
|
10
10
|
attr_reader :root_path
|
11
11
|
attr_reader :versions_path
|
12
|
+
attr_reader :swift_module_path
|
13
|
+
attr_reader :fwk_path
|
12
14
|
|
13
15
|
def initialize(name, platform, local_build_dir)
|
14
16
|
@name = name
|
@@ -29,6 +31,21 @@ module CBin
|
|
29
31
|
(Pathname.new(@fwk_path) + Pathname.new('Resources')).delete
|
30
32
|
end
|
31
33
|
|
34
|
+
def remove_current_version
|
35
|
+
FileUtils.rm_f(File.join(@fwk_path,@name))
|
36
|
+
FileUtils.rm_f(File.join(@fwk_path,"Headers"))
|
37
|
+
FileUtils.rm_f(File.join(@fwk_path,"Resources"))
|
38
|
+
|
39
|
+
FileUtils.cp_r("#{@versions_path}/.", @fwk_path)
|
40
|
+
# FileUtils.remove_dir(@versions_path)
|
41
|
+
FileUtils.remove_dir("#{@fwk_path}/Versions")
|
42
|
+
|
43
|
+
# current_version_path = @versions_path + Pathname.new('../Current')
|
44
|
+
# `ln -sf A #{current_version_path}`
|
45
|
+
# `ln -sf Versions/Current/Headers #{@fwk_path}/`
|
46
|
+
# `ln -sf Versions/Current/Resources #{@fwk_path}/`
|
47
|
+
# `ln -sf Versions/Current/#{@name} #{@fwk_path}/`
|
48
|
+
end
|
32
49
|
private
|
33
50
|
|
34
51
|
def make_current_version
|
@@ -41,10 +58,13 @@ module CBin
|
|
41
58
|
|
42
59
|
def make_framework
|
43
60
|
@fwk_path = @root_path + Pathname.new(@name + '.framework')
|
61
|
+
FileUtils.remove_dir(@fwk_path) if @fwk_path.exist?
|
44
62
|
@fwk_path.mkdir unless @fwk_path.exist?
|
45
63
|
|
46
64
|
@module_map_path = @fwk_path + Pathname.new('Modules')
|
47
65
|
@versions_path = @fwk_path + Pathname.new('Versions/A')
|
66
|
+
@fwk_path.exist?
|
67
|
+
@swift_module_path = @module_map_path + Pathname.new(@name + '.swiftmodule')
|
48
68
|
end
|
49
69
|
|
50
70
|
def make_headers
|