15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
# File 'lib/cocoapods-jxedt/binary/hooks/pre_install.rb', line 15
def run
return unless Jxedt.config.binary_switch?
unless Gem::Version.new(Pod::VERSION) >= Gem::Version.new('1.10.0')
raise STDERR.puts "[!] cocoapods-jxedt binary plugin should use cocoapods version greater than '1.10.0'`".red
end
require_relative '../helper/prebuild_sandbox'
require_relative '../helper/prebuild_installer'
return if @installer_context.sandbox.is_a?(Pod::JxedtPrebuildSandbox)
original_installer = ObjectSpace.each_object(Pod::Installer).first
prebuild_sandbox = Pod::JxedtPrebuildSandbox.from_standard_sandbox(@installer_context.sandbox)
source_installer = Pod::JxedtPrebuildInstaller.new(prebuild_sandbox, @installer_context.podfile, @installer_context.lockfile)
source_installer.update = original_installer.update
source_installer.repo_update = original_installer.repo_update
source_installer.install!
@installer_context.sandbox.source_lockfile = prebuild_sandbox.source_lockfile = source_installer.lockfile
require_relative '../helper/podfile_options'
require_relative '../prebuild'
if Jxedt.config.cache_repo_enabled? && Jxedt.config.auto_fetch?
log_section "🚗 Fetch git cache"
pods = prebuild_sandbox.source_lockfile.internal_data["SPEC CHECKSUMS"].keys
binary_hash = pods.reduce({}) do |hash, name|
checksum = prebuild_sandbox.source_lockfile.spec_checksums_hash_key(name)
hash.update(name => checksum) unless checksum.nil?
end
require 'cocoapods-jxedt/git_helper/cache_fetcher'
binary_dir = @installer_context.sandbox.standard_sandbox_root + Jxedt.config.binary_dir
Jxedt::CacheFetcher.sync(binary_hash, binary_dir)
end
if Jxedt.config.prebuild_job?
log_section "🚀 Prebuild frameworks"
build_targets = Jxedt::Prebuild.new(source_installer).build
if Jxedt.config.cache_repo_enabled? && Jxedt.config.auto_push? && build_targets && build_targets.size > 0
log_section "🚄 Push git cache"
require 'cocoapods-jxedt/git_helper/cache_pucher'
output_dir = prebuild_sandbox.standard_sandbox_root + Jxedt.config.binary_dir
Jxedt::CachePucher.push(output_dir, build_targets, false)
end
end
prebuild_sandbox.clean_source_project!
log_section "🤖 Resume pod installation"
require_relative '../targets/pod_target'
require_relative '../Intergation'
end
|