cocoapods-binary-cache 0.1.6 → 0.1.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/cocoapods-binary-cache/cache/validation_result.rb +4 -0
- data/lib/cocoapods-binary-cache/cache/validator.rb +1 -1
- data/lib/cocoapods-binary-cache/cache/validator_dependencies_graph.rb +1 -1
- data/lib/cocoapods-binary-cache/dependencies_graph/dependencies_graph.rb +20 -25
- data/lib/cocoapods-binary-cache/dependencies_graph/graph_visualizer.rb +29 -38
- data/lib/cocoapods-binary-cache/diagnosis/diagnosis.rb +9 -1
- data/lib/cocoapods-binary-cache/diagnosis/integration.rb +7 -3
- data/lib/cocoapods-binary-cache/env.rb +1 -1
- data/lib/cocoapods-binary-cache/helper/podspec.rb +4 -2
- data/lib/cocoapods-binary-cache/hooks/post_install.rb +2 -12
- data/lib/cocoapods-binary-cache/hooks/pre_install.rb +22 -39
- data/lib/cocoapods-binary-cache/main.rb +0 -1
- data/lib/cocoapods-binary-cache/pod-binary/helper/build.rb +27 -29
- data/lib/cocoapods-binary-cache/pod-binary/helper/detected_prebuilt_pods/installer.rb +2 -2
- data/lib/cocoapods-binary-cache/pod-binary/helper/prebuild_sandbox.rb +15 -14
- data/lib/cocoapods-binary-cache/pod-binary/helper/target_checker.rb +7 -10
- data/lib/cocoapods-binary-cache/pod-binary/integration.rb +1 -2
- data/lib/cocoapods-binary-cache/pod-binary/integration/alter_specs.rb +4 -1
- data/lib/cocoapods-binary-cache/pod-binary/integration/patch/embed_framework_script.rb +1 -1
- data/lib/cocoapods-binary-cache/pod-binary/integration/patch/resolve_dependencies.rb +0 -3
- data/lib/cocoapods-binary-cache/pod-binary/integration/patch/sandbox_analyzer_state.rb +29 -0
- data/lib/cocoapods-binary-cache/pod-binary/integration/patch/source_installation.rb +26 -12
- data/lib/cocoapods-binary-cache/pod-binary/integration/source_installer.rb +57 -62
- data/lib/cocoapods-binary-cache/pod-binary/prebuild.rb +34 -112
- data/lib/cocoapods-binary-cache/pod-binary/prebuild_dsl.rb +2 -66
- data/lib/cocoapods-binary-cache/pod-binary/prebuild_hook.rb +0 -1
- data/lib/cocoapods-binary-cache/pod-rome/xcodebuild_command.rb +166 -146
- data/lib/cocoapods-binary-cache/pod-rome/xcodebuild_raw.rb +38 -33
- data/lib/cocoapods-binary-cache/prebuild_output/output.rb +7 -5
- data/lib/cocoapods-binary-cache/state_store.rb +16 -6
- data/lib/command/binary.rb +20 -1
- data/lib/command/config.rb +181 -8
- data/lib/command/executor/base.rb +18 -1
- data/lib/command/executor/fetcher.rb +21 -5
- data/lib/command/executor/prebuilder.rb +9 -7
- data/lib/command/executor/pusher.rb +20 -4
- data/lib/command/executor/visualizer.rb +3 -2
- data/lib/command/fetch.rb +0 -1
- data/lib/command/prebuild.rb +16 -6
- data/lib/command/push.rb +0 -1
- metadata +5 -9
- data/lib/cocoapods-binary-cache/pod-binary/helper/feature_switches.rb +0 -52
- data/lib/cocoapods-binary-cache/pod-binary/helper/passer.rb +0 -25
- data/lib/cocoapods-binary-cache/pod-binary/integration/remove_target_files.rb +0 -29
- data/lib/cocoapods-binary-cache/pod-binary/tool/tool.rb +0 -12
- data/lib/cocoapods-binary-cache/scheme_editor.rb +0 -35
@@ -1,12 +1,11 @@
|
|
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
|
|
8
7
|
module Pod
|
9
|
-
class PrebuildInstaller < Installer
|
8
|
+
class PrebuildInstaller < Installer # rubocop:disable Metrics/ClassLength
|
10
9
|
attr_reader :lockfile_wrapper
|
11
10
|
|
12
11
|
def initialize(options)
|
@@ -15,124 +14,50 @@ module Pod
|
|
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::StateStore.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 Pod::Podfile::DSL.prebuild_all_pods?
|
48
|
-
end
|
49
|
-
|
50
17
|
def run_code_gen!(targets)
|
51
|
-
return if
|
18
|
+
return if PodPrebuild.config.prebuild_code_gen.nil?
|
52
19
|
|
53
20
|
Pod::UI.title("Running code generation...") do
|
54
|
-
|
21
|
+
PodPrebuild.config.prebuild_code_gen.call(self, 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 = Pod::Podfile::DSL.targets_to_prebuild_from_cli
|
63
|
-
if !targets_from_cli.empty?
|
64
|
-
targets = targets.select { |target| targets_from_cli.include?(target.name) }
|
65
|
-
elsif !Pod::Podfile::DSL.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::StateStore.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 Pod::Podfile::DSL.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 Podfile::DSL.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
|
|
110
|
-
|
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
|
+
|
111
37
|
def prebuild_frameworks!
|
112
|
-
UI.puts "Start prebuild_frameworks"
|
113
38
|
existed_framework_folder = sandbox.generate_framework_path
|
114
39
|
sandbox_path = sandbox.root
|
115
40
|
targets = targets_to_prebuild
|
41
|
+
Pod::UI.puts "Prebuild frameworks (total #{targets.count}): #{targets.map(&:name)}".magenta
|
116
42
|
|
117
|
-
Pod::UI.puts "Prebuild frameworks (total #{targets.count}): #{targets.map(&:name)}"
|
118
|
-
Pod::Prebuild.remove_build_dir(sandbox_path)
|
119
43
|
run_code_gen!(targets)
|
44
|
+
|
45
|
+
PodPrebuild.remove_build_dir(sandbox_path)
|
46
|
+
PodPrebuild.build(
|
47
|
+
sandbox: sandbox_path,
|
48
|
+
targets: targets,
|
49
|
+
configuration: PodPrebuild.config.prebuild_config,
|
50
|
+
output_path: sandbox.generate_framework_path,
|
51
|
+
bitcode_enabled: PodPrebuild.config.bitcode_enabled?,
|
52
|
+
device_build_enabled: PodPrebuild.config.device_build_enabled?,
|
53
|
+
disable_dsym: PodPrebuild.config.disable_dsym?,
|
54
|
+
args: PodPrebuild.config.build_args
|
55
|
+
)
|
56
|
+
PodPrebuild.remove_build_dir(sandbox_path)
|
57
|
+
|
120
58
|
targets.each do |target|
|
121
|
-
|
122
|
-
output_path.mkpath unless output_path.exist?
|
123
|
-
Pod::Prebuild.build(
|
124
|
-
sandbox: sandbox_path,
|
125
|
-
target: target,
|
126
|
-
configuration: Pod::Podfile::DSL.prebuild_config,
|
127
|
-
output_path: output_path,
|
128
|
-
bitcode_enabled: Pod::Podfile::DSL.bitcode_enabled?,
|
129
|
-
device_build_enabled: Pod::Podfile::DSL.device_build_enabled?,
|
130
|
-
disable_dsym: Pod::Podfile::DSL.disable_dsym?,
|
131
|
-
args: Pod::Podfile::DSL.build_args
|
132
|
-
)
|
133
|
-
collect_metadata(target, output_path)
|
59
|
+
collect_metadata(target, sandbox.framework_folder_path_for_target_name(target.name))
|
134
60
|
end
|
135
|
-
Pod::Prebuild.remove_build_dir(sandbox_path)
|
136
61
|
|
137
62
|
# copy vendored libraries and frameworks
|
138
63
|
targets.each do |target|
|
@@ -142,7 +67,6 @@ module Pod
|
|
142
67
|
# If target shouldn't build, we copy all the original files
|
143
68
|
# This is for target with only .a and .h files
|
144
69
|
unless target.should_build?
|
145
|
-
Prebuild::Passer.target_names_to_skip_integration_framework << target.name
|
146
70
|
FileUtils.cp_r(root_path, target_folder, :remove_destination => true)
|
147
71
|
next
|
148
72
|
end
|
@@ -173,12 +97,12 @@ module Pod
|
|
173
97
|
all_needed_names.include? name
|
174
98
|
end
|
175
99
|
useless_target_names.each do |name|
|
176
|
-
UI.
|
100
|
+
Pod::UI.message "Remove: #{name}"
|
177
101
|
path = sandbox.framework_folder_path_for_target_name(name)
|
178
102
|
path.rmtree if path.exist?
|
179
103
|
end
|
180
104
|
|
181
|
-
if
|
105
|
+
if PodPrebuild.config.dont_remove_source_code?
|
182
106
|
# just remove the tmp files
|
183
107
|
path = sandbox.root + "Manifest.lock.tmp"
|
184
108
|
path.rmtree if path.exist?
|
@@ -189,12 +113,10 @@ module Pod
|
|
189
113
|
to_delete_files.each { |file| file.rmtree if file.exist? }
|
190
114
|
end
|
191
115
|
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
prebuild_output.write_delta_file(updated_target_names, deleted_target_names)
|
116
|
+
prebuild_output.write_delta_file(
|
117
|
+
updated: targets.map { |target| target.label.to_s },
|
118
|
+
deleted: useless_target_names
|
119
|
+
)
|
198
120
|
end
|
199
121
|
|
200
122
|
def clean_delta_file
|
@@ -215,7 +137,7 @@ module Pod
|
|
215
137
|
metadata.build_settings = pods_project.targets
|
216
138
|
.detect { |native_target| native_target.name == target.name }
|
217
139
|
.build_configurations
|
218
|
-
.detect { |config| config.name ==
|
140
|
+
.detect { |config| config.name == PodPrebuild.config.prebuild_config }
|
219
141
|
.build_settings
|
220
142
|
metadata.source_hash = @lockfile_wrapper && @lockfile_wrapper.dev_pod_hash(target.name)
|
221
143
|
|
@@ -1,73 +1,9 @@
|
|
1
|
-
require_relative "tool/tool"
|
2
|
-
|
3
1
|
module Pod
|
4
2
|
class Podfile
|
5
3
|
module DSL
|
6
|
-
@binary_cache_config = {}
|
7
|
-
@binary_cache_cli_config = {}
|
8
4
|
def config_cocoapods_binary_cache(options)
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
class << self
|
13
|
-
attr_accessor :binary_cache_config
|
14
|
-
attr_accessor :binary_cache_cli_config
|
15
|
-
|
16
|
-
def prebuild_config
|
17
|
-
@binary_cache_config[:prebuild_config] || "Debug"
|
18
|
-
end
|
19
|
-
|
20
|
-
def prebuild_job?
|
21
|
-
@binary_cache_cli_config[:prebuild_job] || @binary_cache_config[:prebuild_job]
|
22
|
-
end
|
23
|
-
|
24
|
-
def prebuild_all_pods?
|
25
|
-
@binary_cache_cli_config[:prebuild_all_pods] || @binary_cache_config[:prebuild_all_pods]
|
26
|
-
end
|
27
|
-
|
28
|
-
def excluded_pods
|
29
|
-
@binary_cache_config[:excluded_pods] || Set.new
|
30
|
-
end
|
31
|
-
|
32
|
-
def dev_pods_enabled?
|
33
|
-
@binary_cache_config[:dev_pods_enabled]
|
34
|
-
end
|
35
|
-
|
36
|
-
def bitcode_enabled?
|
37
|
-
@binary_cache_config[:bitcode_enabled]
|
38
|
-
end
|
39
|
-
|
40
|
-
def device_build_enabled?
|
41
|
-
@binary_cache_config[:device_build_enabled]
|
42
|
-
end
|
43
|
-
|
44
|
-
def disable_dsym?
|
45
|
-
@binary_cache_config[:disable_dsym]
|
46
|
-
end
|
47
|
-
|
48
|
-
def dont_remove_source_code?
|
49
|
-
@binary_cache_config[:dont_remove_source_code]
|
50
|
-
end
|
51
|
-
|
52
|
-
def build_args
|
53
|
-
@binary_cache_config[:build_args]
|
54
|
-
end
|
55
|
-
|
56
|
-
def save_cache_validation_to
|
57
|
-
@binary_cache_config[:save_cache_validation_to]
|
58
|
-
end
|
59
|
-
|
60
|
-
def validate_prebuilt_settings
|
61
|
-
@binary_cache_config[:validate_prebuilt_settings]
|
62
|
-
end
|
63
|
-
|
64
|
-
def prebuild_code_gen
|
65
|
-
@binary_cache_config[:prebuild_code_gen]
|
66
|
-
end
|
67
|
-
|
68
|
-
def targets_to_prebuild_from_cli
|
69
|
-
@binary_cache_cli_config[:prebuild_targets] || []
|
70
|
-
end
|
5
|
+
PodPrebuild.config.dsl_config = options
|
6
|
+
PodPrebuild.config.validate_dsl_config
|
71
7
|
end
|
72
8
|
end
|
73
9
|
end
|
@@ -1,176 +1,196 @@
|
|
1
1
|
require_relative "xcodebuild_raw"
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
3
|
+
module PodPrebuild
|
4
|
+
class XcodebuildCommand # rubocop:disable Metrics/ClassLength
|
5
|
+
def initialize(options)
|
6
|
+
@options = options
|
7
|
+
case options[:targets][0].platform.name
|
8
|
+
when :ios
|
9
|
+
@options[:device] = "iphoneos"
|
10
|
+
@options[:simulator] = "iphonesimulator"
|
11
|
+
when :tvos
|
12
|
+
@options[:device] = "appletvos"
|
13
|
+
@options[:simulator] = "appletvsimulator"
|
14
|
+
when :watchos
|
15
|
+
@options[:device] = "watchos"
|
16
|
+
@options[:simulator] = "watchsimulator"
|
17
|
+
end
|
18
|
+
@build_args = make_up_build_args(options[:args] || {})
|
19
|
+
end
|
19
20
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
21
|
+
def run
|
22
|
+
build_for_sdk(simulator) if build_types.include?(:simulator)
|
23
|
+
build_for_sdk(device) if build_types.include?(:device)
|
24
|
+
|
25
|
+
targets.each do |target|
|
26
|
+
case build_types
|
27
|
+
when [:simulator]
|
28
|
+
collect_output(target, Dir[target_products_dir_of(target, simulator) + "/*"])
|
29
|
+
when [:device]
|
30
|
+
collect_output(target, Dir[target_products_dir_of(target, device) + "/*"])
|
31
|
+
else
|
32
|
+
# When merging contents of `simulator` & `device`, prefer contents of `device` over `simulator`
|
33
|
+
# https://github.com/grab/cocoapods-binary-cache/issues/25
|
34
|
+
collect_output(target, Dir[target_products_dir_of(target, device) + "/*"])
|
35
|
+
create_universal_framework(target)
|
36
|
+
end
|
37
|
+
end
|
28
38
|
end
|
29
|
-
collect_output(Dir[target_products_dir_of(simulator) + "/*"])
|
30
|
-
end
|
31
39
|
|
32
|
-
|
33
|
-
|
34
|
-
def make_up_build_args(args)
|
35
|
-
args_ = args.clone
|
36
|
-
args_[:default] ||= []
|
37
|
-
args_[:simulator] ||= []
|
38
|
-
args_[:device] ||= []
|
39
|
-
args_[:default] += ["BITCODE_GENERATION_MODE=bitcode"] if bitcode_enabled?
|
40
|
-
args_[:default] += ["DEBUG_INFORMATION_FORMAT=dwarf"] if disable_dsym?
|
41
|
-
args_[:simulator] += ["ARCHS=x86_64", "ONLY_ACTIVE_ARCH=NO"] if simulator == "iphonesimulator"
|
42
|
-
args_[:simulator] += args_[:default]
|
43
|
-
args_[:device] += args_[:default]
|
44
|
-
args_
|
45
|
-
end
|
40
|
+
private
|
46
41
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
sandbox: sandbox,
|
56
|
-
target: target.label,
|
57
|
-
configuration: configuration,
|
58
|
-
sdk: sdk,
|
59
|
-
deployment_target: target.platform.deployment_target.to_s,
|
60
|
-
args: sdk == simulator ? @build_args[:simulator] : @build_args[:device]
|
61
|
-
)
|
62
|
-
raise "Build framework failed: #{target.label}" unless succeeded
|
63
|
-
end
|
42
|
+
def build_types
|
43
|
+
@build_types ||= begin
|
44
|
+
# TODO (thuyen): Add DSL options `build_for_types` to specify build types
|
45
|
+
types = [:simulator]
|
46
|
+
types << :device if device_build_enabled?
|
47
|
+
types
|
48
|
+
end
|
49
|
+
end
|
64
50
|
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
51
|
+
def make_up_build_args(args)
|
52
|
+
args_ = args.clone
|
53
|
+
args_[:default] ||= []
|
54
|
+
args_[:simulator] ||= []
|
55
|
+
args_[:device] ||= []
|
56
|
+
args_[:default] += ["BITCODE_GENERATION_MODE=bitcode"] if bitcode_enabled?
|
57
|
+
args_[:default] += ["DEBUG_INFORMATION_FORMAT=dwarf"] if disable_dsym?
|
58
|
+
args_[:simulator] += ["ARCHS=x86_64", "ONLY_ACTIVE_ARCH=NO"] if simulator == "iphonesimulator"
|
59
|
+
args_[:simulator] += args_[:default]
|
60
|
+
args_[:device] += ["ONLY_ACTIVE_ARCH=NO"]
|
61
|
+
args_[:device] += args_[:default]
|
62
|
+
args_
|
63
|
+
end
|
71
64
|
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
65
|
+
def build_for_sdk(sdk)
|
66
|
+
PodPrebuild::XcodebuildCommand.xcodebuild(
|
67
|
+
sandbox: sandbox,
|
68
|
+
scheme: scheme,
|
69
|
+
targets: targets.map(&:label),
|
70
|
+
configuration: configuration,
|
71
|
+
sdk: sdk,
|
72
|
+
deployment_target: targets.map { |t| t.platform.deployment_target }.max.to_s,
|
73
|
+
args: sdk == simulator ? @build_args[:simulator] : @build_args[:device]
|
74
|
+
)
|
75
|
+
end
|
76
76
|
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
77
|
+
def create_universal_framework(target)
|
78
|
+
merge_framework_binary(target)
|
79
|
+
merge_framework_dsym(target)
|
80
|
+
merge_swift_headers(target)
|
81
|
+
merge_swift_modules(target)
|
82
|
+
end
|
83
83
|
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
cmd << options[:simulator] << options[:device]
|
88
|
-
Pod::UI.puts `#{cmd.join(" ")}`
|
89
|
-
end
|
84
|
+
def merge_framework_binary(target)
|
85
|
+
merge_contents(target, "/#{target.product_module_name}", &method(:create_fat_binary))
|
86
|
+
end
|
90
87
|
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
88
|
+
def merge_framework_dsym(target)
|
89
|
+
merge_contents(
|
90
|
+
target,
|
91
|
+
".dSYM/Contents/Resources/DWARF/#{target.product_module_name}",
|
92
|
+
&method(:create_fat_binary)
|
93
|
+
)
|
94
|
+
end
|
95
|
+
|
96
|
+
def merge_swift_headers(target)
|
97
|
+
merge_contents(target, "/Headers/#{target.product_module_name}-Swift.h") do |options|
|
98
|
+
merged_header = <<~HEREDOC
|
99
|
+
#if TARGET_OS_SIMULATOR // merged by cocoapods-binary
|
100
|
+
#{File.read(options[:simulator])}
|
101
|
+
#else // merged by cocoapods-binary
|
102
|
+
#{File.read(options[:device])}
|
103
|
+
#endif // merged by cocoapods-binary
|
104
|
+
HEREDOC
|
105
|
+
File.write(options[:output], merged_header.strip)
|
106
|
+
end
|
107
|
+
end
|
105
108
|
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
109
|
+
def merge_swift_modules(target)
|
110
|
+
merge_contents(target, "/Modules/#{target.product_module_name}.swiftmodule") do |options|
|
111
|
+
# Note: swiftmodules of `device` were copied beforehand,
|
112
|
+
# here, we only need to copy swiftmodules of `simulator`
|
113
|
+
FileUtils.cp_r(options[:simulator] + "/.", options[:output])
|
114
|
+
end
|
115
|
+
end
|
110
116
|
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
117
|
+
def merge_contents(target, path_suffix, &merger)
|
118
|
+
simulator_, device_, output_ = [
|
119
|
+
framework_path_of(target, simulator),
|
120
|
+
framework_path_of(target, device),
|
121
|
+
"#{output_path(target)}/#{target.product_module_name}.framework"
|
122
|
+
].map { |p| p + path_suffix }
|
123
|
+
return unless File.exist?(simulator_) && File.exist?(device_)
|
116
124
|
|
117
|
-
|
118
|
-
paths = [paths] unless paths.is_a?(Array)
|
119
|
-
paths.each do |path|
|
120
|
-
FileUtils.rm_rf(File.join(output_path, File.basename(path)))
|
121
|
-
FileUtils.mv(path, output_path)
|
125
|
+
merger.call(simulator: simulator_, device: device_, output: output_)
|
122
126
|
end
|
123
|
-
end
|
124
127
|
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
+
def create_fat_binary(options)
|
129
|
+
cmd = ["lipo", " -create"]
|
130
|
+
cmd << "-output" << options[:output]
|
131
|
+
cmd << options[:simulator] << options[:device]
|
132
|
+
`#{cmd.join(" ")}`
|
133
|
+
end
|
128
134
|
|
129
|
-
|
130
|
-
|
131
|
-
|
135
|
+
def collect_output(target, paths)
|
136
|
+
FileUtils.mkdir_p(output_path(target))
|
137
|
+
paths = [paths] unless paths.is_a?(Array)
|
138
|
+
paths.each do |path|
|
139
|
+
FileUtils.rm_rf(File.join(output_path(target), File.basename(path)))
|
140
|
+
FileUtils.cp_r(path, output_path(target))
|
141
|
+
end
|
142
|
+
end
|
132
143
|
|
133
|
-
|
134
|
-
|
135
|
-
|
144
|
+
def target_products_dir_of(target, sdk)
|
145
|
+
"#{build_dir}/#{configuration}-#{sdk}/#{target.name}"
|
146
|
+
end
|
136
147
|
|
137
|
-
|
138
|
-
|
139
|
-
|
148
|
+
def framework_path_of(target, sdk)
|
149
|
+
"#{target_products_dir_of(target, sdk)}/#{target.product_module_name}.framework"
|
150
|
+
end
|
140
151
|
|
141
|
-
|
142
|
-
|
143
|
-
|
152
|
+
def sandbox
|
153
|
+
@options[:sandbox]
|
154
|
+
end
|
144
155
|
|
145
|
-
|
146
|
-
|
147
|
-
|
156
|
+
def build_dir
|
157
|
+
@options[:build_dir]
|
158
|
+
end
|
148
159
|
|
149
|
-
|
150
|
-
|
151
|
-
|
160
|
+
def output_path(target)
|
161
|
+
"#{@options[:output_path]}/#{target.label}"
|
162
|
+
end
|
152
163
|
|
153
|
-
|
154
|
-
|
155
|
-
|
164
|
+
def scheme
|
165
|
+
@options[:scheme]
|
166
|
+
end
|
156
167
|
|
157
|
-
|
158
|
-
|
159
|
-
|
168
|
+
def targets
|
169
|
+
@options[:targets]
|
170
|
+
end
|
160
171
|
|
161
|
-
|
162
|
-
|
163
|
-
|
172
|
+
def configuration
|
173
|
+
@options[:configuration]
|
174
|
+
end
|
164
175
|
|
165
|
-
|
166
|
-
|
167
|
-
|
176
|
+
def bitcode_enabled?
|
177
|
+
@options[:bitcode_enabled]
|
178
|
+
end
|
168
179
|
|
169
|
-
|
170
|
-
|
171
|
-
|
180
|
+
def device_build_enabled?
|
181
|
+
@options[:device_build_enabled]
|
182
|
+
end
|
183
|
+
|
184
|
+
def device
|
185
|
+
@options[:device] || "iphoneos"
|
186
|
+
end
|
172
187
|
|
173
|
-
|
174
|
-
|
188
|
+
def simulator
|
189
|
+
@options[:simulator] || "iphonesimulator"
|
190
|
+
end
|
191
|
+
|
192
|
+
def disable_dsym?
|
193
|
+
@options[:disable_dsym]
|
194
|
+
end
|
175
195
|
end
|
176
196
|
end
|