Class: Pod::Swift::PackageDescription
- Inherits:
-
PackageDescriptionBaseObject
show all
- Includes:
- Pod::SPM::Config::Mixin
- Defined in:
- lib/cocoapods-spm/swift/package/target.rb,
lib/cocoapods-spm/swift/package/product.rb,
lib/cocoapods-spm/swift/package/resources.rb,
lib/cocoapods-spm/swift/package/dependency.rb,
lib/cocoapods-spm/swift/package/description.rb
Defined Under Namespace
Classes: Dependency, Product, Resources, Target
Instance Attribute Summary
#parent, #raw
Class Method Summary
collapse
Instance Method Summary
collapse
#local_macro_pod?, #local_macro_pod_dir, #macro_pods, #spm_config
#pod_config
#prepare_dir
#project_config
#[], #dup_with_attrs, from_file, from_s, #initialize, #inspect, #name, #pkg_name, #root
Class Method Details
.from_dir(dir) ⇒ Object
11
12
13
14
|
# File 'lib/cocoapods-spm/swift/package/description.rb', line 11
def self.from_dir(dir)
raw = `swift package dump-package --package-path #{dir.shellescape}`
from_s(raw)
end
|
Instance Method Details
#artifacts_dir ⇒ Object
27
28
29
|
# File 'lib/cocoapods-spm/swift/package/description.rb', line 27
def artifacts_dir
spm_config.pkg_artifacts_dir / slug
end
|
#checkouts_dir ⇒ Object
23
24
25
|
# File 'lib/cocoapods-spm/swift/package/description.rb', line 23
def checkouts_dir
src_dir.parent
end
|
#dependencies ⇒ Object
35
36
37
|
# File 'lib/cocoapods-spm/swift/package/description.rb', line 35
def dependencies
@dependencies ||= convert_field("dependencies", Dependency)
end
|
#macro_impl_name ⇒ Object
58
59
60
|
# File 'lib/cocoapods-spm/swift/package/description.rb', line 58
def macro_impl_name
targets.find(&:macro?)&.name
end
|
#products ⇒ Object
43
44
45
|
# File 'lib/cocoapods-spm/swift/package/description.rb', line 43
def products
@products ||= convert_field("products", Product)
end
|
#slug ⇒ Object
31
32
33
|
# File 'lib/cocoapods-spm/swift/package/description.rb', line 31
def slug
src_dir.nil? ? name : src_dir.basename.to_s
end
|
#src_dir ⇒ Object
16
17
18
19
20
21
|
# File 'lib/cocoapods-spm/swift/package/description.rb', line 16
def src_dir
@src_dir ||= begin
path = raw.fetch("packageKind", {}).fetch("root", [])[0]
Pathname.new(path) unless path.nil?
end
end
|
#targets ⇒ Object
39
40
41
|
# File 'lib/cocoapods-spm/swift/package/description.rb', line 39
def targets
@targets ||= convert_field("targets", Target)
end
|
#targets_of_product(name) ⇒ Object
47
48
49
50
51
52
53
54
55
56
|
# File 'lib/cocoapods-spm/swift/package/description.rb', line 47
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
62
63
64
65
66
67
|
# File 'lib/cocoapods-spm/swift/package/description.rb', line 62
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
|