cocoapods-xcremotecache 0.0.15 → 0.0.16

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: 0d10f7d00729ae888941fcef52d599379a094020de82b5540005ae970d814929
4
+ data.tar.gz: 391aee8027c9796ac45b3703b5f5eafc24fd6a555d211e6aa02629ace9f9b887
5
5
  SHA512:
6
- metadata.gz: 0ce9ed4249f55c838501321dadb012ea556441836fb07edaac8db88ff7ccd8510ab0debccbf1c92c98d9537680874a0416c68d33cdfad4c7620a52ca6d4608dd
7
- data.tar.gz: 2cfed964db8d3078f35b48758e8be756938e77fd4b3937e7032327cf703cbcc5268cca67c96b6c82d1013cedac26cabc9efaae3ecb20da231ea812ba29da5687
6
+ metadata.gz: 9df9bb0c507814034d0af16d24337eaec451a1d0456ff727952c9d76a8abef63384bcf5e8fd436d0ee212d5455e65934d409123bba3d2f9e1a81d3f70b91a39f
7
+ data.tar.gz: c583acfc889027a047b5144919469a2477b4391994f72d82568838a839a44c91fe982c772dcb3c7296c47f7bb27db2da334907b8cd9640fe1ad17aabb9eaf5ea
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,18 @@ 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
+ )
115
128
  srcroot_relative_xc_location = parent_dir(xc_location, repo_distance)
116
129
  # location of the entrite CocoaPods project, relative to SRCROOT
117
130
  srcroot_relative_project_location = parent_dir('', repo_distance)
@@ -120,23 +133,27 @@ module CocoapodsXCRemoteCacheModifier
120
133
  # apply only for relevant Configurations
121
134
  next if exclude_build_configurations.include?(config.name)
122
135
  if mode == 'consumer'
123
- config.build_settings['CC'] = ["$SRCROOT/#{parent_dir(xc_cc_path, repo_distance)}"]
136
+ reset_build_setting(config.build_settings, 'CC', "$SRCROOT/#{parent_dir(xc_cc_path, repo_distance)}", exclude_sdks_configurations)
124
137
  elsif mode == 'producer' || mode == 'producer-fast'
125
138
  config.build_settings.delete('CC') if config.build_settings.key?('CC')
126
139
  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}"]
140
+ reset_build_setting(config.build_settings, 'SWIFT_EXEC', "$SRCROOT/#{srcroot_relative_xc_location}/xcswiftc", exclude_sdks_configurations)
141
+ reset_build_setting(config.build_settings, 'LIBTOOL', "$SRCROOT/#{srcroot_relative_xc_location}/xclibtool", exclude_sdks_configurations)
142
+ # Setting LIBTOOL to '' breaks SwiftDriver intengration so resetting it to the original value 'libtool' for all excluded configurations
143
+ add_build_setting_for_sdks(config.build_settings, 'LIBTOOL', 'libtool', exclude_sdks_configurations)
144
+ reset_build_setting(config.build_settings, 'LD', "$SRCROOT/#{srcroot_relative_xc_location}/xcld", exclude_sdks_configurations)
145
+ reset_build_setting(config.build_settings, 'LDPLUSPLUS', "$SRCROOT/#{srcroot_relative_xc_location}/xcldplusplus", exclude_sdks_configurations)
146
+ reset_build_setting(config.build_settings, 'LIPO', "$SRCROOT/#{srcroot_relative_xc_location}/xclipo", exclude_sdks_configurations)
147
+ reset_build_setting(config.build_settings, 'SWIFT_USE_INTEGRATED_DRIVER', 'NO', exclude_sdks_configurations)
148
+
149
+ reset_build_setting(config.build_settings, 'XCREMOTE_CACHE_FAKE_SRCROOT', fake_src_root, exclude_sdks_configurations)
150
+ 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)
151
+ reset_build_setting(config.build_settings, XCRC_COOCAPODS_ROOT_KEY, "$SRCROOT/#{srcroot_relative_project_location}", exclude_sdks_configurations)
137
152
  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)")
153
+ add_cflags!(config.build_settings, '-fdebug-prefix-map', "#{debug_prefix_map_replacement}=$(XCREMOTE_CACHE_FAKE_SRCROOT)", exclude_sdks_configurations)
154
+ add_swiftflags!(config.build_settings, '-debug-prefix-map', "#{debug_prefix_map_replacement}=$(XCREMOTE_CACHE_FAKE_SRCROOT)", exclude_sdks_configurations)
155
+ delete_build_setting(config.build_settings, 'XCRC_DISABLED')
156
+ add_build_setting_for_sdks(config.build_settings, 'XCRC_DISABLED', 'YES', exclude_sdks_configurations)
140
157
  end
141
158
 
142
159
  # Prebuild
@@ -283,9 +300,8 @@ module CocoapodsXCRemoteCacheModifier
283
300
  end
284
301
  end
285
302
 
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}"
303
+ def self.add_cflags!(options, key, value, exclude_sdks_configurations)
304
+ reset_build_setting(options, 'OTHER_CFLAGS', remove_cflags!(options, key) << "#{key}=#{value}", exclude_sdks_configurations)
289
305
  end
290
306
 
291
307
  def self.remove_cflags!(options, key)
@@ -295,9 +311,8 @@ module CocoapodsXCRemoteCacheModifier
295
311
  options['OTHER_CFLAGS']
296
312
  end
297
313
 
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}"
314
+ def self.add_swiftflags!(options, key, value, exclude_sdks_configurations)
315
+ reset_build_setting(options, 'OTHER_SWIFT_FLAGS', remove_swiftflags!(options, key) + " #{key} #{value}", exclude_sdks_configurations)
301
316
  end
302
317
 
303
318
  def self.remove_swiftflags!(options, key)
@@ -305,6 +320,34 @@ module CocoapodsXCRemoteCacheModifier
305
320
  options['OTHER_SWIFT_FLAGS']
306
321
  end
307
322
 
323
+ def self.add_build_setting(build_settings, key, value, exclude_sdks_configurations)
324
+ build_settings[key] = value
325
+ for exclude_sdks_configuration in exclude_sdks_configurations
326
+ build_settings["#{key}[sdk=#{exclude_sdks_configuration}]"] = [""]
327
+ end
328
+ end
329
+
330
+ # Deletes all previous build settings for a key, and sets a new value to all configurations
331
+ # but the sdks in exclude_sdks_configurations
332
+ def self.reset_build_setting(build_settings, key, value, exclude_sdks_configurations)
333
+ delete_build_setting(build_settings, key)
334
+ add_build_setting(build_settings, key, value, exclude_sdks_configurations)
335
+ end
336
+
337
+ # Delete all build setting for a key, including settings like "[skd=*,arch=*]"
338
+ def self.delete_build_setting(build_settings, key)
339
+ for build_setting_key in build_settings.keys
340
+ build_settings.delete(build_setting_key) if build_setting_key == key || build_setting_key.start_with?("#{key}[")
341
+ end
342
+ end
343
+
344
+ # Sets value for a key only for a subset of sdk configurations
345
+ def self.add_build_setting_for_sdks(build_settings, key, value, sdk_configurations)
346
+ for sdk_configuration in sdk_configurations
347
+ build_settings["#{key}[sdk=#{sdk_configuration}]"] = value
348
+ end
349
+ end
350
+
308
351
  # Uninstall the XCRemoteCache
309
352
  def self.disable_xcremotecache(user_project, pods_project = nil)
310
353
  user_project.targets.each do |target|
@@ -454,6 +497,7 @@ module CocoapodsXCRemoteCacheModifier
454
497
  check_build_configuration = @@configuration['check_build_configuration']
455
498
  check_platform = @@configuration['check_platform']
456
499
  fake_src_root = @@configuration['fake_src_root']
500
+ exclude_sdks_configurations = @@configuration['exclude_sdks_configurations'] || []
457
501
 
458
502
  xccc_location_absolute = "#{user_proj_directory}/#{xccc_location}"
459
503
  xcrc_location_absolute = "#{user_proj_directory}/#{xcrc_location}"
@@ -477,7 +521,7 @@ module CocoapodsXCRemoteCacheModifier
477
521
  next if target.name.start_with?("Pods-")
478
522
  next if target.name.end_with?("Tests")
479
523
  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)
524
+ enable_xcremotecache(target, 1, xcrc_location, xccc_location, mode, exclude_build_configurations, final_target,fake_src_root, exclude_sdks_configurations)
481
525
  end
482
526
 
483
527
  # Create .rcinfo into `Pods` directory as that .xcodeproj reads configuration from .xcodeproj location
@@ -490,7 +534,7 @@ module CocoapodsXCRemoteCacheModifier
490
534
  next if target.source_build_phase.files_references.empty?
491
535
  next if target.name.end_with?("Tests")
492
536
  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)
537
+ enable_xcremotecache(target, 1, xcrc_location, xccc_location, mode, exclude_build_configurations, final_target,fake_src_root, exclude_sdks_configurations)
494
538
  end
495
539
  generated_project.save()
496
540
  end
@@ -531,7 +575,7 @@ module CocoapodsXCRemoteCacheModifier
531
575
  # Attach XCRC to the app targets
532
576
  user_project.targets.each do |target|
533
577
  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)
578
+ enable_xcremotecache(target, 0, xcrc_location, xccc_location, mode, exclude_build_configurations, final_target,fake_src_root, exclude_sdks_configurations)
535
579
  end
536
580
 
537
581
  # 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.16"
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.16
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-04-15 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: CocoaPods plugin that enables XCRemoteCache with the project.
15
15
  email: