Skip to content

Commit b72c8e6

Browse files
chore(*): clean up passer
1 parent f3125a2 commit b72c8e6

File tree

8 files changed

+13
-124
lines changed

8 files changed

+13
-124
lines changed

integration_tests/Podfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,6 @@ SPEC CHECKSUMS:
5656
IQKeyboardManagerSwift: 977affaeb4d6e971975c7790a6850f31d38f1207
5757
SwiftDate: fa2bb3962056bb44047b4b85a30044e5eae30b03
5858

59-
PODFILE CHECKSUM: d755289df85b8a4dc12c9ce139da91ad5fad2fd0
59+
PODFILE CHECKSUM: 49945672c7b1a5bacc7ae6652b1e57d5fdad96f2
6060

6161
COCOAPODS: 1.9.3

lib/cocoapods-binary-cache/cache/validation_result.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ def initialize(missed_with_reasons = {}, hit = Set.new)
77
@hit = hit.to_set - missed_with_reasons.keys
88
end
99

10+
def all
11+
(hit + missed).to_set
12+
end
13+
1014
def missed
1115
@missed_with_reasons.keys.to_set
1216
end

lib/cocoapods-binary-cache/pod-binary/helper/passer.rb

Lines changed: 0 additions & 25 deletions
This file was deleted.

lib/cocoapods-binary-cache/pod-binary/integration.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
require_relative "helper/podfile_options"
22
require_relative "helper/prebuild_sandbox"
3-
require_relative "helper/passer"
43
require_relative "helper/names"
54
require_relative "helper/target_checker"
65
require_relative "integration/alter_specs"

lib/cocoapods-binary-cache/pod-binary/prebuild.rb

Lines changed: 8 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
require "fileutils"
22
require_relative "../prebuild_output/output"
33
require_relative "../helper/lockfile"
4-
require_relative "helper/passer"
54
require_relative "helper/target_checker"
65
require_relative "helper/build"
76

@@ -15,38 +14,6 @@ def initialize(options)
1514
@lockfile_wrapper = lockfile && PodPrebuild::Lockfile.new(lockfile)
1615
end
1716

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-
5017
def run_code_gen!(targets)
5118
return if PodPrebuild.config.prebuild_code_gen.nil?
5219

@@ -55,58 +22,18 @@ def run_code_gen!(targets)
5522
end
5623
end
5724

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-
10625
def prebuild_output
10726
@prebuild_output ||= PodPrebuild::Output.new(sandbox)
10827
end
10928

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+
11037
def prebuild_frameworks!
11138
existed_framework_folder = sandbox.generate_framework_path
11239
sandbox_path = sandbox.root
@@ -140,7 +67,6 @@ def prebuild_frameworks!
14067
# If target shouldn't build, we copy all the original files
14168
# This is for target with only .a and .h files
14269
unless target.should_build?
143-
Prebuild::Passer.target_names_to_skip_integration_framework << target.name
14470
FileUtils.cp_r(root_path, target_folder, :remove_destination => true)
14571
next
14672
end

lib/cocoapods-binary-cache/pod-binary/prebuild_dsl.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
require_relative "tool/tool"
2-
31
module Pod
42
class Podfile
53
module DSL

lib/cocoapods-binary-cache/pod-binary/prebuild_hook.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
require_relative "helper/passer"
21
require_relative "helper/podfile_options"
32
require_relative "helper/prebuild_sandbox"
43

lib/cocoapods-binary-cache/pod-binary/tool/tool.rb

Lines changed: 0 additions & 12 deletions
This file was deleted.

0 commit comments

Comments
 (0)