Class: Pod::SPM::Resolver::Result
- Inherits:
-
Object
- Object
- Pod::SPM::Resolver::Result
- Defined in:
- lib/cocoapods-spm/resolver/result.rb
Direct Known Subclasses
Defined Under Namespace
Classes: WritableResult
Instance Attribute Summary collapse
-
#metadata_cache ⇒ Object
readonly
Returns the value of attribute metadata_cache.
-
#spm_dependencies_by_target ⇒ Object
readonly
Returns the value of attribute spm_dependencies_by_target.
-
#spm_pkgs ⇒ Object
readonly
Returns the value of attribute spm_pkgs.
-
#spm_products ⇒ Object
readonly
Returns the value of attribute spm_products.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Result
constructor
A new instance of Result.
- #linker_flags_for(target) ⇒ Object
- #metadata_of(name) ⇒ Object
- #spm_dependencies_for(target) ⇒ Object
- #spm_products_for(target) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Result
Returns a new instance of Result.
20 21 22 23 24 25 |
# File 'lib/cocoapods-spm/resolver/result.rb', line 20 def initialize( = {}) @spm_pkgs = [:spm_pkgs] || [] @spm_dependencies_by_target = [:spm_dependencies_by_target] || {} @spm_products = [:spm_products] || {} = [:metadata_cache] || {} end |
Instance Attribute Details
#metadata_cache ⇒ Object (readonly)
Returns the value of attribute metadata_cache.
18 19 20 |
# File 'lib/cocoapods-spm/resolver/result.rb', line 18 def end |
#spm_dependencies_by_target ⇒ Object (readonly)
Returns the value of attribute spm_dependencies_by_target.
18 19 20 |
# File 'lib/cocoapods-spm/resolver/result.rb', line 18 def spm_dependencies_by_target @spm_dependencies_by_target end |
#spm_pkgs ⇒ Object (readonly)
Returns the value of attribute spm_pkgs.
18 19 20 |
# File 'lib/cocoapods-spm/resolver/result.rb', line 18 def spm_pkgs @spm_pkgs end |
#spm_products ⇒ Object (readonly)
Returns the value of attribute spm_products.
18 19 20 |
# File 'lib/cocoapods-spm/resolver/result.rb', line 18 def spm_products @spm_products end |
Instance Method Details
#linker_flags_for(target) ⇒ Object
41 42 43 44 45 46 47 |
# File 'lib/cocoapods-spm/resolver/result.rb', line 41 def linker_flags_for(target) flags = spm_dependencies_for(target).flat_map { |d| d.pkg.linker_flags } flags += spm_products_for(target).map do |p| p.linked_as_framework? ? "-framework \"#{p.name}\"" : "-l\"#{p.name}.o\"" end flags.uniq end |
#metadata_of(name) ⇒ Object
27 28 29 30 31 |
# File 'lib/cocoapods-spm/resolver/result.rb', line 27 def (name) return [name] if .key?(name) raise Informative, "Metadata of `#{name}` does not exist" end |
#spm_dependencies_for(target) ⇒ Object
33 34 35 |
# File 'lib/cocoapods-spm/resolver/result.rb', line 33 def spm_dependencies_for(target) @spm_dependencies_by_target[target.to_s].to_a end |
#spm_products_for(target) ⇒ Object
37 38 39 |
# File 'lib/cocoapods-spm/resolver/result.rb', line 37 def spm_products_for(target) spm_dependencies_for(target).flat_map { |d| @spm_products[d.product].to_a }.uniq(&:name) end |