cocoapods-xcremotecache 0.0.15 → 0.0.17

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: be0f0312463e793e7f6afccd9ae49ea0a0ed5f740adade59c780a0e6873f05a5
4
- data.tar.gz: adbc9a76871be26f0fe19e53f92b67554db4f55a69d0e3d88118ed0c1b5cf9e5
3
+ metadata.gz: dba4fdcb0680c3c684de948c827d778d28fcd7410f94543d25bce49066b50ae9
4
+ data.tar.gz: 72a36d2de6377fe6d18f33596c8b076b87e254c5bccc9675045f32fa6589500c
5
5
  SHA512:
6
- metadata.gz: 0ce9ed4249f55c838501321dadb012ea556441836fb07edaac8db88ff7ccd8510ab0debccbf1c92c98d9537680874a0416c68d33cdfad4c7620a52ca6d4608dd
7
- data.tar.gz: 2cfed964db8d3078f35b48758e8be756938e77fd4b3937e7032327cf703cbcc5268cca67c96b6c82d1013cedac26cabc9efaae3ecb20da231ea812ba29da5687
6
+ metadata.gz: f9e335d055ffdf78a9421bb712eec08aaf8aa2f9fbd61685f8da5eb1b4bd3a74585bae442f01f5a30c50472f4965a4148fa1d7e6228ffa878661163f98982fe7
7
+ data.tar.gz: 714534dc97841633dd31f3fb3f136a2d967696b5fb0ff8544ae83fa0684a171e13c2d5dae40c35ae1d03f9d7c392829cdb74bd51ca1ff33a7434368cc8c4e559
data/README.md CHANGED
@@ -28,7 +28,7 @@ plugin 'cocoapods-xcremotecache'
28
28
  2. Configure XCRemoteCache at the top of your `Podfile` definition:
29
29
  ```ruby
30
30
  xcremotecache({
31
- 'cache_addresses' => ['http://localhost:8080/cache/pods'],
31
+ 'cache_addresses' => ['http://localhost:8080/cache/pods'],
32
32
  'primary_repo' => 'https://your.primary.repo.git',
33
33
  'mode' => 'consumer'
34
34
  })
@@ -48,13 +48,14 @@ An object that is passed to the `xcremotecache` can contain all properties suppo
48
48
  | `exclude_build_configurations` | Comma-separated list of configurations that shouldn't use XCRemoteCache | `[]`| ⬜️ |
49
49
  | `final_target` | A target name that is build at the end of the build chain. Relevant only for a 'producer' mode to mark a given sha as ready to use from cache | `Debug` | ⬜️ |
50
50
  | `check_build_configuration` | A build configuration for which the remote cache availability is performed. Relevant only for a 'consumer' mode | `Debug` | ⬜️ |
51
- | `check_platform` | A platform for which the remote cache availability is performed. Relevant only for a 'consumer' mode | `iphonesimulator` | ⬜️
51
+ | `check_platform` | A platform for which the remote cache availability is performed. Relevant only for a 'consumer' mode | `iphonesimulator` | ⬜️
52
52
  | `modify_lldb_init` | Controls if the pod integration should modify `~/.lldbinit` | `true` | ⬜️ |
53
53
  | `xccc_file` | The path where should be placed the `xccc` binary (in the pod installation phase) | `{podfile_dir}/.rc/xccc` | ⬜️ |
54
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
55
  | `prettify_meta_files` | A Boolean value that opts-in pretty JSON formatting for meta files | `false` | ⬜️ |
56
56
  | `fake_src_root` | An arbitrary source location shared between producers and consumers. Should be unique for a project. | `/xxxxxxxxxx` | ⬜️ |
57
57
  | `disable_certificate_verification` | A Boolean value that opts-in SSL certificate validation is disabled | `false` | ⬜️ |
58
+ | `exclude_sdks_configurations` | array of sdks to not integrate XCRemoteCache (e.g. "watchos*, watchsimulator*") (Experimental) | `[]`| ⬜️ |
58
59
 
59
60
  ## Uninstalling
60
61
 
@@ -40,6 +40,7 @@ module CocoapodsXCRemoteCacheModifier
40
40
  'check_platform',
41
41
  'modify_lldb_init',
42
42
  'fake_src_root',
43
+ 'exclude_sdks_configurations'
43
44
  ]
44
45
 
45
46
  class XCRemoteCache
@@ -64,7 +65,8 @@ module CocoapodsXCRemoteCacheModifier
64
65
  'prettify_meta_files' => false,
65
66
  'fake_src_root' => "/#{'x' * 10 }",
66
67
  'disable_certificate_verification' => false,
67
- 'custom_rewrite_envs' => []
68
+ 'custom_rewrite_envs' => [],
69
+ 'exclude_sdks_configurations' => []
68
70
  }
69
71
  @@configuration.merge! default_values.select { |k, v| !@@configuration.key?(k) }
70
72
  # Always include XCRC_COOCAPODS_ROOT_KEY in custom_rewrite_envs
@@ -111,7 +113,19 @@ module CocoapodsXCRemoteCacheModifier
111
113
  # @param mode [String] mode name ('consumer', 'producer', 'producer-fast' etc.)
112
114
  # @param exclude_build_configurations [String[]] list of targets that should have disabled remote cache
113
115
  # @param final_target [String] name of target that should trigger marking
114
- def self.enable_xcremotecache(target, repo_distance, xc_location, xc_cc_path, mode, exclude_build_configurations, final_target, fake_src_root)
116
+ # @param exclude_sdks_configurations [String[]] list of sdks that should have disabled remote cache
117
+ def self.enable_xcremotecache(
118
+ target,
119
+ repo_distance,
120
+ xc_location,
121
+ xc_cc_path,
122
+ mode,
123
+ exclude_build_configurations,
124
+ final_target,
125
+ fake_src_root,
126
+ exclude_sdks_configurations,
127
+ enable_swift_driver_integration
128
+ )
115
129
  srcroot_relative_xc_location = parent_dir(xc_location, repo_distance)
116
130
  # location of the entrite CocoaPods project, relative to SRCROOT
117
131
  srcroot_relative_project_location = parent_dir('', repo_distance)
@@ -120,23 +134,28 @@ module CocoapodsXCRemoteCacheModifier
120
134
  # apply only for relevant Configurations
121
135
  next if exclude_build_configurations.include?(config.name)
122
136
  if mode == 'consumer'
123
- config.build_settings['CC'] = ["$SRCROOT/#{parent_dir(xc_cc_path, repo_distance)}"]
137
+ reset_build_setting(config.build_settings, 'CC', "$SRCROOT/#{parent_dir(xc_cc_path, repo_distance)}", exclude_sdks_configurations)
124
138
  elsif mode == 'producer' || mode == 'producer-fast'
125
139
  config.build_settings.delete('CC') if config.build_settings.key?('CC')
126
140
  end
127
- config.build_settings['SWIFT_EXEC'] = ["$SRCROOT/#{srcroot_relative_xc_location}/xcswiftc"]
128
- config.build_settings['LIBTOOL'] = ["$SRCROOT/#{srcroot_relative_xc_location}/xclibtool"]
129
- config.build_settings['LD'] = ["$SRCROOT/#{srcroot_relative_xc_location}/xcld"]
130
- config.build_settings['LDPLUSPLUS'] = ["$SRCROOT/#{srcroot_relative_xc_location}/xcldplusplus"]
131
- config.build_settings['LIPO'] = ["$SRCROOT/#{srcroot_relative_xc_location}/xclipo"]
132
- config.build_settings['SWIFT_USE_INTEGRATED_DRIVER'] = ['NO']
133
-
134
- config.build_settings['XCREMOTE_CACHE_FAKE_SRCROOT'] = fake_src_root
135
- config.build_settings['XCRC_PLATFORM_PREFERRED_ARCH'] = ["$(LINK_FILE_LIST_$(CURRENT_VARIANT)_$(PLATFORM_PREFERRED_ARCH):dir:standardizepath:file:default=arm64)"]
136
- config.build_settings[XCRC_COOCAPODS_ROOT_KEY] = ["$SRCROOT/#{srcroot_relative_project_location}"]
141
+ swiftc_name = enable_swift_driver_integration ? 'swiftc' : 'xcswiftc'
142
+ reset_build_setting(config.build_settings, 'SWIFT_EXEC', "$SRCROOT/#{srcroot_relative_xc_location}/#{swiftc_name}", exclude_sdks_configurations)
143
+ reset_build_setting(config.build_settings, 'LIBTOOL', "$SRCROOT/#{srcroot_relative_xc_location}/xclibtool", exclude_sdks_configurations)
144
+ # Setting LIBTOOL to '' breaks SwiftDriver intengration so resetting it to the original value 'libtool' for all excluded configurations
145
+ add_build_setting_for_sdks(config.build_settings, 'LIBTOOL', 'libtool', exclude_sdks_configurations)
146
+ reset_build_setting(config.build_settings, 'LD', "$SRCROOT/#{srcroot_relative_xc_location}/xcld", exclude_sdks_configurations)
147
+ reset_build_setting(config.build_settings, 'LDPLUSPLUS', "$SRCROOT/#{srcroot_relative_xc_location}/xcldplusplus", exclude_sdks_configurations)
148
+ reset_build_setting(config.build_settings, 'LIPO', "$SRCROOT/#{srcroot_relative_xc_location}/xclipo", exclude_sdks_configurations)
149
+ reset_build_setting(config.build_settings, 'SWIFT_USE_INTEGRATED_DRIVER', 'NO', exclude_sdks_configurations) unless enable_swift_driver_integration
150
+
151
+ reset_build_setting(config.build_settings, 'XCREMOTE_CACHE_FAKE_SRCROOT', fake_src_root, exclude_sdks_configurations)
152
+ reset_build_setting(config.build_settings, 'XCRC_PLATFORM_PREFERRED_ARCH', "$(LINK_FILE_LIST_$(CURRENT_VARIANT)_$(PLATFORM_PREFERRED_ARCH):dir:standardizepath:file:default=arm64)", exclude_sdks_configurations)
153
+ reset_build_setting(config.build_settings, XCRC_COOCAPODS_ROOT_KEY, "$SRCROOT/#{srcroot_relative_project_location}", exclude_sdks_configurations)
137
154
  debug_prefix_map_replacement = '$(SRCROOT' + ':dir:standardizepath' * repo_distance + ')'
138
- add_cflags!(config.build_settings, '-fdebug-prefix-map', "#{debug_prefix_map_replacement}=$(XCREMOTE_CACHE_FAKE_SRCROOT)")
139
- add_swiftflags!(config.build_settings, '-debug-prefix-map', "#{debug_prefix_map_replacement}=$(XCREMOTE_CACHE_FAKE_SRCROOT)")
155
+ add_cflags!(config.build_settings, '-fdebug-prefix-map', "#{debug_prefix_map_replacement}=$(XCREMOTE_CACHE_FAKE_SRCROOT)", exclude_sdks_configurations)
156
+ add_swiftflags!(config.build_settings, '-debug-prefix-map', "#{debug_prefix_map_replacement}=$(XCREMOTE_CACHE_FAKE_SRCROOT)", exclude_sdks_configurations)
157
+ delete_build_setting(config.build_settings, 'XCRC_DISABLED')
158
+ add_build_setting_for_sdks(config.build_settings, 'XCRC_DISABLED', 'YES', exclude_sdks_configurations)
140
159
  end
141
160
 
142
161
  # Prebuild
@@ -283,9 +302,8 @@ module CocoapodsXCRemoteCacheModifier
283
302
  end
284
303
  end
285
304
 
286
- def self.add_cflags!(options, key, value)
287
- return if options.fetch('OTHER_CFLAGS',[]).include?(value)
288
- options['OTHER_CFLAGS'] = remove_cflags!(options, key) << "#{key}=#{value}"
305
+ def self.add_cflags!(options, key, value, exclude_sdks_configurations)
306
+ reset_build_setting(options, 'OTHER_CFLAGS', remove_cflags!(options, key) << "#{key}=#{value}", exclude_sdks_configurations)
289
307
  end
290
308
 
291
309
  def self.remove_cflags!(options, key)
@@ -295,9 +313,8 @@ module CocoapodsXCRemoteCacheModifier
295
313
  options['OTHER_CFLAGS']
296
314
  end
297
315
 
298
- def self.add_swiftflags!(options, key, value)
299
- return if options.fetch('OTHER_SWIFT_FLAGS','').include?(value)
300
- options['OTHER_SWIFT_FLAGS'] = remove_swiftflags!(options, key) + " #{key} #{value}"
316
+ def self.add_swiftflags!(options, key, value, exclude_sdks_configurations)
317
+ reset_build_setting(options, 'OTHER_SWIFT_FLAGS', remove_swiftflags!(options, key) + " #{key} #{value}", exclude_sdks_configurations)
301
318
  end
302
319
 
303
320
  def self.remove_swiftflags!(options, key)
@@ -305,6 +322,34 @@ module CocoapodsXCRemoteCacheModifier
305
322
  options['OTHER_SWIFT_FLAGS']
306
323
  end
307
324
 
325
+ def self.add_build_setting(build_settings, key, value, exclude_sdks_configurations)
326
+ build_settings[key] = value
327
+ for exclude_sdks_configuration in exclude_sdks_configurations
328
+ build_settings["#{key}[sdk=#{exclude_sdks_configuration}]"] = [""]
329
+ end
330
+ end
331
+
332
+ # Deletes all previous build settings for a key, and sets a new value to all configurations
333
+ # but the sdks in exclude_sdks_configurations
334
+ def self.reset_build_setting(build_settings, key, value, exclude_sdks_configurations)
335
+ delete_build_setting(build_settings, key)
336
+ add_build_setting(build_settings, key, value, exclude_sdks_configurations)
337
+ end
338
+
339
+ # Delete all build setting for a key, including settings like "[skd=*,arch=*]"
340
+ def self.delete_build_setting(build_settings, key)
341
+ for build_setting_key in build_settings.keys
342
+ build_settings.delete(build_setting_key) if build_setting_key == key || build_setting_key.start_with?("#{key}[")
343
+ end
344
+ end
345
+
346
+ # Sets value for a key only for a subset of sdk configurations
347
+ def self.add_build_setting_for_sdks(build_settings, key, value, sdk_configurations)
348
+ for sdk_configuration in sdk_configurations
349
+ build_settings["#{key}[sdk=#{sdk_configuration}]"] = value
350
+ end
351
+ end
352
+
308
353
  # Uninstall the XCRemoteCache
309
354
  def self.disable_xcremotecache(user_project, pods_project = nil)
310
355
  user_project.targets.each do |target|
@@ -454,6 +499,8 @@ module CocoapodsXCRemoteCacheModifier
454
499
  check_build_configuration = @@configuration['check_build_configuration']
455
500
  check_platform = @@configuration['check_platform']
456
501
  fake_src_root = @@configuration['fake_src_root']
502
+ exclude_sdks_configurations = @@configuration['exclude_sdks_configurations'] || []
503
+ enable_swift_driver_integration = @@configuration['enable_swift_driver_integration'] || false
457
504
 
458
505
  xccc_location_absolute = "#{user_proj_directory}/#{xccc_location}"
459
506
  xcrc_location_absolute = "#{user_proj_directory}/#{xcrc_location}"
@@ -477,7 +524,7 @@ module CocoapodsXCRemoteCacheModifier
477
524
  next if target.name.start_with?("Pods-")
478
525
  next if target.name.end_with?("Tests")
479
526
  next if exclude_targets.include?(target.name)
480
- enable_xcremotecache(target, 1, xcrc_location, xccc_location, mode, exclude_build_configurations, final_target,fake_src_root)
527
+ enable_xcremotecache(target, 1, xcrc_location, xccc_location, mode, exclude_build_configurations, final_target,fake_src_root, exclude_sdks_configurations, enable_swift_driver_integration)
481
528
  end
482
529
 
483
530
  # Create .rcinfo into `Pods` directory as that .xcodeproj reads configuration from .xcodeproj location
@@ -490,7 +537,7 @@ module CocoapodsXCRemoteCacheModifier
490
537
  next if target.source_build_phase.files_references.empty?
491
538
  next if target.name.end_with?("Tests")
492
539
  next if exclude_targets.include?(target.name)
493
- enable_xcremotecache(target, 1, xcrc_location, xccc_location, mode, exclude_build_configurations, final_target,fake_src_root)
540
+ enable_xcremotecache(target, 1, xcrc_location, xccc_location, mode, exclude_build_configurations, final_target,fake_src_root, exclude_sdks_configurations, enable_swift_driver_integration)
494
541
  end
495
542
  generated_project.save()
496
543
  end
@@ -531,7 +578,7 @@ module CocoapodsXCRemoteCacheModifier
531
578
  # Attach XCRC to the app targets
532
579
  user_project.targets.each do |target|
533
580
  next if exclude_targets.include?(target.name)
534
- enable_xcremotecache(target, 0, xcrc_location, xccc_location, mode, exclude_build_configurations, final_target,fake_src_root)
581
+ enable_xcremotecache(target, 0, xcrc_location, xccc_location, mode, exclude_build_configurations, final_target,fake_src_root, exclude_sdks_configurations, enable_swift_driver_integration)
535
582
  end
536
583
 
537
584
  # Set Target sourcemap
@@ -13,5 +13,5 @@
13
13
  # limitations under the License.
14
14
 
15
15
  module CocoapodsXcremotecache
16
- VERSION = "0.0.15"
16
+ VERSION = "0.0.17"
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.15
4
+ version: 0.0.17
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: 2023-03-21 00:00:00.000000000 Z
12
+ date: 2023-06-14 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: CocoaPods plugin that enables XCRemoteCache with the project.
15
15
  email: