Class: Pod::Source::Manager

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

Instance Method Summary collapse

Instance Method Details

#binary_sourceObject

二进制 source (区分动态库还是静态库)



34
35
36
# File 'lib/cocoapods-bb-bin/native/sources_manager.rb', line 34

def binary_source
  return supportDylibSource ? dylib_binary_source : static_binary_source
end

#code_sourceObject

源码 source



16
17
18
19
20
21
22
# File 'lib/cocoapods-bb-bin/native/sources_manager.rb', line 16

def code_source
  if supportDylibSource # 动态库
    source_with_name_or_url(CBin.config.sourceV2_repo_url)
  else # 静态库
    source_with_name_or_url(CBin.config.code_repo_url)
  end
end

#dylib_binary_sourceObject

动态库二进制源



29
30
31
# File 'lib/cocoapods-bb-bin/native/sources_manager.rb', line 29

def dylib_binary_source
  source_with_name_or_url(CBin.config.dylib_repo_url)
end

#initLibEnv(isGenDylib = false) ⇒ Object



10
11
12
13
# File 'lib/cocoapods-bb-bin/native/sources_manager.rb', line 10

def initLibEnv(isGenDylib=false)
  @dylib = isGenDylib
  UI.puts "初始化源环境support dylib:#{isGenDylib}"
end

#static_binary_sourceObject

静态库二进制源



25
26
27
# File 'lib/cocoapods-bb-bin/native/sources_manager.rb', line 25

def static_binary_source
  source_with_name_or_url(CBin.config.binary_repo_url)
end

#supportDylibSourceObject

是否支持动态库



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/cocoapods-bb-bin/native/sources_manager.rb', line 39

def supportDylibSource
  if @dylib
    return true
  else
    # 优先解析podfile中source动态配置是否添加动态库源
    podfile = Pod::Config.instance.podfile
    if podfile
      dylib_source = CBin.config.dylib_repo_url
      podfile.sources.map do |source|
        if source === dylib_source
          UI.puts "切换到动态库源:#{dylib_binary_source}"
          return true
        end
      end
    end
    return false
  end
end