fastlane 2.241.2 → 2.242.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.
Files changed (127) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +38 -38
  3. data/cert/lib/cert/runner.rb +1 -1
  4. data/credentials_manager/README.md +3 -3
  5. data/credentials_manager/lib/credentials_manager/account_manager.rb +13 -3
  6. data/deliver/lib/deliver/runner.rb +5 -0
  7. data/fastlane/lib/assets/certificates/AppleIncRootCertificate.cer +0 -0
  8. data/fastlane/lib/assets/certificates/AppleRootCA-G3.cer +0 -0
  9. data/fastlane/lib/fastlane/action.rb +8 -6
  10. data/fastlane/lib/fastlane/actions/app_store_connect_api_key.rb +1 -1
  11. data/fastlane/lib/fastlane/actions/changelog_from_git_commits.rb +0 -3
  12. data/fastlane/lib/fastlane/actions/clipboard.rb +1 -1
  13. data/fastlane/lib/fastlane/actions/commit_version_bump.rb +0 -1
  14. data/fastlane/lib/fastlane/actions/create_keychain.rb +20 -29
  15. data/fastlane/lib/fastlane/actions/delete_keychain.rb +5 -3
  16. data/fastlane/lib/fastlane/actions/docs/build_app.md +1 -1
  17. data/fastlane/lib/fastlane/actions/docs/create_app_online.md +1 -1
  18. data/fastlane/lib/fastlane/actions/docs/frame_screenshots.md +4 -4
  19. data/fastlane/lib/fastlane/actions/docs/get_provisioning_profile.md +1 -1
  20. data/fastlane/lib/fastlane/actions/docs/upload_to_app_store.md.erb +1 -1
  21. data/fastlane/lib/fastlane/actions/docs/upload_to_play_store.md +12 -0
  22. data/fastlane/lib/fastlane/actions/download_app_privacy_details_from_app_store.rb +5 -4
  23. data/fastlane/lib/fastlane/actions/download_dsyms.rb +3 -1
  24. data/fastlane/lib/fastlane/actions/get_managed_play_store_publishing_rights.rb +1 -0
  25. data/fastlane/lib/fastlane/actions/git_pull.rb +1 -1
  26. data/fastlane/lib/fastlane/actions/hg_commit_version_bump.rb +0 -1
  27. data/fastlane/lib/fastlane/actions/import_certificate.rb +18 -6
  28. data/fastlane/lib/fastlane/actions/import_from_gem.rb +70 -0
  29. data/fastlane/lib/fastlane/actions/jazzy.rb +1 -1
  30. data/fastlane/lib/fastlane/actions/lcov.rb +1 -1
  31. data/fastlane/lib/fastlane/actions/mailgun.rb +2 -2
  32. data/fastlane/lib/fastlane/actions/make_changelog_from_jenkins.rb +1 -1
  33. data/fastlane/lib/fastlane/actions/notarize.rb +55 -7
  34. data/fastlane/lib/fastlane/actions/prompt.rb +1 -1
  35. data/fastlane/lib/fastlane/actions/push_to_git_remote.rb +2 -2
  36. data/fastlane/lib/fastlane/actions/sh.rb +20 -2
  37. data/fastlane/lib/fastlane/actions/sourcedocs.rb +2 -2
  38. data/fastlane/lib/fastlane/actions/swiftlint.rb +5 -2
  39. data/fastlane/lib/fastlane/actions/unlock_keychain.rb +17 -29
  40. data/fastlane/lib/fastlane/actions/update_fastlane.rb +10 -3
  41. data/fastlane/lib/fastlane/actions/update_project_code_signing.rb +2 -1
  42. data/fastlane/lib/fastlane/actions/update_project_provisioning.rb +21 -18
  43. data/fastlane/lib/fastlane/actions/upload_app_privacy_details_to_app_store.rb +1 -1
  44. data/fastlane/lib/fastlane/actions/upload_symbols_to_crashlytics.rb +8 -2
  45. data/fastlane/lib/fastlane/actions/verify_build.rb +2 -1
  46. data/fastlane/lib/fastlane/actions/verify_pod_keys.rb +2 -1
  47. data/fastlane/lib/fastlane/actions/xcodebuild.rb +1 -1
  48. data/fastlane/lib/fastlane/cli_tools_distributor.rb +7 -0
  49. data/fastlane/lib/fastlane/environment_printer.rb +14 -14
  50. data/fastlane/lib/fastlane/fast_file.rb +35 -4
  51. data/fastlane/lib/fastlane/helper/sh_helper.rb +27 -45
  52. data/fastlane/lib/fastlane/lane_list.rb +1 -1
  53. data/fastlane/lib/fastlane/plugins/plugin_manager.rb +2 -2
  54. data/fastlane/lib/fastlane/plugins/template/.rubocop.yml +0 -2
  55. data/fastlane/lib/fastlane/runner.rb +4 -6
  56. data/fastlane/lib/fastlane/server/socket_server_action_command_executor.rb +4 -4
  57. data/fastlane/lib/fastlane/swift_fastlane_api_generator.rb +3 -3
  58. data/fastlane/lib/fastlane/version.rb +2 -1
  59. data/fastlane/swift/Deliverfile.swift +1 -1
  60. data/fastlane/swift/DeliverfileProtocol.swift +1 -1
  61. data/fastlane/swift/Fastlane.swift +46 -152
  62. data/fastlane/swift/Gymfile.swift +1 -1
  63. data/fastlane/swift/GymfileProtocol.swift +1 -1
  64. data/fastlane/swift/Matchfile.swift +1 -1
  65. data/fastlane/swift/MatchfileProtocol.swift +1 -1
  66. data/fastlane/swift/Precheckfile.swift +1 -1
  67. data/fastlane/swift/PrecheckfileProtocol.swift +1 -1
  68. data/fastlane/swift/Runner.swift +1 -1
  69. data/fastlane/swift/Scanfile.swift +1 -1
  70. data/fastlane/swift/ScanfileProtocol.swift +1 -1
  71. data/fastlane/swift/Screengrabfile.swift +1 -1
  72. data/fastlane/swift/ScreengrabfileProtocol.swift +1 -1
  73. data/fastlane/swift/Snapshotfile.swift +1 -1
  74. data/fastlane/swift/SnapshotfileProtocol.swift +1 -1
  75. data/fastlane_core/lib/fastlane_core/cert_checker.rb +40 -76
  76. data/fastlane_core/lib/fastlane_core/command_executor.rb +128 -7
  77. data/fastlane_core/lib/fastlane_core/configuration/config_item.rb +1 -1
  78. data/fastlane_core/lib/fastlane_core/configuration/configuration_file.rb +1 -1
  79. data/fastlane_core/lib/fastlane_core/device_manager.rb +14 -5
  80. data/fastlane_core/lib/fastlane_core/fastlane_pty.rb +25 -10
  81. data/fastlane_core/lib/fastlane_core/helper.rb +26 -2
  82. data/fastlane_core/lib/fastlane_core/ios_app_identifier_guesser.rb +1 -1
  83. data/fastlane_core/lib/fastlane_core/itunes_transporter.rb +24 -19
  84. data/fastlane_core/lib/fastlane_core/keychain_importer.rb +48 -71
  85. data/fastlane_core/lib/fastlane_core/pkg_file_analyser.rb +5 -1
  86. data/fastlane_core/lib/fastlane_core/print_table.rb +1 -1
  87. data/fastlane_core/lib/fastlane_core/queue_worker.rb +0 -2
  88. data/fastlane_core/lib/fastlane_core/stored_passwords.rb +29 -0
  89. data/fastlane_core/lib/fastlane_core/string_filters.rb +1 -2
  90. data/fastlane_core/lib/fastlane_core/ui/fastlane_runner.rb +8 -4
  91. data/fastlane_core/lib/fastlane_core/ui/github_issue_inspector_reporter.rb +2 -2
  92. data/fastlane_core/lib/fastlane_core/ui/implementations/shell.rb +1 -1
  93. data/frameit/lib/frameit/device_types.rb +11 -4
  94. data/frameit/lib/frameit/editor.rb +31 -12
  95. data/frameit/lib/frameit/frame_downloader.rb +4 -1
  96. data/gym/lib/gym/detect_values.rb +10 -10
  97. data/gym/lib/gym/options.rb +1 -7
  98. data/gym/lib/gym/runner.rb +6 -1
  99. data/match/lib/match/encryption/encryption.rb +6 -1
  100. data/match/lib/match/encryption/openssl.rb +8 -3
  101. data/match/lib/match/portal_fetcher.rb +12 -6
  102. data/match/lib/match/runner.rb +2 -1
  103. data/pem/lib/pem/manager.rb +3 -3
  104. data/precheck/lib/precheck/runner.rb +4 -2
  105. data/scan/lib/scan/detect_values.rb +0 -1
  106. data/scan/lib/scan/runner.rb +1 -0
  107. data/sigh/lib/assets/resign.sh +10 -3
  108. data/sigh/lib/sigh/resign.rb +5 -21
  109. data/snapshot/lib/snapshot/reset_simulators.rb +5 -2
  110. data/snapshot/lib/snapshot/runner.rb +0 -1
  111. data/spaceship/lib/spaceship/base.rb +1 -1
  112. data/spaceship/lib/spaceship/client.rb +6 -3
  113. data/spaceship/lib/spaceship/connect_api/api_client.rb +12 -14
  114. data/spaceship/lib/spaceship/connect_api/models/bundle_id.rb +1 -1
  115. data/spaceship/lib/spaceship/connect_api/models/user.rb +7 -3
  116. data/spaceship/lib/spaceship/connect_api/testflight/testflight.rb +9 -11
  117. data/spaceship/lib/spaceship/connect_api/token.rb +21 -1
  118. data/spaceship/lib/spaceship/connect_api/tunes/tunes.rb +3 -1
  119. data/spaceship/lib/spaceship/helper/plist_middleware.rb +2 -2
  120. data/spaceship/lib/spaceship/portal/portal_client.rb +8 -8
  121. data/spaceship/lib/spaceship/test_flight/client.rb +1 -5
  122. data/supply/lib/supply/client.rb +1 -1
  123. data/supply/lib/supply/options.rb +6 -0
  124. data/supply/lib/supply/uploader.rb +28 -2
  125. metadata +29 -26
  126. data/fastlane/lib/fastlane/actions/hockey.rb +0 -400
  127. data/fastlane/lib/fastlane/actions/typetalk.rb +0 -93
@@ -83,10 +83,7 @@ module FastlaneCore
83
83
  end
84
84
  # Specified p8 needs to be generated to call altool or iTMSTransporter
85
85
  p8_path = File.join(api_key[:key_dir], p8_name)
86
- File.open(p8_path, "wb", 0o600) do |p8|
87
- p8.write(api_key[:key])
88
- end
89
- File.chmod(0o600, p8_path)
86
+ Helper.open_owner_only(p8_path, "wb") { |p8| p8.write(api_key[:key]) }
90
87
  api_key
91
88
  end
92
89
 
@@ -96,7 +93,8 @@ module FastlaneCore
96
93
  FileUtils.rm_rf(api_key[:cleanup_path])
97
94
  end
98
95
 
99
- def execute(command, hide_output)
96
+ # @param env [Hash] environment for the command, such as the password it reads with -p @env:
97
+ def execute(command, hide_output, env: {})
100
98
  if Helper.test?
101
99
  yield(nil) if block_given?
102
100
  return command
@@ -113,7 +111,7 @@ module FastlaneCore
113
111
  end
114
112
 
115
113
  begin
116
- exit_status = FastlaneCore::FastlanePty.spawn(command) do |command_stdout, command_stdin, pid|
114
+ exit_status = FastlaneCore::FastlanePty.spawn(command, env: env) do |command_stdout, command_stdin, pid|
117
115
  begin
118
116
  command_stdout.each do |line|
119
117
  @all_lines << line
@@ -267,7 +265,8 @@ module FastlaneCore
267
265
 
268
266
  attr_reader :errors
269
267
 
270
- def execute(command, hide_output)
268
+ # @param env [Hash] environment for the command, such as the password it reads with -p @env:
269
+ def execute(command, hide_output, env: {})
271
270
  if Helper.test?
272
271
  yield(nil) if block_given?
273
272
  return command
@@ -283,7 +282,7 @@ module FastlaneCore
283
282
  end
284
283
 
285
284
  begin
286
- exit_status = FastlaneCore::FastlanePty.spawn(command) do |command_stdout, command_stdin, pid|
285
+ exit_status = FastlaneCore::FastlanePty.spawn(command, env: env) do |command_stdout, command_stdin, pid|
287
286
  command_stdout.each do |line|
288
287
  @all_lines << line
289
288
  parse_line(line, hide_output) # this is where the parsing happens
@@ -313,7 +312,8 @@ module FastlaneCore
313
312
 
314
313
  def build_credential_params(username = nil, password = nil, jwt = nil, api_key = nil)
315
314
  if !username.nil? && !password.nil? && api_key.nil?
316
- "-u #{username.shellescape} -p #{password.shellescape}"
315
+ # The password itself comes from the environment, see ItunesTransporter#password_environment
316
+ "-u #{username.shellescape} -p @env:ITMS_TRANSPORTER_PASSWORD"
317
317
  elsif !api_key.nil?
318
318
  # Individual API keys have no issuer_id; altool requires --apiIssuer
319
319
  # to be present, so we pass the key_id as a placeholder and add
@@ -582,7 +582,6 @@ module FastlaneCore
582
582
  credential_params = build_credential_params(username, password, jwt, api_key, is_default_itms_on_xcode_11?)
583
583
  if is_default_itms_on_xcode_11?
584
584
  [
585
- ("ITMS_TRANSPORTER_PASSWORD=#{password.shellescape}" if jwt.to_s.empty?),
586
585
  'xcrun iTMSTransporter',
587
586
  '-m upload',
588
587
  credential_params,
@@ -620,7 +619,6 @@ module FastlaneCore
620
619
  credential_params = build_credential_params(username, password, jwt, nil, is_default_itms_on_xcode_11?)
621
620
  if is_default_itms_on_xcode_11?
622
621
  [
623
- ("ITMS_TRANSPORTER_PASSWORD=#{password.shellescape}" if jwt.to_s.empty?),
624
622
  'xcrun iTMSTransporter',
625
623
  '-m verify',
626
624
  credential_params,
@@ -652,7 +650,6 @@ module FastlaneCore
652
650
  credential_params = build_credential_params(username, password, jwt, nil, is_default_itms_on_xcode_11?)
653
651
  if is_default_itms_on_xcode_11?
654
652
  [
655
- ("ITMS_TRANSPORTER_PASSWORD=#{password.shellescape}" if jwt.to_s.empty?),
656
653
  'xcrun iTMSTransporter',
657
654
  '-m lookupMetadata',
658
655
  credential_params,
@@ -686,7 +683,6 @@ module FastlaneCore
686
683
  credential_params = build_credential_params(username, password, jwt, api_key, is_default_itms_on_xcode_11?)
687
684
  if is_default_itms_on_xcode_11?
688
685
  [
689
- ("ITMS_TRANSPORTER_PASSWORD=#{password.shellescape}" if jwt.to_s.empty?),
690
686
  'xcrun iTMSTransporter',
691
687
  '-m provider',
692
688
  credential_params,
@@ -730,12 +726,12 @@ module FastlaneCore
730
726
  end
731
727
  end
732
728
 
733
- def execute(command, hide_output)
729
+ def execute(command, hide_output, env: {})
734
730
  # The Java command needs to be run starting in a working directory in the iTMSTransporter
735
731
  # file area. The shell script takes care of changing directories over to there, but we'll
736
732
  # handle it manually here for this strategy.
737
733
  FileUtils.cd(Helper.itms_path) do
738
- return super(command, hide_output)
734
+ return super(command, hide_output, env: env)
739
735
  end
740
736
  end
741
737
  end
@@ -771,6 +767,8 @@ module FastlaneCore
771
767
  use_shell_script ||= Helper.is_mac? && Helper.xcode_version.start_with?('6.')
772
768
  use_shell_script ||= Helper.windows?
773
769
  use_shell_script ||= Feature.enabled?('FASTLANE_ITUNES_TRANSPORTER_USE_SHELL_SCRIPT')
770
+ # Transporter 2.0 and later bundles a Java that refuses the direct Java invocation; its own launcher works. See #15323.
771
+ use_shell_script ||= Helper.user_defined_itms_path?
774
772
 
775
773
  if jwt.to_s.empty? && api_key.nil?
776
774
  @user = user
@@ -810,7 +808,7 @@ module FastlaneCore
810
808
  UI.verbose(@transporter_executor.build_download_command(@user, password_placeholder, app_id, dir, @provider_short_name, jwt_placeholder))
811
809
 
812
810
  begin
813
- result = @transporter_executor.execute(command, ItunesTransporter.hide_transporter_output?)
811
+ result = @transporter_executor.execute(command, ItunesTransporter.hide_transporter_output?, env: password_environment)
814
812
  rescue TransporterRequiresApplicationSpecificPasswordError => ex
815
813
  handle_two_step_failure(ex)
816
814
  return download(app_id, dir)
@@ -877,7 +875,7 @@ module FastlaneCore
877
875
  UI.verbose(@transporter_executor.build_upload_command(@user, password_placeholder, actual_dir, upload_options_placeholder))
878
876
 
879
877
  begin
880
- result = @transporter_executor.execute(command, ItunesTransporter.hide_transporter_output?)
878
+ result = @transporter_executor.execute(command, ItunesTransporter.hide_transporter_output?, env: password_environment)
881
879
  rescue TransporterRequiresApplicationSpecificPasswordError => ex
882
880
  handle_two_step_failure(ex)
883
881
  return upload(app_id, dir, package_path: package_path, asset_path: asset_path)
@@ -938,7 +936,7 @@ module FastlaneCore
938
936
  UI.verbose(@transporter_executor.build_verify_command(@user, password_placeholder, actual_dir, verify_options_placeholder))
939
937
 
940
938
  begin
941
- result = @transporter_executor.execute(command, ItunesTransporter.hide_transporter_output?)
939
+ result = @transporter_executor.execute(command, ItunesTransporter.hide_transporter_output?, env: password_environment)
942
940
  rescue TransporterRequiresApplicationSpecificPasswordError => ex
943
941
  handle_two_step_failure(ex)
944
942
  return verify(app_id, dir, package_path: package_path)
@@ -974,7 +972,7 @@ module FastlaneCore
974
972
 
975
973
  lines = []
976
974
  begin
977
- result = @transporter_executor.execute(command, ItunesTransporter.hide_transporter_output?) { |xs| lines = xs }
975
+ result = @transporter_executor.execute(command, ItunesTransporter.hide_transporter_output?, env: password_environment) { |xs| lines = xs }
978
976
  return result if Helper.test?
979
977
  rescue TransporterRequiresApplicationSpecificPasswordError => ex
980
978
  handle_two_step_failure(ex)
@@ -992,6 +990,13 @@ module FastlaneCore
992
990
 
993
991
  TWO_FACTOR_ENV_VARIABLE = "FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD"
994
992
 
993
+ # The password goes to the transporter in its environment, which altool and xcrun iTMSTransporter read through
994
+ # -p @env:ITMS_TRANSPORTER_PASSWORD, rather than on their command line
995
+ def password_environment
996
+ return {} if @password.to_s.empty?
997
+ { "ITMS_TRANSPORTER_PASSWORD" => @password }
998
+ end
999
+
995
1000
  # Returns whether altool should be used or ItunesTransporter should be used
996
1001
  def should_use_altool?(altool_compatible_command, use_shell_script)
997
1002
  # Xcode 14 no longer supports iTMSTransporter. Use altool instead
@@ -1,5 +1,5 @@
1
1
  require_relative 'helper'
2
- require 'open3'
2
+ require_relative 'stored_passwords'
3
3
  require 'security'
4
4
 
5
5
  module FastlaneCore
@@ -7,81 +7,57 @@ module FastlaneCore
7
7
  def self.import_file(path, keychain_path, keychain_password: nil, certificate_password: "", certificate_format: nil, skip_set_partition_list: false, output: FastlaneCore::Globals.verbose?)
8
8
  UI.user_error!("Could not find file '#{path}'") unless File.exist?(path)
9
9
 
10
- password_part = " -P #{certificate_password.shellescape}"
11
- certificate_format_part = certificate_format.to_s.strip.empty? ? "" : " -f #{certificate_format.shellescape}"
12
-
13
- command = "security import #{path.shellescape} -k #{keychain_path.shellescape}"
14
- command << password_part
15
- command << certificate_format_part
16
- command << " -T /usr/bin/codesign" # to not be asked for permission when running a tool like `gym` (before Sierra)
17
- command << " -T /usr/bin/security"
18
- command << " -T /usr/bin/productbuild" # to not be asked for permission when using an installer cert for macOS
19
- command << " -T /usr/bin/productsign" # to not be asked for permission when using an installer cert for macOS
20
- command << " 1> /dev/null" unless output
21
-
22
- sensitive_command = command.gsub(password_part, " -P ********")
23
- UI.command(sensitive_command) if output
24
- Open3.popen3(command) do |stdin, stdout, stderr, thrd|
25
- UI.command_output(stdout.read.to_s) if output
26
-
27
- # Set partition list only if success since it can be a time consuming process if a lot of keys are installed
28
- if thrd.value.success? && !skip_set_partition_list
29
- keychain_password ||= resolve_keychain_password(keychain_path)
30
- set_partition_list(path, keychain_path, keychain_password: keychain_password, output: output)
31
- else
32
- # Output verbose if file is already installed since not an error otherwise we will show the whole error
33
- err = stderr.read.to_s.strip
34
- if err.include?("SecKeychainItemImport") && err.include?("The specified item already exists in the keychain")
35
- UI.verbose("'#{File.basename(path)}' is already installed on this machine")
36
- else
37
- UI.error(err)
38
- end
39
- end
10
+ certificate_format = nil if certificate_format.to_s.strip.empty?
11
+ UI.command("security import #{path.shellescape} -k #{keychain_path.shellescape} -P ********#{" -f #{certificate_format}" if certificate_format}") if output
12
+
13
+ begin
14
+ Security::Certificate.import(path, keychain: keychain_path, password: certificate_password, format: certificate_format)
15
+ rescue Security::DuplicateItemError
16
+ UI.verbose("'#{File.basename(path)}' is already installed on this machine")
17
+ return
18
+ rescue Security::Error => e
19
+ UI.error(e.output.strip)
20
+ return
40
21
  end
22
+
23
+ # Set partition list only if success since it can be a time consuming process if a lot of keys are installed
24
+ return if skip_set_partition_list
25
+
26
+ keychain_password ||= resolve_keychain_password(keychain_path)
27
+ set_partition_list(path, keychain_path, keychain_password: keychain_password, output: output)
41
28
  end
42
29
 
30
+ # What `security` reports for a wrong keychain password, on older and newer macOS.
31
+ WRONG_KEYCHAIN_PASSWORD = ["SecKeychainItemSetAccessWithPassword", "The user name or passphrase you entered is not correct"]
32
+
43
33
  def self.set_partition_list(path, keychain_path, keychain_password: nil, output: FastlaneCore::Globals.verbose?)
44
34
  # When security supports partition lists, also add the partition IDs
45
35
  # See https://openradar.appspot.com/28524119
46
- if Helper.backticks('security -h | grep set-key-partition-list', print: false).length > 0
47
- password_part = " -k #{keychain_password.to_s.shellescape}"
48
-
49
- command = "security set-key-partition-list"
50
- command << " -S apple-tool:,apple:,codesign:"
51
- command << " -s" # This is a needed in Catalina to prevent "security: SecKeychainItemCopyAccess: A missing value was detected."
52
- command << password_part
53
- command << " #{keychain_path.shellescape}"
54
- command << " 1> /dev/null" # always disable stdout. This can be very verbose, and leak potentially sensitive info
55
-
56
- # Showing loading indicator as this can take some time if a lot of keys installed
57
- Helper.with_loading_indicator("Setting key partition list... (this can take a minute if there are a lot of keys installed)") do
58
- # Strip keychain password from command output
59
- sensitive_command = command.gsub(password_part, " -k ********")
60
- UI.command(sensitive_command) if output
61
- Open3.popen3(command) do |stdin, stdout, stderr, thrd|
62
- unless thrd.value.success?
63
- err = stderr.read.to_s.strip
64
-
65
- # Inform user when no/wrong password was used as its needed to prevent UI permission popup from Xcode when signing
66
- if err.include?("SecKeychainItemSetAccessWithPassword")
67
- keychain_name = File.basename(keychain_path, ".*")
68
- Security::InternetPassword.delete(server: server_name(keychain_name))
69
-
70
- UI.important("")
71
- UI.important("Could not configure imported keychain item (certificate) to prevent UI permission popup when code signing\n" \
72
- "Check if you supplied the correct `keychain_password` for keychain: `#{keychain_path}`\n" \
73
- "#{err}")
74
- UI.important("")
75
- UI.important("Please look at the following docs to see how to set a keychain password:")
76
- UI.important(" - https://docs.fastlane.tools/actions/sync_code_signing")
77
- UI.important(" - https://docs.fastlane.tools/actions/get_certificates")
78
- else
79
- UI.error(err)
80
- end
81
- end
82
- end
36
+ return unless Security::Keychain.supports_key_partition_list?
37
+
38
+ # Showing loading indicator as this can take some time if a lot of keys installed
39
+ Helper.with_loading_indicator("Setting key partition list... (this can take a minute if there are a lot of keys installed)") do
40
+ UI.command("security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k ******** #{keychain_path.shellescape}") if output
41
+ Security::Keychain.new(keychain_path).set_key_partition_list(keychain_password.to_s)
42
+ rescue Security::Error => e
43
+ err = e.output.strip
44
+
45
+ # Inform user when no/wrong password was used as its needed to prevent UI permission popup from Xcode when signing
46
+ if WRONG_KEYCHAIN_PASSWORD.any? { |message| err.include?(message) }
47
+ keychain_name = File.basename(keychain_path, ".*")
48
+ Security::InternetPassword.delete(server: server_name(keychain_name))
49
+
50
+ UI.important("")
51
+ UI.important("Could not configure imported keychain item (certificate) to prevent UI permission popup when code signing\n" \
52
+ "Check if you supplied the correct `keychain_password` for keychain: `#{keychain_path}`\n" \
53
+ "#{err}")
54
+ UI.important("")
55
+ UI.important("Please look at the following docs to see how to set a keychain password:")
56
+ UI.important(" - https://docs.fastlane.tools/actions/sync_code_signing")
57
+ UI.important(" - https://docs.fastlane.tools/actions/get_certificates")
58
+ else
59
+ UI.error(err)
83
60
  end
84
-
85
61
  end
86
62
  end
87
63
 
@@ -105,15 +81,16 @@ module FastlaneCore
105
81
  if item
106
82
  keychain_password = item.password
107
83
  UI.important("Using keychain password from keychain item #{server} in #{keychain_path}")
84
+ StoredPasswords.read_warning(server, what: "the password for #{keychain_path}", remove_with: "security delete-internet-password -s #{server}", instead: "provide it with the keychain_password option or the MATCH_KEYCHAIN_PASSWORD environment variable")&.each { |line| UI.important(line) }
108
85
  end
109
86
 
110
87
  if keychain_password.nil?
111
88
  if UI.interactive?
112
89
  UI.important("Enter the password for #{keychain_path}")
113
- UI.important("This passphrase will be stored in your local keychain with the name #{server} and used in future runs")
90
+ UI.important("This passphrase will be stored in your local keychain with the name #{server} and used in future runs") if StoredPasswords.store?
114
91
  UI.important("This prompt can be avoided by specifying the 'keychain_password' option or 'MATCH_KEYCHAIN_PASSWORD' environment variable")
115
92
  keychain_password = FastlaneCore::Helper.ask_password(message: "Password for #{keychain_name} keychain: ", confirm: true, confirmation_message: "Type password for #{keychain_name} keychain again: ")
116
- Security::InternetPassword.add(server, "", keychain_password)
93
+ Security::InternetPassword.add(server, "", keychain_password) if StoredPasswords.store?
117
94
  else
118
95
  UI.important("Keychain password for #{keychain_path} was not specified and not found in your keychain. Specify the 'keychain_password' option to prevent the UI permission popup when code signing")
119
96
  keychain_password = ""
@@ -31,7 +31,11 @@ module FastlaneCore
31
31
 
32
32
  def self.fetch_distribution_xml_file(path)
33
33
  Dir.mktmpdir do |dir|
34
- Helper.backticks("xar -C #{dir.shellescape} -xf #{path.shellescape}")
34
+ FastlaneCore::CommandExecutor.execute(command: "xar -C #{dir.shellescape} -xf #{path.shellescape}",
35
+ print_all: true,
36
+ error: proc do |output|
37
+ UI.user_error!("Could not extract '#{path}':\n#{output}")
38
+ end)
35
39
 
36
40
  Dir.foreach(dir) do |file|
37
41
  next unless file.include?('Distribution')
@@ -47,7 +47,7 @@ module FastlaneCore
47
47
  end
48
48
 
49
49
  def colorize_array(array, colors)
50
- value = ""
50
+ value = +""
51
51
  array.each do |l|
52
52
  colored_line = l
53
53
  colored_line = "#{colors.first}#{l}#{colors.last}" if colors.length > 0
@@ -1,5 +1,3 @@
1
- require 'thread'
2
-
3
1
  module FastlaneCore
4
2
  # This dispatches jobs to worker threads and make it work in parallel.
5
3
  # It's suitable for I/O bounds works and not for CPU bounds works.
@@ -0,0 +1,29 @@
1
+ require_relative 'env'
2
+
3
+ module FastlaneCore
4
+ # Items added with `security add-internet-password` trust /usr/bin/security, so any program
5
+ # running as the user can read them (#29712): passwords are only stored when asked to.
6
+ module StoredPasswords
7
+ STORE_ENV = "FASTLANE_STORE_PASSWORDS_IN_KEYCHAIN"
8
+
9
+ # FASTLANE_DONT_STORE_PASSWORD, any value, still prevents storing
10
+ def self.store?
11
+ return false if ENV["FASTLANE_DONT_STORE_PASSWORD"]
12
+ Env.truthy?(STORE_ENV)
13
+ end
14
+
15
+ # The warning to print when a password was read from a keychain item fastlane stored, once per item and run
16
+ def self.read_warning(item, what:, remove_with:, instead:)
17
+ @warned ||= {}
18
+ return nil if @warned[item]
19
+ @warned[item] = true
20
+
21
+ ["Read #{what} from the keychain item '#{item}', which any program running as you can read.",
22
+ "Remove it with `#{remove_with}`, and #{instead}."]
23
+ end
24
+
25
+ def self.reset_warnings!
26
+ @warned = nil
27
+ end
28
+ end
29
+ end
@@ -35,8 +35,7 @@ class String
35
35
  # Base taken from: https://www.ruby-forum.com/topic/57805
36
36
  def wordwrap(length = 80)
37
37
  return [] if length == 0
38
- self.gsub!(/(\S{#{length}})(?=\S)/, '\1 ')
39
- self.scan(/.{1,#{length}}(?:\s+|$)/)
38
+ self.gsub(/(\S{#{length}})(?=\S)/, '\1 ').scan(/.{1,#{length}}(?:\s+|$)/)
40
39
  end
41
40
 
42
41
  # Base taken from: http://stackoverflow.com/a/12202205/1945875
@@ -42,7 +42,6 @@ module Commander
42
42
  # This is raising OptionParser::MissingArgument error because `--env` takes a string argument.
43
43
  # A command of `-e --verbose` works because `--verbose` is seen as the argument.
44
44
  # A command of `--verbose -e` doesn't work because no argument after `-e` so MissingArgument is raised again.
45
- # This broke somewhere between Ruby 2.5 and Ruby 2.6
46
45
  #
47
46
  # Solution:
48
47
  # Proper solution is to set `parser.require_exact = true` but this only available on `optparse` version 0.1.1
@@ -92,10 +91,12 @@ module Commander
92
91
  remove_global_options(options, @args)
93
92
 
94
93
  xcode_outdated = false
94
+ xcode_support_ending = false
95
95
  begin
96
96
  unless FastlaneCore::Helper.xcode_at_least?(Fastlane::MINIMUM_XCODE_RELEASE)
97
97
  xcode_outdated = true
98
98
  end
99
+ xcode_support_ending = !FastlaneCore::Helper.xcode_at_least?(Fastlane::SUGGESTED_MINIMUM_XCODE_RELEASE)
99
100
  rescue
100
101
  # We don't care about exceptions here
101
102
  # We'll land here if the user doesn't have Xcode at all for example
@@ -109,6 +110,10 @@ module Commander
109
110
  FastlaneCore::UI.user_error!("fastlane requires a minimum version of Xcode #{Fastlane::MINIMUM_XCODE_RELEASE}, please upgrade and make sure to use `sudo xcode-select -s /Applications/Xcode.app`")
110
111
  end
111
112
 
113
+ if xcode_support_ending && !FastlaneCore::Env.truthy?("FASTLANE_SKIP_XCODE_VERSION_WARNING")
114
+ FastlaneCore::UI.important("WARNING: Support for your Xcode version (#{FastlaneCore::Helper.xcode_version}) is going away. fastlane will soon require Xcode #{Fastlane::SUGGESTED_MINIMUM_XCODE_RELEASE} or newer.")
115
+ end
116
+
112
117
  is_swift = FastlaneCore::FastlaneFolder.swift?
113
118
  fastlane_client_language = is_swift ? :swift : :ruby
114
119
  action_launch_context = FastlaneCore::ActionLaunchContext.context_for_action_name(@program[:name], fastlane_client_language: fastlane_client_language, args: ARGV)
@@ -221,9 +226,8 @@ module Commander
221
226
  end
222
227
 
223
228
  def handle_tls_error!(e)
224
- # Apple has upgraded its App Store Connect servers to require TLS 1.2, but
225
- # system Ruby 2.0 does not support it. We want to suggest that users upgrade
226
- # their Ruby version
229
+ # Apple's App Store Connect servers require TLS 1.2. We want to suggest that users
230
+ # reinstall their Ruby
227
231
  suggest_ruby_reinstall(e)
228
232
  display_user_error!(e, e.to_s)
229
233
  end
@@ -20,8 +20,8 @@ module Fastlane
20
20
  report.issues[0..(NUMBER_OF_ISSUES_INLINE - 1)].each { |issue| print_issue_full(issue) }
21
21
 
22
22
  if report.issues.count > NUMBER_OF_ISSUES_INLINE
23
- report.url.gsub!('\'', '%27')
24
- puts("and #{report.total_results - NUMBER_OF_ISSUES_INLINE} more at: #{report.url}")
23
+ url = report.url.gsub('\'', '%27')
24
+ puts("and #{report.total_results - NUMBER_OF_ISSUES_INLINE} more at: #{url}")
25
25
  puts("")
26
26
  end
27
27
 
@@ -111,7 +111,7 @@ module FastlaneCore
111
111
 
112
112
  error('```')
113
113
  Range.new(start_line, end_line).each do |line|
114
- str = line == error_line ? " => " : " "
114
+ str = line == error_line ? +" => " : +" "
115
115
  str << line.to_s.rjust(Math.log10(end_line) + 1)
116
116
  str << ":\t#{contents[line - 1]}"
117
117
  error(str)
@@ -43,6 +43,7 @@ module Frameit
43
43
 
44
44
  module Color
45
45
  MATTE_BLACK ||= "Matte Black"
46
+ JET_BLACK ||= "Jet Black"
46
47
  SPACE_GRAY ||= "Space Gray"
47
48
  ROSE_GOLD ||= "Rose Gold"
48
49
  CLEARLY_WHITE ||= "Clearly White"
@@ -87,7 +88,7 @@ module Frameit
87
88
  PACIFIC_BLUE ||= "Pacific Blue"
88
89
  MIDNIGHT ||= "Midnight"
89
90
  STARLIGHT ||= "Starlight"
90
- SIERRA ||= "Sierra"
91
+ SIERRA_BLUE ||= "Sierra Blue"
91
92
  SORTA_SAGE ||= "Sorta Sage"
92
93
  TEAL ||= "Teal"
93
94
  ULTRAMARINE ||= "Ultramarine"
@@ -100,6 +101,8 @@ module Frameit
100
101
  MIST_BLUE ||= "Mist Blue"
101
102
  SAGE ||= "Sage"
102
103
  LAVENDER ||= "Lavender"
104
+ NIGHT_SKY ||= "Night Sky"
105
+ STAR_WHITE ||= "Star White"
103
106
 
104
107
  def self.all_colors
105
108
  Color.constants.map { |c| Color.const_get(c).upcase.gsub(' ', '_') }
@@ -130,6 +133,8 @@ module Frameit
130
133
  end
131
134
 
132
135
  module Devices
136
+ IPHONE_DUO_OUTER ||= Device.new("iphone-duo-outer", "Apple iPhone Duo Outer", 15, [[1398, 2034], [2034, 1398]], 460, Color::NIGHT_SKY, Platform::IOS)
137
+ IPHONE_DUO_INNER ||= Device.new("iphone-duo-inner", "Apple iPhone Duo Inner", 15, [[2007, 2853], [2853, 2007]], 460, Color::NIGHT_SKY, Platform::IOS)
133
138
  GOOGLE_PIXEL_3 ||= Device.new("google-pixel-3", "Google Pixel 3", 7, [[1080, 2160], [2160, 1080]], 443, Color::JUST_BLACK, Platform::ANDROID)
134
139
  GOOGLE_PIXEL_3_XL ||= Device.new("google-pixel-3-xl", "Google Pixel 3 XL", 7, [[1440, 2960], [2960, 1440]], 523, Color::JUST_BLACK, Platform::ANDROID)
135
140
  # Google Pixel 4's priority should be higher than Samsung Galaxy S10+ (priority 8):
@@ -158,6 +163,8 @@ module Frameit
158
163
  SAMSUNG_GALAXY_S10 ||= Device.new("samsung-galaxy-s10", "Samsung Galaxy S10", 7, [[1440, 3040], [3040, 1440]], 550, Color::PRISM_BLACK, Platform::ANDROID)
159
164
  SAMSUNG_GALAXY_S10_PLUS ||= Device.new("samsung-galaxy-s10-plus", "Samsung Galaxy S10+", 8, [[1440, 3040], [3040, 1440]], 522, Color::PRISM_BLACK, Platform::ANDROID)
160
165
  XIAOMI_MI_MIX_ALPHA ||= Device.new("xiaomi-mi-mix-alpha", "Xiaomi Mi Mix Alpha", 1, [[2088, 2250], [2250, 2088]], 388, nil, Platform::ANDROID)
166
+ # Surface Pro X runs Windows, so it's only auto-detected via file name, `force_device_type` or `use_platform: ANY`
167
+ SURFACE_PRO_X ||= Device.new("surface-pro-x", "Surface Pro X", 1, [[1920, 2880], [2880, 1920]], 267, Color::BLACK, Platform::ANY)
161
168
  IPHONE_5S ||= Device.new("iphone-5s", "Apple iPhone 5s", 2, [[640, 1096], [640, 1136], [1136, 600], [1136, 640]], 326, Color::SPACE_GRAY, Platform::IOS, DEVICE_SCREEN_IDS[DisplayType::APP_IPHONE_40], :use_legacy_iphone5s)
162
169
  IPHONE_5C ||= Device.new("iphone-5c", "Apple iPhone 5c", 2, [[640, 1136], [1136, 640]], 326, Color::WHITE)
163
170
  IPHONE_SE ||= Device.new("iphone-se", "Apple iPhone SE", 3, [[640, 1096], [640, 1136], [1136, 600], [1136, 640]], 326, Color::SPACE_GRAY, Platform::IOS, DEVICE_SCREEN_IDS[DisplayType::APP_IPHONE_40])
@@ -175,7 +182,7 @@ module Frameit
175
182
  IPHONE_11_PRO ||= Device.new("iphone-11-pro", "Apple iPhone 11 Pro", 9, [[1125, 2436], [2436, 1125]], 458, Color::SPACE_GRAY, Platform::IOS)
176
183
  IPHONE_11_PRO_MAX ||= Device.new("iphone11-pro-max", "Apple iPhone 11 Pro Max", 9, [[1242, 2688], [2688, 1242]], 458, Color::SPACE_GRAY, Platform::IOS)
177
184
  IPHONE_12 ||= Device.new("iphone-12", "Apple iPhone 12", 10, [[1170, 2532], [2532, 1170]], 460, Color::BLACK, Platform::IOS)
178
- IPHONE_12_PRO ||= Device.new("iphone-12-pro", "Apple iPhone 12 Pro", 10, [[1170, 2532], [2532, 1170]], 460, Color::SPACE_GRAY, Platform::IOS)
185
+ IPHONE_12_PRO ||= Device.new("iphone-12-pro", "Apple iPhone 12 Pro", 10, [[1170, 2532], [2532, 1170]], 460, Color::GRAPHITE, Platform::IOS)
179
186
  IPHONE_12_PRO_MAX ||= Device.new("iphone12-pro-max", "Apple iPhone 12 Pro Max", 10, [[1284, 2778], [2778, 1284]], 458, Color::GRAPHITE, Platform::IOS)
180
187
  IPHONE_12_MINI ||= Device.new("iphone-12-mini", "Apple iPhone 12 Mini", 10, [[1125, 2436], [2436, 1125]], 476, Color::BLACK, Platform::IOS)
181
188
  IPHONE_13 ||= Device.new("iphone-13", "Apple iPhone 13", 11, [[1170, 2532], [2532, 1170]], 460, Color::MIDNIGHT, Platform::IOS)
@@ -204,8 +211,8 @@ module Frameit
204
211
  IPAD_PRO_12_9 ||= Device.new("ipadPro129", "Apple iPad Pro (12.9-inch) (3rd generation)", 4, [[2048, 2732], [2732, 2048]], 264, Color::SPACE_GRAY, Platform::IOS, DEVICE_SCREEN_IDS[DisplayType::APP_IPAD_PRO_3GEN_129])
205
212
  # iPad Pro 13" (4th gen):
206
213
  IPAD_PRO_12_9_4 ||= Device.new("ipadPro129", "Apple iPad Pro (12.9-inch) (4th generation)", 5, [[2048, 2732], [2732, 2048]], 264, Color::SPACE_GRAY, Platform::IOS, DEVICE_SCREEN_IDS[DisplayType::APP_IPAD_PRO_3GEN_129])
207
- # iPad Pro (10.5-inch) is not in frameit-frames repo, but must be included so that we are backward compatible with PR #15373
208
- # priority must be lower so that users who didn't copy the frame to their frameit frames folder will not get an error
214
+ # iPad Pro (10.5-inch) shares the iPad Air (2019) frame and resolution, it was added for backward compatibility with PR #15373
215
+ # priority must be lower than iPad Air (2019) so that 1668x2224 screenshots without a device name keep using that device
209
216
  # ID and formatted name must be exactly as specified so that device.detect_device() will select this device if the filename includes them
210
217
  IPAD_PRO_10_5 ||= Device.new("ipad105", "Apple iPad Pro (10.5-inch)", 1, [[1668, 2224], [2224, 1668]], 265, Color::SPACE_GRAY, Platform::IOS, DEVICE_SCREEN_IDS[DisplayType::APP_IPAD_105])
211
218
  IPAD_PRO_11 ||= Device.new("ipadPro11", "Apple iPad Pro (11-inch)", 1, [[1668, 2388], [2388, 1668]], 265, Color::SPACE_GRAY, Platform::IOS, DEVICE_SCREEN_IDS[DisplayType::APP_IPAD_PRO_3GEN_11])
@@ -31,7 +31,7 @@ module Frameit
31
31
  if @frame_path # Mac doesn't need a frame
32
32
  self.frame = MiniMagick::Image.open(@frame_path)
33
33
  # Rotate the frame according to the device orientation
34
- self.frame.rotate(self.rotation_for_device_orientation)
34
+ rotate_image(self.frame, self.rotation_for_device_orientation)
35
35
  elsif self.class == Editor
36
36
  # Couldn't find device frame (probably an iPhone 4, for which there are no images available any more)
37
37
  # Message is already shown elsewhere
@@ -86,8 +86,20 @@ module Frameit
86
86
  # only. Instead of doing the calculations ourselves, it's much easier to let
87
87
  # imagemagick do the hard lifting for landscape screenshots
88
88
  rotation = self.rotation_for_device_orientation
89
- frame.rotate(-rotation)
90
- @image.rotate(-rotation)
89
+ rotate_image(frame, -rotation)
90
+ rotate_image(@image, -rotation)
91
+
92
+ # Optional screen masks preserve asymmetric corners and camera cutouts.
93
+ # A portrait mask is applied after normalizing the screenshot orientation.
94
+ if offset['mask']
95
+ mask_path = File.join(FrameDownloader.templates_path, offset['mask'])
96
+ UI.user_error!("Could not find screen mask '#{mask_path}'") unless File.file?(mask_path)
97
+ mask = MiniMagick::Image.open(mask_path)
98
+ mask.resize("#{image.width}x#{image.height}!")
99
+ @image = image.composite(mask, "png") do |c|
100
+ c.compose("CopyOpacity")
101
+ end
102
+ end
91
103
 
92
104
  # Debug Mode: Add filename to frame
93
105
  if self.debug_mode
@@ -135,8 +147,14 @@ module Frameit
135
147
  end
136
148
 
137
149
  # Revert the rotation from above
138
- frame.rotate(rotation)
139
- @image.rotate(rotation)
150
+ rotate_image(frame, rotation)
151
+ rotate_image(@image, rotation)
152
+ end
153
+
154
+ # Portrait screenshots need no rotation. ImageMagick would still decode and
155
+ # re-encode the whole image to rotate it by 0 degrees, so skip that pass.
156
+ def rotate_image(image, degrees)
157
+ image.rotate(degrees) unless degrees.zero?
140
158
  end
141
159
 
142
160
  def offset
@@ -283,8 +301,10 @@ module Frameit
283
301
  left_space = (background.width / 2.0 - image.width / 2.0).round
284
302
 
285
303
  @image = background.composite(image, "png") do |c|
286
- colorspace = image.data["colorspace"]
287
- c.colorspace(colorspace) if colorspace
304
+ # Ask for the colorspace alone: `image.data` makes ImageMagick compute
305
+ # statistics over every pixel to print them all as JSON
306
+ colorspace = image["%[colorspace]"]
307
+ c.colorspace(colorspace) unless colorspace.to_s.empty?
288
308
 
289
309
  c.compose("Over")
290
310
  c.geometry("+#{left_space}+#{device_top(background)}")
@@ -431,10 +451,6 @@ module Frameit
431
451
  empty_path = File.join(Frameit::ROOT, "lib/assets/empty.png")
432
452
  text_image = MiniMagick::Image.open(empty_path)
433
453
  image_height = max_height # gets trimmed afterwards anyway, and on the iPad the `y` would get cut
434
- text_image.combine_options do |i|
435
- # Oversize as the text might be larger than the actual image. We're trimming afterwards anyway
436
- i.resize("#{max_width * 5.0}x#{image_height}!") # `!` says it should ignore the ratio
437
- end
438
454
 
439
455
  current_font = font(key)
440
456
  text = fetch_text(key)
@@ -446,8 +462,11 @@ module Frameit
446
462
 
447
463
  interline_spacing = @config['interline_spacing']
448
464
 
449
- # Add the actual title
465
+ # Size the canvas and add the actual title in a single pass, as every
466
+ # pass reads and writes the whole oversized canvas
450
467
  text_image.combine_options do |i|
468
+ # Oversize as the text might be larger than the actual image. We're trimming afterwards anyway
469
+ i.resize("#{max_width * 5.0}x#{image_height}!") # `!` says it should ignore the ratio
451
470
  i.font(current_font) if current_font
452
471
  i.weight(@config[key.to_s]['font_weight']) if @config[key.to_s]['font_weight']
453
472
  i.gravity("Center")
@@ -55,7 +55,7 @@ module Frameit
55
55
 
56
56
  def print_disclaimer
57
57
  UI.header("Device frames disclaimer")
58
- UI.important("All used device frames are available via Facebook Design: https://design.facebook.com/toolsandresources/devices/")
58
+ UI.important("Device frames include assets from Facebook Design: https://design.facebook.com/toolsandresources/devices/")
59
59
  UI.message("----------------------------------------")
60
60
  UI.message("While Facebook has redrawn and shares these assets for the benefit")
61
61
  UI.message("of the design community, Facebook does not own any of the underlying")
@@ -66,6 +66,9 @@ module Frameit
66
66
  UI.message("Facebook disclaims all express or implied warranties with respect to these assets, including")
67
67
  UI.message("non-infringement of intellectual property rights.")
68
68
  UI.message("----------------------------------------")
69
+ UI.important("iPhone Duo artwork is from Apple Design Resources: https://developer.apple.com/design/resources/")
70
+ UI.message("Apple artwork remains subject to Apple's license supplied with the original download.")
71
+ UI.message("----------------------------------------")
69
72
  end
70
73
 
71
74
  private