Module: Pod::Podfile::DSL

Defined in:
lib/cocoapods-spm/def/podfile.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#spm_analyzerObject

Returns the value of attribute spm_analyzer.



6
7
8
# File 'lib/cocoapods-spm/def/podfile.rb', line 6

def spm_analyzer
  @spm_analyzer
end

Instance Method Details

#config_cocoapods_spm(options) ⇒ Object



9
10
11
# File 'lib/cocoapods-spm/def/podfile.rb', line 9

def config_cocoapods_spm(options)
  SPM::Config.instance.dsl_config = options
end

#macro_podsObject



13
14
15
# File 'lib/cocoapods-spm/def/podfile.rb', line 13

def macro_pods
  @macro_pods ||= {}
end

#origin_podObject



8
# File 'lib/cocoapods-spm/def/podfile.rb', line 8

alias origin_pod pod

#pod(name = nil, *requirements) ⇒ Object



17
18
19
20
21
22
23
24
25
# File 'lib/cocoapods-spm/def/podfile.rb', line 17

def pod(name = nil, *requirements)
  macro = requirements[0].delete(:macro) if requirements.first.is_a?(Hash)
  macro ||= {}
  unless macro.empty?
    requirements[0][:path] = prepare_macro_pod_dir(name, macro)
    macro_pods[name] = macro
  end
  origin_pod(name, *requirements)
end

#spm_pkg(name, options) ⇒ Object



27
28
29
# File 'lib/cocoapods-spm/def/podfile.rb', line 27

def spm_pkg(name, options)
  current_target_definition.store_spm_pkg(name, options)
end

#spm_pkgs_by_aggregate_targetObject



35
36
37
38
39
40
41
42
# File 'lib/cocoapods-spm/def/podfile.rb', line 35

def spm_pkgs_by_aggregate_target
  @spm_pkgs_by_aggregate_target ||= begin
    common_spm_pkgs = root_target_definitions.flat_map(&:spm_pkgs)
    target_definition_list.reject(&:abstract?).to_h do |target|
      [target.to_s, (common_spm_pkgs + target.spm_pkgs).uniq(&:name)]
    end
  end
end

#spm_pkgs_for(target) ⇒ Object



31
32
33
# File 'lib/cocoapods-spm/def/podfile.rb', line 31

def spm_pkgs_for(target)
  spm_pkgs_by_aggregate_target[target.to_s]
end