1
1
require "fileutils"
2
2
require_relative "../prebuild_output/output"
3
3
require_relative "../helper/lockfile"
4
- require_relative "helper/passer"
5
4
require_relative "helper/target_checker"
6
5
require_relative "helper/build"
7
6
@@ -15,38 +14,6 @@ def initialize(options)
15
14
@lockfile_wrapper = lockfile && PodPrebuild ::Lockfile . new ( lockfile )
16
15
end
17
16
18
- private
19
-
20
- def local_manifest
21
- @local_manifest ||= sandbox . manifest
22
- end
23
-
24
- # @return [Analyzer::SpecsState]
25
- def prebuild_pods_changes
26
- return nil if local_manifest . nil?
27
-
28
- if @prebuild_pods_changes . nil?
29
- changes = local_manifest . detect_changes_with_podfile ( podfile )
30
- @prebuild_pods_changes = Analyzer ::SpecsState . new ( changes )
31
- # save the chagnes info for later stage
32
- Pod ::Prebuild ::Passer . prebuild_pods_changes = @prebuild_pods_changes
33
- end
34
- @prebuild_pods_changes
35
- end
36
-
37
- def blacklisted? ( name )
38
- PodPrebuild . config . excluded_pods . include? ( name )
39
- end
40
-
41
- def cache_missed? ( name )
42
- @cache_validation . missed? ( name )
43
- end
44
-
45
- def should_not_prebuild_vendor_pod ( name )
46
- return true if blacklisted? ( name )
47
- return false if PodPrebuild . config . prebuild_all_pods?
48
- end
49
-
50
17
def run_code_gen! ( targets )
51
18
return if PodPrebuild . config . prebuild_code_gen . nil?
52
19
@@ -55,58 +22,18 @@ def run_code_gen!(targets)
55
22
end
56
23
end
57
24
58
- def targets_to_prebuild
59
- existed_framework_folder = sandbox . generate_framework_path
60
- targets = pod_targets
61
-
62
- targets_from_cli = PodPrebuild . config . targets_to_prebuild_from_cli
63
- if !targets_from_cli . empty?
64
- targets = targets . select { |target | targets_from_cli . include? ( target . name ) }
65
- elsif !PodPrebuild . config . prebuild_all_pods? && !local_manifest . nil?
66
- changes = prebuild_pods_changes
67
- added = changes . added
68
- changed = changes . changed
69
- unchanged = changes . unchanged
70
-
71
- existed_framework_folder . mkdir unless existed_framework_folder . exist?
72
- exsited_framework_pod_names = sandbox . exsited_framework_pod_names
73
-
74
- # additions
75
- missing = unchanged . reject { |pod_name | exsited_framework_pod_names . include? ( pod_name ) }
76
-
77
- root_names_to_update = ( added + changed + missing )
78
- root_names_to_update += PodPrebuild . state . cache_validation . missed
79
-
80
- # transform names to targets
81
- cache = [ ]
82
- targets = root_names_to_update . map do |pod_name |
83
- tars = Pod . fast_get_targets_for_pod_name ( pod_name , pod_targets , cache ) || [ ]
84
- raise "There's no target named (#{ pod_name } ) in Pod.xcodeproj" if tars . empty?
85
-
86
- tars
87
- end . flatten
88
-
89
- # add the dendencies
90
- dependency_targets = targets . map ( &:recursive_dependent_targets ) . flatten . uniq || [ ]
91
- targets = ( targets + dependency_targets ) . uniq
92
- end
93
-
94
- unless PodPrebuild . config . prebuild_all_pods?
95
- targets = targets . select { |pod_target | cache_missed? ( pod_target . name ) }
96
- end
97
- targets = targets . reject { |pod_target | should_not_prebuild_vendor_pod ( pod_target . name ) }
98
- unless PodPrebuild . config . dev_pods_enabled?
99
- targets = targets . reject { |pod_target | sandbox . local? ( pod_target . pod_name ) }
100
- end
101
- targets
102
- end
103
-
104
- public
105
-
106
25
def prebuild_output
107
26
@prebuild_output ||= PodPrebuild ::Output . new ( sandbox )
108
27
end
109
28
29
+ def targets_to_prebuild
30
+ to_build = PodPrebuild . config . targets_to_prebuild_from_cli
31
+ if to_build . empty?
32
+ to_build = PodPrebuild . config . prebuild_all_pods? ? @cache_validation . all : @cache_validation . missed
33
+ end
34
+ pod_targets . select { |target | to_build . include? ( target . name ) }
35
+ end
36
+
110
37
def prebuild_frameworks!
111
38
existed_framework_folder = sandbox . generate_framework_path
112
39
sandbox_path = sandbox . root
@@ -140,7 +67,6 @@ def prebuild_frameworks!
140
67
# If target shouldn't build, we copy all the original files
141
68
# This is for target with only .a and .h files
142
69
unless target . should_build?
143
- Prebuild ::Passer . target_names_to_skip_integration_framework << target . name
144
70
FileUtils . cp_r ( root_path , target_folder , :remove_destination => true )
145
71
next
146
72
end
0 commit comments