cocoapods-imy-bin 0.2.7 → 0.3.1.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 +4 -4
- data/README.md +0 -453
- data/lib/cocoapods-imy-bin/command/bin/archive.rb +43 -5
- data/lib/cocoapods-imy-bin/command/bin/auto.rb +22 -15
- data/lib/cocoapods-imy-bin/command/bin/dup.rb +78 -0
- 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 +165 -54
- data/lib/cocoapods-imy-bin/helpers/library.rb +2 -2
- 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/installer.rb +22 -2
- 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
- data/lib/cocoapods-imy-bin/source_provider_hook.rb +35 -23
- metadata +12 -12
- data/lib/cocoapods-imy-bin/command/bin/local.rb +0 -156
- data/lib/cocoapods-imy-bin/helpers/local/loca_llibrary.rb +0 -57
- data/lib/cocoapods-imy-bin/helpers/local/local_build_helper.rb +0 -146
- data/lib/cocoapods-imy-bin/helpers/local/local_framework.rb +0 -65
- data/lib/cocoapods-imy-bin/helpers/local/local_framework_builder.rb +0 -174
- data/lib/cocoapods-imy-bin/helpers/local/local_library_builder.rb +0 -92
@@ -1,156 +0,0 @@
|
|
1
|
-
|
2
|
-
require 'cocoapods-imy-bin/native/podfile'
|
3
|
-
require 'cocoapods/command/gen'
|
4
|
-
require 'cocoapods/generate'
|
5
|
-
require 'cocoapods-imy-bin/helpers/local/local_framework_builder'
|
6
|
-
require 'cocoapods-imy-bin/helpers/local/local_library_builder'
|
7
|
-
require 'cocoapods-imy-bin/helpers/local/local_build_helper'
|
8
|
-
require 'cocoapods-imy-bin/helpers/spec_source_creator'
|
9
|
-
require 'cocoapods-imy-bin/config/config_builder'
|
10
|
-
|
11
|
-
module Pod
|
12
|
-
class Command
|
13
|
-
class Bin < Command
|
14
|
-
class Local < Bin
|
15
|
-
self.summary = '根据podfile中信息 将本地已存在的组件静态包 归档,需要归档的组件由外部传入'
|
16
|
-
self.description = <<-DESC
|
17
|
-
根据podfile中信息 将本地已存在的组件静态包 归档,需要归档的组件由外部传入
|
18
|
-
仅支持 iOS 平台
|
19
|
-
此静态 framework/.a 不包含依赖组件的 symbol
|
20
|
-
|
21
|
-
一个用ccache,一个是cocoapods-imy-bin插件支持下的,
|
22
|
-
拿xcodebuild生成的中间构建产物,如生成的 libIMYYQHome.a,利用cocoapods-imy-bin 制作成二进制静态库,保存起来。
|
23
|
-
下次pod update 工程时,在pod update时去捞已经生成的二进制组件打包。这样可以大大减少编译时间
|
24
|
-
|
25
|
-
制作流程:
|
26
|
-
每次pod update 时记录无二进制组件的库,build完后,自动制作缺失二进制组件库。
|
27
|
-
如果pod update 时无二进制组件的库,采用源码编译,源码编译同时有ccache缓存支持,也能加快速度
|
28
|
-
DESC
|
29
|
-
|
30
|
-
def self.options
|
31
|
-
[
|
32
|
-
['--no-clean', '保留构建中间产物'],
|
33
|
-
['--framework-output', '输出framework文件'],
|
34
|
-
['--no-zip', '不压缩静态 framework 为 zip'],
|
35
|
-
['--make-binary-specs', '需要制作spec集合'],
|
36
|
-
['--env', "该组件上传的环境 %w[dev debug_iphoneos release_iphoneos]"]
|
37
|
-
].concat(Pod::Command::Gen.options).concat(super).uniq
|
38
|
-
end
|
39
|
-
|
40
|
-
def initialize(argv)
|
41
|
-
@env = argv.option('env') || 'dev'
|
42
|
-
CBin.config.set_configuration_env(@env)
|
43
|
-
UI.warn "====== cocoapods-imy-bin #{CBin::VERSION} 版本 ======== \n "
|
44
|
-
UI.warn "====== #{@env} 环境 ======== "
|
45
|
-
|
46
|
-
|
47
|
-
@make_binary_specs = argv.option('make-binary-specs') || []
|
48
|
-
@framework_output = argv.flag?('framework-output', false)
|
49
|
-
@clean = argv.flag?('no-clean', true)
|
50
|
-
@zip = argv.flag?('zip', true)
|
51
|
-
@sources = argv.option('sources') || []
|
52
|
-
@platform = Platform.new(:ios)
|
53
|
-
|
54
|
-
@target_name = CBin::Config::Builder.instance.target_name
|
55
|
-
@local_build_dir_name = CBin::Config::Builder.instance.xcode_build_name
|
56
|
-
@local_build_dir = CBin::Config::Builder.instance.xcode_build_dir
|
57
|
-
|
58
|
-
@framework_path
|
59
|
-
super
|
60
|
-
end
|
61
|
-
|
62
|
-
def run
|
63
|
-
# 清除之前的缓存
|
64
|
-
temp = File.join(@local_build_dir, @platform.to_s)
|
65
|
-
FileUtils.rm_r(temp) if File.exist? temp
|
66
|
-
if File.exist?(CBin::Config::Builder.instance.zip_dir)
|
67
|
-
FileUtils.rm_r(CBin::Config::Builder.instance.zip_dir)
|
68
|
-
end
|
69
|
-
|
70
|
-
sources_spec = []
|
71
|
-
Dir.chdir(CBin::Config::Builder.instance.local_psec_dir) do
|
72
|
-
spec_files = Dir.glob(%w[*.json *.podspec])
|
73
|
-
spec_files.each do |file|
|
74
|
-
spec = Pod::Specification.from_file(file)
|
75
|
-
sources_spec << spec
|
76
|
-
end
|
77
|
-
end
|
78
|
-
|
79
|
-
build(sources_spec)
|
80
|
-
end
|
81
|
-
|
82
|
-
def build(make_binary_specs)
|
83
|
-
# 如果没要求,就清空依赖库数据
|
84
|
-
sources_sepc = []
|
85
|
-
make_binary_specs.uniq.each do |spec|
|
86
|
-
next if spec.name.include?('/')
|
87
|
-
next if spec.name == @target_name
|
88
|
-
#过滤白名单
|
89
|
-
next if CBin::Config::Builder.instance.white_pod_list.include?(spec.name)
|
90
|
-
#过滤 git
|
91
|
-
if spec.source[:git] && spec.source[:git]
|
92
|
-
spec_git = spec.source[:git]
|
93
|
-
spec_git_res = false
|
94
|
-
CBin::Config::Builder.instance.ignore_git_list.each do |ignore_git|
|
95
|
-
spec_git_res = spec_git.include?(ignore_git)
|
96
|
-
break if spec_git_res
|
97
|
-
end
|
98
|
-
next if spec_git_res
|
99
|
-
end
|
100
|
-
UI.warn "#{spec.name}.podspec 带有 vendored_frameworks 字段,请检查是否有效!!!" if spec.attributes_hash['vendored_frameworks']
|
101
|
-
next if spec.attributes_hash['vendored_frameworks'] && @target_name != spec.name #过滤带有vendored_frameworks的
|
102
|
-
next if (spec.attributes_hash['ios'] && spec.attributes_hash['ios']['vendored_frameworks']) #过滤带有vendored_frameworks的
|
103
|
-
#获取没有制作二进制版本的spec集合
|
104
|
-
|
105
|
-
next unless library_exist(spec)
|
106
|
-
|
107
|
-
# 获取没有制作二进制版本的spec集合
|
108
|
-
sources_sepc << spec
|
109
|
-
end
|
110
|
-
fail_build_specs = []
|
111
|
-
sources_sepc.uniq.each do |spec|
|
112
|
-
begin
|
113
|
-
builder = CBin::LocalBuild::Helper.new(spec,
|
114
|
-
@platform,
|
115
|
-
@framework_output,
|
116
|
-
@zip,
|
117
|
-
@clean,
|
118
|
-
@target_name,
|
119
|
-
@local_build_dir_name,
|
120
|
-
@local_build_dir)
|
121
|
-
builder.build
|
122
|
-
CBin::Upload::Helper.new(spec, @code_dependencies, @sources).upload
|
123
|
-
rescue StandardError
|
124
|
-
fail_build_specs << spec
|
125
|
-
end
|
126
|
-
end
|
127
|
-
|
128
|
-
if fail_build_specs.any?
|
129
|
-
fail_build_specs.uniq.each do |spec|
|
130
|
-
UI.warn "【#{spec.name} | #{spec.version}】组件二进制版本编译失败 ."
|
131
|
-
end
|
132
|
-
end
|
133
|
-
|
134
|
-
success_specs = sources_sepc - fail_build_specs
|
135
|
-
if success_specs.any?
|
136
|
-
success_specs.uniq.each do |spec|
|
137
|
-
UI.warn " =======【 #{spec.name} | #{spec.version} 】二进制组件制作完成 !!!"
|
138
|
-
end
|
139
|
-
end
|
140
|
-
# pod repo update
|
141
|
-
UI.section("\nUpdating Spec Repositories\n".yellow) do
|
142
|
-
Pod::Command::Bin::Repo::Update.new(CLAide::ARGV.new([])).run
|
143
|
-
end
|
144
|
-
end
|
145
|
-
|
146
|
-
private
|
147
|
-
|
148
|
-
def library_exist(spec)
|
149
|
-
File.exist?(File.join(@local_build_dir, "lib#{spec.name}.a"))
|
150
|
-
end
|
151
|
-
|
152
|
-
|
153
|
-
end
|
154
|
-
end
|
155
|
-
end
|
156
|
-
end
|
@@ -1,57 +0,0 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
# copy from https://github.com/CocoaPods/cocoapods-packager
|
4
|
-
require 'cocoapods-imy-bin/config/config_builder'
|
5
|
-
|
6
|
-
module CBin
|
7
|
-
class LocalLibrary
|
8
|
-
attr_reader :headers_path
|
9
|
-
attr_reader :resources_path
|
10
|
-
attr_reader :root_path
|
11
|
-
attr_reader :versions_path
|
12
|
-
attr_reader :name_path
|
13
|
-
|
14
|
-
def initialize(name, platform, version)
|
15
|
-
@name = name
|
16
|
-
@platform = platform
|
17
|
-
@version = version
|
18
|
-
end
|
19
|
-
|
20
|
-
def make
|
21
|
-
make_root
|
22
|
-
make_library
|
23
|
-
make_headers
|
24
|
-
make_resources
|
25
|
-
end
|
26
|
-
|
27
|
-
def delete_resources
|
28
|
-
Pathname.new(@resources_path).rmtree
|
29
|
-
(Pathname.new(@fwk_path) + Pathname.new('Resources')).delete
|
30
|
-
end
|
31
|
-
|
32
|
-
private
|
33
|
-
|
34
|
-
def make_library
|
35
|
-
@name_path = CBin::Config::Builder.instance.library_name_version(@name, @version)
|
36
|
-
@fwk_path = @root_path + Pathname.new(@name_path)
|
37
|
-
@fwk_path.mkdir unless @fwk_path.exist?
|
38
|
-
|
39
|
-
@versions_path = @fwk_path
|
40
|
-
end
|
41
|
-
|
42
|
-
def make_headers
|
43
|
-
@headers_path = @versions_path + Pathname.new('Headers')
|
44
|
-
# @headers_path.mkpath unless @headers_path.exist?
|
45
|
-
end
|
46
|
-
|
47
|
-
def make_resources
|
48
|
-
@resources_path = @versions_path + Pathname.new('Resources')
|
49
|
-
# @resources_path.mkpath unless @resources_path.exist?
|
50
|
-
end
|
51
|
-
|
52
|
-
def make_root
|
53
|
-
@root_path = Pathname.new(@platform)
|
54
|
-
@root_path.mkpath unless @root_path.exist?
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
@@ -1,146 +0,0 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
# copy from https://github.com/CocoaPods/cocoapods-packager
|
4
|
-
|
5
|
-
require 'cocoapods-imy-bin/native/podfile'
|
6
|
-
require 'cocoapods/command/gen'
|
7
|
-
require 'cocoapods/generate'
|
8
|
-
require 'cocoapods-imy-bin/helpers/framework_builder'
|
9
|
-
require 'cocoapods-imy-bin/helpers/library_builder'
|
10
|
-
require 'cocoapods-imy-bin/config/config_builder'
|
11
|
-
|
12
|
-
module CBin
|
13
|
-
class LocalBuild
|
14
|
-
class Helper
|
15
|
-
include Pod
|
16
|
-
#class var
|
17
|
-
@@build_defines = ""
|
18
|
-
#Debug下还待完成
|
19
|
-
def initialize(spec,
|
20
|
-
platform,
|
21
|
-
framework_output,
|
22
|
-
zip,
|
23
|
-
clean,
|
24
|
-
target_name,
|
25
|
-
local_build_dir_name,
|
26
|
-
local_build_dir)
|
27
|
-
@spec = spec
|
28
|
-
@target_name = target_name
|
29
|
-
@platform = platform
|
30
|
-
|
31
|
-
@framework_output = framework_output
|
32
|
-
@zip = zip
|
33
|
-
@local_build_dir_name = local_build_dir_name
|
34
|
-
@local_build_dir = local_build_dir
|
35
|
-
@clean = clean
|
36
|
-
@framework_path
|
37
|
-
end
|
38
|
-
|
39
|
-
def build
|
40
|
-
UI.section("Building static framework #{@spec}") do
|
41
|
-
|
42
|
-
build_static_framework
|
43
|
-
build_static_library
|
44
|
-
zip_static_framework if @zip &&= @framework_output
|
45
|
-
zip_static_library
|
46
|
-
|
47
|
-
clean_workspace if @clean
|
48
|
-
end
|
49
|
-
|
50
|
-
end
|
51
|
-
|
52
|
-
def build_static_framework
|
53
|
-
file_accessor = Sandbox::FileAccessor.new(Pathname.new('.').expand_path, @spec.consumer(@platform))
|
54
|
-
Dir.chdir(workspace_directory) do
|
55
|
-
builder = CBin::LocalFramework::Builder.new(@spec, file_accessor, @platform, @local_build_dir_name,@local_build_dir)
|
56
|
-
@framework_path = builder.create
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
def build_static_library
|
61
|
-
source_dir = zip_dir
|
62
|
-
file_accessor = Sandbox::FileAccessor.new(Pathname.new('.').expand_path, @spec.consumer(@platform))
|
63
|
-
Dir.chdir(workspace_directory) do
|
64
|
-
builder = CBin::LocalLibrary::Builder.new(@spec, file_accessor, @platform, source_dir,@framework_path)
|
65
|
-
builder.build
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
def zip_static_framework
|
70
|
-
Dir.chdir(zip_dir) do
|
71
|
-
output_name = "#{framework_name}.zip"
|
72
|
-
unless File.exist?(framework_name)
|
73
|
-
raise Informative, "没有需要压缩的 framework 文件:#{framework_name}"
|
74
|
-
end
|
75
|
-
|
76
|
-
UI.puts "Compressing #{framework_name} into #{output_name}"
|
77
|
-
`zip --symlinks -r #{output_name} #{framework_name}`
|
78
|
-
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
|
-
def zip_static_library
|
83
|
-
Dir.chdir(zip_dir) do
|
84
|
-
output_library = "#{library_name}.zip"
|
85
|
-
unless File.exist?(library_name)
|
86
|
-
raise Informative, "没有需要压缩的 library 文件:#{library_name}"
|
87
|
-
end
|
88
|
-
|
89
|
-
UI.puts "Compressing #{library_name} into #{output_library}"
|
90
|
-
|
91
|
-
`zip --symlinks -r #{output_library} #{library_name}`
|
92
|
-
end
|
93
|
-
|
94
|
-
end
|
95
|
-
|
96
|
-
|
97
|
-
def clean_workspace
|
98
|
-
UI.puts 'Cleaning workspace'
|
99
|
-
|
100
|
-
FileUtils.rm_rf(gen_name)
|
101
|
-
Dir.chdir(zip_dir) do
|
102
|
-
FileUtils.rm_rf(framework_name) if @zip
|
103
|
-
FileUtils.rm_rf(library_name)
|
104
|
-
FileUtils.rm_rf(framework_name) unless @framework_output
|
105
|
-
FileUtils.rm_rf("#{framework_name}.zip") unless @framework_output
|
106
|
-
end
|
107
|
-
end
|
108
|
-
|
109
|
-
def framework_name
|
110
|
-
CBin::Config::Builder.instance.framework_name(@spec)
|
111
|
-
end
|
112
|
-
|
113
|
-
def library_name
|
114
|
-
CBin::Config::Builder.instance.library_name(@spec)
|
115
|
-
end
|
116
|
-
|
117
|
-
def workspace_directory
|
118
|
-
@local_build_dir
|
119
|
-
end
|
120
|
-
|
121
|
-
def zip_dir
|
122
|
-
CBin::Config::Builder.instance.zip_dir
|
123
|
-
end
|
124
|
-
|
125
|
-
def gen_name
|
126
|
-
CBin::Config::Builder.instance.gen_name
|
127
|
-
end
|
128
|
-
|
129
|
-
def spec_file
|
130
|
-
@spec_file ||= begin
|
131
|
-
if @podspec
|
132
|
-
find_spec_file(@podspec)
|
133
|
-
else
|
134
|
-
if code_spec_files.empty?
|
135
|
-
raise Informative, '当前目录下没有找到可用源码 podspec.'
|
136
|
-
end
|
137
|
-
|
138
|
-
spec_file = code_spec_files.first
|
139
|
-
spec_file
|
140
|
-
end
|
141
|
-
end
|
142
|
-
end
|
143
|
-
|
144
|
-
end
|
145
|
-
end
|
146
|
-
end
|
@@ -1,65 +0,0 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
# copy from https://github.com/CocoaPods/cocoapods-packager
|
4
|
-
|
5
|
-
module CBin
|
6
|
-
class LocalFramework
|
7
|
-
attr_reader :headers_path
|
8
|
-
attr_reader :module_map_path
|
9
|
-
attr_reader :resources_path
|
10
|
-
attr_reader :root_path
|
11
|
-
attr_reader :versions_path
|
12
|
-
|
13
|
-
def initialize(name, platform, local_build_dir)
|
14
|
-
@name = name
|
15
|
-
@platform = platform
|
16
|
-
@local_build_dir = local_build_dir
|
17
|
-
end
|
18
|
-
|
19
|
-
def make
|
20
|
-
make_root
|
21
|
-
make_framework
|
22
|
-
make_headers
|
23
|
-
make_resources
|
24
|
-
make_current_version
|
25
|
-
end
|
26
|
-
|
27
|
-
def delete_resources
|
28
|
-
Pathname.new(@resources_path).rmtree
|
29
|
-
(Pathname.new(@fwk_path) + Pathname.new('Resources')).delete
|
30
|
-
end
|
31
|
-
|
32
|
-
private
|
33
|
-
|
34
|
-
def make_current_version
|
35
|
-
current_version_path = @versions_path + Pathname.new('../Current')
|
36
|
-
`ln -sf A #{current_version_path}`
|
37
|
-
`ln -sf Versions/Current/Headers #{@fwk_path}/`
|
38
|
-
`ln -sf Versions/Current/Resources #{@fwk_path}/`
|
39
|
-
`ln -sf Versions/Current/#{@name} #{@fwk_path}/`
|
40
|
-
end
|
41
|
-
|
42
|
-
def make_framework
|
43
|
-
@fwk_path = @root_path + Pathname.new(@name + '.framework')
|
44
|
-
@fwk_path.mkdir unless @fwk_path.exist?
|
45
|
-
|
46
|
-
@module_map_path = @fwk_path + Pathname.new('Modules')
|
47
|
-
@versions_path = @fwk_path + Pathname.new('Versions/A')
|
48
|
-
end
|
49
|
-
|
50
|
-
def make_headers
|
51
|
-
@headers_path = @versions_path + Pathname.new('Headers')
|
52
|
-
@headers_path.mkpath unless @headers_path.exist?
|
53
|
-
end
|
54
|
-
|
55
|
-
def make_resources
|
56
|
-
@resources_path = @versions_path + Pathname.new('Resources')
|
57
|
-
@resources_path.mkpath unless @resources_path.exist?
|
58
|
-
end
|
59
|
-
|
60
|
-
def make_root
|
61
|
-
@root_path = Pathname.new(File.join(@local_build_dir, @platform))
|
62
|
-
@root_path.mkpath unless @root_path.exist?
|
63
|
-
end
|
64
|
-
end
|
65
|
-
end
|
@@ -1,174 +0,0 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
# copy from https://github.com/CocoaPods/cocoapods-packager
|
4
|
-
|
5
|
-
require 'cocoapods-imy-bin/helpers/local/local_framework'
|
6
|
-
require 'English'
|
7
|
-
require 'cocoapods-imy-bin/config/config_builder'
|
8
|
-
require 'shellwords'
|
9
|
-
|
10
|
-
module CBin
|
11
|
-
class LocalFramework
|
12
|
-
class Builder
|
13
|
-
include Pod
|
14
|
-
#Debug下还待完成
|
15
|
-
def initialize(spec, file_accessor, platform, local_build_dir_name, local_build_dir)
|
16
|
-
@spec = spec
|
17
|
-
@file_accessor = file_accessor
|
18
|
-
@platform = platform
|
19
|
-
@local_build_dir_name = local_build_dir_name
|
20
|
-
@local_build_dir = local_build_dir
|
21
|
-
end
|
22
|
-
|
23
|
-
def create
|
24
|
-
UI.section("Building static framework #{@spec}") do
|
25
|
-
output = framework.versions_path + Pathname.new(@spec.name)
|
26
|
-
|
27
|
-
build_static_library_for_ios(output)
|
28
|
-
|
29
|
-
copy_headers
|
30
|
-
copy_resources
|
31
|
-
|
32
|
-
cp_to_source_dir
|
33
|
-
end
|
34
|
-
framework
|
35
|
-
end
|
36
|
-
|
37
|
-
private
|
38
|
-
|
39
|
-
def cp_to_source_dir
|
40
|
-
target_dir = File.join(CBin::Config::Builder.instance.root_dir,CBin::Config::Builder.instance.framework_file(@spec))
|
41
|
-
FileUtils.rm_rf(target_dir) if File.exist?(target_dir)
|
42
|
-
|
43
|
-
zip_dir = CBin::Config::Builder.instance.zip_dir
|
44
|
-
FileUtils.mkdir_p(zip_dir) unless File.exist?(zip_dir)
|
45
|
-
|
46
|
-
`cp -fa #{@platform}/#{CBin::Config::Builder.instance.framework_name(@spec)} #{target_dir}`
|
47
|
-
end
|
48
|
-
|
49
|
-
def copy_headers
|
50
|
-
#by slj 如果没有头文件,去 "Headers/Public"拿
|
51
|
-
# if public_headers.empty?
|
52
|
-
Dir.chdir(File.join(Pod::Config.instance.installation_root,'Pods')) do
|
53
|
-
|
54
|
-
#走 podsepc中的public_headers
|
55
|
-
public_headers = Array.new
|
56
|
-
Dir.chdir("./Headers/Public/#{@spec.name}") do
|
57
|
-
headers = Dir.glob('*.h')
|
58
|
-
headers.each do |h|
|
59
|
-
public_headers << Pathname.new(File.join(Dir.pwd,h))
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
UI.message "Copying public headers #{public_headers.map(&:basename).map(&:to_s)}"
|
64
|
-
|
65
|
-
public_headers.each do |h|
|
66
|
-
`ditto #{h} #{framework.headers_path}/#{h.basename}`
|
67
|
-
end
|
68
|
-
|
69
|
-
# If custom 'module_map' is specified add it to the framework distribution
|
70
|
-
# otherwise check if a header exists that is equal to 'spec.name', if so
|
71
|
-
# create a default 'module_map' one using it.
|
72
|
-
if !@spec.module_map.nil?
|
73
|
-
module_map_file = @file_accessor.module_map
|
74
|
-
if Pathname(module_map_file).exist?
|
75
|
-
module_map = File.read(module_map_file)
|
76
|
-
end
|
77
|
-
elsif public_headers.map(&:basename).map(&:to_s).include?("#{@spec.name}.h")
|
78
|
-
module_map = <<-MAP
|
79
|
-
framework module #{@spec.name} {
|
80
|
-
umbrella header "#{@spec.name}.h"
|
81
|
-
|
82
|
-
export *
|
83
|
-
module * { export * }
|
84
|
-
}
|
85
|
-
MAP
|
86
|
-
end
|
87
|
-
|
88
|
-
unless module_map.nil?
|
89
|
-
UI.message "Writing module map #{module_map}"
|
90
|
-
unless framework.module_map_path.exist?
|
91
|
-
framework.module_map_path.mkpath
|
92
|
-
end
|
93
|
-
File.write("#{framework.module_map_path}/module.modulemap", module_map)
|
94
|
-
end
|
95
|
-
|
96
|
-
end
|
97
|
-
end
|
98
|
-
|
99
|
-
def copy_resources
|
100
|
-
|
101
|
-
Dir.chdir(Pod::Config.instance.sandbox_root) do
|
102
|
-
|
103
|
-
bundles = Dir.glob('./build/*.bundle')
|
104
|
-
|
105
|
-
bundle_names = [@spec, *@spec.recursive_subspecs].flat_map do |spec|
|
106
|
-
consumer = spec.consumer(@platform)
|
107
|
-
consumer.resource_bundles.keys +
|
108
|
-
consumer.resources.map do |r|
|
109
|
-
File.basename(r, '.bundle') if File.extname(r) == 'bundle'
|
110
|
-
end
|
111
|
-
end.compact.uniq
|
112
|
-
|
113
|
-
bundles.select! do |bundle|
|
114
|
-
bundle_name = File.basename(bundle, '.bundle')
|
115
|
-
bundle_names.include?(bundle_name)
|
116
|
-
end
|
117
|
-
|
118
|
-
if bundles.count > 0
|
119
|
-
UI.message "Copying bundle files #{bundles}"
|
120
|
-
bundle_files = bundles.join(' ')
|
121
|
-
`cp -rp #{bundle_files} #{framework.resources_path} 2>&1`
|
122
|
-
end
|
123
|
-
|
124
|
-
real_source_dir = @spec.name
|
125
|
-
resources = [@spec, *@spec.recursive_subspecs].flat_map do |spec|
|
126
|
-
expand_paths(real_source_dir, spec.consumer(@platform).resources)
|
127
|
-
end.compact.uniq
|
128
|
-
|
129
|
-
if resources.count == 0 && bundles.count == 0
|
130
|
-
framework.delete_resources
|
131
|
-
return
|
132
|
-
end
|
133
|
-
|
134
|
-
if resources.count > 0
|
135
|
-
#把 路径转义。 避免空格情况下拷贝失败
|
136
|
-
escape_resource = []
|
137
|
-
resources.each do |source|
|
138
|
-
escape_resource << Shellwords.join(source)
|
139
|
-
end
|
140
|
-
UI.message "Copying resources #{escape_resource}"
|
141
|
-
`cp -rp #{escape_resource.join(' ')} #{framework.resources_path}`
|
142
|
-
end
|
143
|
-
|
144
|
-
end
|
145
|
-
|
146
|
-
end
|
147
|
-
|
148
|
-
|
149
|
-
def build_static_library_for_ios(output)
|
150
|
-
`cp -rp #{library_name} #{output}`
|
151
|
-
end
|
152
|
-
|
153
|
-
def library_name
|
154
|
-
File.join(@local_build_dir, "lib#{@spec.name}.a")
|
155
|
-
end
|
156
|
-
|
157
|
-
|
158
|
-
def expand_paths(source_dir, path_specs)
|
159
|
-
path_specs.map do |path_spec|
|
160
|
-
Dir.glob(File.join(source_dir, path_spec))
|
161
|
-
end
|
162
|
-
end
|
163
|
-
|
164
|
-
def framework
|
165
|
-
@framework ||= begin
|
166
|
-
framework = CBin::LocalFramework.new(@spec.name, @platform.name.to_s,@local_build_dir)
|
167
|
-
framework.make
|
168
|
-
framework
|
169
|
-
end
|
170
|
-
end
|
171
|
-
|
172
|
-
end
|
173
|
-
end
|
174
|
-
end
|