Class: Pod::Resolver

Inherits:
Object
  • Object
show all
Defined in:
lib/cocoapods-bb-bin/native/resolver.rb

Instance Method Summary collapse

Instance Method Details

#aggregate_for_dependency(dependency) ⇒ Object

其实不用到 resolver_specs_by_target 再改 spec 在这个方法里面,通过修改 dependency 的 source 应该也可以就是有一点,如果改了之后,对应的 source 没有符合 dependency 的版本分析依赖阶段就会报错了,没法像 resolver_specs_by_target 一样没有对应的二进制版本时还可以转到源码源码



20
21
22
23
24
25
26
27
28
29
30
# File 'lib/cocoapods-bb-bin/native/resolver.rb', line 20

def aggregate_for_dependency(dependency)
  sources_manager = Config.instance.sources_manager
  if dependency&.podspec_repo
    sources_manager.aggregate_for_dependency(dependency)
    # 采用 lock 中的 source ,会导致插件对 source 的先后调整失效
    # elsif (locked_vertex = @locked_dependencies.vertex_named(dependency.name)) && (locked_dependency = locked_vertex.payload) && locked_dependency.podspec_repo
    #   sources_manager.aggregate_for_dependency(locked_dependency)
  else
    @aggregate ||= Source::Aggregate.new(sources)
  end
end

#old_valid_possibility_version_for_root_name?Object



63
# File 'lib/cocoapods-bb-bin/native/resolver.rb', line 63

alias old_valid_possibility_version_for_root_name? valid_possibility_version_for_root_name?

#requirement_satisfied_by?(requirement, activated, spec) ⇒ Boolean

Returns:

  • (Boolean)


71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/cocoapods-bb-bin/native/resolver.rb', line 71

def requirement_satisfied_by?(requirement, activated, spec)
  version = spec.version
  return false unless requirement.requirement.satisfied_by?(version)

  shared_possibility_versions, prerelease_requirement = possibility_versions_for_root_name(requirement, activated)
  if !shared_possibility_versions.empty? && !shared_possibility_versions.include?(version)
    return false
  end
  if !podfile.allow_prerelease? && version.prerelease? && !prerelease_requirement
    return false
  end
  unless spec_is_platform_compatible?(activated, requirement, spec)
    return false
  end

  true
end

#specifications_for_dependency(dependency, additional_requirements_frozen = []) ⇒ Object



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/cocoapods-bb-bin/native/resolver.rb', line 34

def specifications_for_dependency(dependency, additional_requirements_frozen = [])
  additional_requirements = additional_requirements_frozen.dup.compact
  requirement = Requirement.new(dependency.requirement.as_list + additional_requirements.flat_map(&:as_list))
  if podfile.allow_prerelease? && !requirement.prerelease?
    requirement = Requirement.new(dependency.requirement.as_list.map { |r| r + '.a' } + additional_requirements.flat_map(&:as_list))
  end

  options = if Pod.match_version?('~> 1.7')
              podfile.installation_options
            else
              installation_options
            end

  if Pod.match_version?('~> 1.8')
    specifications = find_cached_set(dependency)
                     .all_specifications(options.warn_for_multiple_pod_sources, requirement)
  else
    specifications = find_cached_set(dependency)
                     .all_specifications(options.warn_for_multiple_pod_sources)
                     .select { |s| requirement.satisfied_by? s.version }
  end

  specifications
    .map { |s| s.subspec_by_name(dependency.name, false, true) }
    .compact
end

#valid_possibility_version_for_root_name?(requirement, activated, spec) ⇒ Boolean

Returns:

  • (Boolean)


65
66
67
68
69
# File 'lib/cocoapods-bb-bin/native/resolver.rb', line 65

def valid_possibility_version_for_root_name?(requirement, activated, spec)
  return true if podfile.allow_prerelease?

  old_valid_possibility_version_for_root_name?(requirement, activated, spec)
end