fastlane_core 0.50.3 → 0.51.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b96d82ed677bd4751568e0936cb6b729d8a64e73
4
- data.tar.gz: 7e7a3f90bd8de431f1427148a958faf103db97dc
3
+ metadata.gz: fd9d8635178694a33d1b84e4bc9ec6169cdccc98
4
+ data.tar.gz: 95004a8b16ad7fe2fe2095ed70037b6978206c42
5
5
  SHA512:
6
- metadata.gz: f2637e750148dd81c2964ae76d62bec4b29ec74f065d45092d5a8f64551edfc5039019f7911748081361b4f225b2df1ca9a100855f60793bdaee935e17ecd3dd
7
- data.tar.gz: cad4a1dddec39691cdb6599d076038b784fded7df8bfa78e54036a0e780e86e25f339c495e89df2c1a7d1be2ee80605e102c8046077f897fe5e5071da637379a
6
+ metadata.gz: bf19eb51582311a5e087439e686fe24d83867228795c5f6f30fc08d6be2326509e49fe0a4565e922fac21a10b011c10f18020e7d0c4b2fd5ee6f31927db662f1
7
+ data.tar.gz: b9cebd1cd4252a66fbb0f5a3e81cfbacd1566bf8f8a611763994cdda24224538f523d99690cd284504e9a64f6be5b0a74a3a2c0af83a8480e0abccb57f13d1d9
@@ -34,4 +34,5 @@ require 'commander'
34
34
  require 'fastlane_core/ui/fastlane_runner' # monkey patch
35
35
 
36
36
  module FastlaneCore
37
+ ROOT = Pathname.new(File.expand_path('../..', __FILE__))
37
38
  end
@@ -58,7 +58,7 @@ module FastlaneCore
58
58
 
59
59
  # This will raise an exception if the value is not valid
60
60
  def verify!(value)
61
- UI.user_error!("Invalid value '#{value}' for option '#{self}'") unless valid? value
61
+ UI.user_error!("Invalid value '#{value}' for option '#{self}'") unless valid?(value)
62
62
  true
63
63
  end
64
64
 
@@ -140,8 +140,13 @@ module FastlaneCore
140
140
  @enabled ||= (File.directory?("./fastlane") || File.directory?("./.fastlane"))
141
141
  end
142
142
 
143
+ # <b>DEPRECATED:</b> Use the `ROOT` constant from the appropriate tool module instead
144
+ # e.g. File.join(Sigh::ROOT, 'lib', 'assets', 'resign.sh')
145
+ #
143
146
  # Path to the installed gem to load resources (e.g. resign.sh)
144
147
  def self.gem_path(gem_name)
148
+ UI.deprecated('`Helper.gem_path` is deprecated. Use the `ROOT` constant from the appropriate tool module instead.')
149
+
145
150
  if !Helper.is_test? and Gem::Specification.find_all_by_name(gem_name).any?
146
151
  return Gem::Specification.find_by_name(gem_name).gem_dir
147
152
  else
@@ -12,8 +12,6 @@ module FastlaneCore
12
12
  FileUtils.rm_rf self.package_path if File.directory?(self.package_path)
13
13
  FileUtils.mkdir_p self.package_path
14
14
 
15
- lib_path = Helper.gem_path("fastlane_core")
16
-
17
15
  ipa_path = copy_ipa(ipa_path)
18
16
  @data = {
19
17
  apple_id: app_id,
@@ -24,7 +22,7 @@ module FastlaneCore
24
22
  platform: (platform || "ios") # pass "appletvos" for Apple TV's IPA
25
23
  }
26
24
 
27
- xml_path = File.join(lib_path, "lib/assets/XMLTemplate.xml.erb")
25
+ xml_path = File.join(FastlaneCore::ROOT, "lib/assets/XMLTemplate.xml.erb")
28
26
  xml = ERB.new(File.read(xml_path)).result(binding) # http://www.rrn.dk/rubys-erb-templating-system
29
27
 
30
28
  File.write(File.join(self.package_path, METADATA_FILE_NAME), xml)
@@ -12,8 +12,6 @@ module FastlaneCore
12
12
  FileUtils.rm_rf(self.package_path) if File.directory?(self.package_path)
13
13
  FileUtils.mkdir_p self.package_path
14
14
 
15
- lib_path = Helper.gem_path('fastlane_core')
16
-
17
15
  pkg_path = copy_pkg(pkg_path)
18
16
  @data = {
19
17
  apple_id: app_id,
@@ -24,7 +22,7 @@ module FastlaneCore
24
22
  platform: 'osx'
25
23
  }
26
24
 
27
- xml_path = File.join(lib_path, 'lib/assets/XMLTemplate.xml.erb')
25
+ xml_path = File.join(FastlaneCore::ROOT, 'lib/assets/XMLTemplate.xml.erb')
28
26
  xml = ERB.new(File.read(xml_path)).result(binding) # http://www.rrn.dk/rubys-erb-templating-system
29
27
 
30
28
  File.write(File.join(self.package_path, METADATA_FILE_NAME), xml)
@@ -204,8 +204,11 @@ module FastlaneCore
204
204
  #####################################################
205
205
 
206
206
  def build_xcodebuild_showbuildsettings_command
207
- # We also need to pass the workspace and scheme to this command
208
- command = "xcodebuild -showBuildSettings #{xcodebuild_parameters.join(' ')}"
207
+ # We also need to pass the workspace and scheme to this command.
208
+ #
209
+ # The 'clean' portion of this command is a workaround for an xcodebuild bug with Core Data projects.
210
+ # See: https://github.com/fastlane/fastlane/pull/5626
211
+ command = "xcodebuild clean -showBuildSettings #{xcodebuild_parameters.join(' ')}"
209
212
  command += " 2> /dev/null" if xcodebuild_suppress_stderr
210
213
  command
211
214
  end
@@ -216,7 +219,17 @@ module FastlaneCore
216
219
  def build_settings(key: nil, optional: true)
217
220
  unless @build_settings
218
221
  command = build_xcodebuild_showbuildsettings_command
219
- @build_settings = Helper.backticks(command, print: false)
222
+
223
+ # xcode might hang here and retrying fixes the problem, see fastlane#4059
224
+ begin
225
+ timeout = FastlaneCore::Project.xcode_build_settings_timeout
226
+ retries = FastlaneCore::Project.xcode_build_settings_retries
227
+ @build_settings = FastlaneCore::Project.run_command(command, timeout: timeout, retries: retries, print: !self.xcodebuild_list_silent)
228
+ rescue Timeout::Error
229
+ UI.crash!("xcodebuild -showBuildSettings timed-out after #{timeout} seconds and #{retries} retries." \
230
+ " You can override the timeout value with the environment variable FASTLANE_XCODEBUILD_SETTINGS_TIMEOUT," \
231
+ " and the number of retries with the environment variable FASTLANE_XCODEBUILD_SETTINGS_RETRIES ")
232
+ end
220
233
  end
221
234
 
222
235
  begin
@@ -279,14 +292,14 @@ module FastlaneCore
279
292
  return @raw if @raw
280
293
 
281
294
  command = build_xcodebuild_list_command
282
- UI.important(command) unless silent
283
295
 
284
296
  # xcode >= 6 might hang here if the user schemes are missing
285
297
  begin
286
298
  timeout = FastlaneCore::Project.xcode_list_timeout
287
- @raw = FastlaneCore::Project.run_command(command, timeout: timeout)
299
+ retries = FastlaneCore::Project.xcode_list_retries
300
+ @raw = FastlaneCore::Project.run_command(command, timeout: timeout, retries: retries, print: !silent)
288
301
  rescue Timeout::Error
289
- UI.user_error!("xcodebuild -list timed-out after #{timeout} seconds. You might need to recreate the user schemes." \
302
+ UI.user_error!("xcodebuild -list timed-out after #{timeout * retries} seconds. You might need to recreate the user schemes." \
290
303
  " You can override the timeout value with the environment variable FASTLANE_XCODE_LIST_TIMEOUT")
291
304
  end
292
305
 
@@ -301,13 +314,55 @@ module FastlaneCore
301
314
  end
302
315
 
303
316
  # @internal to module
304
- # runs the specified command and kills it if timeouts
305
- # @raises Timeout::Error if timeout is passed
306
- # @returns the output
307
- # Note: currently affected by fastlane/fastlane_core#102
308
- def self.run_command(command, timeout: 0)
317
+ def self.xcode_list_retries
318
+ (ENV['FASTLANE_XCODE_LIST_RETRIES'] || 3).to_i
319
+ end
320
+
321
+ # @internal to module
322
+ def self.xcode_build_settings_timeout
323
+ (ENV['FASTLANE_XCODEBUILD_SETTINGS_TIMEOUT'] || 10).to_i
324
+ end
325
+
326
+ # @internal to module
327
+ def self.xcode_build_settings_retries
328
+ (ENV['FASTLANE_XCODEBUILD_SETTINGS_RETRIES'] || 3).to_i
329
+ end
330
+
331
+ # @internal to module
332
+ # runs the specified command with the specified number of retries, killing each run if it times out
333
+ # @raises Timeout::Error if all tries result in a timeout
334
+ # @returns the output of the command
335
+ # Note: - currently affected by https://github.com/fastlane/fastlane/issues/1504
336
+ # - retry feature added to solve https://github.com/fastlane/fastlane/issues/4059
337
+ def self.run_command(command, timeout: 0, retries: 0, print: true)
309
338
  require 'timeout'
310
- @raw = Timeout.timeout(timeout) { `#{command}`.to_s }
339
+
340
+ UI.command(command) if print
341
+
342
+ result = ''
343
+
344
+ total_tries = retries + 1
345
+ try = 1
346
+ begin
347
+ Timeout.timeout(timeout) do
348
+ # Using Helper.backticks didn't work here. `Timeout` doesn't time out, and the command hangs forever
349
+ result = `#{command}`.to_s
350
+ end
351
+ rescue Timeout::Error
352
+ try_limit_reached = try >= total_tries
353
+
354
+ message = "Command timed out after #{timeout} seconds on try #{try} of #{total_tries}"
355
+ message += ", trying again..." unless try_limit_reached
356
+
357
+ UI.important(message)
358
+
359
+ raise if try_limit_reached
360
+
361
+ try += 1
362
+ retry
363
+ end
364
+
365
+ return result
311
366
  end
312
367
 
313
368
  private
@@ -1,3 +1,3 @@
1
1
  module FastlaneCore
2
- VERSION = "0.50.3".freeze
2
+ VERSION = "0.51.0".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.50.3
4
+ version: 0.51.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Felix Krause
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-22 00:00:00.000000000 Z
11
+ date: 2016-09-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json