Class: Pod::Resolver

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

Constant Summary collapse

@@build_dependencies_only_build =

仅仅只是编译出产物,不上传

false
@@build_dependencies_bin =

是否是在进行二进制打包处理,没有的话一些步奏需要省略掉

false

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.build_dependencies_bin(bin) ⇒ Object



105
106
107
# File 'lib/cocoapods-tdf-bin/native/resolver.rb', line 105

def Resolver.build_dependencies_bin(bin)
  @@build_dependencies_bin = bin
end

.build_dependencies_only_build(only_build) ⇒ Object

仅仅是本地编译生成产物,不需要去校验远程库是否存在,全部编译出来



101
102
103
# File 'lib/cocoapods-tdf-bin/native/resolver.rb', line 101

def Resolver.build_dependencies_only_build(only_build)
  @@build_dependencies_only_build = only_build
end

Instance Method Details

#aggregate_for_dependency(dependency) ⇒ Object

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



27
28
29
30
31
32
33
34
35
36
37
# File 'lib/cocoapods-tdf-bin/native/resolver.rb', line 27

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



70
# File 'lib/cocoapods-tdf-bin/native/resolver.rb', line 70

alias old_valid_possibility_version_for_root_name? valid_possibility_version_for_root_name?

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

Returns:

  • (Boolean)


78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/cocoapods-tdf-bin/native/resolver.rb', line 78

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



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/cocoapods-tdf-bin/native/resolver.rb', line 41

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)


72
73
74
75
76
# File 'lib/cocoapods-tdf-bin/native/resolver.rb', line 72

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