Class: Pod::Swift::PackageDescription
Defined Under Namespace
Classes: Product, Resources, Target
Instance Attribute Summary
#parent, #raw
Instance Method Summary
collapse
#macro_pods, #spm_config
#pod_config
#project_config
#[], #dup_with_attrs, from_file, from_s, #initialize, #inspect, #name, #pkg_name, #root
Instance Method Details
#artifacts_dir ⇒ Object
17
18
19
|
# File 'lib/cocoapods-spm/swift/package/description.rb', line 17
def artifacts_dir
spm_config.pkg_artifacts_dir / slug
end
|
#macro_impl_name ⇒ Object
44
45
46
|
# File 'lib/cocoapods-spm/swift/package/description.rb', line 44
def macro_impl_name
targets.find(&:macro?)&.name
end
|
#products ⇒ Object
29
30
31
|
# File 'lib/cocoapods-spm/swift/package/description.rb', line 29
def products
@products ||= raw.fetch("products", []).flat_map { |h| Product.new(h, parent: nil) }
end
|
#slug ⇒ Object
21
22
23
|
# File 'lib/cocoapods-spm/swift/package/description.rb', line 21
def slug
src_dir.nil? ? name : src_dir.basename.to_s
end
|
#src_dir ⇒ Object
10
11
12
13
14
15
|
# File 'lib/cocoapods-spm/swift/package/description.rb', line 10
def src_dir
@src_dir ||= begin
path = raw.fetch("packageKind", {}).fetch("root", [])[0]
Pathname.new(path) unless path.nil?
end
end
|
#targets ⇒ Object
25
26
27
|
# File 'lib/cocoapods-spm/swift/package/description.rb', line 25
def targets
@targets ||= raw.fetch("targets", []).flat_map { |h| Target.new(h, parent: self) }
end
|
#targets_of_product(name) ⇒ Object
33
34
35
36
37
38
39
40
41
42
|
# File 'lib/cocoapods-spm/swift/package/description.rb', line 33
def targets_of_product(name)
matched_products = products.select { |p| p.name == name }
dynamic = matched_products.any?(&:dynamic?)
matched_products
.flat_map do |p|
targets.select { |t| p.target_names.include?(t.name) }.map do |t|
t.dup_with_attrs(dynamic: dynamic, product_name: name)
end
end
end
|
#use_default_xcode_linking? ⇒ Boolean
48
49
50
51
52
53
|
# File 'lib/cocoapods-spm/swift/package/description.rb', line 48
def use_default_xcode_linking?
return @use_default_xcode_linking unless @use_default_xcode_linking.nil?
pkg = pod_config.podfile.spm_pkgs.find { |t| t.name == name }
@use_default_xcode_linking = pkg&.use_default_xcode_linking?
end
|