cocoapods-binary-cache 0.1.1 → 0.1.7
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.rb +0 -2
- data/lib/cocoapods-binary-cache/cache/validator.rb +2 -3
- data/lib/cocoapods-binary-cache/cache/validator_base.rb +28 -8
- data/lib/cocoapods-binary-cache/cache/validator_dependencies_graph.rb +7 -2
- data/lib/cocoapods-binary-cache/cache/validator_dev_pods.rb +21 -13
- data/lib/cocoapods-binary-cache/cache/validator_non_dev_pods.rb +1 -1
- data/lib/cocoapods-binary-cache/diagnosis/base.rb +13 -0
- data/lib/cocoapods-binary-cache/diagnosis/diagnosis.rb +16 -0
- data/lib/cocoapods-binary-cache/diagnosis/integration.rb +21 -0
- data/lib/cocoapods-binary-cache/env.rb +32 -0
- data/lib/cocoapods-binary-cache/helper/checksum.rb +10 -4
- data/lib/cocoapods-binary-cache/helper/lockfile.rb +26 -3
- data/lib/cocoapods-binary-cache/helper/podspec.rb +1 -0
- data/lib/cocoapods-binary-cache/hooks/post_install.rb +19 -2
- data/lib/cocoapods-binary-cache/hooks/pre_install.rb +11 -14
- data/lib/cocoapods-binary-cache/main.rb +2 -1
- data/lib/cocoapods-binary-cache/pod-binary/helper/build.rb +39 -0
- data/lib/cocoapods-binary-cache/pod-binary/helper/detected_prebuilt_pods/installer.rb +1 -1
- data/lib/cocoapods-binary-cache/pod-binary/helper/detected_prebuilt_pods/target_definition.rb +3 -10
- data/lib/cocoapods-binary-cache/pod-binary/helper/feature_switches.rb +0 -38
- data/lib/cocoapods-binary-cache/pod-binary/helper/names.rb +2 -11
- data/lib/cocoapods-binary-cache/pod-binary/helper/prebuild_sandbox.rb +1 -2
- data/lib/cocoapods-binary-cache/pod-binary/integration.rb +0 -1
- data/lib/cocoapods-binary-cache/pod-binary/integration/alter_specs.rb +4 -1
- data/lib/cocoapods-binary-cache/pod-binary/integration/patch/source_installation.rb +5 -2
- data/lib/cocoapods-binary-cache/pod-binary/integration/remove_target_files.rb +2 -2
- data/lib/cocoapods-binary-cache/pod-binary/integration/source_installer.rb +42 -50
- data/lib/cocoapods-binary-cache/pod-binary/prebuild.rb +59 -47
- data/lib/cocoapods-binary-cache/pod-binary/prebuild_dsl.rb +2 -59
- data/lib/cocoapods-binary-cache/pod-rome/xcodebuild_command.rb +176 -0
- data/lib/cocoapods-binary-cache/pod-rome/xcodebuild_raw.rb +43 -0
- data/lib/cocoapods-binary-cache/prebuild_output/metadata.rb +16 -0
- data/lib/cocoapods-binary-cache/prebuild_output/output.rb +8 -37
- data/lib/cocoapods-binary-cache/scheme_editor.rb +1 -1
- data/lib/command/binary.rb +21 -2
- data/lib/command/config.rb +150 -9
- data/lib/command/executor/fetcher.rb +10 -5
- data/lib/command/executor/prebuilder.rb +2 -1
- data/lib/command/executor/pusher.rb +1 -1
- data/lib/command/fetch.rb +0 -1
- data/lib/command/helper/zip.rb +1 -1
- data/lib/command/prebuild.rb +14 -2
- data/lib/command/push.rb +22 -0
- metadata +19 -14
- data/lib/cocoapods-binary-cache/gem_version.rb +0 -6
- data/lib/cocoapods-binary-cache/pod-rome/build_framework.rb +0 -247
- data/lib/cocoapods-binary-cache/prebuild_cache.rb +0 -49
|
@@ -22,7 +22,7 @@ module PodPrebuild
|
|
|
22
22
|
if Dir.exist?(dest_dir + "/.git")
|
|
23
23
|
git("fetch origin #{branch}")
|
|
24
24
|
git("checkout -f FETCH_HEAD", ignore_output: true)
|
|
25
|
-
git("branch -D #{branch}
|
|
25
|
+
git("branch -D #{branch}", ignore_output: true, can_fail: true)
|
|
26
26
|
git("checkout -b #{branch}")
|
|
27
27
|
else
|
|
28
28
|
FileUtils.rm_rf(dest_dir)
|
|
@@ -31,11 +31,16 @@ module PodPrebuild
|
|
|
31
31
|
end
|
|
32
32
|
|
|
33
33
|
def unzip_cache
|
|
34
|
-
Pod::UI.puts "Unzipping cache: #{@config.cache_path} -> #{@config.
|
|
35
|
-
FileUtils.rm_rf(@config.
|
|
36
|
-
FileUtils.mkdir_p(@config.
|
|
34
|
+
Pod::UI.puts "Unzipping cache: #{@config.cache_path} -> #{@config.prebuild_sandbox_path}".green
|
|
35
|
+
FileUtils.rm_rf(@config.prebuild_sandbox_path)
|
|
36
|
+
FileUtils.mkdir_p(@config.prebuild_sandbox_path)
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
if File.exist?(@config.manifest_path(in_cache: true))
|
|
39
|
+
FileUtils.cp(
|
|
40
|
+
@config.manifest_path(in_cache: true),
|
|
41
|
+
@config.manifest_path
|
|
42
|
+
)
|
|
43
|
+
end
|
|
39
44
|
Dir[@config.generated_frameworks_dir(in_cache: true) + "/*.zip"].each do |path|
|
|
40
45
|
ZipUtils.unzip(path, to_dir: @config.generated_frameworks_dir)
|
|
41
46
|
end
|
|
@@ -15,7 +15,7 @@ module PodPrebuild
|
|
|
15
15
|
def run
|
|
16
16
|
@fetcher.run
|
|
17
17
|
prebuild
|
|
18
|
-
changes = PodPrebuild::JSONFile.new(@config.
|
|
18
|
+
changes = PodPrebuild::JSONFile.new(@config.prebuild_delta_path)
|
|
19
19
|
return if changes.empty?
|
|
20
20
|
|
|
21
21
|
sync_cache(changes)
|
|
@@ -39,6 +39,7 @@ module PodPrebuild
|
|
|
39
39
|
end
|
|
40
40
|
|
|
41
41
|
def zip_to_cache(pods_to_update)
|
|
42
|
+
FileUtils.mkdir_p(@config.generated_frameworks_dir(in_cache: true))
|
|
42
43
|
pods_to_update.each do |pod|
|
|
43
44
|
Pod::UI.puts "- Update cache: #{pod}"
|
|
44
45
|
ZipUtils.zip(
|
data/lib/command/fetch.rb
CHANGED
data/lib/command/helper/zip.rb
CHANGED
|
@@ -5,7 +5,7 @@ module PodPrebuild
|
|
|
5
5
|
out_path = to_dir.nil? ? "#{basename}.zip" : "#{to_dir}/#{basename}.zip"
|
|
6
6
|
cmd = []
|
|
7
7
|
cmd << "cd" << File.dirname(path)
|
|
8
|
-
cmd << "&& zip --symlinks" << out_path << basename
|
|
8
|
+
cmd << "&& zip -r --symlinks" << out_path << basename
|
|
9
9
|
cmd << "&& cd -"
|
|
10
10
|
`#{cmd.join(" ")}`
|
|
11
11
|
end
|
data/lib/command/prebuild.rb
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
require_relative "executor/prebuilder"
|
|
2
|
+
require_relative "../cocoapods-binary-cache/pod-binary/prebuild_dsl"
|
|
2
3
|
|
|
3
4
|
module Pod
|
|
4
5
|
class Command
|
|
@@ -7,12 +8,23 @@ module Pod
|
|
|
7
8
|
self.arguments = [CLAide::Argument.new("CACHE-BRANCH", false)]
|
|
8
9
|
def self.options
|
|
9
10
|
[
|
|
10
|
-
["--
|
|
11
|
-
|
|
11
|
+
["--config", "Config (Debug, Test...) to prebuild"],
|
|
12
|
+
["--push", "Push cache to repo upon completion"],
|
|
13
|
+
["--all", "Prebuild all binary pods regardless of cache validation"],
|
|
14
|
+
["--targets", "Targets to prebuild. Use comma (,) to specify a list of targets"]
|
|
15
|
+
].concat(super)
|
|
12
16
|
end
|
|
13
17
|
|
|
14
18
|
def initialize(argv)
|
|
15
19
|
super
|
|
20
|
+
prebuild_all_pods = argv.flag?("all")
|
|
21
|
+
prebuild_targets = argv.option("targets", "").split(",")
|
|
22
|
+
update_cli_config(
|
|
23
|
+
:prebuild_job => true,
|
|
24
|
+
:prebuild_all_pods => prebuild_all_pods,
|
|
25
|
+
:prebuild_config => argv.option("config")
|
|
26
|
+
)
|
|
27
|
+
update_cli_config(:prebuild_targets => prebuild_targets) unless prebuild_all_pods
|
|
16
28
|
@prebuilder = PodPrebuild::CachePrebuilder.new(
|
|
17
29
|
config: prebuild_config,
|
|
18
30
|
cache_branch: argv.shift_argument || "master",
|
data/lib/command/push.rb
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
require_relative "executor/pusher"
|
|
2
|
+
|
|
3
|
+
module Pod
|
|
4
|
+
class Command
|
|
5
|
+
class Binary < Command
|
|
6
|
+
class Push < Binary
|
|
7
|
+
self.arguments = [CLAide::Argument.new("CACHE-BRANCH", false)]
|
|
8
|
+
def initialize(argv)
|
|
9
|
+
super
|
|
10
|
+
@pusher = PodPrebuild::CachePusher.new(
|
|
11
|
+
config: prebuild_config,
|
|
12
|
+
cache_branch: argv.shift_argument || "master"
|
|
13
|
+
)
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def run
|
|
17
|
+
@pusher.run
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: cocoapods-binary-cache
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.7
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Bang Nguyen
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2020-
|
|
11
|
+
date: 2020-09-18 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: cocoapods
|
|
@@ -39,45 +39,45 @@ dependencies:
|
|
|
39
39
|
- !ruby/object:Gem::Version
|
|
40
40
|
version: '2.0'
|
|
41
41
|
- !ruby/object:Gem::Dependency
|
|
42
|
-
name:
|
|
42
|
+
name: rgl
|
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
|
44
44
|
requirements:
|
|
45
45
|
- - "~>"
|
|
46
46
|
- !ruby/object:Gem::Version
|
|
47
|
-
version: 0.
|
|
47
|
+
version: 0.5.6
|
|
48
48
|
type: :runtime
|
|
49
49
|
prerelease: false
|
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
|
51
51
|
requirements:
|
|
52
52
|
- - "~>"
|
|
53
53
|
- !ruby/object:Gem::Version
|
|
54
|
-
version: 0.
|
|
54
|
+
version: 0.5.6
|
|
55
55
|
- !ruby/object:Gem::Dependency
|
|
56
|
-
name:
|
|
56
|
+
name: xcpretty
|
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
|
58
58
|
requirements:
|
|
59
59
|
- - "~>"
|
|
60
60
|
- !ruby/object:Gem::Version
|
|
61
|
-
version: 0.
|
|
61
|
+
version: 0.3.0
|
|
62
62
|
type: :runtime
|
|
63
63
|
prerelease: false
|
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
|
65
65
|
requirements:
|
|
66
66
|
- - "~>"
|
|
67
67
|
- !ruby/object:Gem::Version
|
|
68
|
-
version: 0.
|
|
68
|
+
version: 0.3.0
|
|
69
69
|
- !ruby/object:Gem::Dependency
|
|
70
70
|
name: bundler
|
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
|
72
72
|
requirements:
|
|
73
|
-
- - "
|
|
73
|
+
- - ">="
|
|
74
74
|
- !ruby/object:Gem::Version
|
|
75
75
|
version: '1.3'
|
|
76
76
|
type: :development
|
|
77
77
|
prerelease: false
|
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
|
79
79
|
requirements:
|
|
80
|
-
- - "
|
|
80
|
+
- - ">="
|
|
81
81
|
- !ruby/object:Gem::Version
|
|
82
82
|
version: '1.3'
|
|
83
83
|
- !ruby/object:Gem::Dependency
|
|
@@ -115,7 +115,10 @@ files:
|
|
|
115
115
|
- lib/cocoapods-binary-cache/cache/validator_with_podfile.rb
|
|
116
116
|
- lib/cocoapods-binary-cache/dependencies_graph/dependencies_graph.rb
|
|
117
117
|
- lib/cocoapods-binary-cache/dependencies_graph/graph_visualizer.rb
|
|
118
|
-
- lib/cocoapods-binary-cache/
|
|
118
|
+
- lib/cocoapods-binary-cache/diagnosis/base.rb
|
|
119
|
+
- lib/cocoapods-binary-cache/diagnosis/diagnosis.rb
|
|
120
|
+
- lib/cocoapods-binary-cache/diagnosis/integration.rb
|
|
121
|
+
- lib/cocoapods-binary-cache/env.rb
|
|
119
122
|
- lib/cocoapods-binary-cache/helper/benchmark_show.rb
|
|
120
123
|
- lib/cocoapods-binary-cache/helper/checksum.rb
|
|
121
124
|
- lib/cocoapods-binary-cache/helper/json.rb
|
|
@@ -126,6 +129,7 @@ files:
|
|
|
126
129
|
- lib/cocoapods-binary-cache/hooks/pre_install.rb
|
|
127
130
|
- lib/cocoapods-binary-cache/main.rb
|
|
128
131
|
- lib/cocoapods-binary-cache/pod-binary/LICENSE.txt
|
|
132
|
+
- lib/cocoapods-binary-cache/pod-binary/helper/build.rb
|
|
129
133
|
- lib/cocoapods-binary-cache/pod-binary/helper/detected_prebuilt_pods/installer.rb
|
|
130
134
|
- lib/cocoapods-binary-cache/pod-binary/helper/detected_prebuilt_pods/target_definition.rb
|
|
131
135
|
- lib/cocoapods-binary-cache/pod-binary/helper/feature_switches.rb
|
|
@@ -147,8 +151,8 @@ files:
|
|
|
147
151
|
- lib/cocoapods-binary-cache/pod-binary/prebuild_hook.rb
|
|
148
152
|
- lib/cocoapods-binary-cache/pod-binary/tool/tool.rb
|
|
149
153
|
- lib/cocoapods-binary-cache/pod-rome/LICENSE.txt
|
|
150
|
-
- lib/cocoapods-binary-cache/pod-rome/
|
|
151
|
-
- lib/cocoapods-binary-cache/
|
|
154
|
+
- lib/cocoapods-binary-cache/pod-rome/xcodebuild_command.rb
|
|
155
|
+
- lib/cocoapods-binary-cache/pod-rome/xcodebuild_raw.rb
|
|
152
156
|
- lib/cocoapods-binary-cache/prebuild_output/metadata.rb
|
|
153
157
|
- lib/cocoapods-binary-cache/prebuild_output/output.rb
|
|
154
158
|
- lib/cocoapods-binary-cache/scheme_editor.rb
|
|
@@ -165,6 +169,7 @@ files:
|
|
|
165
169
|
- lib/command/fetch.rb
|
|
166
170
|
- lib/command/helper/zip.rb
|
|
167
171
|
- lib/command/prebuild.rb
|
|
172
|
+
- lib/command/push.rb
|
|
168
173
|
- lib/command/visualize.rb
|
|
169
174
|
homepage: https://github.com/grab/cocoapods-binary-cache
|
|
170
175
|
licenses:
|
|
@@ -185,7 +190,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
185
190
|
- !ruby/object:Gem::Version
|
|
186
191
|
version: '0'
|
|
187
192
|
requirements: []
|
|
188
|
-
rubygems_version: 3.0.
|
|
193
|
+
rubygems_version: 3.0.3
|
|
189
194
|
signing_key:
|
|
190
195
|
specification_version: 4
|
|
191
196
|
summary: Reduce build time by building pod frameworks and cache to remote storage,
|
|
@@ -1,247 +0,0 @@
|
|
|
1
|
-
require 'fourflusher'
|
|
2
|
-
require 'xcpretty' # TODO (thuyen): Revise this dependency
|
|
3
|
-
|
|
4
|
-
PLATFORMS = { 'iphonesimulator' => 'iOS',
|
|
5
|
-
'appletvsimulator' => 'tvOS',
|
|
6
|
-
'watchsimulator' => 'watchOS' }
|
|
7
|
-
|
|
8
|
-
# Build specific target to framework file
|
|
9
|
-
# @param [PodTarget] target
|
|
10
|
-
# a specific pod target
|
|
11
|
-
#
|
|
12
|
-
def build_for_iosish_platform(sandbox,
|
|
13
|
-
build_dir,
|
|
14
|
-
output_path,
|
|
15
|
-
target,
|
|
16
|
-
configuration,
|
|
17
|
-
device,
|
|
18
|
-
simulator,
|
|
19
|
-
bitcode_enabled,
|
|
20
|
-
custom_build_options = [], # Array<String>
|
|
21
|
-
custom_build_options_simulator = [], # Array<String>
|
|
22
|
-
enable_device_build = false
|
|
23
|
-
)
|
|
24
|
-
|
|
25
|
-
deployment_target = target.platform.deployment_target.to_s
|
|
26
|
-
|
|
27
|
-
target_label = target.label # name with platform if it's used in multiple platforms
|
|
28
|
-
Pod::UI.puts "Prebuilding #{target_label}..."
|
|
29
|
-
|
|
30
|
-
other_options = []
|
|
31
|
-
# bitcode enabled
|
|
32
|
-
other_options += ['BITCODE_GENERATION_MODE=bitcode'] if bitcode_enabled
|
|
33
|
-
# make less arch to iphone simulator for faster build
|
|
34
|
-
custom_build_options_simulator += ['ARCHS=x86_64', 'ONLY_ACTIVE_ARCH=NO'] if simulator == 'iphonesimulator'
|
|
35
|
-
|
|
36
|
-
# paths
|
|
37
|
-
target_name = target.name # equals target.label, like "AFNeworking-iOS" when AFNetworking is used in multiple platforms.
|
|
38
|
-
module_name = target.product_module_name
|
|
39
|
-
device_framework_path = "#{build_dir}/#{configuration}-#{device}/#{target_name}/#{module_name}.framework"
|
|
40
|
-
simulator_framework_path = "#{build_dir}/#{configuration}-#{simulator}/#{target_name}/#{module_name}.framework"
|
|
41
|
-
simulator_target_products_path = "#{build_dir}/#{configuration}-#{simulator}/#{target_name}"
|
|
42
|
-
|
|
43
|
-
if !Dir.exist?(simulator_framework_path)
|
|
44
|
-
is_succeed, = xcodebuild(
|
|
45
|
-
sandbox,
|
|
46
|
-
target_label,
|
|
47
|
-
configuration,
|
|
48
|
-
simulator,
|
|
49
|
-
deployment_target,
|
|
50
|
-
other_options + custom_build_options_simulator
|
|
51
|
-
)
|
|
52
|
-
raise "Build simulator framework failed: #{target_label}" unless is_succeed
|
|
53
|
-
else
|
|
54
|
-
puts "Simulator framework already exist at: #{simulator_framework_path}"
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
unless enable_device_build
|
|
58
|
-
FileUtils.cp_r Dir["#{simulator_target_products_path}/*"], output_path
|
|
59
|
-
return
|
|
60
|
-
end
|
|
61
|
-
|
|
62
|
-
if !Dir.exist?(device_framework_path)
|
|
63
|
-
is_succeed, = xcodebuild(
|
|
64
|
-
sandbox,
|
|
65
|
-
target_label,
|
|
66
|
-
configuration,
|
|
67
|
-
device,
|
|
68
|
-
deployment_target,
|
|
69
|
-
other_options + custom_build_options
|
|
70
|
-
)
|
|
71
|
-
raise "Build device framework failed: #{target_label}" unless is_succeed
|
|
72
|
-
else
|
|
73
|
-
puts "Device framework already exist at: #{device_framework_path}"
|
|
74
|
-
end
|
|
75
|
-
|
|
76
|
-
device_binary = device_framework_path + "/#{module_name}"
|
|
77
|
-
simulator_binary = simulator_framework_path + "/#{module_name}"
|
|
78
|
-
return unless File.file?(device_binary) && File.file?(simulator_binary)
|
|
79
|
-
|
|
80
|
-
# the device_lib path is the final output file path
|
|
81
|
-
# combine the binaries
|
|
82
|
-
tmp_lipoed_binary_path = "#{build_dir}/#{target_name}"
|
|
83
|
-
lipo_log = `lipo -create -output #{tmp_lipoed_binary_path} #{device_binary} #{simulator_binary}`
|
|
84
|
-
puts lipo_log unless File.exist?(tmp_lipoed_binary_path)
|
|
85
|
-
FileUtils.mv tmp_lipoed_binary_path, device_binary, :force => true
|
|
86
|
-
|
|
87
|
-
# collect the swiftmodule file for various archs.
|
|
88
|
-
device_swiftmodule_path = device_framework_path + "/Modules/#{module_name}.swiftmodule"
|
|
89
|
-
simulator_swiftmodule_path = simulator_framework_path + "/Modules/#{module_name}.swiftmodule"
|
|
90
|
-
if File.exist?(device_swiftmodule_path)
|
|
91
|
-
FileUtils.cp_r simulator_swiftmodule_path + "/.", device_swiftmodule_path
|
|
92
|
-
end
|
|
93
|
-
|
|
94
|
-
# combine the generated swift headers
|
|
95
|
-
# (In xcode 10.2, the generated swift headers vary for each archs)
|
|
96
|
-
# https://github.com/leavez/cocoapods-binary/issues/58
|
|
97
|
-
simulator_generated_swift_header_path = simulator_framework_path + "/Headers/#{module_name}-Swift.h"
|
|
98
|
-
device_generated_swift_header_path = device_framework_path + "/Headers/#{module_name}-Swift.h"
|
|
99
|
-
if File.exist? simulator_generated_swift_header_path
|
|
100
|
-
device_header = File.read(device_generated_swift_header_path)
|
|
101
|
-
simulator_header = File.read(simulator_generated_swift_header_path)
|
|
102
|
-
# https://github.com/Carthage/Carthage/issues/2718#issuecomment-473870461
|
|
103
|
-
combined_header_content = %Q{
|
|
104
|
-
#if TARGET_OS_SIMULATOR // merged by cocoapods-binary
|
|
105
|
-
|
|
106
|
-
#{simulator_header}
|
|
107
|
-
|
|
108
|
-
#else // merged by cocoapods-binary
|
|
109
|
-
|
|
110
|
-
#{device_header}
|
|
111
|
-
|
|
112
|
-
#endif // merged by cocoapods-binary
|
|
113
|
-
}
|
|
114
|
-
File.write(device_generated_swift_header_path, combined_header_content.strip)
|
|
115
|
-
end
|
|
116
|
-
|
|
117
|
-
# handle the dSYM files
|
|
118
|
-
device_dsym = "#{device_framework_path}.dSYM"
|
|
119
|
-
if File.exist? device_dsym
|
|
120
|
-
# lipo the simulator dsym
|
|
121
|
-
simulator_dsym = "#{simulator_framework_path}.dSYM"
|
|
122
|
-
if File.exist? simulator_dsym
|
|
123
|
-
tmp_lipoed_binary_path = "#{output_path}/#{module_name}.draft"
|
|
124
|
-
lipo_log = `lipo -create -output #{tmp_lipoed_binary_path} #{device_dsym}/Contents/Resources/DWARF/#{module_name} #{simulator_dsym}/Contents/Resources/DWARF/#{module_name}`
|
|
125
|
-
puts lipo_log unless File.exist?(tmp_lipoed_binary_path)
|
|
126
|
-
FileUtils.mv tmp_lipoed_binary_path, "#{device_framework_path}.dSYM/Contents/Resources/DWARF/#{module_name}", :force => true
|
|
127
|
-
end
|
|
128
|
-
# move
|
|
129
|
-
FileUtils.mv device_dsym, output_path, :force => true
|
|
130
|
-
end
|
|
131
|
-
|
|
132
|
-
# output
|
|
133
|
-
output_path.mkpath unless output_path.exist?
|
|
134
|
-
FileUtils.mv device_framework_path, output_path, :force => true
|
|
135
|
-
|
|
136
|
-
end
|
|
137
|
-
|
|
138
|
-
def xcodebuild(sandbox, target, configuration, sdk='macosx', deployment_target=nil, other_options=[])
|
|
139
|
-
args = %W(-project #{sandbox.project_path.realdirpath} -scheme #{target} -configuration #{configuration} -sdk #{sdk} )
|
|
140
|
-
platform = PLATFORMS[sdk]
|
|
141
|
-
args += Fourflusher::SimControl.new.destination(:oldest, platform, deployment_target) unless platform.nil?
|
|
142
|
-
args += other_options
|
|
143
|
-
|
|
144
|
-
args_str = args.join(" ")
|
|
145
|
-
cmd = "xcodebuild #{args_str} 2>&1"
|
|
146
|
-
puts "xcodebuild command: #{cmd}"
|
|
147
|
-
log = `#{cmd}`
|
|
148
|
-
|
|
149
|
-
exit_code = $?.exitstatus # Process::Status
|
|
150
|
-
is_succeed = (exit_code == 0)
|
|
151
|
-
|
|
152
|
-
if !is_succeed
|
|
153
|
-
begin
|
|
154
|
-
if log.include?('** BUILD FAILED **')
|
|
155
|
-
# use xcpretty to print build log
|
|
156
|
-
# 64 represent command invalid. http://www.manpagez.com/man/3/sysexits/
|
|
157
|
-
printer = XCPretty::Printer.new({:formatter => XCPretty::Simple, :colorize => 'auto'})
|
|
158
|
-
log.each_line do |line|
|
|
159
|
-
printer.pretty_print(line)
|
|
160
|
-
end
|
|
161
|
-
else
|
|
162
|
-
raise "shouldn't be handle by xcpretty"
|
|
163
|
-
end
|
|
164
|
-
rescue
|
|
165
|
-
puts log.red
|
|
166
|
-
end
|
|
167
|
-
end
|
|
168
|
-
[is_succeed, log]
|
|
169
|
-
end
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
module Pod
|
|
174
|
-
class Prebuild
|
|
175
|
-
|
|
176
|
-
# Build the frameworks with sandbox and targets
|
|
177
|
-
#
|
|
178
|
-
# @param [String] sandbox_root_path
|
|
179
|
-
# The sandbox root path where the targets project place
|
|
180
|
-
#
|
|
181
|
-
# [PodTarget] target
|
|
182
|
-
# The pod targets to build
|
|
183
|
-
#
|
|
184
|
-
# [Pathname] output_path
|
|
185
|
-
# output path for generated frameworks
|
|
186
|
-
#
|
|
187
|
-
def self.build(sandbox_root_path, target, configuration, output_path, bitcode_enabled = false, custom_build_options=[], custom_build_options_simulator=[])
|
|
188
|
-
return if target.nil?
|
|
189
|
-
|
|
190
|
-
sandbox_root = Pathname(sandbox_root_path)
|
|
191
|
-
sandbox = Pod::Sandbox.new(sandbox_root)
|
|
192
|
-
build_dir = self.build_dir(sandbox_root)
|
|
193
|
-
|
|
194
|
-
# -- build the framework
|
|
195
|
-
case target.platform.name
|
|
196
|
-
when :ios
|
|
197
|
-
build_for_iosish_platform(
|
|
198
|
-
sandbox,
|
|
199
|
-
build_dir,
|
|
200
|
-
output_path,
|
|
201
|
-
target,
|
|
202
|
-
configuration,
|
|
203
|
-
"iphoneos",
|
|
204
|
-
"iphonesimulator",
|
|
205
|
-
bitcode_enabled,
|
|
206
|
-
custom_build_options,
|
|
207
|
-
custom_build_options_simulator
|
|
208
|
-
)
|
|
209
|
-
when :osx
|
|
210
|
-
xcodebuild(
|
|
211
|
-
sandbox,
|
|
212
|
-
target.label,
|
|
213
|
-
configuration,
|
|
214
|
-
"macosx",
|
|
215
|
-
nil,
|
|
216
|
-
custom_build_options
|
|
217
|
-
)
|
|
218
|
-
# when :tvos then build_for_iosish_platform(sandbox, build_dir, target, 'appletvos', 'appletvsimulator')
|
|
219
|
-
when :watchos
|
|
220
|
-
build_for_iosish_platform(
|
|
221
|
-
sandbox,
|
|
222
|
-
build_dir,
|
|
223
|
-
output_path,
|
|
224
|
-
target,
|
|
225
|
-
configuration,
|
|
226
|
-
"watchos",
|
|
227
|
-
"watchsimulator",
|
|
228
|
-
true,
|
|
229
|
-
custom_build_options,
|
|
230
|
-
custom_build_options_simulator
|
|
231
|
-
)
|
|
232
|
-
else raise "Unsupported platform for '#{target.name}': '#{target.platform.name}'" end
|
|
233
|
-
|
|
234
|
-
raise Pod::Informative, "The build directory was not found in the expected location" unless build_dir.directory?
|
|
235
|
-
end
|
|
236
|
-
|
|
237
|
-
def self.remove_build_dir(sandbox_root)
|
|
238
|
-
path = build_dir(sandbox_root)
|
|
239
|
-
path.rmtree if path.exist?
|
|
240
|
-
end
|
|
241
|
-
|
|
242
|
-
def self.build_dir(sandbox_root)
|
|
243
|
-
sandbox_root.parent + "build"
|
|
244
|
-
end
|
|
245
|
-
|
|
246
|
-
end
|
|
247
|
-
end
|