Class: XCCache::SPM::Package::Umbrella
Instance Attribute Summary
#root_dir
Instance Method Summary
collapse
#gen_xcconfigs
#gen_cachemap_viz
#manifest_pkg_dependencies, #manifest_platforms, #manifest_products_to_targets_json, #manifest_targets_json, #write_manifest
#build, #targets_to_build
#binary_targets, #dependency_targets_of_products, #desc_of, #gen_metadata, #targets_of_products, #xccache_desc
#sync_cachemap
#config
#build, #build_target, #resolve
Methods included from Cacheable
#__cacheable_module_name, #cacheable, included
Constructor Details
#initialize(options = {}) ⇒ Umbrella
Returns a new instance of Umbrella.
20
21
22
23
24
25
|
# File 'lib/xccache/spm/pkg/umbrella.rb', line 20
def initialize(options = {})
super
@descs = []
@descs_by_name = {}
@dependency_targets_by_products = {}
end
|
Instance Method Details
#create ⇒ Object
45
46
47
48
49
50
51
52
53
54
|
# File 'lib/xccache/spm/pkg/umbrella.rb', line 45
def create
UI.info("Creating umbrella package")
write_manifest(no_cache: true)
config.project_targets.each do |target|
dir = Dir.prepare(root_dir / ".Sources" / "#{target.name}.xccache")
(dir / "dummy.swift").write("")
end
end
|
#create_symlinks_for_convenience ⇒ Object
56
57
58
59
60
61
|
# File 'lib/xccache/spm/pkg/umbrella.rb', line 56
def create_symlinks_for_convenience
(root_dir / "binaries").symlink_to(root_dir.parent / "binaries")
(root_dir / ".build").symlink_to(root_dir.parent / ".build")
(root_dir / ".build/checkouts").symlink_to(root_dir.parent / "checkouts")
end
|
#create_symlinks_to_artifacts ⇒ Object
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
# File 'lib/xccache/spm/pkg/umbrella.rb', line 72
def create_symlinks_to_artifacts
config.spm_binaries_dir.glob("*/*.{xcframework,macro}").each do |p|
p.rmtree if p.symlink?
end
binary_targets.each do |target|
dst_path = config.spm_binaries_dir / target.name / "#{target.name}.xcframework"
target.local_binary_path.symlink_to(dst_path) if target.local_binary_path&.extname == ".xcframework"
config.spm_artifacts_dir.glob("#{target.full_name}/*.xcframework").each do |p|
p.symlink_to(dst_path)
end
end
end
|
#create_symlinks_to_local_pkgs ⇒ Object
63
64
65
66
67
68
69
70
|
# File 'lib/xccache/spm/pkg/umbrella.rb', line 63
def create_symlinks_to_local_pkgs
pkg_desc.dependencies.select(&:local?).each do |dep|
dep.path.symlink_to(root_dir / ".build/checkouts/#{dep.slug}")
dep.path.symlink_to(Config.instance.spm_local_pkgs_dir / dep.slug)
end
end
|
#prepare(options = {}) ⇒ Object
27
28
29
30
31
32
33
34
35
36
|
# File 'lib/xccache/spm/pkg/umbrella.rb', line 27
def prepare(options = {})
create
resolve unless options[:skip_resolving_dependencies]
create_symlinks_for_convenience
create_symlinks_to_local_pkgs
gen_metadata
resolve_recursive_dependencies
create_symlinks_to_artifacts
sync_cachemap(sdks: options[:sdks])
end
|
#resolve_recursive_dependencies ⇒ Object
38
39
40
41
42
43
|
# File 'lib/xccache/spm/pkg/umbrella.rb', line 38
def resolve_recursive_dependencies
UI.section("Resolving recursive dependencies")
@descs.each do |desc|
@dependency_targets_by_products.merge!(desc.resolve_recursive_dependencies.transform_keys(&:full_name))
end
end
|