cocoapods-xcremotecache 0.0.14 → 0.0.15

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: 9929e3043567b27f1a9a8dd2d475876930ed6ba35d654b463776688edcf4f0c4
4
- data.tar.gz: f03ed16f60910db323d0ae5edf3e3d8db4f5c32b722c417990a3cae3184b9fa7
3
+ metadata.gz: be0f0312463e793e7f6afccd9ae49ea0a0ed5f740adade59c780a0e6873f05a5
4
+ data.tar.gz: adbc9a76871be26f0fe19e53f92b67554db4f55a69d0e3d88118ed0c1b5cf9e5
5
5
  SHA512:
6
- metadata.gz: 14d5fba66c6ed362882a1cd6bcdf6a2e9095f81cca83ab7893020232af51839fc2154e61bdb7621f175873c460bfd5178413fc73d3c6f9c7a08c4354b3880486
7
- data.tar.gz: 7ea3092b9c346a2d75d0df98431a721badc7065449a1f89ab19db8fa58137002907e39a755dfffa789cb2cbe1e491aa4b5ffbee31a694df9752a236981619cc8
6
+ metadata.gz: 0ce9ed4249f55c838501321dadb012ea556441836fb07edaac8db88ff7ccd8510ab0debccbf1c92c98d9537680874a0416c68d33cdfad4c7620a52ca6d4608dd
7
+ data.tar.gz: 2cfed964db8d3078f35b48758e8be756938e77fd4b3937e7032327cf703cbcc5268cca67c96b6c82d1013cedac26cabc9efaae3ecb20da231ea812ba29da5687
@@ -3,9 +3,9 @@
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
5
5
  # You may obtain a copy of the License at
6
- #
6
+ #
7
7
  # http://www.apache.org/licenses/LICENSE-2.0
8
- #
8
+ #
9
9
  # Unless required by applicable law or agreed to in writing, software
10
10
  # distributed under the License is distributed on an "AS IS" BASIS,
11
11
  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -29,15 +29,15 @@ module CocoapodsXCRemoteCacheModifier
29
29
  FAT_ARCHIVE_NAME_INFIX = 'arm64-x86_64'
30
30
  XCRC_COOCAPODS_ROOT_KEY = 'XCRC_COOCAPODS_ROOT'
31
31
 
32
- # List of plugins' user properties that should not be copied to .rcinfo
32
+ # List of plugins' user properties that should not be copied to .rcinfo
33
33
  CUSTOM_CONFIGURATION_KEYS = [
34
- 'enabled',
34
+ 'enabled',
35
35
  'xcrc_location',
36
36
  'exclude_targets',
37
37
  'exclude_build_configurations',
38
38
  'final_target',
39
- 'check_build_configuration',
40
- 'check_platform',
39
+ 'check_build_configuration',
40
+ 'check_platform',
41
41
  'modify_lldb_init',
42
42
  'fake_src_root',
43
43
  ]
@@ -45,19 +45,19 @@ module CocoapodsXCRemoteCacheModifier
45
45
  class XCRemoteCache
46
46
  @@configuration = nil
47
47
 
48
- def self.configure(c)
48
+ def self.configure(c)
49
49
  @@configuration = c
50
50
  end
51
51
 
52
52
  def self.set_configuration_default_values
53
53
  default_values = {
54
54
  'mode' => 'consumer',
55
- 'enabled' => true,
55
+ 'enabled' => true,
56
56
  'xcrc_location' => "XCRC",
57
57
  'exclude_build_configurations' => [],
58
58
  'check_build_configuration' => 'Debug',
59
- 'check_platform' => 'iphonesimulator',
60
- 'modify_lldb_init' => true,
59
+ 'check_platform' => 'iphonesimulator',
60
+ 'modify_lldb_init' => true,
61
61
  'xccc_file' => "#{BIN_DIR}/xccc",
62
62
  'remote_commit_file' => "#{BIN_DIR}/arc.rc",
63
63
  'exclude_targets' => [],
@@ -75,12 +75,12 @@ module CocoapodsXCRemoteCacheModifier
75
75
 
76
76
  def self.validate_configuration()
77
77
  required_values = [
78
- 'cache_addresses',
78
+ 'cache_addresses',
79
79
  'primary_repo',
80
80
  'check_build_configuration',
81
81
  'check_platform'
82
82
  ]
83
-
83
+
84
84
  missing_configuration_values = required_values.select { |v| !@@configuration.key?(v) }
85
85
  unless missing_configuration_values.empty?
86
86
  throw "XCRemoteCache not fully configured. Make sure all required fields are provided. Missing fields are: #{missing_configuration_values.join(', ')}."
@@ -105,7 +105,7 @@ module CocoapodsXCRemoteCacheModifier
105
105
  end
106
106
 
107
107
  # @param target [Target] target to apply XCRemoteCache
108
- # @param repo_distance [Integer] distance from the git repo root to the target's $SRCROOT
108
+ # @param repo_distance [Integer] distance from the git repo root to the target's $SRCROOT
109
109
  # @param xc_location [String] path to the dir with all XCRemoteCache binaries, relative to the repo root
110
110
  # @param xc_cc_path [String] path to the XCRemoteCache clang wrapper, relative to the repo root
111
111
  # @param mode [String] mode name ('consumer', 'producer', 'producer-fast' etc.)
@@ -128,6 +128,7 @@ module CocoapodsXCRemoteCacheModifier
128
128
  config.build_settings['LIBTOOL'] = ["$SRCROOT/#{srcroot_relative_xc_location}/xclibtool"]
129
129
  config.build_settings['LD'] = ["$SRCROOT/#{srcroot_relative_xc_location}/xcld"]
130
130
  config.build_settings['LDPLUSPLUS'] = ["$SRCROOT/#{srcroot_relative_xc_location}/xcldplusplus"]
131
+ config.build_settings['LIPO'] = ["$SRCROOT/#{srcroot_relative_xc_location}/xclipo"]
131
132
  config.build_settings['SWIFT_USE_INTEGRATED_DRIVER'] = ['NO']
132
133
 
133
134
  config.build_settings['XCREMOTE_CACHE_FAKE_SRCROOT'] = fake_src_root
@@ -156,7 +157,7 @@ module CocoapodsXCRemoteCacheModifier
156
157
  prebuild_script.dependency_file = "$(TARGET_TEMP_DIR)/prebuild.d"
157
158
 
158
159
  # Move prebuild (last element) to the position before compile sources phase (to make it real 'prebuild')
159
- if !existing_prebuild_script
160
+ if !existing_prebuild_script
160
161
  compile_phase_index = target.build_phases.index(target.source_build_phase)
161
162
  target.build_phases.insert(compile_phase_index, target.build_phases.delete(prebuild_script))
162
163
  end
@@ -184,7 +185,7 @@ module CocoapodsXCRemoteCacheModifier
184
185
  ]
185
186
  postbuild_script.dependency_file = "$(TARGET_TEMP_DIR)/postbuild.d"
186
187
  # Move postbuild (last element) to the position after compile sources phase (to make it real 'postbuild')
187
- if !existing_postbuild_script
188
+ if !existing_postbuild_script
188
189
  compile_phase_index = target.build_phases.index(target.source_build_phase)
189
190
  target.build_phases.insert(compile_phase_index + 1, target.build_phases.delete(postbuild_script))
190
191
  end
@@ -214,6 +215,7 @@ module CocoapodsXCRemoteCacheModifier
214
215
  config.build_settings.delete('CC') if config.build_settings.key?('CC')
215
216
  config.build_settings.delete('SWIFT_EXEC') if config.build_settings.key?('SWIFT_EXEC')
216
217
  config.build_settings.delete('LIBTOOL') if config.build_settings.key?('LIBTOOL')
218
+ config.build_settings.delete('LIPO') if config.build_settings.key?('LIPO')
217
219
  config.build_settings.delete('LD') if config.build_settings.key?('LD')
218
220
  config.build_settings.delete('LDPLUSPLUS') if config.build_settings.key?('LDPLUSPLUS')
219
221
  config.build_settings.delete('SWIFT_USE_INTEGRATED_DRIVER') if config.build_settings.key?('SWIFT_USE_INTEGRATED_DRIVER')
@@ -226,9 +228,9 @@ module CocoapodsXCRemoteCacheModifier
226
228
  end
227
229
 
228
230
  # User project is not generated from scratch (contrary to `Pods`), delete all previous XCRemoteCache phases
229
- target.build_phases.delete_if {|phase|
231
+ target.build_phases.delete_if {|phase|
230
232
  # Some phases (e.g. PBXSourcesBuildPhase) don't have strict name check respond_to?
231
- if phase.respond_to?(:name)
233
+ if phase.respond_to?(:name)
232
234
  phase.name != nil && phase.name.start_with?("[XCRC]")
233
235
  end
234
236
  }
@@ -240,9 +242,9 @@ module CocoapodsXCRemoteCacheModifier
240
242
  end
241
243
 
242
244
  def self.download_xcrc_if_needed(local_location)
243
- required_binaries = ['xcld', 'xcldplusplus', 'xclibtool', 'xcpostbuild', 'xcprebuild', 'xcprepare', 'xcswiftc']
245
+ required_binaries = ['xcld', 'xcldplusplus', 'xclibtool', 'xclipo', 'xcpostbuild', 'xcprebuild', 'xcprepare', 'xcswiftc']
244
246
  binaries_exist = required_binaries.reduce(true) do |exists, filename|
245
- file_path = File.join(local_location, filename)
247
+ file_path = File.join(local_location, filename)
246
248
  exists = exists && File.exist?(file_path)
247
249
  end
248
250
 
@@ -256,13 +258,13 @@ module CocoapodsXCRemoteCacheModifier
256
258
 
257
259
  if !system("unzip #{local_package_location} -d #{local_location}")
258
260
  throw "Unzipping XCRemoteCache failed"
259
- end
261
+ end
260
262
  end
261
263
 
262
264
  def self.download_latest_xcrc_release(local_package_location)
263
265
  release_url = 'https://api.github.com/repos/spotify/XCRemoteCache/releases/latest'
264
266
  asset_url = nil
265
-
267
+
266
268
  URI.open(release_url) do |f|
267
269
  assets_array = JSON.parse(f.read)['assets']
268
270
  # Pick fat archive
@@ -270,7 +272,7 @@ module CocoapodsXCRemoteCacheModifier
270
272
  asset_url = asset_array['url']
271
273
  end
272
274
 
273
- if asset_url.nil?
275
+ if asset_url.nil?
274
276
  throw "Downloading XCRemoteCache failed"
275
277
  end
276
278
 
@@ -283,7 +285,7 @@ module CocoapodsXCRemoteCacheModifier
283
285
 
284
286
  def self.add_cflags!(options, key, value)
285
287
  return if options.fetch('OTHER_CFLAGS',[]).include?(value)
286
- options['OTHER_CFLAGS'] = remove_cflags!(options, key) << "#{key}=#{value}"
288
+ options['OTHER_CFLAGS'] = remove_cflags!(options, key) << "#{key}=#{value}"
287
289
  end
288
290
 
289
291
  def self.remove_cflags!(options, key)
@@ -295,7 +297,7 @@ module CocoapodsXCRemoteCacheModifier
295
297
 
296
298
  def self.add_swiftflags!(options, key, value)
297
299
  return if options.fetch('OTHER_SWIFT_FLAGS','').include?(value)
298
- options['OTHER_SWIFT_FLAGS'] = remove_swiftflags!(options, key) + " #{key} #{value}"
300
+ options['OTHER_SWIFT_FLAGS'] = remove_swiftflags!(options, key) + " #{key} #{value}"
299
301
  end
300
302
 
301
303
  def self.remove_swiftflags!(options, key)
@@ -336,7 +338,7 @@ module CocoapodsXCRemoteCacheModifier
336
338
  File.open(lldbinit_path) { |file|
337
339
  while(line = file.gets) != nil
338
340
  line = line.strip
339
- if line == LLDB_INIT_COMMENT
341
+ if line == LLDB_INIT_COMMENT
340
342
  # skip current and next lines
341
343
  file.gets
342
344
  next
@@ -351,7 +353,7 @@ module CocoapodsXCRemoteCacheModifier
351
353
  def self.add_lldbinit_rewrite(lines_content, user_proj_directory,fake_src_root)
352
354
  all_lines = lines_content.clone
353
355
  all_lines << LLDB_INIT_COMMENT
354
- all_lines << "settings set target.source-map #{fake_src_root} #{user_proj_directory}"
356
+ all_lines << "settings set target.source-map #{fake_src_root} #{user_proj_directory}"
355
357
  all_lines << ""
356
358
  all_lines
357
359
  end
@@ -413,8 +415,8 @@ module CocoapodsXCRemoteCacheModifier
413
415
  # Remote cache is still disabled - no need to force Pods projects/targets regeneration
414
416
  next
415
417
  end
416
-
417
- # Force rebuilding all Pods project, because XCRC build steps and settings need to be added to Pods project/targets
418
+
419
+ # Force rebuilding all Pods project, because XCRC build steps and settings need to be added to Pods project/targets
418
420
  # It is relevant only when 'incremental_installation' is enabled, otherwise installed_cache_path does not exist on a disk
419
421
  installed_cache_path = installer_context.sandbox.project_installation_cache_path
420
422
  if !was_previously_enabled && File.exist?(installed_cache_path)
@@ -431,7 +433,7 @@ module CocoapodsXCRemoteCacheModifier
431
433
 
432
434
  user_project = installer_context.umbrella_targets[0].user_project
433
435
 
434
- begin
436
+ begin
435
437
  user_proj_directory = File.dirname(user_project.path)
436
438
  set_configuration_default_values
437
439
 
@@ -494,12 +496,12 @@ module CocoapodsXCRemoteCacheModifier
494
496
  end
495
497
 
496
498
  # Manual Pods/.rcinfo generation
497
-
499
+
498
500
  # all paths in .rcinfo are relative to the root so paths used in Pods.xcodeproj need to be aligned
499
501
  pods_path = Pathname.new(pods_proj_directory)
500
502
  root_path = Pathname.new(user_proj_directory)
501
503
  root_path_to_pods = root_path.relative_path_from(pods_path)
502
-
504
+
503
505
  pods_rcinfo = root_rcinfo.merge({
504
506
  'remote_commit_file' => "#{root_path_to_pods}/#{remote_commit_file}",
505
507
  'xccc_file' => "#{root_path_to_pods}/#{xccc_location}"
@@ -511,7 +513,7 @@ module CocoapodsXCRemoteCacheModifier
511
513
 
512
514
  # Enabled/disable XCRemoteCache for the main (user) project
513
515
  begin
514
- # TODO: Do not compile xcc again. `xcprepare` compiles it in pre-install anyway
516
+ # TODO: Do not compile xcc again. `xcprepare` compiles it in pre-install anyway
515
517
  prepare_result = YAML.load`#{xcrc_location_absolute}/xcprepare --configuration #{check_build_configuration} --platform #{check_platform}`
516
518
  unless prepare_result['result'] || mode != 'consumer'
517
519
  # Uninstall the XCRemoteCache for the consumer mode
@@ -3,9 +3,9 @@
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
5
5
  # You may obtain a copy of the License at
6
- #
6
+ #
7
7
  # http://www.apache.org/licenses/LICENSE-2.0
8
- #
8
+ #
9
9
  # Unless required by applicable law or agreed to in writing, software
10
10
  # distributed under the License is distributed on an "AS IS" BASIS,
11
11
  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -13,5 +13,5 @@
13
13
  # limitations under the License.
14
14
 
15
15
  module CocoapodsXcremotecache
16
- VERSION = "0.0.14"
16
+ VERSION = "0.0.15"
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.14
4
+ version: 0.0.15
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-08-26 00:00:00.000000000 Z
12
+ date: 2023-03-21 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: CocoaPods plugin that enables XCRemoteCache with the project.
15
15
  email: