cocoapods-swordfish 0.1.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.
Files changed (55) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +35 -0
  3. data/lib/cocoapods_plugin.rb +86 -0
  4. data/lib/gem_version.rb +11 -0
  5. data/lib/swordfish/command/archive.rb +187 -0
  6. data/lib/swordfish/command/auto.rb +192 -0
  7. data/lib/swordfish/command/config.rb +70 -0
  8. data/lib/swordfish/command/repo/update.rb +42 -0
  9. data/lib/swordfish/command/spec/create.rb +78 -0
  10. data/lib/swordfish/command/spec/push.rb +114 -0
  11. data/lib/swordfish/command/swordfish.rb +41 -0
  12. data/lib/swordfish/command.rb +2 -0
  13. data/lib/swordfish/config/config.rb +137 -0
  14. data/lib/swordfish/config/config_asker.rb +57 -0
  15. data/lib/swordfish/config/config_builder.rb +216 -0
  16. data/lib/swordfish/helpers/build_helper.rb +160 -0
  17. data/lib/swordfish/helpers/build_utils.rb +94 -0
  18. data/lib/swordfish/helpers/framework.rb +85 -0
  19. data/lib/swordfish/helpers/framework_builder.rb +451 -0
  20. data/lib/swordfish/helpers/library.rb +54 -0
  21. data/lib/swordfish/helpers/library_builder.rb +90 -0
  22. data/lib/swordfish/helpers/sources_helper.rb +38 -0
  23. data/lib/swordfish/helpers/spec_creator.rb +167 -0
  24. data/lib/swordfish/helpers/spec_files_helper.rb +76 -0
  25. data/lib/swordfish/helpers/spec_source_creator.rb +266 -0
  26. data/lib/swordfish/helpers/upload_helper.rb +94 -0
  27. data/lib/swordfish/hmap/hmap_generator.rb +59 -0
  28. data/lib/swordfish/hmap/pod_target.rb +92 -0
  29. data/lib/swordfish/hmap/podfile_dsl.rb +36 -0
  30. data/lib/swordfish/hmap/post_install_hook_context.rb +41 -0
  31. data/lib/swordfish/hmap/xcconfig.rb +99 -0
  32. data/lib/swordfish/hmap.rb +4 -0
  33. data/lib/swordfish/native/acknowledgements.rb +27 -0
  34. data/lib/swordfish/native/analyzer.rb +55 -0
  35. data/lib/swordfish/native/file_accessor.rb +28 -0
  36. data/lib/swordfish/native/installation_options.rb +25 -0
  37. data/lib/swordfish/native/installer.rb +135 -0
  38. data/lib/swordfish/native/linter.rb +25 -0
  39. data/lib/swordfish/native/path_source.rb +33 -0
  40. data/lib/swordfish/native/pod_source_installer.rb +19 -0
  41. data/lib/swordfish/native/pod_target_installer.rb +94 -0
  42. data/lib/swordfish/native/podfile.rb +105 -0
  43. data/lib/swordfish/native/podfile_env.rb +36 -0
  44. data/lib/swordfish/native/podfile_generator.rb +195 -0
  45. data/lib/swordfish/native/podspec_finder.rb +24 -0
  46. data/lib/swordfish/native/resolver.rb +223 -0
  47. data/lib/swordfish/native/source.rb +35 -0
  48. data/lib/swordfish/native/sources_manager.rb +19 -0
  49. data/lib/swordfish/native/specification.rb +31 -0
  50. data/lib/swordfish/native/target_architectures.rb +79 -0
  51. data/lib/swordfish/native/target_validator.rb +41 -0
  52. data/lib/swordfish/native/validator.rb +39 -0
  53. data/lib/swordfish/native.rb +16 -0
  54. data/lib/swordfish.rb +2 -0
  55. metadata +167 -0
@@ -0,0 +1,78 @@
1
+
2
+ require 'swordfish/helpers/sources_helper'
3
+ require 'swordfish/helpers/spec_creator'
4
+ require 'swordfish/helpers/spec_files_helper'
5
+ require 'swordfish/helpers/spec_source_creator'
6
+ require 'swordfish/helpers/build_utils'
7
+
8
+ module Pod
9
+ class Command
10
+ class Swordfish < Command
11
+ class Spec < Swordfish
12
+ class Create < Spec
13
+ self.summary = '创建二进制 spec.'
14
+ self.description = <<-DESC
15
+ 根据源码 podspec 文件,创建对应的二进制 podspec 文件.
16
+ DESC
17
+
18
+ def self.options
19
+ [
20
+ ['--platforms=ios', '生成二进制 spec 支持的平台'],
21
+ ['--template-podspec=A.binary-template.podspec', '生成拥有 subspec 的二进制 spec 需要的模版 podspec, 插件会更改 version 和 source'],
22
+ ['--no-overwrite', '不允许覆盖']
23
+ ].concat(super)
24
+ end
25
+
26
+ def initialize(argv)
27
+ @platforms = argv.option('platforms', 'ios')
28
+ @allow_overwrite = argv.flag?('overwrite', true)
29
+ @template_podspec = argv.option('template-podspec')
30
+ @podspec = argv.shift_argument
31
+ super
32
+ end
33
+
34
+ def run
35
+ UI.puts "开始读取 podspec 文件...\n"
36
+
37
+ code_spec = Pod::Specification.from_file(spec_file)
38
+ if template_spec_file
39
+ template_spec = Pod::Specification.from_file(template_spec_file)
40
+ end
41
+
42
+ if binary_spec && !@allow_overwrite
43
+ UI.warn "二进制 podspec 文件 #{binary_spec_files.first} 已存在.\n"
44
+ else
45
+ UI.puts "开始生成二进制 podspec 文件...\n"
46
+ spec_file = create_binary_spec_file(code_spec, template_spec)
47
+ UI.puts "创建二进制 podspec 文件 #{spec_file} 成功.\n".green
48
+ end
49
+ end
50
+
51
+ def template_spec_file
52
+ @template_spec_file ||= begin
53
+ if @template_podspec
54
+ find_spec_file(@template_podspec)
55
+ else
56
+ binary_template_spec_file
57
+ end
58
+ end
59
+ end
60
+
61
+ def spec_file
62
+ @spec_file ||= begin
63
+ if @podspec
64
+ find_spec_file(@podspec)
65
+ else
66
+ if code_spec_files.empty?
67
+ raise Informative, '当前目录下没有找到可用源码 podspec.'
68
+ end
69
+
70
+ code_spec_files.first
71
+ end
72
+ end
73
+ end
74
+ end
75
+ end
76
+ end
77
+ end
78
+ end
@@ -0,0 +1,114 @@
1
+ require 'swordfish/config/config'
2
+ require 'swordfish/native/podfile'
3
+
4
+ module Pod
5
+ class Command
6
+ class Swordfish < Command
7
+ class Repo < Swordfish
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
@@ -0,0 +1,41 @@
1
+ require 'cocoapods'
2
+
3
+ require 'swordfish/command/config'
4
+ require 'swordfish/command/auto'
5
+ require 'swordfish/command/archive'
6
+ require 'swordfish/command/spec/create'
7
+ require 'swordfish/command/spec/push'
8
+ require 'swordfish/command/repo/update'
9
+
10
+ require 'swordfish/helpers/sources_helper'
11
+ require 'swordfish/helpers/spec_files_helper'
12
+ require 'swordfish/native'
13
+
14
+ module Pod
15
+ class Command
16
+ class Swordfish < Command
17
+ include Ocean::SourcesHelper
18
+ include Ocean::SpecFilesHelper
19
+
20
+ self.abstract_command = true
21
+ self.summary = 'pod编译加速插件.'
22
+ self.description = <<-DESC
23
+ 组件二进制、hmap等功能。
24
+ DESC
25
+
26
+ def initialize(argv)
27
+ require 'swordfish/native/resolver'
28
+
29
+ @help = argv.flag?('help')
30
+ super
31
+ end
32
+
33
+ def validate!
34
+ super
35
+ # 这里由于 --help 是在 validate! 方法中提取的,会导致 --help 失效
36
+ # pod lib create 也有这个问题
37
+ banner! if @help
38
+ end
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,2 @@
1
+
2
+ require 'swordfish/command/swordfish'
@@ -0,0 +1,137 @@
1
+ require 'yaml'
2
+ require 'cocoapods/generate'
3
+ require 'swordfish/native/podfile'
4
+ require 'swordfish/native/podfile_env'
5
+
6
+ module Ocean
7
+ class Config
8
+ def config_file
9
+ config_file_with_configuration_env(configuration_env)
10
+ end
11
+
12
+ def template_hash
13
+ {
14
+ 'configuration_env' => { description: '编译环境', default: 'dev', selection: %w[dev debug_iphoneos release_iphoneos] },
15
+ #'code_repo_url' => { description: '源码私有源 Git 地址', default: 'https://gitlab.lizhi.fm/iOSPods/pod_binary_spec_source.git' },
16
+ 'binary_repo_url' => { description: '二进制私有源 Git 地址', default: 'https://gitlab.lizhi.fm/iOSPods/pod_binary_spec.git' },
17
+ 'binary_download_url' => { description: '二进制下载地址,内部会依次传入组件名称与版本,替换字符串中的 %s ', default: 'http://192.168.33.15:8080/frameworks/%s/%s/zip' },
18
+ # 'binary_type' => { description: '二进制打包类型', default: 'framework', selection: %w[framework library] },
19
+ 'download_file_type' => { description: '下载二进制文件类型', default: 'zip', selection: %w[zip tgz tar tbz txz dmg] }
20
+ }
21
+ end
22
+
23
+ def config_file_with_configuration_env(configuration_env)
24
+ file = config_dev_file
25
+ if configuration_env == "release_iphoneos"
26
+ file = config_release_iphoneos_file
27
+ puts "\n====== #{configuration_env} 环境 ========"
28
+ elsif configuration_env == "debug_iphoneos"
29
+ file = config_debug_iphoneos_file
30
+ puts "\n====== #{configuration_env} 环境 ========"
31
+ elsif configuration_env == "dev"
32
+ puts "\n====== #{configuration_env} 环境 ========"
33
+ else
34
+ raise "\n===== #{configuration_env} 参数有误,请检查%w[dev debug_iphoneos release_iphoneos]===="
35
+ end
36
+
37
+ File.expand_path("#{Pod::Config.instance.home_dir}/#{file}")
38
+ end
39
+
40
+ def configuration_env
41
+ #如果是dev 再去 podfile的配置文件中获取,确保是正确的, pod update时会用到
42
+ if @configuration_env == "dev" || @configuration_env == nil
43
+ if Pod::Config.instance.podfile
44
+ configuration_env ||= Pod::Config.instance.podfile.configuration_env
45
+ end
46
+ configuration_env ||= "dev"
47
+ @configuration_env = configuration_env
48
+ end
49
+ @configuration_env
50
+ end
51
+
52
+ #上传的url
53
+ def binary_upload_url
54
+ cut_string = "/%s/%s/zip"
55
+ binary_download_url[0,binary_download_url.length - cut_string.length]
56
+ end
57
+
58
+ def set_configuration_env(env)
59
+ @configuration_env = env
60
+ end
61
+
62
+ #包含arm64 armv7架构,xcodebuild 是Debug模式
63
+ def config_debug_iphoneos_file
64
+ "swordfish_debug_iphoneos.yml"
65
+ end
66
+ #包含arm64 armv7架构,xcodebuild 是Release模式
67
+ def config_release_iphoneos_file
68
+ "swordfish_release_iphoneos.yml"
69
+ end
70
+ #包含x86 arm64 armv7架构,xcodebuild 是Release模式
71
+ def config_dev_file
72
+ "swordfish_dev.yml"
73
+ end
74
+
75
+ def sync_config(config)
76
+ File.open(config_file_with_configuration_env(config['configuration_env']), 'w+') do |f|
77
+ f.write(config.to_yaml)
78
+ end
79
+ end
80
+
81
+ def default_config
82
+ @default_config ||= Hash[template_hash.map { |k, v| [k, v[:default]] }]
83
+ end
84
+
85
+ private
86
+
87
+ def load_config
88
+ if File.exist?(config_file)
89
+ YAML.load_file(config_file)
90
+ else
91
+ default_config
92
+ end
93
+ end
94
+
95
+ def config
96
+ @config ||= begin
97
+ puts "====== cocoapods-swordfish #{Ocean::VERSION} 版本 ======== \n"
98
+ @config = OpenStruct.new load_config
99
+ validate!
100
+ @config
101
+ end
102
+ end
103
+
104
+ def validate!
105
+ template_hash.each do |k, v|
106
+ selection = v[:selection]
107
+ next if !selection || selection.empty?
108
+
109
+ config_value = @config.send(k)
110
+ next unless config_value
111
+ unless selection.include?(config_value)
112
+ raise Pod::Informative, "#{k} 字段的值必须限定在可选值 [ #{selection.join(' / ')} ] 内".red
113
+ end
114
+ end
115
+ end
116
+
117
+ def respond_to_missing?(method, include_private = false)
118
+ config.respond_to?(method) || super
119
+ end
120
+
121
+ def method_missing(method, *args, &block)
122
+ if config.respond_to?(method)
123
+ config.send(method, *args)
124
+ elsif template_hash.keys.include?(method.to_s)
125
+ raise Pod::Informative, "#{method} 字段必须在配置文件 #{config_file} 中设置, 请执行 init 命令配置或手动修改配置文件".red
126
+ else
127
+ super
128
+ end
129
+ end
130
+ end
131
+
132
+ def self.config
133
+ @config ||= Config.new
134
+ end
135
+
136
+
137
+ end
@@ -0,0 +1,57 @@
1
+ require 'yaml'
2
+ require 'swordfish/config/config'
3
+
4
+ module Ocean
5
+ class Config
6
+ class Asker
7
+ def show_prompt
8
+ print ' > '.green
9
+ end
10
+
11
+ def ask_with_answer(question, pre_answer, selection)
12
+ print "\n#{question}\n"
13
+
14
+ print_selection_info = lambda {
15
+ print "可选值:[ #{selection.join(' / ')} ]\n" if selection
16
+ }
17
+ print_selection_info.call
18
+ print "旧值:#{pre_answer}\n" unless pre_answer.nil?
19
+
20
+ answer = ''
21
+ loop do
22
+ show_prompt
23
+ answer = STDIN.gets.chomp.strip
24
+
25
+ if answer == '' && !pre_answer.nil?
26
+ answer = pre_answer
27
+ print answer.yellow
28
+ print "\n"
29
+ end
30
+
31
+ next if answer.empty?
32
+ break if !selection || selection.include?(answer)
33
+
34
+ print_selection_info.call
35
+ end
36
+
37
+ answer
38
+ end
39
+
40
+ def wellcome_message
41
+ print <<~EOF
42
+
43
+ 开始设置二进制化初始信息.
44
+ 所有的信息都会保存在 #{Ocean.config.config_file} 文件中.
45
+ %w[swordfish_dev.yml swordfish_debug_iphoneos.yml swordfish_release_iphoneos.yml]
46
+ 你可以在对应目录下手动添加编辑该文件. 文件包含的配置信息样式如下:
47
+
48
+ #{Ocean.config.default_config.to_yaml}
49
+ EOF
50
+ end
51
+
52
+ def done_message
53
+ print "\n设置完成.\n".green
54
+ end
55
+ end
56
+ end
57
+ end
@@ -0,0 +1,216 @@
1
+ require 'yaml'
2
+
3
+ module Ocean
4
+ class Config
5
+ class Builder
6
+
7
+ include Pod
8
+
9
+ def self.instance
10
+ @instance ||= new
11
+ end
12
+
13
+ def initialize
14
+ load_build_config
15
+ # clean
16
+ end
17
+
18
+ # 加载配置项
19
+ def load_build_config
20
+ @pod_source_list = []
21
+ @white_pod_list = []
22
+ project_root = Pod::Config.instance.project_root
23
+ path = File.join(project_root.to_s, 'SwordfishArchiveConfig.json')
24
+
25
+ if File.exist?(path)
26
+ config = JSON.parse(File.read(path))
27
+
28
+ @pod_source_list = config['pod-source-list'] || []
29
+ # 添加默认source
30
+ @pod_source_list << 'https://github.com/CocoaPods/Specs.git' if @pod_source_list.empty?
31
+ UI.warn "====== archive-pod-source-list = #{@pod_source_list}" if @pod_source_list
32
+
33
+ @white_pod_list = config['archive-white-pod-list']
34
+ UI.warn "====== archive-white-pod-list = #{@white_pod_list}" if @white_pod_list
35
+
36
+ @xcode_build_name = config['xcode_build_path']
37
+ @root_dir = config['root_dir'] unless config['root_dir'].nil?
38
+ end
39
+
40
+ end
41
+
42
+ def clean
43
+ #清除之前的缓存
44
+ FileUtils.rm_rf(Dir.glob("#{zip_dir}/*")) if File.exist?(zip_dir)
45
+ FileUtils.rm_rf(Dir.glob("#{binary_json_dir}/*")) if File.exist?(binary_json_dir)
46
+ FileUtils.rm_rf(Dir.glob("#{local_psec_dir}/*")) if File.exist?(local_psec_dir)
47
+ end
48
+
49
+ # 制作二进制打包 工程目录
50
+ def gen_name
51
+ 'swordfish-archive'
52
+ end
53
+
54
+ # 制作二进制打包 工程目录
55
+ def gen_dir
56
+ @gen_dir ||= begin
57
+ dir = File.join(root_dir,gen_name)
58
+ Dir.mkdir(dir) unless File.exist?dir
59
+ Pathname.new(dir)
60
+ end
61
+ end
62
+
63
+
64
+ def framework_name(spec)
65
+ "#{spec.name}.framework"
66
+ end
67
+
68
+ def framework_name_version(spec)
69
+ "#{spec.name}.framework_#{spec.version}"
70
+ end
71
+
72
+ def framework_zip_file(spec)
73
+ File.join(zip_dir_name, framework_name_version(spec))
74
+ end
75
+
76
+ def framework_file(spec)
77
+ File.join(zip_dir_name, framework_name(spec))
78
+ end
79
+
80
+ def library_name(spec)
81
+ library_name_version(spec.name, spec.version)
82
+ end
83
+
84
+ def library_name_version(name,version)
85
+ "swordfish_#{name}_#{version}"
86
+ end
87
+ def library_file(spec)
88
+ File.join(zip_dir_name, library_name(spec))
89
+ end
90
+
91
+ def zip_dir_name
92
+ "swordfish-zip"
93
+ end
94
+
95
+ def zip_dir
96
+ @zip_dir ||= begin
97
+ dir = File.join(root_dir,zip_dir_name)
98
+ Dir.mkdir(dir) unless File.exist?dir
99
+ Pathname.new(dir)
100
+ end
101
+ end
102
+
103
+ #本地
104
+ def local_spec_dir_name
105
+ "swordfish-spec"
106
+ end
107
+
108
+ def local_psec_dir
109
+ @local_psec_dir ||= begin
110
+ dir = File.join(root_dir,local_spec_dir_name)
111
+ Dir.mkdir(dir) unless File.exist?dir
112
+ Pathname.new(dir)
113
+ end
114
+ end
115
+
116
+ def binary_json_dir_name
117
+ "swordfish-json"
118
+ end
119
+
120
+ def binary_json_dir
121
+ @binary_json_dir ||= begin
122
+ dir = File.join(root_dir,binary_json_dir_name)
123
+ Dir.mkdir(dir) unless File.exist?dir
124
+ Pathname.new(dir)
125
+ end
126
+ end
127
+
128
+
129
+
130
+ #编译target名,如 seeyou
131
+ def target_name
132
+ @target_name ||= begin
133
+ target_name_str = Pod::Config.instance.podfile.root_target_definitions.first.children.first.to_s
134
+ target_name_str[5,target_name_str.length]
135
+ end
136
+ end
137
+
138
+ #编译缓存文件目录,如Xcodebuild的编译缓存目录
139
+ # 如果有配置, 配置完整路径,会使用
140
+ def xcode_build_name
141
+ @xcode_build_name ||= begin
142
+ project_root = Pod::Config.instance.project_root
143
+ path = File.join(project_root.to_s, 'SwordfishArchive.json')
144
+
145
+ if File.exist?(path)
146
+ config = JSON.parse(File.read(path))
147
+ @xcode_build_name = config['xcode_build_path']
148
+ end
149
+ #默认值,在美柚上使用默认
150
+ if @xcode_build_name.nil? || Dir.exist?(@xcode_build_name)
151
+ @xcode_build_name = "xcode-build/Build/Intermediates.noindex/ArchiveIntermediates/#{target_name}/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/"
152
+ end
153
+ puts @xcode_build_name
154
+ @xcode_build_name
155
+ end
156
+ end
157
+
158
+
159
+ #完整的xcodebuild 输出路径
160
+ def xcode_build_dir
161
+ @xcode_build_dir ||= begin
162
+ temp_xcode_build_name = xcode_build_name
163
+ if File.exist?(temp_xcode_build_name)
164
+ Pathname.new(temp_xcode_build_name)
165
+ else
166
+ dir = File.join(root_dir,xcode_build_name)
167
+ Pathname.new(dir)
168
+ end
169
+ end
170
+ end
171
+ #完整的xcodebuild BuildProductsPath输出路径,
172
+ def xcode_BuildProductsPath_dir
173
+ @xcode_BuildProductsPath_dir ||= begin
174
+ temp_xcode_BuildProductsPath_dir = "xcode-build/Build/Intermediates.noindex/ArchiveIntermediates/#{target_name}/BuildProductsPath/"
175
+ full_path = File.join(root_dir, temp_xcode_BuildProductsPath_dir)
176
+
177
+ if (File.exist?(full_path))
178
+ Dir.chdir(full_path) do
179
+ iphoneos = Dir.glob('*-iphoneos')
180
+ if iphoneos.length > 0
181
+ full_path = File.join(full_path,iphoneos.first)
182
+ else
183
+ UI.warn "====== 找不到 *-iphoneos @xcode_BuildProductsPath_dir = #{@xcode_BuildProductsPath_dir}"
184
+ end
185
+ end
186
+ end
187
+ Pathname.new(full_path)
188
+ end
189
+ end
190
+
191
+
192
+ #处理编译产物后存储根目录,会存放spec、 json、zip的父目录,默认是工程的同级目录下,"#{basename}-build-temp"
193
+ def root_dir
194
+ @root_dir ||= begin
195
+ basename = File.basename(Pod::Config.instance.installation_root)
196
+ parent_dir = File.dirname(Pod::Config.instance.installation_root)
197
+ root_name = File.join(parent_dir,"#{basename}-build-temp")
198
+ Dir.mkdir(root_name) unless File.exist?root_name
199
+ Pathname.new(root_name)
200
+ end
201
+
202
+ end
203
+
204
+ #制作二进制 白名单
205
+ def white_pod_list
206
+ @white_pod_list
207
+ end
208
+
209
+ # 制作pod源
210
+ def pod_source_list
211
+ @pod_source_list
212
+ end
213
+
214
+ end
215
+ end
216
+ end