cocoapods-xcremotecache 0.0.5 → 0.0.6

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: 073bb6eb42ef3ca4b2911ecf1a22f57d3fee56b4ca151446b542c1e2a8ea95bd
4
- data.tar.gz: 3baa31150bb89f06635781eaae290b9b998776f0e0d5f099fa93197a84034de9
3
+ metadata.gz: b5729278f5bfda276e8d0ea6c3a240e7292dbe0c91530f1de8ea925ef5aeb9c6
4
+ data.tar.gz: 6188f57eceb4c204fdccf41e0fe3d6fcca38bf942c4f84ed2524943c16a1b73b
5
5
  SHA512:
6
- metadata.gz: 3a1a857abfdd8231b6eeaaeb626bd0b446bd58176b03143e0d1c292c78b2bd56c8f1e567293708f71518c91f6869326f726b20582286172b68de6f657198bebc
7
- data.tar.gz: 987ecea74817a95bf1b1bda403e17d2494d65cc6e5c8c24666f239ae3fd83721474405e5fe3daa87112bb725346432019f6892f0a0ce327741890d449554aa58
6
+ metadata.gz: ca3f2d700a3522a8c26599f1f70ff2539713e44c8cd0fafbdf6041dff6aeb25b88d3cfb117099fd35bc290fd052380d67ddcbcc59443b05cb97cbe01f71575b3
7
+ data.tar.gz: b737a9f5591f86ea1234c812f07010cf18a80cf4ad4497f5da9b9f3812e3e5b3961468743f40b4478bee48e9543fe4fb776548bb720992cf630df746cf7ded32
@@ -82,8 +82,8 @@ module CocoapodsXCRemoteCacheModifier
82
82
  end
83
83
 
84
84
  mode = @@configuration['mode']
85
- unless mode == 'consumer' || mode == 'producer'
86
- 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?"
87
87
  end
88
88
 
89
89
  unless mode == 'consumer' || @@configuration.key?('final_target')
@@ -103,7 +103,7 @@ module CocoapodsXCRemoteCacheModifier
103
103
  # @param repo_distance [Integer] distance from the git repo root to the target's $SRCROOT
104
104
  # @param xc_location [String] path to the dir with all XCRemoteCache binaries, relative to the repo root
105
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' etc.)
106
+ # @param mode [String] mode name ('consumer', 'producer', 'producer-fast' etc.)
107
107
  # @param exclude_build_configurations [String[]] list of targets that should have disabled remote cache
108
108
  # @param final_target [String] name of target that should trigger marking
109
109
  def self.enable_xcremotecache(target, repo_distance, xc_location, xc_cc_path, mode, exclude_build_configurations, final_target)
@@ -114,6 +114,8 @@ module CocoapodsXCRemoteCacheModifier
114
114
  next if exclude_build_configurations.include?(config.name)
115
115
  if mode == 'consumer'
116
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')
117
119
  end
118
120
  config.build_settings['SWIFT_EXEC'] = ["$SRCROOT/#{srcroot_relative_xc_location}/xcswiftc"]
119
121
  config.build_settings['LIBTOOL'] = ["$SRCROOT/#{srcroot_relative_xc_location}/xclibtool"]
@@ -144,7 +146,7 @@ module CocoapodsXCRemoteCacheModifier
144
146
 
145
147
  # Move prebuild (last element) to the first position (to make it real 'prebuild')
146
148
  target.build_phases.rotate!(-1) if existing_prebuild_script.nil?
147
- elsif mode == 'producer'
149
+ elsif mode == 'producer' || mode == 'producer-fast'
148
150
  # Delete existing prebuild build phase (to support switching between modes)
149
151
  target.build_phases.delete_if do |phase|
150
152
  if phase.respond_to?(:name)
@@ -169,7 +171,7 @@ module CocoapodsXCRemoteCacheModifier
169
171
  postbuild_script.dependency_file = "$(TARGET_TEMP_DIR)/postbuild.d"
170
172
 
171
173
  # Mark a sha as ready for a given platform and configuration when building the final_target
172
- if mode == 'producer' && target.name == final_target
174
+ if (mode == 'producer' || mode == 'producer-fast') && target.name == final_target
173
175
  existing_mark_script = target.build_phases.detect do |phase|
174
176
  if phase.respond_to?(:name)
175
177
  phase.name != nil && phase.name.start_with?("[XCRC] Mark")
@@ -194,8 +196,9 @@ module CocoapodsXCRemoteCacheModifier
194
196
  config.build_settings.delete('SWIFT_EXEC') if config.build_settings.key?('SWIFT_EXEC')
195
197
  config.build_settings.delete('LIBTOOL') if config.build_settings.key?('LIBTOOL')
196
198
  config.build_settings.delete('LD') if config.build_settings.key?('LD')
197
- # Add Fake src root for ObjC & Swift
199
+ # Remove Fake src root for ObjC & Swift
198
200
  config.build_settings.delete('XCREMOTE_CACHE_FAKE_SRCROOT')
201
+ config.build_settings.delete('XCRC_PLATFORM_PREFERRED_ARCH')
199
202
  remove_cflags!(config.build_settings, '-fdebug-prefix-map')
200
203
  remove_swiftflags!(config.build_settings, '-debug-prefix-map')
201
204
  end
@@ -257,14 +260,14 @@ module CocoapodsXCRemoteCacheModifier
257
260
  end
258
261
 
259
262
  def self.add_cflags!(options, key, value)
260
- return if options.fetch('OTHER_CFLAGS',[]).include?(' ' + value)
261
- 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}"
262
265
  end
263
266
 
264
267
  def self.remove_cflags!(options, key)
265
268
  cflags_arr = options.fetch('OTHER_CFLAGS', ['$(inherited)'])
266
269
  cflags_arr = [cflags_arr] if cflags_arr.kind_of? String
267
- options['OTHER_CFLAGS'] = cflags_arr.delete_if {|flag| flag.start_with?(" #{key}=") }
270
+ options['OTHER_CFLAGS'] = cflags_arr.delete_if {|flag| flag.include?("#{key}=") }
268
271
  options['OTHER_CFLAGS']
269
272
  end
270
273
 
@@ -279,12 +282,27 @@ module CocoapodsXCRemoteCacheModifier
279
282
  end
280
283
 
281
284
  # Uninstall the XCRemoteCache
282
- def self.disable_xcremotecache(user_project)
285
+ def self.disable_xcremotecache(user_project, pods_project = nil)
283
286
  user_project.targets.each do |target|
284
287
  disable_xcremotecache_for_target(target)
285
288
  end
286
289
  user_project.save()
287
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
+
288
306
  # Remove .lldbinit rewrite
289
307
  save_lldbinit_rewrite(nil) unless !@@configuration['modify_lldb_init']
290
308
  end
@@ -375,7 +393,9 @@ module CocoapodsXCRemoteCacheModifier
375
393
  # Always integrate XCRemoteCache to all Pods, in case it will be needed later
376
394
  unless installer_context.pods_project.nil?
377
395
  # Attach XCRemoteCache to Pods targets
378
- installer_context.pods_project.targets.each do |target|
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?
379
399
  next if target.name.start_with?("Pods-")
380
400
  next if target.name.end_with?("Tests")
381
401
  next if exclude_targets.include?(target.name)
@@ -385,6 +405,18 @@ module CocoapodsXCRemoteCacheModifier
385
405
  # Create .rcinfo into `Pods` directory as that .xcodeproj reads configuration from .xcodeproj location
386
406
  pods_proj_directory = installer_context.sandbox_root
387
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
+
388
420
  # Manual Pods/.rcinfo generation
389
421
 
390
422
  # all paths in .rcinfo are relative to the root so paths used in Pods.xcodeproj need to be aligned
@@ -406,12 +438,12 @@ module CocoapodsXCRemoteCacheModifier
406
438
  prepare_result = YAML.load`#{xcrc_location_absolute}/xcprepare --configuration #{check_build_configuration} --platform #{check_platform}`
407
439
  unless prepare_result['result'] || mode != 'consumer'
408
440
  # Uninstall the XCRemoteCache for the consumer mode
409
- disable_xcremotecache(user_project)
441
+ disable_xcremotecache(user_project, installer_context.pods_project)
410
442
  Pod::UI.puts "[XCRC] XCRemoteCache disabled - no artifacts available"
411
443
  next
412
444
  end
413
445
  rescue => error
414
- disable_xcremotecache(user_project)
446
+ disable_xcremotecache(user_project, installer_context.pods_project)
415
447
  Pod::UI.puts "[XCRC] XCRemoteCache failed with an error: #{error}."
416
448
  next
417
449
  end
@@ -436,7 +468,7 @@ module CocoapodsXCRemoteCacheModifier
436
468
  rescue Exception => e
437
469
  Pod::UI.puts "[XCRC] XCRemoteCache disabled with error: #{e}"
438
470
  puts e.full_message(highlight: true, order: :top)
439
- disable_xcremotecache(user_project)
471
+ disable_xcremotecache(user_project, installer_context.pods_project)
440
472
  end
441
473
  end
442
474
  end
@@ -13,5 +13,5 @@
13
13
  # limitations under the License.
14
14
 
15
15
  module CocoapodsXcremotecache
16
- VERSION = "0.0.5"
16
+ VERSION = "0.0.6"
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.5
4
+ version: 0.0.6
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-01-19 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: