cocoapods-binary-cache 0.1.5 → 0.1.10
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 +7 -2
- 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/checksum.rb +10 -4
- data/lib/cocoapods-binary-cache/helper/lockfile.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 +37 -0
- data/lib/cocoapods-binary-cache/pod-binary/helper/detected_prebuilt_pods/installer.rb +2 -2
- data/lib/cocoapods-binary-cache/pod-binary/helper/detected_prebuilt_pods/target_definition.rb +2 -9
- 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 +27 -12
- data/lib/cocoapods-binary-cache/pod-binary/integration/source_installer.rb +57 -62
- data/lib/cocoapods-binary-cache/pod-binary/prebuild.rb +45 -121
- data/lib/cocoapods-binary-cache/pod-binary/prebuild_dsl.rb +2 -63
- data/lib/cocoapods-binary-cache/pod-binary/prebuild_hook.rb +0 -1
- data/lib/cocoapods-binary-cache/pod-rome/xcodebuild_command.rb +195 -0
- data/lib/cocoapods-binary-cache/pod-rome/xcodebuild_raw.rb +48 -0
- 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 +177 -8
- data/lib/command/executor/base.rb +9 -1
- data/lib/command/executor/fetcher.rb +5 -3
- data/lib/command/executor/prebuilder.rb +9 -7
- data/lib/command/executor/pusher.rb +2 -0
- data/lib/command/executor/visualizer.rb +3 -2
- data/lib/command/fetch.rb +0 -1
- data/lib/command/prebuild.rb +19 -3
- data/lib/command/push.rb +0 -1
- metadata +9 -11
- 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/pod-rome/build_framework.rb +0 -248
- data/lib/cocoapods-binary-cache/scheme_editor.rb +0 -35
@@ -1,135 +1,63 @@
|
|
1
1
|
require "fileutils"
|
2
|
-
require_relative "../pod-rome/build_framework"
|
3
2
|
require_relative "../prebuild_output/output"
|
4
|
-
require_relative "helper/passer"
|
5
|
-
require_relative "helper/target_checker"
|
6
3
|
require_relative "../helper/lockfile"
|
4
|
+
require_relative "helper/target_checker"
|
5
|
+
require_relative "helper/build"
|
7
6
|
|
8
|
-
# patch prebuild ability
|
9
7
|
module Pod
|
10
|
-
class PrebuildInstaller < Installer
|
8
|
+
class PrebuildInstaller < Installer # rubocop:disable Metrics/ClassLength
|
9
|
+
attr_reader :lockfile_wrapper
|
10
|
+
|
11
11
|
def initialize(options)
|
12
12
|
super(options[:sandbox], options[:podfile], options[:lockfile])
|
13
13
|
@cache_validation = options[:cache_validation]
|
14
|
-
@lockfile_wrapper = PodPrebuild::Lockfile.new(lockfile)
|
15
|
-
end
|
16
|
-
|
17
|
-
private
|
18
|
-
|
19
|
-
def local_manifest
|
20
|
-
@local_manifest ||= sandbox.manifest
|
14
|
+
@lockfile_wrapper = lockfile && PodPrebuild::Lockfile.new(lockfile)
|
21
15
|
end
|
22
16
|
|
23
|
-
|
24
|
-
|
25
|
-
return nil if local_manifest.nil?
|
17
|
+
def run_code_gen!(targets)
|
18
|
+
return if PodPrebuild.config.prebuild_code_gen.nil?
|
26
19
|
|
27
|
-
|
28
|
-
|
29
|
-
@prebuild_pods_changes = Analyzer::SpecsState.new(changes)
|
30
|
-
# save the chagnes info for later stage
|
31
|
-
Pod::Prebuild::Passer.prebuild_pods_changes = @prebuild_pods_changes
|
20
|
+
Pod::UI.title("Running code generation...") do
|
21
|
+
PodPrebuild.config.prebuild_code_gen.call(self, targets)
|
32
22
|
end
|
33
|
-
@prebuild_pods_changes
|
34
|
-
end
|
35
|
-
|
36
|
-
def blacklisted?(name)
|
37
|
-
PodPrebuild::StateStore.excluded_pods.include?(name)
|
38
23
|
end
|
39
24
|
|
40
|
-
def cache_missed?(name)
|
41
|
-
@cache_validation.missed?(name)
|
42
|
-
end
|
43
|
-
|
44
|
-
def should_not_prebuild_vendor_pod(name)
|
45
|
-
return true if blacklisted?(name)
|
46
|
-
return false if Pod::Podfile::DSL.prebuild_all_vendor_pods
|
47
|
-
end
|
48
|
-
|
49
|
-
public
|
50
|
-
|
51
25
|
def prebuild_output
|
52
26
|
@prebuild_output ||= PodPrebuild::Output.new(sandbox)
|
53
27
|
end
|
54
28
|
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
# build options
|
60
|
-
sandbox_path = sandbox.root
|
61
|
-
existed_framework_folder = sandbox.generate_framework_path
|
62
|
-
bitcode_enabled = Pod::Podfile::DSL.bitcode_enabled
|
63
|
-
targets = []
|
64
|
-
|
65
|
-
if Pod::Podfile::DSL.prebuild_all_vendor_pods
|
66
|
-
UI.puts "Rebuild all vendor frameworks"
|
67
|
-
targets = pod_targets
|
68
|
-
elsif !local_manifest.nil?
|
69
|
-
UI.puts "Update some frameworks"
|
70
|
-
changes = prebuild_pods_changes
|
71
|
-
added = changes.added
|
72
|
-
changed = changes.changed
|
73
|
-
unchanged = changes.unchanged
|
74
|
-
|
75
|
-
existed_framework_folder.mkdir unless existed_framework_folder.exist?
|
76
|
-
exsited_framework_pod_names = sandbox.exsited_framework_pod_names
|
77
|
-
|
78
|
-
# additions
|
79
|
-
missing = unchanged.reject { |pod_name| exsited_framework_pod_names.include?(pod_name) }
|
80
|
-
|
81
|
-
root_names_to_update = (added + changed + missing)
|
82
|
-
root_names_to_update += PodPrebuild::StateStore.cache_validation.missed
|
83
|
-
|
84
|
-
# transform names to targets
|
85
|
-
cache = []
|
86
|
-
targets = root_names_to_update.map do |pod_name|
|
87
|
-
tars = Pod.fast_get_targets_for_pod_name(pod_name, pod_targets, cache) || []
|
88
|
-
raise "There's no target named (#{pod_name}) in Pod.xcodeproj" if tars.empty?
|
89
|
-
|
90
|
-
tars
|
91
|
-
end.flatten
|
92
|
-
|
93
|
-
# add the dendencies
|
94
|
-
dependency_targets = targets.map(&:recursive_dependent_targets).flatten.uniq || []
|
95
|
-
targets = (targets + dependency_targets).uniq
|
96
|
-
else
|
97
|
-
UI.puts "Rebuild all frameworks"
|
98
|
-
targets = pod_targets
|
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
|
99
33
|
end
|
34
|
+
pod_targets.select { |target| to_build.include?(target.name) }
|
35
|
+
end
|
100
36
|
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
targets =
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
37
|
+
def prebuild_frameworks!
|
38
|
+
existed_framework_folder = sandbox.generate_framework_path
|
39
|
+
sandbox_path = sandbox.root
|
40
|
+
targets = targets_to_prebuild
|
41
|
+
Pod::UI.puts "Prebuild frameworks (total #{targets.count}): #{targets.map(&:name)}".magenta
|
42
|
+
|
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)
|
110
57
|
|
111
|
-
Pod::Prebuild.remove_build_dir(sandbox_path)
|
112
58
|
targets.each do |target|
|
113
|
-
|
114
|
-
Pod::UI.puts "Skip prebuilding #{target.label} because of no source files".yellow
|
115
|
-
next
|
116
|
-
end
|
117
|
-
|
118
|
-
output_path = sandbox.framework_folder_path_for_target_name(target.name)
|
119
|
-
output_path.mkpath unless output_path.exist?
|
120
|
-
Pod::Prebuild.build(
|
121
|
-
sandbox_root_path: sandbox_path,
|
122
|
-
target: target,
|
123
|
-
configuration: Pod::Podfile::DSL.prebuild_config,
|
124
|
-
output_path: output_path,
|
125
|
-
bitcode_enabled: bitcode_enabled,
|
126
|
-
device_build_enabled: Pod::Podfile::DSL.device_build_enabled,
|
127
|
-
custom_build_options: Pod::Podfile::DSL.custom_device_build_options,
|
128
|
-
custom_build_options_simulator: Pod::Podfile::DSL.custom_simulator_build_options
|
129
|
-
)
|
130
|
-
collect_metadata(target, output_path)
|
59
|
+
collect_metadata(target, sandbox.framework_folder_path_for_target_name(target.name))
|
131
60
|
end
|
132
|
-
Pod::Prebuild.remove_build_dir(sandbox_path)
|
133
61
|
|
134
62
|
# copy vendored libraries and frameworks
|
135
63
|
targets.each do |target|
|
@@ -139,7 +67,6 @@ module Pod
|
|
139
67
|
# If target shouldn't build, we copy all the original files
|
140
68
|
# This is for target with only .a and .h files
|
141
69
|
unless target.should_build?
|
142
|
-
Prebuild::Passer.target_names_to_skip_integration_framework << target.name
|
143
70
|
FileUtils.cp_r(root_path, target_folder, :remove_destination => true)
|
144
71
|
next
|
145
72
|
end
|
@@ -170,12 +97,12 @@ module Pod
|
|
170
97
|
all_needed_names.include? name
|
171
98
|
end
|
172
99
|
useless_target_names.each do |name|
|
173
|
-
UI.
|
100
|
+
Pod::UI.message "Remove: #{name}"
|
174
101
|
path = sandbox.framework_folder_path_for_target_name(name)
|
175
102
|
path.rmtree if path.exist?
|
176
103
|
end
|
177
104
|
|
178
|
-
if
|
105
|
+
if PodPrebuild.config.dont_remove_source_code?
|
179
106
|
# just remove the tmp files
|
180
107
|
path = sandbox.root + "Manifest.lock.tmp"
|
181
108
|
path.rmtree if path.exist?
|
@@ -186,12 +113,10 @@ module Pod
|
|
186
113
|
to_delete_files.each { |file| file.rmtree if file.exist? }
|
187
114
|
end
|
188
115
|
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
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
|
+
)
|
195
120
|
end
|
196
121
|
|
197
122
|
def clean_delta_file
|
@@ -212,10 +137,9 @@ module Pod
|
|
212
137
|
metadata.build_settings = pods_project.targets
|
213
138
|
.detect { |native_target| native_target.name == target.name }
|
214
139
|
.build_configurations
|
215
|
-
.detect { |config| config.name ==
|
140
|
+
.detect { |config| config.name == PodPrebuild.config.prebuild_config }
|
216
141
|
.build_settings
|
217
|
-
|
218
|
-
metadata.source_hash = hash unless hash.nil?
|
142
|
+
metadata.source_hash = @lockfile_wrapper && @lockfile_wrapper.dev_pod_hash(target.name)
|
219
143
|
|
220
144
|
# Store root path for code-coverage support later
|
221
145
|
# TODO: update driver code-coverage logic to use path stored here
|
@@ -1,70 +1,9 @@
|
|
1
|
-
require_relative "tool/tool"
|
2
|
-
|
3
1
|
module Pod
|
4
2
|
class Podfile
|
5
3
|
module DSL
|
6
4
|
def config_cocoapods_binary_cache(options)
|
7
|
-
|
8
|
-
|
9
|
-
end
|
10
|
-
|
11
|
-
apply_config.call(:prebuild_config)
|
12
|
-
apply_config.call(:prebuild_all) # TODO (thuyen): Revise this option
|
13
|
-
apply_config.call(:prebuild_all_vendor_pods)
|
14
|
-
apply_config.call(:excluded_pods)
|
15
|
-
apply_config.call(:dev_pods_enabled)
|
16
|
-
apply_config.call(:bitcode_enabled)
|
17
|
-
apply_config.call(:device_build_enabled)
|
18
|
-
apply_config.call(:dont_remove_source_code)
|
19
|
-
apply_config.call(:custom_device_build_options)
|
20
|
-
apply_config.call(:custom_simulator_build_options)
|
21
|
-
apply_config.call(:save_cache_validation_to)
|
22
|
-
apply_config.call(:validate_prebuilt_settings)
|
23
|
-
end
|
24
|
-
|
25
|
-
@prebuild_config = "Debug"
|
26
|
-
@prebuild_job = false
|
27
|
-
@prebuild_all = false
|
28
|
-
@prebuild_all_vendor_pods = false
|
29
|
-
@excluded_pods = Set.new
|
30
|
-
@dev_pods_enabled = false
|
31
|
-
@bitcode_enabled = false
|
32
|
-
@device_build_enabled = false
|
33
|
-
@dont_remove_source_code = false
|
34
|
-
@custom_device_build_options = []
|
35
|
-
@custom_simulator_build_options = []
|
36
|
-
@save_cache_validation_to = nil
|
37
|
-
# A proc to validate the provided build settings (per target) with the build settings of the prebuilt frameworks
|
38
|
-
# For example, in Podfile:
|
39
|
-
# -----------------------------------------------
|
40
|
-
# validate_prebuilt_settings do |target|
|
41
|
-
# settings = {}
|
42
|
-
# settings["MACH_O_TYPE"] == "staticlib"
|
43
|
-
# settings["SWIFT_VERSION"] == swift_version_of(target)
|
44
|
-
# settings
|
45
|
-
# end
|
46
|
-
# -----------------------------------------------
|
47
|
-
@validate_prebuilt_settings = nil
|
48
|
-
|
49
|
-
class << self
|
50
|
-
attr_accessor :prebuild_config
|
51
|
-
attr_accessor :prebuild_job
|
52
|
-
attr_accessor :prebuild_all
|
53
|
-
attr_accessor :prebuild_all_vendor_pods
|
54
|
-
attr_accessor :excluded_pods
|
55
|
-
attr_accessor :dev_pods_enabled
|
56
|
-
attr_accessor :bitcode_enabled
|
57
|
-
attr_accessor :device_build_enabled
|
58
|
-
attr_accessor :dont_remove_source_code
|
59
|
-
attr_accessor :custom_device_build_options
|
60
|
-
attr_accessor :custom_simulator_build_options
|
61
|
-
attr_accessor :save_cache_validation_to
|
62
|
-
attr_accessor :validate_prebuilt_settings
|
63
|
-
|
64
|
-
alias prebuild_job? prebuild_job
|
65
|
-
alias prebuild_all? prebuild_all
|
66
|
-
alias prebuild_all_vendor_pods? prebuild_all_vendor_pods
|
67
|
-
alias dev_pods_enabled? dev_pods_enabled
|
5
|
+
PodPrebuild.config.dsl_config = options
|
6
|
+
PodPrebuild.config.validate_dsl_config
|
68
7
|
end
|
69
8
|
end
|
70
9
|
end
|
@@ -0,0 +1,195 @@
|
|
1
|
+
require_relative "xcodebuild_raw"
|
2
|
+
|
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
|
20
|
+
|
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
|
38
|
+
end
|
39
|
+
|
40
|
+
private
|
41
|
+
|
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
|
50
|
+
|
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] += args_[:default]
|
61
|
+
args_
|
62
|
+
end
|
63
|
+
|
64
|
+
def build_for_sdk(sdk)
|
65
|
+
PodPrebuild::XcodebuildCommand.xcodebuild(
|
66
|
+
sandbox: sandbox,
|
67
|
+
scheme: scheme,
|
68
|
+
targets: targets.map(&:label),
|
69
|
+
configuration: configuration,
|
70
|
+
sdk: sdk,
|
71
|
+
deployment_target: targets.map { |t| t.platform.deployment_target }.max.to_s,
|
72
|
+
args: sdk == simulator ? @build_args[:simulator] : @build_args[:device]
|
73
|
+
)
|
74
|
+
end
|
75
|
+
|
76
|
+
def create_universal_framework(target)
|
77
|
+
merge_framework_binary(target)
|
78
|
+
merge_framework_dsym(target)
|
79
|
+
merge_swift_headers(target)
|
80
|
+
merge_swift_modules(target)
|
81
|
+
end
|
82
|
+
|
83
|
+
def merge_framework_binary(target)
|
84
|
+
merge_contents(target, "/#{target.product_module_name}", &method(:create_fat_binary))
|
85
|
+
end
|
86
|
+
|
87
|
+
def merge_framework_dsym(target)
|
88
|
+
merge_contents(
|
89
|
+
target,
|
90
|
+
".dSYM/Contents/Resources/DWARF/#{target.product_module_name}",
|
91
|
+
&method(:create_fat_binary)
|
92
|
+
)
|
93
|
+
end
|
94
|
+
|
95
|
+
def merge_swift_headers(target)
|
96
|
+
merge_contents(target, "/Headers/#{target.product_module_name}-Swift.h") do |options|
|
97
|
+
merged_header = <<~HEREDOC
|
98
|
+
#if TARGET_OS_SIMULATOR // merged by cocoapods-binary
|
99
|
+
#{File.read(options[:simulator])}
|
100
|
+
#else // merged by cocoapods-binary
|
101
|
+
#{File.read(options[:device])}
|
102
|
+
#endif // merged by cocoapods-binary
|
103
|
+
HEREDOC
|
104
|
+
File.write(options[:output], merged_header.strip)
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
def merge_swift_modules(target)
|
109
|
+
merge_contents(target, "/Modules/#{target.product_module_name}.swiftmodule") do |options|
|
110
|
+
# Note: swiftmodules of `device` were copied beforehand,
|
111
|
+
# here, we only need to copy swiftmodules of `simulator`
|
112
|
+
FileUtils.cp_r(options[:simulator] + "/.", options[:output])
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
def merge_contents(target, path_suffix, &merger)
|
117
|
+
simulator_, device_, output_ = [
|
118
|
+
framework_path_of(target, simulator),
|
119
|
+
framework_path_of(target, device),
|
120
|
+
"#{output_path(target)}/#{target.product_module_name}.framework"
|
121
|
+
].map { |p| p + path_suffix }
|
122
|
+
return unless File.exist?(simulator_) && File.exist?(device_)
|
123
|
+
|
124
|
+
merger.call(simulator: simulator_, device: device_, output: output_)
|
125
|
+
end
|
126
|
+
|
127
|
+
def create_fat_binary(options)
|
128
|
+
cmd = ["lipo", " -create"]
|
129
|
+
cmd << "-output" << options[:output]
|
130
|
+
cmd << options[:simulator] << options[:device]
|
131
|
+
`#{cmd.join(" ")}`
|
132
|
+
end
|
133
|
+
|
134
|
+
def collect_output(target, paths)
|
135
|
+
FileUtils.mkdir_p(output_path(target))
|
136
|
+
paths = [paths] unless paths.is_a?(Array)
|
137
|
+
paths.each do |path|
|
138
|
+
FileUtils.rm_rf(File.join(output_path(target), File.basename(path)))
|
139
|
+
FileUtils.cp_r(path, output_path(target))
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
143
|
+
def target_products_dir_of(target, sdk)
|
144
|
+
"#{build_dir}/#{configuration}-#{sdk}/#{target.name}"
|
145
|
+
end
|
146
|
+
|
147
|
+
def framework_path_of(target, sdk)
|
148
|
+
"#{target_products_dir_of(target, sdk)}/#{target.product_module_name}.framework"
|
149
|
+
end
|
150
|
+
|
151
|
+
def sandbox
|
152
|
+
@options[:sandbox]
|
153
|
+
end
|
154
|
+
|
155
|
+
def build_dir
|
156
|
+
@options[:build_dir]
|
157
|
+
end
|
158
|
+
|
159
|
+
def output_path(target)
|
160
|
+
"#{@options[:output_path]}/#{target.label}"
|
161
|
+
end
|
162
|
+
|
163
|
+
def scheme
|
164
|
+
@options[:scheme]
|
165
|
+
end
|
166
|
+
|
167
|
+
def targets
|
168
|
+
@options[:targets]
|
169
|
+
end
|
170
|
+
|
171
|
+
def configuration
|
172
|
+
@options[:configuration]
|
173
|
+
end
|
174
|
+
|
175
|
+
def bitcode_enabled?
|
176
|
+
@options[:bitcode_enabled]
|
177
|
+
end
|
178
|
+
|
179
|
+
def device_build_enabled?
|
180
|
+
@options[:device_build_enabled]
|
181
|
+
end
|
182
|
+
|
183
|
+
def device
|
184
|
+
@options[:device] || "iphoneos"
|
185
|
+
end
|
186
|
+
|
187
|
+
def simulator
|
188
|
+
@options[:simulator] || "iphonesimulator"
|
189
|
+
end
|
190
|
+
|
191
|
+
def disable_dsym?
|
192
|
+
@options[:disable_dsym]
|
193
|
+
end
|
194
|
+
end
|
195
|
+
end
|