cocoapods-xcremotecache 0.0.13 → 0.0.14

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8929b95b00fd3885898cf18700dddc98fc22b6918f806dae77dd999848a26a35
4
- data.tar.gz: f1e5cdb7db24fbc0c3b29e048424643621dc7c5fea985d0a29d26689e4441deb
3
+ metadata.gz: 9929e3043567b27f1a9a8dd2d475876930ed6ba35d654b463776688edcf4f0c4
4
+ data.tar.gz: f03ed16f60910db323d0ae5edf3e3d8db4f5c32b722c417990a3cae3184b9fa7
5
5
  SHA512:
6
- metadata.gz: d79a51a5c7c21a472caa1311e7208b25322b13a9190cbc29f06d302f1e8d445073d1d985ed5d6626b78de93f28ac08ffb2866195fcd80dc1fecdad4817a971a5
7
- data.tar.gz: bfd2ef88c899f0e6be31ea12109aaffcc09e30582fee638d2b1a206d2e7460fe0249d5695223abcc9220a4425363ebd4deb49102f5df0b9e4daed32e594796cf
6
+ metadata.gz: 14d5fba66c6ed362882a1cd6bcdf6a2e9095f81cca83ab7893020232af51839fc2154e61bdb7621f175873c460bfd5178413fc73d3c6f9c7a08c4354b3880486
7
+ data.tar.gz: 7ea3092b9c346a2d75d0df98431a721badc7065449a1f89ab19db8fa58137002907e39a755dfffa789cb2cbe1e491aa4b5ffbee31a694df9752a236981619cc8
@@ -362,12 +362,73 @@ module CocoapodsXCRemoteCacheModifier
362
362
  File.write(LLDB_INIT_PATH, lldbinit_lines.join("\n"), mode: "w")
363
363
  end
364
364
 
365
- Pod::HooksManager.register('cocoapods-xcremotecache', :post_install) do |installer_context|
365
+ Pod::HooksManager.register('cocoapods-xcremotecache', :pre_install) do |installer_context|
366
+ # The main responsibility of that hook is forcing Pods regeneration when XCRemoteCache is enabled for the first time
367
+ # In the post_install hook, this plugin adds extra build settings and steps to all Pods targets, but only when XCRemoteCache
368
+ # is enabled and all artifacts are available (i.e. xcprepare returns 0).
369
+ # If Pods projects/targets are cached from previous `pod install` action that didn't enable XCRemoteCache (e.g. artifacts
370
+ # are not available in the remote cache), these projects/targets should be invalidated to include XCRemoteCache-related
371
+ # build steps and build settings.
366
372
  if @@configuration.nil?
367
373
  Pod::UI.puts "[XCRC] Warning! XCRemoteCache not configured. Call xcremotecache({...}) in Podfile to enable XCRemoteCache"
368
374
  next
369
375
  end
370
376
 
377
+ begin
378
+ # `user_pod_directory`` and `user_proj_directory` in the 'postinstall' should be equal
379
+ user_pod_directory = File.dirname(installer_context.podfile.defined_in_file)
380
+ set_configuration_default_values
381
+
382
+ unless @@configuration['enabled']
383
+ # No need to check if enabling remote cache for the first time
384
+ next
385
+ end
386
+
387
+ validate_configuration()
388
+ mode = @@configuration['mode']
389
+ remote_commit_file = @@configuration['remote_commit_file']
390
+ xcrc_location = @@configuration['xcrc_location']
391
+ check_build_configuration = @@configuration['check_build_configuration']
392
+ check_platform = @@configuration['check_platform']
393
+
394
+ xcrc_location_absolute = "#{user_pod_directory}/#{xcrc_location}"
395
+ remote_commit_file_absolute = "#{user_pod_directory}/#{remote_commit_file}"
396
+
397
+ # Download XCRC
398
+ download_xcrc_if_needed(xcrc_location_absolute)
399
+
400
+ # Save .rcinfo
401
+ root_rcinfo = generate_rcinfo()
402
+ save_rcinfo(root_rcinfo, user_pod_directory)
403
+
404
+ # Create directory for xccc & arc.rc location
405
+ Dir.mkdir(BIN_DIR) unless File.exist?(BIN_DIR)
406
+
407
+ # Remove previous xccc & arc.rc
408
+ was_previously_enabled = File.exist?(remote_commit_file_absolute)
409
+ File.delete(remote_commit_file_absolute) if File.exist?(remote_commit_file_absolute)
410
+
411
+ prepare_result = YAML.load`#{xcrc_location_absolute}/xcprepare --configuration #{check_build_configuration} --platform #{check_platform}`
412
+ if !prepare_result['result'] && mode == 'consumer'
413
+ # Remote cache is still disabled - no need to force Pods projects/targets regeneration
414
+ next
415
+ end
416
+
417
+ # Force rebuilding all Pods project, because XCRC build steps and settings need to be added to Pods project/targets
418
+ # It is relevant only when 'incremental_installation' is enabled, otherwise installed_cache_path does not exist on a disk
419
+ installed_cache_path = installer_context.sandbox.project_installation_cache_path
420
+ if !was_previously_enabled && File.exist?(installed_cache_path)
421
+ Pod::UI.puts "[XCRC] Forces Pods project regenerations because XCRC is enabled for the first time."
422
+ File.delete(installed_cache_path)
423
+ end
424
+ end
425
+ end
426
+
427
+ Pod::HooksManager.register('cocoapods-xcremotecache', :post_install) do |installer_context|
428
+ if @@configuration.nil?
429
+ next
430
+ end
431
+
371
432
  user_project = installer_context.umbrella_targets[0].user_project
372
433
 
373
434
  begin
@@ -394,20 +455,12 @@ module CocoapodsXCRemoteCacheModifier
394
455
 
395
456
  xccc_location_absolute = "#{user_proj_directory}/#{xccc_location}"
396
457
  xcrc_location_absolute = "#{user_proj_directory}/#{xcrc_location}"
397
- remote_commit_file_absolute = "#{user_proj_directory}/#{remote_commit_file}"
398
-
399
- # Download XCRC
400
- download_xcrc_if_needed(xcrc_location_absolute)
401
458
 
402
459
  # Save .rcinfo
403
460
  root_rcinfo = generate_rcinfo()
404
461
  save_rcinfo(root_rcinfo, user_proj_directory)
405
462
 
406
- # Create directory for xccc & arc.rc location
407
- Dir.mkdir(BIN_DIR) unless File.exist?(BIN_DIR)
408
-
409
- # Remove previous xccc & arc.rc
410
- File.delete(remote_commit_file_absolute) if File.exist?(remote_commit_file_absolute)
463
+ # Remove previous xccc
411
464
  File.delete(xccc_location_absolute) if File.exist?(xccc_location_absolute)
412
465
 
413
466
  # Prepare XCRC
@@ -458,6 +511,7 @@ module CocoapodsXCRemoteCacheModifier
458
511
 
459
512
  # Enabled/disable XCRemoteCache for the main (user) project
460
513
  begin
514
+ # TODO: Do not compile xcc again. `xcprepare` compiles it in pre-install anyway
461
515
  prepare_result = YAML.load`#{xcrc_location_absolute}/xcprepare --configuration #{check_build_configuration} --platform #{check_platform}`
462
516
  unless prepare_result['result'] || mode != 'consumer'
463
517
  # Uninstall the XCRemoteCache for the consumer mode
@@ -13,5 +13,5 @@
13
13
  # limitations under the License.
14
14
 
15
15
  module CocoapodsXcremotecache
16
- VERSION = "0.0.13"
16
+ VERSION = "0.0.14"
17
17
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocoapods-xcremotecache
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.13
4
+ version: 0.0.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bartosz Polaczyk
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2022-07-06 00:00:00.000000000 Z
12
+ date: 2022-08-26 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: CocoaPods plugin that enables XCRemoteCache with the project.
15
15
  email: