cocoapods-xcremotecache 0.0.2 → 0.0.6

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: 359dfd9fb48e07a331b72fa8577d2405ef314f74da80e70a10ba1b215dce31ca
4
- data.tar.gz: b6fe29ac1c506afdf58a6371f43f6f956b110ee1e5e55e2c489241032e349d8b
3
+ metadata.gz: b5729278f5bfda276e8d0ea6c3a240e7292dbe0c91530f1de8ea925ef5aeb9c6
4
+ data.tar.gz: 6188f57eceb4c204fdccf41e0fe3d6fcca38bf942c4f84ed2524943c16a1b73b
5
5
  SHA512:
6
- metadata.gz: 1695e333fc0c7e93513271cd62297579acd0f5f3ced03ff610942969ce631186538b7265e4b29408219974b2ac53f4ca17c514522a9ee7315c6822dfb7d09a62
7
- data.tar.gz: 480b2222e66937897e1a5e9157bde4985a9a9531301d76906553e3c7ac5856b04d417224d428ded3cc4b3cf9bc5a044f461471afaacb14f63ed4f214d73ff543
6
+ metadata.gz: ca3f2d700a3522a8c26599f1f70ff2539713e44c8cd0fafbdf6041dff6aeb25b88d3cfb117099fd35bc290fd052380d67ddcbcc59443b05cb97cbe01f71575b3
7
+ data.tar.gz: b737a9f5591f86ea1234c812f07010cf18a80cf4ad4497f5da9b9f3812e3e5b3961468743f40b4478bee48e9543fe4fb776548bb720992cf630df746cf7ded32
data/README.md CHANGED
@@ -4,6 +4,14 @@ The CocoaPods plugin that integrates XCRemoteCache with the project.
4
4
 
5
5
  ## Installation
6
6
 
7
+ ### Using RubyGems
8
+
9
+ ```bash
10
+ gem install cocoapods-xcremotecache
11
+ ```
12
+
13
+ ### From sources
14
+
7
15
  Build & install the plugin
8
16
 
9
17
  ```bash
@@ -44,6 +52,8 @@ An object that is passed to the `xcremotecache` can contain all properties suppo
44
52
  | `modify_lldb_init` | Controls if the pod integration should modify `~/.lldbinit` | `true` | ⬜️ |
45
53
  | `xccc_file` | The path where should be placed the `xccc` binary (in the pod installation phase) | `{podfile_dir}/.rc/xccc` | ⬜️ |
46
54
  | `remote_commit_file` | The path of the file with the remote commit sha (in the pod installation phase) | `{podfile_dir}/.rc/arc.rc`| ⬜️ |
55
+ | `prettify_meta_files` | A Boolean value that opts-in pretty JSON formatting for meta files | `false` | ⬜️ |
56
+ | `disable_certificate_verification` | A Boolean value that opts-in SSL certificate validation is disabled | `false` | ⬜️ |
47
57
 
48
58
  ## Uninstalling
49
59
 
@@ -52,3 +62,7 @@ To fully uninstall the plugin, call:
52
62
  ```bash
53
63
  gem uninstall cocoapods-xcremotecache
54
64
  ```
65
+
66
+ ## Limitations
67
+
68
+ * When `generate_multiple_pod_projects` mode is enabled, only first-party targets are cached by XCRemoteCache (all dependencies are compiled locally).
@@ -17,6 +17,7 @@ require 'cocoapods/resolver'
17
17
  require 'open-uri'
18
18
  require 'yaml'
19
19
  require 'json'
20
+ require 'pathname'
20
21
 
21
22
 
22
23
  module CocoapodsXCRemoteCacheModifier
@@ -28,6 +29,7 @@ module CocoapodsXCRemoteCacheModifier
28
29
  LLDB_INIT_PATH = "#{ENV['HOME']}/.lldbinit"
29
30
  FAT_ARCHIVE_NAME_INFIX = 'arm64-x86_64'
30
31
 
32
+ # List of plugins' user properties that should be copied to .rcinfo
31
33
  CUSTOM_CONFIGURATION_KEYS = [
32
34
  'enabled',
33
35
  'xcrc_location',
@@ -36,7 +38,9 @@ module CocoapodsXCRemoteCacheModifier
36
38
  'final_target',
37
39
  'check_build_configuration',
38
40
  'check_platform',
39
- 'modify_lldb_init'
41
+ 'modify_lldb_init',
42
+ 'prettify_meta_files',
43
+ 'disable_certificate_verification'
40
44
  ]
41
45
 
42
46
  class XCRemoteCache
@@ -46,18 +50,20 @@ module CocoapodsXCRemoteCacheModifier
46
50
  @@configuration = c
47
51
  end
48
52
 
49
- def self.set_configuration_default_values(user_proj_directory)
53
+ def self.set_configuration_default_values
50
54
  default_values = {
51
55
  'mode' => 'consumer',
52
56
  'enabled' => true,
53
- 'xcrc_location' => "#{user_proj_directory}/XCRC",
57
+ 'xcrc_location' => "XCRC",
54
58
  'exclude_build_configurations' => [],
55
59
  'check_build_configuration' => 'Debug',
56
60
  'check_platform' => 'iphonesimulator',
57
61
  'modify_lldb_init' => true,
58
- 'xccc_file' => "#{user_proj_directory}/#{BIN_DIR}/xccc",
59
- 'remote_commit_file' => "#{user_proj_directory}/#{BIN_DIR}/arc.rc",
62
+ 'xccc_file' => "#{BIN_DIR}/xccc",
63
+ 'remote_commit_file' => "#{BIN_DIR}/arc.rc",
60
64
  'exclude_targets' => [],
65
+ 'prettify_meta_files' => false,
66
+ 'disable_certificate_verification' => false
61
67
  }
62
68
  @@configuration.merge! default_values.select { |k, v| !@@configuration.key?(k) }
63
69
  end
@@ -76,8 +82,8 @@ module CocoapodsXCRemoteCacheModifier
76
82
  end
77
83
 
78
84
  mode = @@configuration['mode']
79
- unless mode == 'consumer' || mode == 'producer'
80
- throw "Incorrect 'mode' value. Allowed values are ['consumer', 'producer'], but you provided '#{mode}'. A typo?"
85
+ unless mode == 'consumer' || mode == 'producer' || mode == 'producer-fast'
86
+ throw "Incorrect 'mode' value. Allowed values are ['consumer', 'producer', 'producer-fast'], but you provided '#{mode}'. A typo?"
81
87
  end
82
88
 
83
89
  unless mode == 'consumer' || @@configuration.key?('final_target')
@@ -89,61 +95,98 @@ module CocoapodsXCRemoteCacheModifier
89
95
  @@configuration.select { |key, value| !CUSTOM_CONFIGURATION_KEYS.include?(key) }
90
96
  end
91
97
 
92
- def self.enable_xcremotecache(target, user_proj_directory, xc_location, xc_cc_path, mode, exclude_build_configurations, check_build_configuration, check_platform, final_target)
93
- target.build_configurations.each do |config|
94
- # apply only for relevant Configurations
95
- next if exclude_build_configurations.include?(config.name)
96
- if mode == 'consumer'
97
- config.build_settings['CC'] = [xc_cc_path]
98
- end
99
- config.build_settings['SWIFT_EXEC'] = ["#{xc_location}/xcswiftc"]
100
- config.build_settings['LIBTOOL'] = ["#{xc_location}/xclibtool"]
101
- config.build_settings['LD'] = ["#{xc_location}/xcld"]
98
+ def self.parent_dir(path, parent_count)
99
+ "../" * parent_count + path
100
+ end
102
101
 
103
- config.build_settings['XCREMOTE_CACHE_FAKE_SRCROOT'] = FAKE_SRCROOT
104
- add_cflags!(config.build_settings, '-fdebug-prefix-map', "#{user_proj_directory}=$(XCREMOTE_CACHE_FAKE_SRCROOT)")
105
- add_swiftflags!(config.build_settings, '-debug-prefix-map', "#{user_proj_directory}=$(XCREMOTE_CACHE_FAKE_SRCROOT)")
106
- end
107
-
102
+ # @param target [Target] target to apply XCRemoteCache
103
+ # @param repo_distance [Integer] distance from the git repo root to the target's $SRCROOT
104
+ # @param xc_location [String] path to the dir with all XCRemoteCache binaries, relative to the repo root
105
+ # @param xc_cc_path [String] path to the XCRemoteCache clang wrapper, relative to the repo root
106
+ # @param mode [String] mode name ('consumer', 'producer', 'producer-fast' etc.)
107
+ # @param exclude_build_configurations [String[]] list of targets that should have disabled remote cache
108
+ # @param final_target [String] name of target that should trigger marking
109
+ def self.enable_xcremotecache(target, repo_distance, xc_location, xc_cc_path, mode, exclude_build_configurations, final_target)
110
+ srcroot_relative_xc_location = parent_dir(xc_location, repo_distance)
108
111
 
109
- # User project is not generated from scratch (contrary to `Pods`), delete all previous XCRemoteCache phases
110
- target.build_phases.delete_if {|phase|
111
- # Some phases (e.g. PBXSourcesBuildPhase) don't have strict name check respond_to?
112
- if phase.respond_to?(:name)
113
- phase.name != nil && phase.name.start_with?("[XCRC]")
112
+ target.build_configurations.each do |config|
113
+ # apply only for relevant Configurations
114
+ next if exclude_build_configurations.include?(config.name)
115
+ if mode == 'consumer'
116
+ config.build_settings['CC'] = ["$SRCROOT/#{parent_dir(xc_cc_path, repo_distance)}"]
117
+ elsif mode == 'producer' || mode == 'producer-fast'
118
+ config.build_settings.delete('CC') if config.build_settings.key?('CC')
114
119
  end
115
- }
120
+ config.build_settings['SWIFT_EXEC'] = ["$SRCROOT/#{srcroot_relative_xc_location}/xcswiftc"]
121
+ config.build_settings['LIBTOOL'] = ["$SRCROOT/#{srcroot_relative_xc_location}/xclibtool"]
122
+ config.build_settings['LD'] = ["$SRCROOT/#{srcroot_relative_xc_location}/xcld"]
123
+
124
+ config.build_settings['XCREMOTE_CACHE_FAKE_SRCROOT'] = FAKE_SRCROOT
125
+ config.build_settings['XCRC_PLATFORM_PREFERRED_ARCH'] = ["$(LINK_FILE_LIST_$(CURRENT_VARIANT)_$(PLATFORM_PREFERRED_ARCH):dir:standardizepath:file:default=arm64)"]
126
+ debug_prefix_map_replacement = '$(SRCROOT' + ':dir:standardizepath' * repo_distance + ')'
127
+ add_cflags!(config.build_settings, '-fdebug-prefix-map', "#{debug_prefix_map_replacement}=$(XCREMOTE_CACHE_FAKE_SRCROOT)")
128
+ add_swiftflags!(config.build_settings, '-debug-prefix-map', "#{debug_prefix_map_replacement}=$(XCREMOTE_CACHE_FAKE_SRCROOT)")
129
+ end
116
130
 
117
131
  # Prebuild
118
132
  if mode == 'consumer'
119
- prebuild_script = target.new_shell_script_build_phase("[XCRC] Prebuild")
133
+ existing_prebuild_script = target.build_phases.detect do |phase|
134
+ if phase.respond_to?(:name)
135
+ phase.name != nil && phase.name.start_with?("[XCRC] Prebuild")
136
+ end
137
+ end
138
+ prebuild_script = existing_prebuild_script || target.new_shell_script_build_phase("[XCRC] Prebuild")
120
139
  prebuild_script.shell_script = "\"$SCRIPT_INPUT_FILE_0\""
121
- prebuild_script.input_paths = ["#{xc_location}/xcprebuild"]
140
+ prebuild_script.input_paths = ["$SRCROOT/#{srcroot_relative_xc_location}/xcprebuild"]
122
141
  prebuild_script.output_paths = [
123
- "$(TARGET_TEMP_DIR)/rc.enabled",
142
+ "$(TARGET_TEMP_DIR)/rc.enabled",
124
143
  "$(DWARF_DSYM_FOLDER_PATH)/$(DWARF_DSYM_FILE_NAME)"
125
144
  ]
126
145
  prebuild_script.dependency_file = "$(TARGET_TEMP_DIR)/prebuild.d"
127
146
 
128
147
  # Move prebuild (last element) to the first position (to make it real 'prebuild')
129
- target.build_phases.rotate!(-1)
148
+ target.build_phases.rotate!(-1) if existing_prebuild_script.nil?
149
+ elsif mode == 'producer' || mode == 'producer-fast'
150
+ # Delete existing prebuild build phase (to support switching between modes)
151
+ target.build_phases.delete_if do |phase|
152
+ if phase.respond_to?(:name)
153
+ phase.name != nil && phase.name.start_with?("[XCRC] Prebuild")
154
+ end
155
+ end
130
156
  end
131
157
 
132
158
  # Postbuild
133
- postbuild_script = target.new_shell_script_build_phase("[XCRC] Postbuild")
159
+ existing_postbuild_script = target.build_phases.detect do |phase|
160
+ if phase.respond_to?(:name)
161
+ phase.name != nil && phase.name.start_with?("[XCRC] Postbuild")
162
+ end
163
+ end
164
+ postbuild_script = existing_postbuild_script || target.new_shell_script_build_phase("[XCRC] Postbuild")
134
165
  postbuild_script.shell_script = "\"$SCRIPT_INPUT_FILE_0\""
135
- postbuild_script.input_paths = ["#{xc_location}/xcpostbuild"]
166
+ postbuild_script.input_paths = ["$SRCROOT/#{srcroot_relative_xc_location}/xcpostbuild"]
136
167
  postbuild_script.output_paths = [
137
- "$(TARGET_BUILD_DIR)/$(MODULES_FOLDER_PATH)/$(PRODUCT_MODULE_NAME).swiftmodule/$(PLATFORM_PREFERRED_ARCH).swiftmodule.md5",
138
- "$(TARGET_BUILD_DIR)/$(MODULES_FOLDER_PATH)/$(PRODUCT_MODULE_NAME).swiftmodule/$(PLATFORM_PREFERRED_ARCH)-$(LLVM_TARGET_TRIPLE_VENDOR)-$(SWIFT_PLATFORM_TARGET_PREFIX)$(LLVM_TARGET_TRIPLE_SUFFIX).swiftmodule.md5"
168
+ "$(TARGET_BUILD_DIR)/$(MODULES_FOLDER_PATH)/$(PRODUCT_MODULE_NAME).swiftmodule/$(XCRC_PLATFORM_PREFERRED_ARCH).swiftmodule.md5",
169
+ "$(TARGET_BUILD_DIR)/$(MODULES_FOLDER_PATH)/$(PRODUCT_MODULE_NAME).swiftmodule/$(XCRC_PLATFORM_PREFERRED_ARCH)-$(LLVM_TARGET_TRIPLE_VENDOR)-$(SWIFT_PLATFORM_TARGET_PREFIX)$(LLVM_TARGET_TRIPLE_SUFFIX).swiftmodule.md5"
139
170
  ]
140
171
  postbuild_script.dependency_file = "$(TARGET_TEMP_DIR)/postbuild.d"
141
172
 
142
173
  # Mark a sha as ready for a given platform and configuration when building the final_target
143
- if mode == 'producer' && target.name == final_target
144
- mark_script = target.new_shell_script_build_phase("[XCRC] Mark")
174
+ if (mode == 'producer' || mode == 'producer-fast') && target.name == final_target
175
+ existing_mark_script = target.build_phases.detect do |phase|
176
+ if phase.respond_to?(:name)
177
+ phase.name != nil && phase.name.start_with?("[XCRC] Mark")
178
+ end
179
+ end
180
+ mark_script = existing_mark_script || target.new_shell_script_build_phase("[XCRC] Mark")
145
181
  mark_script.shell_script = "\"$SCRIPT_INPUT_FILE_0\" mark --configuration $CONFIGURATION --platform $PLATFORM_NAME"
146
- mark_script.input_paths = ["#{xc_location}/xcprepare"]
182
+ mark_script.input_paths = ["$SRCROOT/#{srcroot_relative_xc_location}/xcprepare"]
183
+ else
184
+ # Delete existing mark build phase (to support switching between modes or changing the final target)
185
+ target.build_phases.delete_if do |phase|
186
+ if phase.respond_to?(:name)
187
+ phase.name != nil && phase.name.start_with?("[XCRC] Mark")
188
+ end
189
+ end
147
190
  end
148
191
  end
149
192
 
@@ -153,8 +196,9 @@ module CocoapodsXCRemoteCacheModifier
153
196
  config.build_settings.delete('SWIFT_EXEC') if config.build_settings.key?('SWIFT_EXEC')
154
197
  config.build_settings.delete('LIBTOOL') if config.build_settings.key?('LIBTOOL')
155
198
  config.build_settings.delete('LD') if config.build_settings.key?('LD')
156
- # Add Fake src root for ObjC & Swift
199
+ # Remove Fake src root for ObjC & Swift
157
200
  config.build_settings.delete('XCREMOTE_CACHE_FAKE_SRCROOT')
201
+ config.build_settings.delete('XCRC_PLATFORM_PREFERRED_ARCH')
158
202
  remove_cflags!(config.build_settings, '-fdebug-prefix-map')
159
203
  remove_swiftflags!(config.build_settings, '-debug-prefix-map')
160
204
  end
@@ -216,14 +260,14 @@ module CocoapodsXCRemoteCacheModifier
216
260
  end
217
261
 
218
262
  def self.add_cflags!(options, key, value)
219
- return if options.fetch('OTHER_CFLAGS',[]).include?(' ' + value)
220
- options['OTHER_CFLAGS'] = remove_cflags!(options, key) << " #{key}=#{value}"
263
+ return if options.fetch('OTHER_CFLAGS',[]).include?(value)
264
+ options['OTHER_CFLAGS'] = remove_cflags!(options, key) << "#{key}=#{value}"
221
265
  end
222
266
 
223
267
  def self.remove_cflags!(options, key)
224
268
  cflags_arr = options.fetch('OTHER_CFLAGS', ['$(inherited)'])
225
269
  cflags_arr = [cflags_arr] if cflags_arr.kind_of? String
226
- options['OTHER_CFLAGS'] = cflags_arr.delete_if {|flag| flag.start_with?(" #{key}=") }
270
+ options['OTHER_CFLAGS'] = cflags_arr.delete_if {|flag| flag.include?("#{key}=") }
227
271
  options['OTHER_CFLAGS']
228
272
  end
229
273
 
@@ -238,12 +282,27 @@ module CocoapodsXCRemoteCacheModifier
238
282
  end
239
283
 
240
284
  # Uninstall the XCRemoteCache
241
- def self.disable_xcremotecache(user_project)
285
+ def self.disable_xcremotecache(user_project, pods_project = nil)
242
286
  user_project.targets.each do |target|
243
287
  disable_xcremotecache_for_target(target)
244
288
  end
245
289
  user_project.save()
246
290
 
291
+ unless pods_project.nil?
292
+ pods_project.native_targets.each do |target|
293
+ disable_xcremotecache_for_target(target)
294
+ end
295
+ pods_proj_directory = pods_project.project_dir
296
+ pods_project.root_object.project_references.each do |subproj_ref|
297
+ generated_project = Xcodeproj::Project.open("#{pods_proj_directory}/#{subproj_ref[:project_ref].path}")
298
+ generated_project.native_targets.each do |target|
299
+ disable_xcremotecache_for_target(target)
300
+ end
301
+ generated_project.save()
302
+ end
303
+ pods_project.save()
304
+ end
305
+
247
306
  # Remove .lldbinit rewrite
248
307
  save_lldbinit_rewrite(nil) unless !@@configuration['modify_lldb_init']
249
308
  end
@@ -251,6 +310,7 @@ module CocoapodsXCRemoteCacheModifier
251
310
  # Returns the content (array of lines) of the lldbinit with stripped XCRemoteCache rewrite
252
311
  def self.clean_lldbinit_content(lldbinit_path)
253
312
  all_lines = []
313
+ return all_lines unless File.exist?(lldbinit_path)
254
314
  File.open(lldbinit_path) { |file|
255
315
  while(line = file.gets) != nil
256
316
  line = line.strip
@@ -290,7 +350,7 @@ module CocoapodsXCRemoteCacheModifier
290
350
 
291
351
  begin
292
352
  user_proj_directory = File.dirname(user_project.path)
293
- set_configuration_default_values(user_proj_directory)
353
+ set_configuration_default_values
294
354
 
295
355
  unless @@configuration['enabled']
296
356
  Pod::UI.puts "[XCRC] XCRemoteCache disabled"
@@ -299,7 +359,6 @@ module CocoapodsXCRemoteCacheModifier
299
359
  end
300
360
 
301
361
  validate_configuration()
302
-
303
362
  mode = @@configuration['mode']
304
363
  xccc_location = @@configuration['xccc_file']
305
364
  remote_commit_file = @@configuration['remote_commit_file']
@@ -310,54 +369,90 @@ module CocoapodsXCRemoteCacheModifier
310
369
  check_build_configuration = @@configuration['check_build_configuration']
311
370
  check_platform = @@configuration['check_platform']
312
371
 
372
+ xccc_location_absolute = "#{user_proj_directory}/#{xccc_location}"
373
+ xcrc_location_absolute = "#{user_proj_directory}/#{xcrc_location}"
374
+ remote_commit_file_absolute = "#{user_proj_directory}/#{remote_commit_file}"
375
+
313
376
  # Download XCRC
314
- download_xcrc_if_needed(xcrc_location)
377
+ download_xcrc_if_needed(xcrc_location_absolute)
315
378
 
316
379
  # Save .rcinfo
317
- save_rcinfo(generate_rcinfo(), user_proj_directory)
380
+ root_rcinfo = generate_rcinfo()
381
+ save_rcinfo(root_rcinfo, user_proj_directory)
318
382
 
319
383
  # Create directory for xccc & arc.rc location
320
384
  Dir.mkdir(BIN_DIR) unless File.exist?(BIN_DIR)
321
385
 
322
386
  # Remove previous xccc & arc.rc
323
- File.delete(remote_commit_file) if File.exist?(remote_commit_file)
324
- File.delete(xccc_location) if File.exist?(xccc_location)
387
+ File.delete(remote_commit_file_absolute) if File.exist?(remote_commit_file_absolute)
388
+ File.delete(xccc_location_absolute) if File.exist?(xccc_location_absolute)
325
389
 
326
390
  # Prepare XCRC
391
+
392
+ # Pods projects can be generated only once (if incremental_installation is enabled)
393
+ # Always integrate XCRemoteCache to all Pods, in case it will be needed later
394
+ unless installer_context.pods_project.nil?
395
+ # Attach XCRemoteCache to Pods targets
396
+ # Enable only for native targets which can have compilation steps
397
+ installer_context.pods_project.native_targets.each do |target|
398
+ next if target.source_build_phase.files_references.empty?
399
+ next if target.name.start_with?("Pods-")
400
+ next if target.name.end_with?("Tests")
401
+ next if exclude_targets.include?(target.name)
402
+ enable_xcremotecache(target, 1, xcrc_location, xccc_location, mode, exclude_build_configurations, final_target)
403
+ end
404
+
405
+ # Create .rcinfo into `Pods` directory as that .xcodeproj reads configuration from .xcodeproj location
406
+ pods_proj_directory = installer_context.sandbox_root
407
+
408
+ # Attach XCRemoteCache to Generated Pods projects
409
+ installer_context.pods_project.root_object.project_references.each do |subproj_ref|
410
+ generated_project = Xcodeproj::Project.open("#{pods_proj_directory}/#{subproj_ref[:project_ref].path}")
411
+ generated_project.native_targets.each do |target|
412
+ next if target.source_build_phase.files_references.empty?
413
+ next if target.name.end_with?("Tests")
414
+ next if exclude_targets.include?(target.name)
415
+ enable_xcremotecache(target, 1, xcrc_location, xccc_location, mode, exclude_build_configurations, final_target)
416
+ end
417
+ generated_project.save()
418
+ end
419
+
420
+ # Manual Pods/.rcinfo generation
421
+
422
+ # all paths in .rcinfo are relative to the root so paths used in Pods.xcodeproj need to be aligned
423
+ pods_path = Pathname.new(pods_proj_directory)
424
+ root_path = Pathname.new(user_proj_directory)
425
+ root_path_to_pods = root_path.relative_path_from(pods_path)
426
+
427
+ pods_rcinfo = root_rcinfo.merge({
428
+ 'remote_commit_file' => "#{root_path_to_pods}/#{remote_commit_file}",
429
+ 'xccc_file' => "#{root_path_to_pods}/#{xccc_location}"
430
+ })
431
+ save_rcinfo(pods_rcinfo, pods_proj_directory)
432
+
433
+ installer_context.pods_project.save()
434
+ end
435
+
436
+ # Enabled/disable XCRemoteCache for the main (user) project
327
437
  begin
328
- prepare_result = YAML.load`#{xcrc_location}/xcprepare --configuration #{check_build_configuration} --platform #{check_platform}`
438
+ prepare_result = YAML.load`#{xcrc_location_absolute}/xcprepare --configuration #{check_build_configuration} --platform #{check_platform}`
329
439
  unless prepare_result['result'] || mode != 'consumer'
330
440
  # Uninstall the XCRemoteCache for the consumer mode
331
- disable_xcremotecache(user_project)
441
+ disable_xcremotecache(user_project, installer_context.pods_project)
332
442
  Pod::UI.puts "[XCRC] XCRemoteCache disabled - no artifacts available"
333
443
  next
334
444
  end
335
445
  rescue => error
336
- disable_xcremotecache(user_project)
446
+ disable_xcremotecache(user_project, installer_context.pods_project)
337
447
  Pod::UI.puts "[XCRC] XCRemoteCache failed with an error: #{error}."
338
448
  next
339
449
  end
340
450
 
341
- # Attach XCRemoteCache to Pods targets
342
- installer_context.pods_project.targets.each do |target|
343
- next if target.name.start_with?("Pods-")
344
- next if target.name.end_with?("Tests")
345
- next if exclude_targets.include?(target.name)
346
- enable_xcremotecache(target, user_proj_directory, xcrc_location, xccc_location, mode, exclude_build_configurations, check_build_configuration, check_platform, final_target)
347
- end
348
-
349
- # Create .rcinfo into `Pods` directory as that .xcodeproj reads configuration from .xcodeproj location
350
- pods_proj_directory = installer_context.sandbox_root
351
-
352
- # Manual .rcinfo generation (in YAML format)
353
- save_rcinfo({'extra_configuration_file' => "#{user_proj_directory}/.rcinfo"}, pods_proj_directory)
354
-
355
- installer_context.pods_project.save()
356
451
 
357
452
  # Attach XCRC to the app targets
358
453
  user_project.targets.each do |target|
359
454
  next if exclude_targets.include?(target.name)
360
- enable_xcremotecache(target, user_proj_directory, xcrc_location, xccc_location, mode, exclude_build_configurations, check_build_configuration, check_platform, final_target)
455
+ enable_xcremotecache(target, 0, xcrc_location, xccc_location, mode, exclude_build_configurations, final_target)
361
456
  end
362
457
 
363
458
  # Set Target sourcemap
@@ -373,7 +468,7 @@ module CocoapodsXCRemoteCacheModifier
373
468
  rescue Exception => e
374
469
  Pod::UI.puts "[XCRC] XCRemoteCache disabled with error: #{e}"
375
470
  puts e.full_message(highlight: true, order: :top)
376
- disable_xcremotecache(user_project)
471
+ disable_xcremotecache(user_project, installer_context.pods_project)
377
472
  end
378
473
  end
379
474
  end
@@ -13,5 +13,5 @@
13
13
  # limitations under the License.
14
14
 
15
15
  module CocoapodsXcremotecache
16
- VERSION = "0.0.2"
16
+ VERSION = "0.0.6"
17
17
  end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocoapods-xcremotecache
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bartosz Polaczyk
8
8
  - Mark Vasiv
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2021-11-16 00:00:00.000000000 Z
12
+ date: 2022-02-07 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: CocoaPods plugin that enables XCRemoteCache with the project.
15
15
  email:
@@ -34,7 +34,7 @@ homepage: https://github.com/spotify/XCRemoteCache
34
34
  licenses:
35
35
  - Apache-2.0
36
36
  metadata: {}
37
- post_install_message:
37
+ post_install_message:
38
38
  rdoc_options: []
39
39
  require_paths:
40
40
  - lib
@@ -49,8 +49,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
49
49
  - !ruby/object:Gem::Version
50
50
  version: '0'
51
51
  requirements: []
52
- rubygems_version: 3.2.3
53
- signing_key:
52
+ rubygems_version: 3.2.32
53
+ signing_key:
54
54
  specification_version: 4
55
55
  summary: A simple plugin that attaches to the post_install hook and modifies the generated
56
56
  project to use XCRemoteCache. Supports both producing anc consuming parts.