Class: XCCache::SPM::Package::Proxy
Defined Under Namespace
Modules: Mixin
Classes: Executable
Instance Attribute Summary
#root_dir
Instance Method Summary
collapse
Methods included from Mixin
#xccache_proxy
#build, #build_target, #get_target, #initialize, #pkg_desc, #pkg_desc_of_target, #resolve
Methods included from Cacheable
#__cacheable_module_name, #cacheable, included
#config
Instance Method Details
#gen_proxy ⇒ Object
27
28
29
30
|
# File 'lib/xccache/spm/pkg/proxy.rb', line 27
def gen_proxy
xccache_proxy.run("gen-proxy")
config.cachemap.update_from_graph(graph.reload)
end
|
#graph ⇒ Object
54
55
56
|
# File 'lib/xccache/spm/pkg/proxy.rb', line 54
def graph
@graph ||= JSONRepresentable.new(root_dir / "graph.json")
end
|
#invalidate_cache(sdks: []) ⇒ Object
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
# File 'lib/xccache/spm/pkg/proxy.rb', line 32
def invalidate_cache(sdks: [])
UI.message("Invalidating cache (sdks: #{sdks.map(&:to_s).join(', ')})")
config.spm_cache_dir.glob("*/*.{xcframework,macro}").each do |p|
cmps = p.basename(".*").to_s.split("-")
name, checksum = cmps[...-1].join("-"), cmps[-1]
p_without_checksum = config.spm_binaries_dir / name / "#{name}#{p.extname}"
accept_cache = proc { p.symlink_to(p_without_checksum) }
reject_cache = proc { p_without_checksum.rmtree if p_without_checksum.exist? }
next reject_cache.call if (target = umbrella.get_target(name)).nil?
next reject_cache.call if target.checksum != checksum
next accept_cache.call if target.macro?
metadata = XCFramework::Metadata.new(p / "Info.plist")
expected_triples = sdks.map { |sdk| sdk.triple(with_vendor: false) }
missing_triples = expected_triples - metadata.triples
missing_triples.empty? ? accept_cache.call : reject_cache.call
end
end
|
#prepare(options = {}) ⇒ Object
20
21
22
23
24
25
|
# File 'lib/xccache/spm/pkg/proxy.rb', line 20
def prepare(options = {})
xccache_proxy.run("gen-umbrella")
umbrella.resolve
invalidate_cache(sdks: options[:sdks])
gen_proxy
end
|
#umbrella ⇒ Object
16
17
18
|
# File 'lib/xccache/spm/pkg/proxy.rb', line 16
def umbrella
@umbrella ||= Package.new(root_dir: config.spm_umbrella_sandbox)
end
|