Class: Pod::Installer::Analyzer

Inherits:
Object
  • Object
show all
Defined in:
lib/cocoapods-bb-PodAssistant/babybus/bbsadvert/podfile_dependency_cache.rb,
lib/cocoapods-bb-PodAssistant/command/linkline.rb

Defined Under Namespace

Classes: PodfileDependencyCache

Instance Method Summary collapse

Instance Method Details

#generate_pod_targets(resolver_specs_by_target, target_inspections) ⇒ Object



6
7
8
9
10
11
12
# File 'lib/cocoapods-bb-PodAssistant/command/linkline.rb', line 6

def generate_pod_targets(resolver_specs_by_target, target_inspections)
    targets = ll_original_generate_pod_targets(resolver_specs_by_target, target_inspections)
    targets.each { |target|
        ll_rebuild_linkage(target,target)
    } unless installation_options.skip_linkline_on_local? && $ll_has_local_path
    targets
end

#ll_create_build_type_from(pod_target, linkage) ⇒ Object



56
57
58
59
60
61
62
63
# File 'lib/cocoapods-bb-PodAssistant/command/linkline.rb', line 56

def ll_create_build_type_from(pod_target,linkage)
    return nil if !linkage
    if pod_target.build_as_framework?
        Pod::BuildType.new(:linkage => linkage, :packaging => :framework)
    else
        Pod::BuildType.new(:linkage => linkage, :packaging => :library)
    end
end

#ll_fetch_linkage_from(pod_target) ⇒ Object



46
47
48
49
50
51
52
53
54
# File 'lib/cocoapods-bb-PodAssistant/command/linkline.rb', line 46

def ll_fetch_linkage_from(pod_target)
    linkage = pod_target.target_definitions.map { |t| t.ll_linkages(false)[pod_target.pod_name] }.compact.first
    is_linkage_all = false
    if !linkage 
        linkage = pod_target.target_definitions.map { |t| t.ll_linkages(true)[pod_target.pod_name] }.compact.first
        is_linkage_all = true if linkage
    end
    [linkage,is_linkage_all]
end

#ll_is_need_rewrite_build_type(pod_target, linkage) ⇒ Object



65
66
67
# File 'lib/cocoapods-bb-PodAssistant/command/linkline.rb', line 65

def ll_is_need_rewrite_build_type(pod_target,linkage)
    ((linkage == :static && pod_target.build_as_dynamic?) || (linkage == :dynamic && pod_target.build_as_static?))
end

#ll_original_generate_pod_targetsObject



5
# File 'lib/cocoapods-bb-PodAssistant/command/linkline.rb', line 5

alias_method :ll_original_generate_pod_targets, :generate_pod_targets

#ll_rebuild_linkage(pod_target, root_pod_target) ⇒ Object



14
15
16
17
18
19
20
21
22
# File 'lib/cocoapods-bb-PodAssistant/command/linkline.rb', line 14

def ll_rebuild_linkage(pod_target,root_pod_target) 
    ll_linkage,is_linkage_all = ll_fetch_linkage_from(pod_target)
    if ll_linkage
        build_type = ll_create_build_type_from(pod_target,ll_linkage)
        is_need_rewrite = ll_is_need_rewrite_build_type(pod_target,ll_linkage)
        pod_target.ll_rewrite_build_type(build_type) if is_need_rewrite
        ll_rebuild_linkage_in_dependencies(pod_target,root_pod_target,build_type) if is_linkage_all
    end           
end

#ll_rebuild_linkage_in_dependencies(pod_target, root_pod_target, build_type) ⇒ Object



24
25
26
27
28
29
# File 'lib/cocoapods-bb-PodAssistant/command/linkline.rb', line 24

def ll_rebuild_linkage_in_dependencies(pod_target,root_pod_target,build_type) 
    return if pod_target.dependencies.empty?
    pod_target.dependent_targets.each { |sub_pod_target|
        ll_rebuild_linkage_sub(sub_pod_target,root_pod_target,build_type)        
    }
end

#ll_rebuild_linkage_sub(pod_target, root_pod_target, build_type) ⇒ Object



31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/cocoapods-bb-PodAssistant/command/linkline.rb', line 31

def ll_rebuild_linkage_sub(pod_target,root_pod_target,build_type) 
    exit -9090 if !build_type
    ll_linkage,a = ll_fetch_linkage_from(pod_target)
    if ll_linkage && ll_linkage != build_type.linkage
        err_msg = "- Error: [#{pod_target.pod_name}] is define :linkage => #{ll_linkage} confict to it's parent [#{root_pod_target.pod_name}] :linkage => #{build_type}"
        # raise Informative, err_msg
        Pod::UI.puts "#{err_msg}".send(:red)
        exit -9090
    else
        is_need_rewrite = ll_is_need_rewrite_build_type(pod_target,build_type.linkage)
        pod_target.ll_rewrite_build_type(build_type) if is_need_rewrite
        ll_rebuild_linkage_in_dependencies(pod_target,root_pod_target,build_type)
    end   
end