cocoapods-jxedt 0.0.12 → 0.0.14

Sign up to get free protection for your applications and to get access to all the features.
Files changed (32) hide show
  1. checksums.yaml +4 -4
  2. data/lib/cocoapods-jxedt/binary/Intergation.rb +18 -13
  3. data/lib/cocoapods-jxedt/binary/config.rb +72 -0
  4. data/lib/cocoapods-jxedt/binary/helper/podfile_post_install_hook.rb +29 -0
  5. data/lib/cocoapods-jxedt/binary/helper/prebuild_installer.rb +11 -0
  6. data/lib/cocoapods-jxedt/binary/helper/prebuild_sandbox.rb +58 -53
  7. data/lib/cocoapods-jxedt/binary/hooks/CocoapodsJxedtHook.rb +6 -9
  8. data/lib/cocoapods-jxedt/binary/hooks/post_install.rb +4 -4
  9. data/lib/cocoapods-jxedt/binary/hooks/pre_install.rb +32 -12
  10. data/lib/cocoapods-jxedt/binary/main.rb +1 -0
  11. data/lib/cocoapods-jxedt/binary/pod-room/framework.rb +40 -0
  12. data/lib/cocoapods-jxedt/binary/pod-room/xcodebuild_command.rb +83 -1
  13. data/lib/cocoapods-jxedt/binary/pod-room/xcodebuild_raw.rb +1 -1
  14. data/lib/cocoapods-jxedt/binary/prebuild.rb +94 -16
  15. data/lib/cocoapods-jxedt/command/binary/binary.rb +38 -0
  16. data/lib/cocoapods-jxedt/command/binary/command/build.rb +84 -0
  17. data/lib/cocoapods-jxedt/command/binary/command/clean.rb +101 -0
  18. data/lib/cocoapods-jxedt/command/binary/command/code.rb +66 -0
  19. data/lib/cocoapods-jxedt/command/binary/command/fetch.rb +36 -0
  20. data/lib/cocoapods-jxedt/command/binary/command/push.rb +41 -0
  21. data/lib/cocoapods-jxedt/command/binary/command/source_project.rb +51 -0
  22. data/lib/cocoapods-jxedt/command/binary/command/statistics.rb +104 -0
  23. data/lib/cocoapods-jxedt/command/jxedt.rb +2 -1
  24. data/lib/cocoapods-jxedt/command/options/options.rb +85 -2
  25. data/lib/cocoapods-jxedt/command/user/user.rb +57 -0
  26. data/lib/cocoapods-jxedt/gem_version.rb +1 -1
  27. data/lib/cocoapods-jxedt/git_helper/cache_fetcher.rb +34 -0
  28. data/lib/cocoapods-jxedt/git_helper/cache_pucher.rb +42 -0
  29. data/lib/cocoapods-jxedt/git_helper/git_command.rb +48 -0
  30. data/lib/cocoapods-jxedt/git_helper/zip.rb +22 -0
  31. metadata +18 -3
  32. data/lib/cocoapods-jxedt/command/statistics/statistics.rb +0 -98
@@ -8,7 +8,7 @@ module Jxedt
8
8
 
9
9
  def self.from_sandbox(sandbox)
10
10
  search_path = Jxedt.config.binary_dir
11
- binary_dir = search_path.empty? ? nil : sandbox.root + search_path
11
+ binary_dir = search_path.empty? ? nil : sandbox.standard_sandbox_root + search_path
12
12
  check_sandbox = Sandbox.new(binary_dir)
13
13
  check_sandbox.sandbox = sandbox
14
14
  check_sandbox
@@ -22,12 +22,19 @@ module Jxedt
22
22
  return [] if @sandbox_path.nil?
23
23
  return [] unless binary_dir.exist?
24
24
  return [] if @sandbox.source_lockfile.nil?
25
- @targets ||= binary_dir.children().map do |target_path|
26
- if target_path.directory? && (not target_path.children.empty?)
27
- hash_key = @sandbox.source_lockfile.spec_checksums_hash_key(target_path.basename.to_s)
28
- target_path if !(hash_key.nil?) && (target_path + "#{hash_key}.checksum").exist?
29
- end
30
- end.reject(&:nil?).uniq
25
+ @targets ||= begin
26
+ prebuild_targets = binary_dir.children().map do |target_path|
27
+ if target_path.directory? && (not target_path.children.empty?)
28
+ hash_key = @sandbox.source_lockfile.spec_checksums_hash_key(target_path.basename.to_s)
29
+ next if hash_key.nil?
30
+
31
+ checksum_files = target_path.children().select { |path| path.extname == '.checksum' }
32
+ checksum_exists = (target_path + "#{hash_key}.checksum").exist?
33
+ target_path if checksum_files.count == 1 && checksum_exists
34
+ end
35
+ end.reject(&:nil?).uniq
36
+ prebuild_targets
37
+ end
31
38
  @targets
32
39
  end
33
40
 
@@ -80,21 +87,44 @@ module Jxedt
80
87
  target.target_definition.reject_prebuild_pod_names
81
88
  }.uniq
82
89
 
90
+ targets = all_supports_targets.select { |target|
91
+ next if reject_prebuild_pod_names.include?(target.pod_name)
92
+ explicit_prebuild_pod_names.include?(target.pod_name) || Jxedt.config.all_binary_enabled?
93
+ }
94
+ targets
95
+ end
96
+
97
+ def all_supports_targets
83
98
  targets = @source_installer.pod_targets.select { |target|
99
+ # 排除不需要编译
84
100
  next unless target.should_build?
101
+ # 排除target name和pod name不一致的(有两种情况)
102
+ # 1. 同一个pod,在两个target下使用了不同的subspec
103
+ # 2. 同一个pod,在两个不同ios版本的target种引用
85
104
  next unless target.name == target.pod_name
86
- next if reject_prebuild_pod_names.include?(target.pod_name)
87
- explicit_prebuild_pod_names.include?(target.pod_name) || Jxedt.config.all_binary_enabled?
105
+ true
88
106
  }
107
+ # 排除本地pod
89
108
  targets.reject! { |target| @source_installer.sandbox.local?(target.pod_name) } unless Jxedt.config.dev_pods_enabled?
109
+ # 配置中排除的pods
90
110
  targets.reject! { |target| Jxedt.config.excluded_pods.include?(target.pod_name) }
111
+ # target中可能存在需要编译的resource文件
112
+ Jxedt.config.disable_resource_compilable_pods? && targets.reject! { |target|
113
+ # 因为编译library静态库会把需要编译的文件拷贝到宿主工程编译,后面我们要把静态库组装成framework,所以需要过滤掉
114
+ resource_extension_compilable = false
115
+ target.resource_paths.each {|name, resources|
116
+ resources.each {|resource_file|
117
+ resource_extname = Pathname.new(resource_file).basename.extname
118
+ resource_extension_compilable = target.class.resource_extension_compilable?(resource_extname)
119
+ break if resource_extension_compilable
120
+ }
121
+ break if resource_extension_compilable
122
+ }
123
+ resource_extension_compilable
124
+ }
91
125
  targets
92
126
  end
93
127
 
94
- def pods_to_prebuild
95
- targets_to_prebuild.map(&:name).to_a
96
- end
97
-
98
128
  def build
99
129
  check_sandbox = Jxedt::Sandbox.from_sandbox(@source_installer.sandbox)
100
130
  existed_target_names = check_sandbox.target_paths.map { |pair| pair.basename.to_s }
@@ -102,7 +132,7 @@ module Jxedt
102
132
 
103
133
  Pod::UI.puts "Prebuild total count: #{targets.size}"
104
134
  Pod::UI.puts "Prebuild targets: #{ targets.map(&:name)}"
105
- return if targets.empty?
135
+ return [] if targets.empty?
106
136
 
107
137
  require_relative 'pod-room/xcodebuild_command'
108
138
 
@@ -135,15 +165,63 @@ module Jxedt
135
165
 
136
166
  make_prebuild(targets)
137
167
  clear_output_path
168
+
169
+ targets.map(&:pod_name).to_a
170
+ end
171
+
172
+ def build_targets(names: nil, binary_output: nil)
173
+ targets = all_supports_targets
174
+ targets.select! { |target| names.include?(target.pod_name) } if names && names.is_a?(Array) && names.size > 0
175
+
176
+ Pod::UI.puts "Prebuild total count: #{targets.size}"
177
+ Pod::UI.puts "Prebuild targets: #{ targets.map(&:name)}"
178
+ return [] if targets.empty?
179
+
180
+ require_relative 'pod-room/xcodebuild_command'
181
+
182
+ clear_output_path
183
+ case targets[0].platform.name
184
+ when :ios, :tvos, :watchos
185
+ Jxedt.config.support_configurations.each do |configuration|
186
+ Pod::UI.puts "Prebuild configuration: #{configuration}"
187
+ options = make_options
188
+ options[:configuration] = configuration
189
+ options[:targets] = targets
190
+ options[:output_path] = output_path + configuration
191
+ Jxedt::XcodebuildCommand.new(options).run
192
+ end
193
+ when :osx
194
+ Jxedt.config.support_configurations.each do |configuration|
195
+ Pod::UI.puts "Prebuild configuration: #{configuration}"
196
+ options = make_options
197
+ xcodebuild(
198
+ sandbox: options[:sandbox],
199
+ targets: targets,
200
+ configuration: configuration,
201
+ sdk: "macosx",
202
+ clean_build: Jxedt.config.clean_build?,
203
+ args: options[:args]
204
+ )
205
+ end
206
+ else
207
+ raise "Unsupported platform for '#{targets[0].name}': '#{targets[0].platform.name}'"
208
+ end
209
+
210
+ binary_output = Pathname.new(binary_output)
211
+ make_prebuild(targets, binary_output)
212
+ clear_output_path
213
+
214
+ targets.map(&:pod_name).to_a
138
215
  end
139
216
 
140
- def make_prebuild(targets)
217
+ def make_prebuild(targets, binary_output=nil)
141
218
  lockfile = @source_installer.lockfile
142
219
  checksums = lockfile.internal_data["SPEC CHECKSUMS"] || {}
143
220
  checkout_options = lockfile.internal_data["CHECKOUT OPTIONS"] || {}
144
221
 
145
222
  # 目标binary路径
146
223
  binary_path = output_path.parent
224
+ binary_path = binary_output if binary_output && binary_output.parent.exist?
147
225
  prebuild_targets = targets.map(&:name).to_a
148
226
  prebuild_targets.map {|target_name|
149
227
  target_path = binary_path + target_name
@@ -199,7 +277,7 @@ module Jxedt
199
277
 
200
278
  def output_path
201
279
  sandbox = @source_installer.sandbox
202
- sandbox.root + Jxedt.config.binary_dir + "GeneratedFrameworks"
280
+ sandbox.standard_sandbox_root + Jxedt.config.binary_dir + "GeneratedFrameworks"
203
281
  end
204
282
 
205
283
  def clear_output_path
@@ -0,0 +1,38 @@
1
+ require_relative 'command/statistics'
2
+ require_relative 'command/build'
3
+ require_relative 'command/fetch'
4
+ require_relative 'command/push'
5
+ require_relative 'command/clean'
6
+ require_relative 'command/code'
7
+ require_relative 'command/source_project'
8
+
9
+ module Pod
10
+ class Command
11
+ class JxedtCommand < Command
12
+ class Binary < JxedtCommand
13
+ self.summary = '二进制相关操作,二进制build、fetch、clean、statistics'
14
+ self.description = <<-DESC
15
+ 二进制相关操作,二进制build、fetch、push、statistics
16
+ DESC
17
+ self.command = 'binary'
18
+ self.abstract_command = true
19
+
20
+ self.arguments = [
21
+ ]
22
+ def self.options
23
+ []
24
+ end
25
+ def initialize(argv)
26
+ super
27
+ end
28
+
29
+ def validate!
30
+ super
31
+ end
32
+
33
+ def run
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,84 @@
1
+ module Pod
2
+ class Command
3
+ class JxedtCommand < Command
4
+ class Binary < JxedtCommand
5
+ class Build < Binary
6
+ self.summary = '组件编译成二进制'
7
+ self.description = <<-DESC
8
+ 统计二进制组件
9
+ DESC
10
+ self.command = 'build'
11
+ self.arguments = [
12
+ ]
13
+ def self.options
14
+ [
15
+ ['--name', '编译的组件name,多个以,分隔'],
16
+ ['--output-path', '编译的二进制文件输出路径'],
17
+ ['--push', 'prebuild frameworks push origin.'],
18
+ ['--force-push', 'force push generated frameworks']
19
+ ]
20
+ end
21
+ def initialize(argv)
22
+ @names = argv.option('name', '').split(',')
23
+ @output_path = argv.option('output-path')
24
+ @force_push = argv.flag?('force-push', false)
25
+ @should_push = argv.flag?('push', false) || @force_push
26
+ super
27
+ end
28
+
29
+ def validate!
30
+ super
31
+ end
32
+
33
+ def run
34
+ podfile = Pod::Config.instance.podfile
35
+ lockfile = Pod::Config.instance.lockfile
36
+ sandbox = Pod::Config.instance.sandbox
37
+ help! '请检查命令执行路径,需要在Podfile文件所在目录执行' if podfile.nil? || lockfile.nil? || sandbox.nil?
38
+
39
+ # 修改config配置
40
+ options = {
41
+ :keep_source_project => true, # 保留源码工程
42
+ }
43
+ Jxedt.config.dsl_config.merge!(options)
44
+
45
+ require 'cocoapods-jxedt/binary/helper/target_definition'
46
+ require 'cocoapods-jxedt/binary/helper/prebuild_sandbox'
47
+ require 'cocoapods-jxedt/binary/helper/podfile_post_install_hook'
48
+ require 'cocoapods-jxedt/binary/helper/prebuild_installer'
49
+
50
+ # 获取原始的installer对象,必须先获取对象
51
+ prebuild_sandbox = Pod::JxedtPrebuildSandbox.from_standard_sandbox(sandbox)
52
+ source_installer = Pod::JxedtPrebuildInstaller.new(prebuild_sandbox, podfile, lockfile)
53
+ # 执行install
54
+ source_installer.install!
55
+
56
+ # 保存首次`pod install`的lockfile结果,用来验证二进制文件和后面做结果校验
57
+ sandbox.source_lockfile = prebuild_sandbox.source_lockfile = source_installer.lockfile
58
+
59
+ require 'cocoapods-jxedt/binary/helper/podfile_options'
60
+ require 'cocoapods-jxedt/binary/prebuild'
61
+
62
+ # prebuild_job
63
+ log_section "🚀 Prebuild frameworks"
64
+ # 默认放在Pods源码工程同级目录下
65
+ @output_path = prebuild_sandbox.project_path.parent + '.command_build' if @output_path.nil?
66
+ build_targets = Jxedt::Prebuild.new(source_installer).build_targets :names => @names, :binary_output => @output_path
67
+ if @should_push && Jxedt.config.cache_repo_enabled?
68
+ require 'cocoapods-jxedt/git_helper/cache_pucher'
69
+ output_dir = Pathname.new(@output_path)
70
+ Jxedt::CachePucher.push(output_dir, build_targets, @force_push)
71
+ end
72
+ prebuild_sandbox.clean_source_project!
73
+ end
74
+
75
+ def log_section(message)
76
+ Pod::UI.puts "-----------------------------------------"
77
+ Pod::UI.puts message
78
+ Pod::UI.puts "-----------------------------------------"
79
+ end
80
+ end
81
+ end
82
+ end
83
+ end
84
+ end
@@ -0,0 +1,101 @@
1
+ module Pod
2
+ class Command
3
+ class JxedtCommand < Command
4
+ class Binary < JxedtCommand
5
+ class Clean < Binary
6
+ self.summary = 'clean cache repo.'
7
+ self.description = <<-DESC
8
+ clean cache repo.
9
+ DESC
10
+ self.command = 'clean'
11
+ self.arguments = [
12
+ ]
13
+ def self.options
14
+ [
15
+ ['--name', 'Remove the file with the corresponding name.'],
16
+ ['--local', 'Remove local cache.'],
17
+ ['--all', 'Remove all files.'],
18
+ ]
19
+ end
20
+ def initialize(argv)
21
+ @names = argv.option('name', '').split(',')
22
+ @local = argv.flag?('local', false)
23
+ @all = argv.flag?('all', false)
24
+ super
25
+ end
26
+
27
+ def validate!
28
+ help! "Please enter the necessary options." if @names.empty? && !@all
29
+ super
30
+ end
31
+
32
+ def run
33
+ podfile = Pod::Config.instance.podfile
34
+ help! '请检查命令执行路径,需要在Podfile文件所在目录执行' if podfile.nil?
35
+
36
+ require 'cocoapods-jxedt/git_helper/git_command'
37
+
38
+ repo = Jxedt.config.git_remote_repo
39
+ cache_path = Jxedt.config.git_cache_path
40
+ branch = Jxedt.config.cache_branch
41
+
42
+ local_cache_dir = Pod::Config.instance.sandbox.root + Jxedt.config.binary_dir
43
+
44
+ commander = nil
45
+ commander = Jxedt::GitCommand.new(cache_path) if !@local && Jxedt.config.cache_repo_enabled?
46
+ # fetch
47
+ commander.git_fetch(repo, branch) if commander
48
+
49
+ if @names.size > 0
50
+ local_deleted, remote_deleted = [], []
51
+ @names.each do |name|
52
+ local_cache = local_cache_dir + name
53
+ if local_cache.exist?
54
+ local_cache.rmtree
55
+ local_deleted << name
56
+ end
57
+
58
+ if commander
59
+ remote_cache_dir = Pathname.new(cache_path) + "GeneratedFrameworks"
60
+ remote_cache = remote_cache_dir + name
61
+ if remote_cache.exist?
62
+ remote_cache.rmtree
63
+ remote_deleted << name
64
+ end
65
+ end
66
+ end
67
+ # push
68
+ commander.git_commit_and_push(branch) if commander && remote_deleted.size > 0
69
+ UI.puts "⚠️ ⚠️ ⚠️ 本地缓存文件已清除: #{local_deleted}" if local_deleted.size > 0
70
+ UI.puts "⚠️ ⚠️ ⚠️ 远程缓存文件已清除: #{remote_deleted}" if remote_deleted.size > 0
71
+ else
72
+ random = (0...10).map { (97 + rand(26)).chr }.join
73
+ input = get_stdin("你确认要清除所有缓存吗?包括远程仓库的缓存。确认请输入: #{random}")
74
+ help! "输入错误,自动退出。" if random != input
75
+
76
+ local_cache_dir.rmtree if local_cache_dir.exist?
77
+
78
+ if commander
79
+ remote_cache_dir = Pathname.new(cache_path) + "GeneratedFrameworks"
80
+ if remote_cache_dir.exist?
81
+ remote_cache_dir.rmtree
82
+ # push
83
+ commander.git_commit_and_push(branch)
84
+ end
85
+ end
86
+ UI.puts "⚠️ ⚠️ ⚠️ 所有缓存文件已清除"
87
+ end
88
+
89
+ end
90
+
91
+ def get_stdin(message)
92
+ UI.puts "#{message}".red
93
+ print "请输入--> ".green
94
+ val = STDIN.gets.chomp.strip
95
+ val
96
+ end
97
+ end
98
+ end
99
+ end
100
+ end
101
+ end
@@ -0,0 +1,66 @@
1
+ module Pod
2
+ class Command
3
+ class JxedtCommand < Command
4
+ class Binary < JxedtCommand
5
+ class Code < Binary
6
+ self.summary = 'binary and source code linked.'
7
+ self.description = <<-DESC
8
+ binary and source code linked.
9
+ DESC
10
+ self.command = 'code'
11
+ self.arguments = [
12
+ ]
13
+ def self.options
14
+ [
15
+ ['--link', 'link source code.'],
16
+ ['--unlink', 'Remove source code linked.'],
17
+ ]
18
+ end
19
+ def initialize(argv)
20
+ @link = argv.flag?('link', false)
21
+ @unlink = argv.flag?('unlink', false)
22
+ super
23
+ end
24
+
25
+ def validate!
26
+ help! "Please enter the necessary options." unless @link || @unlink
27
+ super
28
+ end
29
+
30
+ def run
31
+ podfile = Pod::Config.instance.podfile
32
+ help! '请检查命令执行路径,需要在Podfile文件所在目录执行' if podfile.nil?
33
+
34
+ user_path = Pathname.new('/Users/cocoapods-jxedt')
35
+ help! "#{user_path} 路径不存在,源码和二进制链接只支持此路径下的文件。你可以执行`pod jxedt user --add`来添加目录" unless user_path.exist?
36
+
37
+ prebuild_sandbox_path = Jxedt.config.prebuild_sandbox_path
38
+ help! '请配置正确的prebuild sandbox路径' if prebuild_sandbox_path.nil?
39
+
40
+ sandbox_path = Pod::Config.instance.sandbox.root
41
+ prebuild_sandbox_path = Pathname.new(prebuild_sandbox_path)
42
+ if @link
43
+ prebuild_sandbox_path.rmtree if prebuild_sandbox_path.exist?
44
+ help! '不存在Pods文件夹,请检查你的目录' unless sandbox_path.exist?
45
+
46
+ make_source_link(sandbox_path, prebuild_sandbox_path)
47
+ Pod::UI.puts "🎉 源码二进制软链接已添加"
48
+ else
49
+ prebuild_sandbox_path.rmtree if prebuild_sandbox_path.exist?
50
+ Pod::UI.puts "🎉 源码二进制软链接已删除"
51
+ end
52
+ end
53
+
54
+ def make_source_link(source, target)
55
+ source = Pathname.new(source)
56
+ target = Pathname.new(target)
57
+ target.parent.mkpath unless target.parent.exist?
58
+ target.rmtree if target.exist?
59
+ relative_source = source.relative_path_from(target.parent)
60
+ FileUtils.ln_sf(relative_source, target)
61
+ end
62
+ end
63
+ end
64
+ end
65
+ end
66
+ end
@@ -0,0 +1,36 @@
1
+ module Pod
2
+ class Command
3
+ class JxedtCommand < Command
4
+ class Binary < JxedtCommand
5
+ class Fecth < Binary
6
+ self.summary = 'fetch cache repo.'
7
+ self.description = <<-DESC
8
+ fetch cache repo.
9
+ DESC
10
+ self.command = 'fetch'
11
+ self.arguments = [
12
+ ]
13
+ def self.options
14
+ []
15
+ end
16
+ def initialize(argv)
17
+ super
18
+ end
19
+
20
+ def validate!
21
+ super
22
+ end
23
+
24
+ def run
25
+ podfile = Pod::Config.instance.podfile
26
+ help! '请检查命令执行路径,需要在Podfile文件所在目录执行' if podfile.nil?
27
+ help! '你需要在cache_repo中配置正确的git仓库地址!' unless Jxedt.config.cache_repo_enabled?
28
+
29
+ require 'cocoapods-jxedt/git_helper/cache_fetcher'
30
+ Jxedt::CacheFetcher.fetch
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,41 @@
1
+ module Pod
2
+ class Command
3
+ class JxedtCommand < Command
4
+ class Binary < JxedtCommand
5
+ class Push < Binary
6
+ self.summary = 'sync local files to git repo.'
7
+ self.description = <<-DESC
8
+ sync local files to git repo.
9
+ DESC
10
+ self.command = 'push'
11
+ self.arguments = [
12
+ ]
13
+ def self.options
14
+ [
15
+ ['--force-push', 'force push generated frameworks']
16
+ ]
17
+ end
18
+ def initialize(argv)
19
+ @force_push = argv.flag?('force-push', false)
20
+ super
21
+ end
22
+
23
+ def validate!
24
+ super
25
+ end
26
+
27
+ def run
28
+ podfile = Pod::Config.instance.podfile
29
+ help! '请检查命令执行路径,需要在Podfile文件所在目录执行' if podfile.nil?
30
+ help! '你需要在cache_repo中配置正确的git仓库地址!' unless Jxedt.config.cache_repo_enabled?
31
+
32
+ require 'cocoapods-jxedt/git_helper/cache_pucher'
33
+
34
+ output_dir = Pod::Config.instance.sandbox.root + Jxedt.config.binary_dir
35
+ Jxedt::CachePucher.push(output_dir, nil, @force_push)
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,51 @@
1
+ module Pod
2
+ class Command
3
+ class JxedtCommand < Command
4
+ class Binary < JxedtCommand
5
+ class SourceProject < Binary
6
+ self.summary = '生成binary对应的源码工程'
7
+ self.description = <<-DESC
8
+ 生成binary对应的源码工程
9
+ DESC
10
+ self.command = 'sourceProject'
11
+ self.arguments = [
12
+ ]
13
+ def self.options
14
+ []
15
+ end
16
+ def initialize(argv)
17
+ super
18
+ end
19
+
20
+ def validate!
21
+ super
22
+ end
23
+
24
+ def run
25
+ podfile = Pod::Config.instance.podfile
26
+ lockfile = Pod::Config.instance.lockfile
27
+ sandbox = Pod::Config.instance.sandbox
28
+ help! '请检查命令执行路径,需要在Podfile文件所在目录执行' if podfile.nil?
29
+
30
+ # 修改config配置
31
+ options = {
32
+ :keep_source_project => true, # 保留源码工程
33
+ }
34
+ Jxedt.config.dsl_config.merge!(options)
35
+
36
+ require 'cocoapods-jxedt/binary/helper/target_definition'
37
+ require 'cocoapods-jxedt/binary/helper/prebuild_sandbox'
38
+ require 'cocoapods-jxedt/binary/helper/podfile_post_install_hook'
39
+ require 'cocoapods-jxedt/binary/helper/prebuild_installer'
40
+
41
+ # 获取原始的installer对象,必须先获取对象
42
+ prebuild_sandbox = Pod::JxedtPrebuildSandbox.from_standard_sandbox(sandbox)
43
+ source_installer = Pod::JxedtPrebuildInstaller.new(prebuild_sandbox, podfile, lockfile)
44
+ # 执行install
45
+ source_installer.install!
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end