cocoapods-binary-cache 0.1.9 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ffcf342c1552381e28baebabf84a328ee30b744beb832740d04b3125be23f2fe
4
- data.tar.gz: 77d55d695ad65749fe94d2238361ac76b290e7f6873ceec2286b9020f236f804
3
+ metadata.gz: 2d362803909e7c1d6490e6e589706882e9b8b3e1a94c58fb496f790f8a8d41a5
4
+ data.tar.gz: ed54d6a54246ac70cf8b5a55e11d76b407b8e7f75aeaf1dfa863ecd6e15972c5
5
5
  SHA512:
6
- metadata.gz: 00c13ec5a3bbc3df1ea0071cb1a90a91a85eb9a75f8a33853a5b60c4fcaf85dd6c5e3ac8aaaf0a6db6ceeb8e27d19bc6c5ede34b3d68e93cdeb4db2e808233b4
7
- data.tar.gz: a39d29b292d9878fd808fb3aa61c7ae6c1b323b132dfa30810c71d32e3d6089cf80109f23fc1c4f57399df1d187c102ef78f23847ff97635b513a7f42a735702
6
+ metadata.gz: 786d8ae14ca79bd43a4d2a0fda5b56f47bf59d8ba6043855609ad14f8ca18bca5ce5c7f40d121106756bf7cf4882f0b8c158f5f73fffc521c88dcf59f2c81d32
7
+ data.tar.gz: 7f213efbebb1cf27da7ac2794d154f83abb45ec16ae0b81b8f6a510af8e44101ae1b6b10341ac57c07d7ada16161551a42bd2ebd0e7c8680dff3029739d8cc38
@@ -2,13 +2,14 @@ module PodPrebuild
2
2
  class PreInstallHook
3
3
  include ObjectSpace
4
4
 
5
- attr_reader :installer_context, :podfile, :prebuild_sandbox, :cache_validation
5
+ attr_reader :installer_context, :podfile, :prebuild_sandbox, :standard_sandbox, :cache_validation
6
6
 
7
7
  def initialize(installer_context)
8
8
  @installer_context = installer_context
9
9
  @podfile = installer_context.podfile
10
10
  @pod_install_options = {}
11
11
  @prebuild_sandbox = nil
12
+ @standard_sandbox = installer_context.sandbox
12
13
  @cache_validation = nil
13
14
  end
14
15
 
@@ -24,6 +25,7 @@ module PodPrebuild
24
25
  prebuild! if PodPrebuild.config.prebuild_job?
25
26
 
26
27
  PodPrebuild::Env.next_stage!
28
+ prepare_for_integration
27
29
  log_section "🤖 Resume pod installation"
28
30
  require_relative "../pod-binary/integration"
29
31
  end
@@ -51,7 +53,6 @@ module PodPrebuild
51
53
  end
52
54
 
53
55
  def create_prebuild_sandbox
54
- standard_sandbox = installer_context.sandbox
55
56
  @prebuild_sandbox = Pod::PrebuildSandbox.from_standard_sandbox(standard_sandbox)
56
57
  Pod::UI.message "Create prebuild sandbox at #{@prebuild_sandbox.root}"
57
58
  end
@@ -102,6 +103,15 @@ module PodPrebuild
102
103
  end
103
104
  end
104
105
 
106
+ def prepare_for_integration
107
+ # Remove local podspec of external sources so that it downloads sources correctly.
108
+ # Otherwise, with incremental pod installation, CocoaPods downloads the sources
109
+ # based on the `s.source` declaration in the podspecs which are sometimes incorrect.
110
+ PodPrebuild.config.prebuilt_pod_names.each do |name|
111
+ @standard_sandbox.remove_local_podspec(name) if @standard_sandbox.checkout_sources.key?(name)
112
+ end
113
+ end
114
+
105
115
  def log_section(message)
106
116
  Pod::UI.puts "-----------------------------------------"
107
117
  Pod::UI.puts message
@@ -1,39 +1,37 @@
1
1
  require_relative "../../pod-rome/xcodebuild_raw"
2
2
  require_relative "../../pod-rome/xcodebuild_command"
3
3
 
4
- module Pod
5
- class Prebuild
6
- def self.build(options)
7
- targets = options[:targets] || []
8
- return if targets.empty?
4
+ module PodPrebuild
5
+ def self.build(options)
6
+ targets = options[:targets] || []
7
+ return if targets.empty?
9
8
 
10
- options[:sandbox] = Pod::Sandbox.new(Pathname(options[:sandbox])) unless options[:sandbox].is_a?(Pod::Sandbox)
11
- options[:build_dir] = build_dir(options[:sandbox].root)
9
+ options[:sandbox] = Pod::Sandbox.new(Pathname(options[:sandbox])) unless options[:sandbox].is_a?(Pod::Sandbox)
10
+ options[:build_dir] = build_dir(options[:sandbox].root)
12
11
 
13
- case targets[0].platform.name
14
- when :ios, :tvos, :watchos
15
- XcodebuildCommand.new(options).run
16
- when :osx
17
- xcodebuild(
18
- sandbox: options[:sandbox],
19
- targets: targets,
20
- configuration: options[:configuration],
21
- sdk: "macosx",
22
- args: options[:args]
23
- )
24
- else
25
- raise "Unsupported platform for '#{targets[0].name}': '#{targets[0].platform.name}'"
26
- end
27
- raise "The build directory was not found in the expected location" unless options[:build_dir].directory?
12
+ case targets[0].platform.name
13
+ when :ios, :tvos, :watchos
14
+ PodPrebuild::XcodebuildCommand.new(options).run
15
+ when :osx
16
+ xcodebuild(
17
+ sandbox: options[:sandbox],
18
+ targets: targets,
19
+ configuration: options[:configuration],
20
+ sdk: "macosx",
21
+ args: options[:args]
22
+ )
23
+ else
24
+ raise "Unsupported platform for '#{targets[0].name}': '#{targets[0].platform.name}'"
28
25
  end
26
+ raise "The build directory was not found in the expected location" unless options[:build_dir].directory?
27
+ end
29
28
 
30
- def self.remove_build_dir(sandbox_root)
31
- path = build_dir(sandbox_root)
32
- path.rmtree if path.exist?
33
- end
29
+ def self.remove_build_dir(sandbox_root)
30
+ path = build_dir(sandbox_root)
31
+ path.rmtree if path.exist?
32
+ end
34
33
 
35
- def self.build_dir(sandbox_root)
36
- sandbox_root.parent + "build"
37
- end
34
+ def self.build_dir(sandbox_root)
35
+ sandbox_root.parent + "build"
38
36
  end
39
37
  end
@@ -42,8 +42,8 @@ module Pod
42
42
 
43
43
  run_code_gen!(targets)
44
44
 
45
- Pod::Prebuild.remove_build_dir(sandbox_path)
46
- Pod::Prebuild.build(
45
+ PodPrebuild.remove_build_dir(sandbox_path)
46
+ PodPrebuild.build(
47
47
  sandbox: sandbox_path,
48
48
  targets: targets,
49
49
  configuration: PodPrebuild.config.prebuild_config,
@@ -53,7 +53,7 @@ module Pod
53
53
  disable_dsym: PodPrebuild.config.disable_dsym?,
54
54
  args: PodPrebuild.config.build_args
55
55
  )
56
- Pod::Prebuild.remove_build_dir(sandbox_path)
56
+ PodPrebuild.remove_build_dir(sandbox_path)
57
57
 
58
58
  targets.each do |target|
59
59
  collect_metadata(target, sandbox.framework_folder_path_for_target_name(target.name))
@@ -1,189 +1,195 @@
1
1
  require_relative "xcodebuild_raw"
2
2
 
3
- class XcodebuildCommand # rubocop:disable Metrics/ClassLength
4
- def initialize(options)
5
- @options = options
6
- case options[:targets][0].platform.name
7
- when :ios
8
- @options[:device] = "iphoneos"
9
- @options[:simulator] = "iphonesimulator"
10
- when :tvos
11
- @options[:device] = "appletvos"
12
- @options[:simulator] = "appletvsimulator"
13
- when :watchos
14
- @options[:device] = "watchos"
15
- @options[:simulator] = "watchsimulator"
16
- end
17
- @build_args = make_up_build_args(options[:args] || {})
18
- end
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
- def run
21
- build_for_sdk(simulator) if build_types.include?(:simulator)
22
- build_for_sdk(device) if build_types.include?(:device)
23
-
24
- targets.each do |target|
25
- case build_types
26
- when [:simulator]
27
- collect_output(target, Dir[target_products_dir_of(target, simulator) + "/*"])
28
- when [:device]
29
- collect_output(target, Dir[target_products_dir_of(target, device) + "/*"])
30
- else
31
- # When merging contents of `simulator` & `device`, prefer contents of `device` over `simulator`
32
- # https://github.com/grab/cocoapods-binary-cache/issues/25
33
- collect_output(target, Dir[target_products_dir_of(target, device) + "/*"])
34
- create_universal_framework(target)
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
35
37
  end
36
38
  end
37
- end
38
39
 
39
- private
40
+ private
40
41
 
41
- def build_types
42
- @build_types ||= begin
43
- # TODO (thuyen): Add DSL options `build_for_types` to specify build types
44
- types = [:simulator]
45
- types << :device if device_build_enabled?
46
- types
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
47
49
  end
48
- end
49
50
 
50
- def make_up_build_args(args)
51
- args_ = args.clone
52
- args_[:default] ||= []
53
- args_[:simulator] ||= []
54
- args_[:device] ||= []
55
- args_[:default] += ["BITCODE_GENERATION_MODE=bitcode"] if bitcode_enabled?
56
- args_[:default] += ["DEBUG_INFORMATION_FORMAT=dwarf"] if disable_dsym?
57
- args_[:simulator] += ["ARCHS=x86_64", "ONLY_ACTIVE_ARCH=NO"] if simulator == "iphonesimulator"
58
- args_[:simulator] += args_[:default]
59
- args_[:device] += args_[:default]
60
- args_
61
- end
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
62
63
 
63
- def build_for_sdk(sdk)
64
- xcodebuild(
65
- sandbox: sandbox,
66
- scheme: scheme,
67
- targets: targets.map(&:label),
68
- configuration: configuration,
69
- sdk: sdk,
70
- deployment_target: targets.map { |t| t.platform.deployment_target }.max.to_s,
71
- args: sdk == simulator ? @build_args[:simulator] : @build_args[:device]
72
- )
73
- end
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
74
75
 
75
- def create_universal_framework(target)
76
- merge_framework_binary(target)
77
- merge_framework_dsym(target)
78
- merge_swift_headers(target)
79
- merge_swift_modules(target)
80
- end
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
81
82
 
82
- def merge_framework_binary(target)
83
- merge_contents(target, "/#{target.product_module_name}", &method(:create_fat_binary))
84
- end
83
+ def merge_framework_binary(target)
84
+ merge_contents(target, "/#{target.product_module_name}", &method(:create_fat_binary))
85
+ end
85
86
 
86
- def merge_framework_dsym(target)
87
- merge_contents(target, ".dSYM/Contents/Resources/DWARF/#{target.product_module_name}", &method(:create_fat_binary))
88
- end
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
89
94
 
90
- def merge_swift_headers(target)
91
- merge_contents(target, "/Headers/#{target.product_module_name}-Swift.h") do |options|
92
- merged_header = <<~HEREDOC
93
- #if TARGET_OS_SIMULATOR // merged by cocoapods-binary
94
- #{File.read(options[:simulator])}
95
- #else // merged by cocoapods-binary
96
- #{File.read(options[:device])}
97
- #endif // merged by cocoapods-binary
98
- HEREDOC
99
- File.write(options[:output], merged_header.strip)
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
100
106
  end
101
- end
102
107
 
103
- def merge_swift_modules(target)
104
- merge_contents(target, "/Modules/#{target.product_module_name}.swiftmodule") do |options|
105
- # Note: swiftmodules of `device` were copied beforehand,
106
- # here, we only need to copy swiftmodules of `simulator`
107
- FileUtils.cp_r(options[:simulator] + "/.", options[:output])
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
108
114
  end
109
- end
110
115
 
111
- def merge_contents(target, path_suffix, &merger)
112
- simulator_, device_, output_ = [
113
- framework_path_of(target, simulator),
114
- framework_path_of(target, device),
115
- "#{output_path(target)}/#{target.product_module_name}.framework"
116
- ].map { |p| p + path_suffix }
117
- return unless File.exist?(simulator_) && File.exist?(device_)
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_)
118
123
 
119
- merger.call(simulator: simulator_, device: device_, output: output_)
120
- end
124
+ merger.call(simulator: simulator_, device: device_, output: output_)
125
+ end
121
126
 
122
- def create_fat_binary(options)
123
- cmd = ["lipo", " -create"]
124
- cmd << "-output" << options[:output]
125
- cmd << options[:simulator] << options[:device]
126
- `#{cmd.join(" ")}`
127
- end
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
128
133
 
129
- def collect_output(target, paths)
130
- FileUtils.mkdir_p(output_path(target))
131
- paths = [paths] unless paths.is_a?(Array)
132
- paths.each do |path|
133
- FileUtils.rm_rf(File.join(output_path(target), File.basename(path)))
134
- FileUtils.cp_r(path, output_path(target))
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
135
141
  end
136
- end
137
142
 
138
- def target_products_dir_of(target, sdk)
139
- "#{build_dir}/#{configuration}-#{sdk}/#{target.name}"
140
- end
143
+ def target_products_dir_of(target, sdk)
144
+ "#{build_dir}/#{configuration}-#{sdk}/#{target.name}"
145
+ end
141
146
 
142
- def framework_path_of(target, sdk)
143
- "#{target_products_dir_of(target, sdk)}/#{target.product_module_name}.framework"
144
- end
147
+ def framework_path_of(target, sdk)
148
+ "#{target_products_dir_of(target, sdk)}/#{target.product_module_name}.framework"
149
+ end
145
150
 
146
- def sandbox
147
- @options[:sandbox]
148
- end
151
+ def sandbox
152
+ @options[:sandbox]
153
+ end
149
154
 
150
- def build_dir
151
- @options[:build_dir]
152
- end
155
+ def build_dir
156
+ @options[:build_dir]
157
+ end
153
158
 
154
- def output_path(target)
155
- "#{@options[:output_path]}/#{target.label}"
156
- end
159
+ def output_path(target)
160
+ "#{@options[:output_path]}/#{target.label}"
161
+ end
157
162
 
158
- def scheme
159
- @options[:scheme]
160
- end
163
+ def scheme
164
+ @options[:scheme]
165
+ end
161
166
 
162
- def targets
163
- @options[:targets]
164
- end
167
+ def targets
168
+ @options[:targets]
169
+ end
165
170
 
166
- def configuration
167
- @options[:configuration]
168
- end
171
+ def configuration
172
+ @options[:configuration]
173
+ end
169
174
 
170
- def bitcode_enabled?
171
- @options[:bitcode_enabled]
172
- end
175
+ def bitcode_enabled?
176
+ @options[:bitcode_enabled]
177
+ end
173
178
 
174
- def device_build_enabled?
175
- @options[:device_build_enabled]
176
- end
179
+ def device_build_enabled?
180
+ @options[:device_build_enabled]
181
+ end
177
182
 
178
- def device
179
- @options[:device] || "iphoneos"
180
- end
183
+ def device
184
+ @options[:device] || "iphoneos"
185
+ end
181
186
 
182
- def simulator
183
- @options[:simulator] || "iphonesimulator"
184
- end
187
+ def simulator
188
+ @options[:simulator] || "iphonesimulator"
189
+ end
185
190
 
186
- def disable_dsym?
187
- @options[:disable_dsym]
191
+ def disable_dsym?
192
+ @options[:disable_dsym]
193
+ end
188
194
  end
189
195
  end
@@ -1,42 +1,48 @@
1
1
  require "fourflusher"
2
2
 
3
- PLATFORM_OF_SDK = {
4
- "iphonesimulator" => "iOS",
5
- "appletvsimulator" => "tvOS",
6
- "watchsimulator" => "watchOS"
7
- }.freeze
3
+ module PodPrebuild
4
+ class XcodebuildCommand
5
+ PLATFORM_OF_SDK = {
6
+ "iphonesimulator" => "iOS",
7
+ "appletvsimulator" => "tvOS",
8
+ "watchsimulator" => "watchOS"
9
+ }.freeze
8
10
 
9
- def xcodebuild(options)
10
- sdk = options[:sdk] || "iphonesimulator"
11
- targets = options[:targets] || [options[:target]]
12
- platform = PLATFORM_OF_SDK[sdk]
11
+ def self.xcodebuild(options)
12
+ sdk = options[:sdk] || "iphonesimulator"
13
+ targets = options[:targets] || [options[:target]]
14
+ platform = PLATFORM_OF_SDK[sdk]
13
15
 
14
- cmd = ["xcodebuild"]
15
- cmd << "-project" << options[:sandbox].project_path.realdirpath
16
- targets.each { |target| cmd << "-target" << target }
17
- cmd << "-configuration" << options[:configuration]
18
- cmd << "-sdk" << sdk
19
- cmd << Fourflusher::SimControl.new.destination(:oldest, platform, options[:deployment_target]) unless platform.nil?
20
- cmd += options[:args] if options[:args]
21
- cmd << "build"
22
- cmd << "2>&1"
23
- cmd = cmd.join(" ")
16
+ cmd = ["xcodebuild"]
17
+ cmd << "-project" << options[:sandbox].project_path.realdirpath
18
+ targets.each { |target| cmd << "-target" << target }
19
+ cmd << "-configuration" << options[:configuration]
20
+ cmd << "-sdk" << sdk
21
+ unless platform.nil?
22
+ cmd << Fourflusher::SimControl.new.destination(:oldest, platform, options[:deployment_target])
23
+ end
24
+ cmd += options[:args] if options[:args]
25
+ cmd << "build"
26
+ cmd << "2>&1"
27
+ cmd = cmd.join(" ")
24
28
 
25
- Pod::UI.puts_indented "$ #{cmd}"
26
- log = `#{cmd}`
27
- return if $?.exitstatus.zero? # rubocop:disable Style/SpecialGlobalVars
29
+ Pod::UI.puts_indented "$ #{cmd}"
30
+ log = `#{cmd}`
31
+ return if $?.exitstatus.zero? # rubocop:disable Style/SpecialGlobalVars
28
32
 
29
- begin
30
- require "xcpretty" # TODO (thuyen): Revise this dependency
31
- # use xcpretty to print build log
32
- # 64 represent command invalid. http://www.manpagez.com/man/3/sysexits/
33
- printer = XCPretty::Printer.new({:formatter => XCPretty::Simple, :colorize => "auto"})
34
- log.each_line do |line|
35
- printer.pretty_print(line)
33
+ begin
34
+ require "xcpretty" # TODO (thuyen): Revise this dependency
35
+ # use xcpretty to print build log
36
+ # 64 represent command invalid. http://www.manpagez.com/man/3/sysexits/
37
+ printer = XCPretty::Printer.new({:formatter => XCPretty::Simple, :colorize => "auto"})
38
+ log.each_line do |line|
39
+ printer.pretty_print(line)
40
+ end
41
+ rescue
42
+ Pod::UI.puts log.red
43
+ ensure
44
+ raise "Fail to build targets: #{targets}"
45
+ end
36
46
  end
37
- rescue
38
- Pod::UI.puts log.red
39
- ensure
40
- raise "Fail to build targets: #{targets}"
41
47
  end
42
48
  end
@@ -3,6 +3,8 @@ require_relative "../helper/zip"
3
3
 
4
4
  module PodPrebuild
5
5
  class CacheFetcher < CommandExecutor
6
+ attr_reader :cache_branch
7
+
6
8
  def initialize(options)
7
9
  super(options)
8
10
  @cache_branch = options[:cache_branch]
@@ -4,23 +4,23 @@ require_relative "pusher"
4
4
 
5
5
  module PodPrebuild
6
6
  class CachePrebuilder < CommandExecutor
7
+ attr_reader :repo_update, :fetcher, :pusher
8
+
7
9
  def initialize(options)
8
10
  super(options)
9
- @cache_branch = options[:cache_branch]
10
- @push_cache = options[:push_cache]
11
11
  @repo_update = options[:repo_update]
12
- @fetcher = PodPrebuild::CacheFetcher.new(options)
13
- @pusher = PodPrebuild::CachePusher.new(options)
12
+ @fetcher = PodPrebuild::CacheFetcher.new(options) unless options[:no_fetch]
13
+ @pusher = PodPrebuild::CachePusher.new(options) if options[:push_cache]
14
14
  end
15
15
 
16
16
  def run
17
- @fetcher.run
17
+ @fetcher&.run
18
18
  prebuild
19
19
  changes = PodPrebuild::JSONFile.new(@config.prebuild_delta_path)
20
20
  return if changes.empty?
21
21
 
22
22
  sync_cache(changes)
23
- @pusher.run if @push_cache
23
+ @pusher&.run
24
24
  end
25
25
 
26
26
  private
@@ -2,6 +2,8 @@ require_relative "base"
2
2
 
3
3
  module PodPrebuild
4
4
  class CachePusher < CommandExecutor
5
+ attr_reader :cache_branch
6
+
5
7
  def initialize(options)
6
8
  super(options)
7
9
  @cache_branch = options[:cache_branch]
@@ -5,11 +5,14 @@ module Pod
5
5
  class Command
6
6
  class Binary < Command
7
7
  class Prebuild < Binary
8
+ attr_reader :prebuilder
9
+
8
10
  self.arguments = [CLAide::Argument.new("CACHE-BRANCH", false)]
9
11
  def self.options
10
12
  [
11
13
  ["--config", "Config (Debug, Test...) to prebuild"],
12
14
  ["--repo-update", "Update pod repo before installing"],
15
+ ["--no-fetch", "Do not perform a cache fetch beforehand"],
13
16
  ["--push", "Push cache to repo upon completion"],
14
17
  ["--all", "Prebuild all binary pods regardless of cache validation"],
15
18
  ["--targets", "Targets to prebuild. Use comma (,) to specify a list of targets"]
@@ -30,6 +33,7 @@ module Pod
30
33
  config: prebuild_config,
31
34
  cache_branch: argv.shift_argument || "master",
32
35
  repo_update: argv.flag?("repo-update"),
36
+ no_fetch: argv.flag?("fetch") == false,
33
37
  push_cache: argv.flag?("push")
34
38
  )
35
39
  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.9
4
+ version: 0.1.10
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-10-23 00:00:00.000000000 Z
11
+ date: 2020-11-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cocoapods