cocoapods-binary-ht 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/cocoapods-binary-cache.rb +2 -0
- data/lib/cocoapods-binary-ht/cache/all.rb +9 -0
- data/lib/cocoapods-binary-ht/cache/validation_result.rb +73 -0
- data/lib/cocoapods-binary-ht/cache/validator.rb +20 -0
- data/lib/cocoapods-binary-ht/cache/validator_accumulated.rb +4 -0
- data/lib/cocoapods-binary-ht/cache/validator_base.rb +112 -0
- data/lib/cocoapods-binary-ht/cache/validator_dependencies_graph.rb +25 -0
- data/lib/cocoapods-binary-ht/cache/validator_dev_pods.rb +30 -0
- data/lib/cocoapods-binary-ht/cache/validator_exclusion.rb +14 -0
- data/lib/cocoapods-binary-ht/cache/validator_non_dev_pods.rb +13 -0
- data/lib/cocoapods-binary-ht/cache/validator_with_podfile.rb +9 -0
- data/lib/cocoapods-binary-ht/dependencies_graph/dependencies_graph.rb +108 -0
- data/lib/cocoapods-binary-ht/dependencies_graph/graph_visualizer.rb +65 -0
- data/lib/cocoapods-binary-ht/diagnosis/base.rb +13 -0
- data/lib/cocoapods-binary-ht/diagnosis/diagnosis.rb +24 -0
- data/lib/cocoapods-binary-ht/diagnosis/integration.rb +23 -0
- data/lib/cocoapods-binary-ht/env.rb +32 -0
- data/lib/cocoapods-binary-ht/helper/benchmark_show.rb +11 -0
- data/lib/cocoapods-binary-ht/helper/checksum.rb +18 -0
- data/lib/cocoapods-binary-ht/helper/json.rb +37 -0
- data/lib/cocoapods-binary-ht/helper/lockfile.rb +90 -0
- data/lib/cocoapods-binary-ht/helper/path_utils.rb +8 -0
- data/lib/cocoapods-binary-ht/helper/podspec.rb +20 -0
- data/lib/cocoapods-binary-ht/hooks/post_install.rb +23 -0
- data/lib/cocoapods-binary-ht/hooks/pre_install.rb +121 -0
- data/lib/cocoapods-binary-ht/main.rb +21 -0
- data/lib/cocoapods-binary-ht/pod-binary/LICENSE.txt +22 -0
- data/lib/cocoapods-binary-ht/pod-binary/helper/build.rb +37 -0
- data/lib/cocoapods-binary-ht/pod-binary/helper/detected_prebuilt_pods/installer.rb +25 -0
- data/lib/cocoapods-binary-ht/pod-binary/helper/detected_prebuilt_pods/target_definition.rb +29 -0
- data/lib/cocoapods-binary-ht/pod-binary/helper/names.rb +27 -0
- data/lib/cocoapods-binary-ht/pod-binary/helper/podfile_options.rb +2 -0
- data/lib/cocoapods-binary-ht/pod-binary/helper/prebuild_sandbox.rb +71 -0
- data/lib/cocoapods-binary-ht/pod-binary/helper/sandbox.rb +9 -0
- data/lib/cocoapods-binary-ht/pod-binary/helper/target_checker.rb +42 -0
- data/lib/cocoapods-binary-ht/pod-binary/integration/alter_specs.rb +150 -0
- data/lib/cocoapods-binary-ht/pod-binary/integration/patch/embed_framework_script.rb +36 -0
- data/lib/cocoapods-binary-ht/pod-binary/integration/patch/resolve_dependencies.rb +20 -0
- data/lib/cocoapods-binary-ht/pod-binary/integration/patch/sandbox_analyzer_state.rb +29 -0
- data/lib/cocoapods-binary-ht/pod-binary/integration/patch/source_installation.rb +55 -0
- data/lib/cocoapods-binary-ht/pod-binary/integration/source_installer.rb +114 -0
- data/lib/cocoapods-binary-ht/pod-binary/integration/validation.rb +20 -0
- data/lib/cocoapods-binary-ht/pod-binary/integration.rb +11 -0
- data/lib/cocoapods-binary-ht/pod-binary/prebuild.rb +166 -0
- data/lib/cocoapods-binary-ht/pod-binary/prebuild_dsl.rb +10 -0
- data/lib/cocoapods-binary-ht/pod-binary/prebuild_hook.rb +10 -0
- data/lib/cocoapods-binary-ht/pod-rome/LICENSE.txt +22 -0
- data/lib/cocoapods-binary-ht/pod-rome/xcodebuild_command.rb +266 -0
- data/lib/cocoapods-binary-ht/pod-rome/xcodebuild_raw.rb +68 -0
- data/lib/cocoapods-binary-ht/prebuild_output/metadata.rb +63 -0
- data/lib/cocoapods-binary-ht/prebuild_output/output.rb +44 -0
- data/lib/cocoapods-binary-ht/state_store.rb +21 -0
- data/lib/cocoapods-binary-ht/ui.rb +9 -0
- data/lib/cocoapods_plugin.rb +5 -0
- data/lib/command/binary.rb +37 -0
- data/lib/command/config.rb +215 -0
- data/lib/command/executor/base.rb +37 -0
- data/lib/command/executor/fetcher.rb +67 -0
- data/lib/command/executor/prebuilder.rb +61 -0
- data/lib/command/executor/pusher.rb +35 -0
- data/lib/command/executor/visualizer.rb +23 -0
- data/lib/command/fetch.rb +22 -0
- data/lib/command/helper/zip.rb +20 -0
- data/lib/command/prebuild.rb +47 -0
- data/lib/command/push.rb +22 -0
- data/lib/command/visualize.rb +34 -0
- metadata +209 -0
@@ -0,0 +1,215 @@
|
|
1
|
+
require_relative "../cocoapods-binary-ht/helper/json"
|
2
|
+
|
3
|
+
module PodPrebuild
|
4
|
+
def self.config
|
5
|
+
PodPrebuild::Config.instance
|
6
|
+
end
|
7
|
+
|
8
|
+
class Config # rubocop:disable Metrics/ClassLength
|
9
|
+
attr_accessor :dsl_config, :cli_config
|
10
|
+
|
11
|
+
def initialize(path)
|
12
|
+
@deprecated_config = File.exist?(path) ? PodPrebuild::JSONFile.new(path).data : {}
|
13
|
+
@dsl_config = {}
|
14
|
+
@cli_config = {}
|
15
|
+
@detected_config = {}
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.instance
|
19
|
+
@instance ||= new("PodBinaryCacheConfig.json")
|
20
|
+
end
|
21
|
+
|
22
|
+
def reset!
|
23
|
+
@deprecated_config = {}
|
24
|
+
@dsl_config = {}
|
25
|
+
@cli_config = {}
|
26
|
+
end
|
27
|
+
|
28
|
+
def cache_repo
|
29
|
+
@cache_repo ||= cache_repo_config["remote"]
|
30
|
+
end
|
31
|
+
|
32
|
+
def local_cache?
|
33
|
+
cache_repo.nil?
|
34
|
+
end
|
35
|
+
|
36
|
+
def cache_path
|
37
|
+
@cache_path ||= File.expand_path(cache_repo_config["local"])
|
38
|
+
end
|
39
|
+
|
40
|
+
def prebuild_sandbox_path
|
41
|
+
@dsl_config[:prebuild_sandbox_path] || @deprecated_config["prebuild_path"] || "_Prebuild"
|
42
|
+
end
|
43
|
+
|
44
|
+
def prebuild_delta_path
|
45
|
+
@dsl_config[:prebuild_delta_path] || @deprecated_config["prebuild_delta_path"] || "_Prebuild_delta/changes.json"
|
46
|
+
end
|
47
|
+
|
48
|
+
def manifest_path(in_cache: false)
|
49
|
+
root_dir(in_cache) + "/Manifest.lock"
|
50
|
+
end
|
51
|
+
|
52
|
+
def root_dir(in_cache)
|
53
|
+
in_cache ? cache_path : prebuild_sandbox_path
|
54
|
+
end
|
55
|
+
|
56
|
+
def generated_frameworks_dir(in_cache: false)
|
57
|
+
root_dir(in_cache) + "/GeneratedFrameworks"
|
58
|
+
end
|
59
|
+
|
60
|
+
def prebuilt_path(path: nil)
|
61
|
+
p = Pathname.new(path.nil? ? "_Prebuilt" : "_Prebuilt/#{path}")
|
62
|
+
p = p.sub_ext(".xcframework") if xcframework? && p.extname == ".framework"
|
63
|
+
p.to_s
|
64
|
+
end
|
65
|
+
|
66
|
+
def validate_dsl_config
|
67
|
+
inapplicable_options = @dsl_config.keys - applicable_dsl_config
|
68
|
+
return if inapplicable_options.empty?
|
69
|
+
|
70
|
+
message = <<~HEREDOC
|
71
|
+
[WARNING] The following options (in `config_cocoapods_binary_cache`) are not correct: #{inapplicable_options}.
|
72
|
+
Available options: #{applicable_dsl_config}.
|
73
|
+
Check out the following doc for more details
|
74
|
+
https://github.com/pandaleecn/cocoapods-binary-ht/blob/master/docs/configure_cocoapods_binary_cache.md
|
75
|
+
HEREDOC
|
76
|
+
|
77
|
+
Pod::UI.puts message.yellow
|
78
|
+
end
|
79
|
+
|
80
|
+
def prebuild_config
|
81
|
+
@cli_config[:prebuild_config] || @dsl_config[:prebuild_config] || "Debug"
|
82
|
+
end
|
83
|
+
|
84
|
+
def prebuild_job?
|
85
|
+
@cli_config[:prebuild_job] || @dsl_config[:prebuild_job]
|
86
|
+
end
|
87
|
+
|
88
|
+
def prebuild_all_pods?
|
89
|
+
@cli_config[:prebuild_all_pods] || @dsl_config[:prebuild_all_pods]
|
90
|
+
end
|
91
|
+
|
92
|
+
def excluded_pods
|
93
|
+
((@dsl_config[:excluded_pods] || Set.new) + (@detected_config[:excluded_pods] || Set.new)).to_set
|
94
|
+
end
|
95
|
+
|
96
|
+
def dev_pods_enabled?
|
97
|
+
@dsl_config[:dev_pods_enabled]
|
98
|
+
end
|
99
|
+
|
100
|
+
def bitcode_enabled?
|
101
|
+
@dsl_config[:bitcode_enabled]
|
102
|
+
end
|
103
|
+
|
104
|
+
def device_build_enabled?
|
105
|
+
@dsl_config[:device_build_enabled]
|
106
|
+
end
|
107
|
+
|
108
|
+
def xcframework?
|
109
|
+
@dsl_config[:xcframework]
|
110
|
+
end
|
111
|
+
|
112
|
+
def disable_dsym?
|
113
|
+
@dsl_config[:disable_dsym]
|
114
|
+
end
|
115
|
+
|
116
|
+
def dont_remove_source_code?
|
117
|
+
@dsl_config[:dont_remove_source_code]
|
118
|
+
end
|
119
|
+
|
120
|
+
def xcodebuild_log_path
|
121
|
+
@dsl_config[:xcodebuild_log_path]
|
122
|
+
end
|
123
|
+
|
124
|
+
def build_args
|
125
|
+
@dsl_config[:build_args]
|
126
|
+
end
|
127
|
+
|
128
|
+
def save_cache_validation_to
|
129
|
+
@dsl_config[:save_cache_validation_to]
|
130
|
+
end
|
131
|
+
|
132
|
+
def validate_prebuilt_settings
|
133
|
+
@dsl_config[:validate_prebuilt_settings]
|
134
|
+
end
|
135
|
+
|
136
|
+
def prebuild_code_gen
|
137
|
+
@dsl_config[:prebuild_code_gen]
|
138
|
+
end
|
139
|
+
|
140
|
+
def strict_diagnosis?
|
141
|
+
@dsl_config[:strict_diagnosis]
|
142
|
+
end
|
143
|
+
|
144
|
+
def silent_build?
|
145
|
+
@dsl_config[:silent_build]
|
146
|
+
end
|
147
|
+
|
148
|
+
def targets_to_prebuild_from_cli
|
149
|
+
@cli_config[:prebuild_targets] || []
|
150
|
+
end
|
151
|
+
|
152
|
+
def update_detected_prebuilt_pod_names!(value)
|
153
|
+
@detected_config[:prebuilt_pod_names] = value
|
154
|
+
end
|
155
|
+
|
156
|
+
def update_detected_excluded_pods!(value)
|
157
|
+
@detected_config[:excluded_pods] = value
|
158
|
+
end
|
159
|
+
|
160
|
+
def prebuilt_pod_names
|
161
|
+
@detected_config[:prebuilt_pod_names] || Set.new
|
162
|
+
end
|
163
|
+
|
164
|
+
def tracked_prebuilt_pod_names
|
165
|
+
prebuilt_pod_names - excluded_pods
|
166
|
+
end
|
167
|
+
|
168
|
+
private
|
169
|
+
|
170
|
+
def applicable_dsl_config
|
171
|
+
[
|
172
|
+
:cache_repo,
|
173
|
+
:prebuild_sandbox_path,
|
174
|
+
:prebuild_delta_path,
|
175
|
+
:prebuild_config,
|
176
|
+
:prebuild_job,
|
177
|
+
:prebuild_all_pods,
|
178
|
+
:excluded_pods,
|
179
|
+
:dev_pods_enabled,
|
180
|
+
:bitcode_enabled,
|
181
|
+
:device_build_enabled,
|
182
|
+
:xcframework,
|
183
|
+
:disable_dsym,
|
184
|
+
:dont_remove_source_code,
|
185
|
+
:xcodebuild_log_path,
|
186
|
+
:build_args,
|
187
|
+
:save_cache_validation_to,
|
188
|
+
:validate_prebuilt_settings,
|
189
|
+
:prebuild_code_gen,
|
190
|
+
:strict_diagnosis,
|
191
|
+
:silent_build
|
192
|
+
]
|
193
|
+
end
|
194
|
+
|
195
|
+
def cache_repo_config
|
196
|
+
@cache_repo_config ||= begin
|
197
|
+
repo = @cli_config[:repo] || "default"
|
198
|
+
config_ = @dsl_config[:cache_repo] || {}
|
199
|
+
if config_[repo].nil?
|
200
|
+
message = <<~HEREDOC
|
201
|
+
[Deprecated] Configs in `PodBinaryCacheConfig.json` are deprecated.
|
202
|
+
Declare option `cache_repo` in `config_cocoapods_binary_cache` instead.
|
203
|
+
Check out the following doc for more details
|
204
|
+
https://github.com/pandaleecn/cocoapods-binary-ht/blob/master/docs/configure_cocoapods_binary_cache.md
|
205
|
+
HEREDOC
|
206
|
+
Pod::UI.puts message.yellow
|
207
|
+
end
|
208
|
+
config_[repo] || {
|
209
|
+
"remote" => @deprecated_config["cache_repo"] || @deprecated_config["prebuilt_cache_repo"],
|
210
|
+
"local" => @deprecated_config["cache_path"] || "~/.cocoapods-binary-ht/prebuilt-frameworks"
|
211
|
+
}
|
212
|
+
end
|
213
|
+
end
|
214
|
+
end
|
215
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module PodPrebuild
|
2
|
+
class CommandExecutor
|
3
|
+
def initialize(options)
|
4
|
+
@config = options[:config]
|
5
|
+
prepare_cache_dir
|
6
|
+
end
|
7
|
+
|
8
|
+
def installer
|
9
|
+
@installer ||= begin
|
10
|
+
pod_config = Pod::Config.instance
|
11
|
+
Pod::Installer.new(pod_config.sandbox, pod_config.podfile, pod_config.lockfile)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def use_local_cache?
|
16
|
+
@config.cache_repo.nil?
|
17
|
+
end
|
18
|
+
|
19
|
+
def prepare_cache_dir
|
20
|
+
FileUtils.mkdir_p(@config.cache_path) if @config.cache_path
|
21
|
+
end
|
22
|
+
|
23
|
+
def git(cmd, options = {})
|
24
|
+
comps = ["git"]
|
25
|
+
comps << "-C" << @config.cache_path unless options[:cache_repo] == false
|
26
|
+
comps << cmd
|
27
|
+
comps << "&> /dev/null" if options[:ignore_output]
|
28
|
+
comps << "|| true" if options[:can_fail]
|
29
|
+
cmd = comps.join(" ")
|
30
|
+
raise "Fail to run command '#{cmd}'" unless system(cmd)
|
31
|
+
end
|
32
|
+
|
33
|
+
def git_clone(cmd, options = {})
|
34
|
+
git("clone #{cmd}", options.merge(:cache_repo => false))
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
require "parallel"
|
2
|
+
require_relative "base"
|
3
|
+
require_relative "../helper/zip"
|
4
|
+
|
5
|
+
module PodPrebuild
|
6
|
+
class CacheFetcher < CommandExecutor
|
7
|
+
attr_reader :cache_branch
|
8
|
+
|
9
|
+
def initialize(options)
|
10
|
+
super(options)
|
11
|
+
@cache_branch = options[:cache_branch]
|
12
|
+
end
|
13
|
+
|
14
|
+
def run
|
15
|
+
Pod::UI.step("Fetching cache") do
|
16
|
+
if @config.local_cache?
|
17
|
+
print_message_for_local_cache(@config.cache_path)
|
18
|
+
else
|
19
|
+
fetch_remote_cache(@config.cache_repo, @cache_branch, @config.cache_path)
|
20
|
+
end
|
21
|
+
unzip_cache
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
def print_message_for_local_cache(cache_dir)
|
28
|
+
Pod::UI.puts "You're using local cache at: #{cache_dir}.".yellow
|
29
|
+
message = <<~HEREDOC
|
30
|
+
To enable remote cache (with a git repo), add the `remote` field to the repo config in the `cache_repo` option.
|
31
|
+
For more details, check out this doc:
|
32
|
+
https://github.com/pandaleecn/cocoapods-binary-ht/blob/master/docs/configure_cocoapods_binary_cache.md#cache_repo-
|
33
|
+
HEREDOC
|
34
|
+
Pod::UI.puts message
|
35
|
+
end
|
36
|
+
|
37
|
+
def fetch_remote_cache(repo, branch, dest_dir)
|
38
|
+
Pod::UI.puts "Fetching cache from #{repo} (branch: #{branch})".green
|
39
|
+
if Dir.exist?(dest_dir + "/.git")
|
40
|
+
git("fetch origin #{branch}")
|
41
|
+
git("checkout -f FETCH_HEAD", ignore_output: true)
|
42
|
+
git("branch -D #{branch}", ignore_output: true, can_fail: true)
|
43
|
+
git("checkout -b #{branch}")
|
44
|
+
else
|
45
|
+
FileUtils.rm_rf(dest_dir)
|
46
|
+
git_clone("--depth=1 --branch=#{branch} #{repo} #{dest_dir}")
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def unzip_cache
|
51
|
+
Pod::UI.puts "Unzipping cache: #{@config.cache_path} -> #{@config.prebuild_sandbox_path}".green
|
52
|
+
FileUtils.rm_rf(@config.prebuild_sandbox_path)
|
53
|
+
FileUtils.mkdir_p(@config.prebuild_sandbox_path)
|
54
|
+
|
55
|
+
if File.exist?(@config.manifest_path(in_cache: true))
|
56
|
+
FileUtils.cp(
|
57
|
+
@config.manifest_path(in_cache: true),
|
58
|
+
@config.manifest_path
|
59
|
+
)
|
60
|
+
end
|
61
|
+
zip_paths = Dir[@config.generated_frameworks_dir(in_cache: true) + "/*.zip"]
|
62
|
+
Parallel.each(zip_paths, in_threads: 8) do |path|
|
63
|
+
ZipUtils.unzip(path, to_dir: @config.generated_frameworks_dir)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
require_relative "base"
|
2
|
+
require_relative "fetcher"
|
3
|
+
require_relative "pusher"
|
4
|
+
|
5
|
+
module PodPrebuild
|
6
|
+
class CachePrebuilder < CommandExecutor
|
7
|
+
attr_reader :repo_update, :fetcher, :pusher
|
8
|
+
|
9
|
+
def initialize(options)
|
10
|
+
super(options)
|
11
|
+
@repo_update = options[:repo_update]
|
12
|
+
@fetcher = PodPrebuild::CacheFetcher.new(options) unless options[:no_fetch]
|
13
|
+
@pusher = PodPrebuild::CachePusher.new(options) if options[:push_cache]
|
14
|
+
end
|
15
|
+
|
16
|
+
def run
|
17
|
+
@fetcher&.run
|
18
|
+
prebuild
|
19
|
+
changes = PodPrebuild::JSONFile.new(@config.prebuild_delta_path)
|
20
|
+
return if changes.empty?
|
21
|
+
|
22
|
+
sync_cache(changes)
|
23
|
+
@pusher&.run
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
def prebuild
|
29
|
+
Pod::UI.step("Installation") do
|
30
|
+
installer.repo_update = @repo_update
|
31
|
+
installer.install!
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def sync_cache(changes)
|
36
|
+
Pod::UI.step("Syncing cache") do
|
37
|
+
FileUtils.cp(@config.manifest_path, @config.manifest_path(in_cache: true))
|
38
|
+
clean_cache(changes["deleted"])
|
39
|
+
zip_to_cache(changes["updated"])
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def zip_to_cache(pods_to_update)
|
44
|
+
FileUtils.mkdir_p(@config.generated_frameworks_dir(in_cache: true))
|
45
|
+
pods_to_update.each do |pod|
|
46
|
+
Pod::UI.puts "- Update cache: #{pod}"
|
47
|
+
ZipUtils.zip(
|
48
|
+
"#{@config.generated_frameworks_dir}/#{pod}",
|
49
|
+
to_dir: @config.generated_frameworks_dir(in_cache: true)
|
50
|
+
)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
def clean_cache(pods_to_delete)
|
55
|
+
pods_to_delete.each do |pod|
|
56
|
+
Pod::UI.puts "- Clean up cache: #{pod}"
|
57
|
+
FileUtils.rm_rf("#{@config.generated_frameworks_dir(in_cache: true)}/#{pod}.zip")
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require_relative "base"
|
2
|
+
|
3
|
+
module PodPrebuild
|
4
|
+
class CachePusher < CommandExecutor
|
5
|
+
attr_reader :cache_branch
|
6
|
+
|
7
|
+
def initialize(options)
|
8
|
+
super(options)
|
9
|
+
@cache_branch = options[:cache_branch]
|
10
|
+
end
|
11
|
+
|
12
|
+
def run
|
13
|
+
Pod::UI.step("Pushing cache") do
|
14
|
+
if @config.local_cache?
|
15
|
+
print_message_for_local_cache
|
16
|
+
else
|
17
|
+
commit_and_push_cache
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
def print_message_for_local_cache
|
25
|
+
Pod::UI.puts "Skip pushing cache as you're using local cache".yellow
|
26
|
+
end
|
27
|
+
|
28
|
+
def commit_and_push_cache
|
29
|
+
commit_message = "Update prebuilt cache"
|
30
|
+
git("add .")
|
31
|
+
git("commit -m '#{commit_message}'")
|
32
|
+
git("push origin #{@cache_branch}")
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require_relative "base"
|
2
|
+
require_relative "../../cocoapods-binary-ht/dependencies_graph/dependencies_graph"
|
3
|
+
|
4
|
+
module PodPrebuild
|
5
|
+
class Visualizer < CommandExecutor
|
6
|
+
def initialize(options)
|
7
|
+
super(options)
|
8
|
+
@lockfile = options[:lockfile]
|
9
|
+
@open = options[:open]
|
10
|
+
@output_dir = options[:output_dir]
|
11
|
+
@devpod_only = options[:devpod_only]
|
12
|
+
@max_deps = options[:max_deps]
|
13
|
+
end
|
14
|
+
|
15
|
+
def run
|
16
|
+
FileUtils.mkdir_p(@output_dir)
|
17
|
+
graph = DependenciesGraph.new(lockfile: @lockfile, devpod_only: @devpod_only, max_deps: @max_deps)
|
18
|
+
output_path = "#{@output_dir}/graph.png"
|
19
|
+
graph.write_graphic_file(output_path: output_path)
|
20
|
+
system("open #{@output_path}") if @open
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require_relative "executor/fetcher"
|
2
|
+
|
3
|
+
module Pod
|
4
|
+
class Command
|
5
|
+
class Binary < Command
|
6
|
+
class Fetch < Binary
|
7
|
+
self.arguments = [CLAide::Argument.new("CACHE-BRANCH", false)]
|
8
|
+
def initialize(argv)
|
9
|
+
super
|
10
|
+
@fetcher = PodPrebuild::CacheFetcher.new(
|
11
|
+
config: prebuild_config,
|
12
|
+
cache_branch: argv.shift_argument || "master"
|
13
|
+
)
|
14
|
+
end
|
15
|
+
|
16
|
+
def run
|
17
|
+
@fetcher.run
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module PodPrebuild
|
2
|
+
module ZipUtils
|
3
|
+
def self.zip(path, to_dir: nil)
|
4
|
+
basename = File.basename(path)
|
5
|
+
out_path = to_dir.nil? ? "#{basename}.zip" : "#{to_dir}/#{basename}.zip"
|
6
|
+
cmd = []
|
7
|
+
cmd << "cd" << File.dirname(path)
|
8
|
+
cmd << "&& zip -r --symlinks" << out_path << basename
|
9
|
+
cmd << "&& cd -"
|
10
|
+
`#{cmd.join(" ")}`
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.unzip(path, to_dir: nil)
|
14
|
+
cmd = []
|
15
|
+
cmd << "unzip -nq" << path
|
16
|
+
cmd << "-d" << to_dir unless to_dir.nil?
|
17
|
+
`#{cmd.join(" ")}`
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
require_relative "executor/prebuilder"
|
2
|
+
require_relative "../cocoapods-binary-ht/pod-binary/prebuild_dsl"
|
3
|
+
|
4
|
+
module Pod
|
5
|
+
class Command
|
6
|
+
class Binary < Command
|
7
|
+
class Prebuild < Binary
|
8
|
+
attr_reader :prebuilder
|
9
|
+
|
10
|
+
self.arguments = [CLAide::Argument.new("CACHE-BRANCH", false)]
|
11
|
+
def self.options
|
12
|
+
[
|
13
|
+
["--config", "Config (Debug, Test...) to prebuild"],
|
14
|
+
["--repo-update", "Update pod repo before installing"],
|
15
|
+
["--no-fetch", "Do not perform a cache fetch beforehand"],
|
16
|
+
["--push", "Push cache to repo upon completion"],
|
17
|
+
["--all", "Prebuild all binary pods regardless of cache validation"],
|
18
|
+
["--targets", "Targets to prebuild. Use comma (,) to specify a list of targets"]
|
19
|
+
].concat(super)
|
20
|
+
end
|
21
|
+
|
22
|
+
def initialize(argv)
|
23
|
+
super
|
24
|
+
prebuild_all_pods = argv.flag?("all")
|
25
|
+
prebuild_targets = argv.option("targets", "").split(",")
|
26
|
+
update_cli_config(
|
27
|
+
:prebuild_job => true,
|
28
|
+
:prebuild_all_pods => prebuild_all_pods,
|
29
|
+
:prebuild_config => argv.option("config")
|
30
|
+
)
|
31
|
+
update_cli_config(:prebuild_targets => prebuild_targets) unless prebuild_all_pods
|
32
|
+
@prebuilder = PodPrebuild::CachePrebuilder.new(
|
33
|
+
config: prebuild_config,
|
34
|
+
cache_branch: argv.shift_argument || "master",
|
35
|
+
repo_update: argv.flag?("repo-update"),
|
36
|
+
no_fetch: argv.flag?("fetch") == false,
|
37
|
+
push_cache: argv.flag?("push")
|
38
|
+
)
|
39
|
+
end
|
40
|
+
|
41
|
+
def run
|
42
|
+
@prebuilder.run
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
data/lib/command/push.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
require_relative "executor/pusher"
|
2
|
+
|
3
|
+
module Pod
|
4
|
+
class Command
|
5
|
+
class Binary < Command
|
6
|
+
class Push < Binary
|
7
|
+
self.arguments = [CLAide::Argument.new("CACHE-BRANCH", false)]
|
8
|
+
def initialize(argv)
|
9
|
+
super
|
10
|
+
@pusher = PodPrebuild::CachePusher.new(
|
11
|
+
config: prebuild_config,
|
12
|
+
cache_branch: argv.shift_argument || "master"
|
13
|
+
)
|
14
|
+
end
|
15
|
+
|
16
|
+
def run
|
17
|
+
@pusher.run
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require_relative "executor/visualizer"
|
2
|
+
|
3
|
+
module Pod
|
4
|
+
class Command
|
5
|
+
class Binary < Command
|
6
|
+
class Viz < Binary
|
7
|
+
self.arguments = [CLAide::Argument.new("OUTPUT-DIR", false)]
|
8
|
+
def self.options
|
9
|
+
[
|
10
|
+
["--open", "Open the graph upon completion"],
|
11
|
+
["--devpod_only", "Only include development pod"],
|
12
|
+
["--max_deps", "Only include pod with number of dependencies <= max_deps"]
|
13
|
+
]
|
14
|
+
end
|
15
|
+
|
16
|
+
def initialize(argv)
|
17
|
+
super
|
18
|
+
@visualizer = PodPrebuild::Visualizer.new(
|
19
|
+
config: prebuild_config,
|
20
|
+
lockfile: config.lockfile,
|
21
|
+
output_dir: argv.shift_argument || ".",
|
22
|
+
open: argv.flag?("open"),
|
23
|
+
devpod_only: argv.flag?("devpod_only"),
|
24
|
+
max_deps: argv.option("max_deps")
|
25
|
+
)
|
26
|
+
end
|
27
|
+
|
28
|
+
def run
|
29
|
+
@visualizer.run
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|