fastlane 2.156.1 → 2.157.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (76) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +82 -82
  3. data/deliver/lib/deliver.rb +1 -0
  4. data/deliver/lib/deliver/app_screenshot_iterator.rb +26 -29
  5. data/deliver/lib/deliver/detect_values.rb +4 -1
  6. data/deliver/lib/deliver/languages.rb +7 -0
  7. data/deliver/lib/deliver/loader.rb +4 -5
  8. data/deliver/lib/deliver/runner.rb +8 -5
  9. data/deliver/lib/deliver/upload_screenshots.rb +34 -17
  10. data/fastlane/lib/fastlane/actions/{.git_commit.rb.swp → .ensure_git_status_clean.rb.swp} +0 -0
  11. data/fastlane/lib/fastlane/actions/.hockey.rb.swp +0 -0
  12. data/fastlane/lib/fastlane/actions/.slack.rb.swp +0 -0
  13. data/fastlane/lib/fastlane/actions/.update_project_provisioning.rb.swp +0 -0
  14. data/fastlane/lib/fastlane/actions/app_store_build_number.rb +12 -8
  15. data/fastlane/lib/fastlane/actions/app_store_connect_api_key.rb +120 -0
  16. data/fastlane/lib/fastlane/actions/commit_version_bump.rb +1 -1
  17. data/fastlane/lib/fastlane/actions/docs/upload_to_play_store.md +2 -0
  18. data/fastlane/lib/fastlane/actions/docs/upload_to_testflight.md +17 -1
  19. data/fastlane/lib/fastlane/actions/download_dsyms.rb +89 -68
  20. data/fastlane/lib/fastlane/actions/set_changelog.rb +3 -2
  21. data/fastlane/lib/fastlane/actions/sonar.rb +5 -0
  22. data/fastlane/lib/fastlane/actions/spaceship_stats.rb +73 -0
  23. data/fastlane/lib/fastlane/actions/upload_to_testflight.rb +4 -0
  24. data/fastlane/lib/fastlane/version.rb +1 -1
  25. data/fastlane/swift/Deliverfile.swift +1 -1
  26. data/fastlane/swift/DeliverfileProtocol.swift +1 -1
  27. data/fastlane/swift/Fastlane.swift +78 -18
  28. data/fastlane/swift/FastlaneSwiftRunner/FastlaneSwiftRunner.xcodeproj/project.xcworkspace/xcuserdata/josh.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  29. data/fastlane/swift/Gymfile.swift +1 -1
  30. data/fastlane/swift/GymfileProtocol.swift +1 -1
  31. data/fastlane/swift/Matchfile.swift +1 -1
  32. data/fastlane/swift/MatchfileProtocol.swift +1 -1
  33. data/fastlane/swift/Precheckfile.swift +1 -1
  34. data/fastlane/swift/PrecheckfileProtocol.swift +1 -1
  35. data/fastlane/swift/Scanfile.swift +1 -1
  36. data/fastlane/swift/ScanfileProtocol.swift +1 -1
  37. data/fastlane/swift/Screengrabfile.swift +1 -1
  38. data/fastlane/swift/ScreengrabfileProtocol.swift +1 -1
  39. data/fastlane/swift/Snapshotfile.swift +1 -1
  40. data/fastlane/swift/SnapshotfileProtocol.swift +1 -1
  41. data/fastlane_core/lib/fastlane_core/command_executor.rb +1 -0
  42. data/fastlane_core/lib/fastlane_core/itunes_transporter.rb +71 -42
  43. data/gym/lib/gym/error_handler.rb +1 -1
  44. data/match/lib/match/spaceship_ensure.rb +5 -5
  45. data/{fastlane/lib/fastlane/.erb_template_helper.rb.swp → pilot/lib/pilot/.manager.rb.swp} +0 -0
  46. data/pilot/lib/pilot/build_manager.rb +15 -4
  47. data/pilot/lib/pilot/manager.rb +15 -5
  48. data/pilot/lib/pilot/options.rb +16 -0
  49. data/produce/lib/produce/itunes_connect.rb +3 -2
  50. data/screengrab/lib/screengrab/runner.rb +29 -10
  51. data/sigh/lib/assets/resign.sh +9 -6
  52. data/sigh/lib/sigh/runner.rb +5 -4
  53. data/spaceship/lib/spaceship.rb +4 -0
  54. data/spaceship/lib/spaceship/client.rb +3 -0
  55. data/spaceship/lib/spaceship/connect_api.rb +1 -15
  56. data/spaceship/lib/spaceship/{.DS_Store → connect_api/.DS_Store} +0 -0
  57. data/spaceship/lib/spaceship/connect_api/api_client.rb +270 -0
  58. data/spaceship/lib/spaceship/connect_api/client.rb +155 -210
  59. data/spaceship/lib/spaceship/connect_api/file_uploader.rb +2 -0
  60. data/spaceship/lib/spaceship/connect_api/models/app.rb +5 -5
  61. data/spaceship/lib/spaceship/connect_api/models/app_price_point.rb +26 -0
  62. data/spaceship/lib/spaceship/connect_api/models/app_store_version.rb +7 -1
  63. data/spaceship/lib/spaceship/connect_api/provisioning/client.rb +8 -17
  64. data/spaceship/lib/spaceship/connect_api/provisioning/provisioning.rb +75 -64
  65. data/spaceship/lib/spaceship/connect_api/spaceship.rb +98 -0
  66. data/spaceship/lib/spaceship/connect_api/testflight/client.rb +8 -17
  67. data/spaceship/lib/spaceship/connect_api/testflight/testflight.rb +288 -277
  68. data/spaceship/lib/spaceship/connect_api/token.rb +46 -5
  69. data/spaceship/lib/spaceship/connect_api/token_refresh_middleware.rb +24 -0
  70. data/spaceship/lib/spaceship/connect_api/tunes/client.rb +8 -17
  71. data/spaceship/lib/spaceship/connect_api/tunes/tunes.rb +725 -706
  72. data/spaceship/lib/spaceship/connect_api/users/client.rb +8 -17
  73. data/spaceship/lib/spaceship/connect_api/users/users.rb +28 -17
  74. data/spaceship/lib/spaceship/stats_middleware.rb +65 -0
  75. metadata +33 -22
  76. data/spaceship/lib/spaceship/connect_api/.client.rb.swp +0 -0
@@ -26,27 +26,31 @@ module Fastlane
26
26
  end
27
27
 
28
28
  def self.get_build_number(params)
29
+ # Prompts select team if multiple teams and none specified
29
30
  UI.message("Login to App Store Connect (#{params[:username]})")
30
- Spaceship::Tunes.login(params[:username])
31
- Spaceship::Tunes.select_team(team_id: params[:team_id], team_name: params[:team_name])
31
+ Spaceship::ConnectAPI.login(params[:username], use_portal: false, use_tunes: true, tunes_team_id: params[:team_id], team_name: params[:team_name])
32
32
  UI.message("Login successful")
33
33
 
34
- app = Spaceship::Tunes::Application.find(params[:app_identifier], mac: params[:platform] == "osx")
34
+ platform = Spaceship::ConnectAPI::Platform.map(params[:platform])
35
+
36
+ app = Spaceship::ConnectAPI::App.find(params[:app_identifier])
35
37
  UI.user_error!("Could not find an app on App Store Connect with app_identifier: #{params[:app_identifier]}") unless app
36
38
  if params[:live]
37
39
  UI.message("Fetching the latest build number for live-version")
38
- UI.user_error!("Could not find a live-version of #{params[:app_identifier]} on iTC") unless app.live_version
39
- build_nr = app.live_version.current_build_number
40
+ live_version = app.get_live_app_store_version(platform: platform)
41
+
42
+ UI.user_error!("Could not find a live-version of #{params[:app_identifier]} on App Store Connect") unless live_version
43
+ build_nr = live_version.build.version
40
44
 
41
- UI.message("Latest upload for live-version #{app.live_version.version} is build: #{build_nr}")
45
+ UI.message("Latest upload for live-version #{live_version.version_string} is build: #{build_nr}")
42
46
 
43
- return OpenStruct.new({ build_nr: build_nr, build_v: app.live_version.version })
47
+ return OpenStruct.new({ build_nr: build_nr, build_v: live_version.version_string })
44
48
  else
45
49
  version_number = params[:version]
46
50
  platform = params[:platform]
47
51
 
48
52
  # Create filter for get_builds with optional version number
49
- filter = { app: app.apple_id }
53
+ filter = { app: app.id }
50
54
  if version_number
51
55
  filter["preReleaseVersion.version"] = version_number
52
56
  version_number_message = "version #{version_number}"
@@ -0,0 +1,120 @@
1
+ module Fastlane
2
+ module Actions
3
+ module SharedValues
4
+ APP_STORE_CONNECT_API_KEY = :APP_STORE_CONNECT_API_KEY
5
+ end
6
+
7
+ class AppStoreConnectApiKeyAction < Action
8
+ def self.run(options)
9
+ key_id = options[:key_id]
10
+ issuer_id = options[:issuer_id]
11
+ key_content = options[:key_content]
12
+ key_filepath = options[:key_filepath]
13
+ duration = options[:duration]
14
+ in_house = options[:in_house]
15
+
16
+ if key_content.nil? && key_filepath.nil?
17
+ UI.user_error!(":key_content or :key_filepath is required")
18
+ end
19
+
20
+ # This hash matches the named arguments on
21
+ # the Spaceship::ConnectAPI::Token.create method
22
+ key = {
23
+ key_id: key_id,
24
+ issuer_id: issuer_id,
25
+ key: key_content || File.binread(key_filepath),
26
+ duration: duration,
27
+ in_house: in_house
28
+ }
29
+
30
+ Actions.lane_context[SharedValues::APP_STORE_CONNECT_API_KEY] = key
31
+
32
+ return key
33
+ end
34
+
35
+ def self.description
36
+ "Load the App Store Connect API token to use in other fastlane tools and actions"
37
+ end
38
+
39
+ def self.available_options
40
+ [
41
+ FastlaneCore::ConfigItem.new(key: :key_id,
42
+ env_name: "APP_STORE_CONNECT_API_KEY_KEY_ID",
43
+ description: "The key ID"),
44
+ FastlaneCore::ConfigItem.new(key: :issuer_id,
45
+ env_name: "APP_STORE_CONNECT_API_KEY_ISSUER_ID",
46
+ description: "The issuer ID"),
47
+ FastlaneCore::ConfigItem.new(key: :key_filepath,
48
+ env_name: "APP_STORE_CONNECT_API_KEY_KEY_FILEPATH",
49
+ description: "The path to the key p8 file",
50
+ optional: true,
51
+ conflicting_options: [:key_content],
52
+ verify_block: proc do |value|
53
+ UI.user_error!("Couldn't find key p8 file at path '#{value}'") unless File.exist?(value)
54
+ end),
55
+ FastlaneCore::ConfigItem.new(key: :key_content,
56
+ env_name: "APP_STORE_CONNECT_API_KEY_KEY",
57
+ description: "The content of the key p8 file",
58
+ optional: true,
59
+ conflicting_options: [:filepath]),
60
+ FastlaneCore::ConfigItem.new(key: :duration,
61
+ env_name: "APP_STORE_CONNECT_API_KEY_DURATION",
62
+ description: "The token session duration",
63
+ optional: true,
64
+ type: Integer),
65
+ FastlaneCore::ConfigItem.new(key: :in_house,
66
+ env_name: "APP_STORE_CONNECT_API_KEY_IN_HOUSE",
67
+ description: "Is App Store or Enterprise (in house) team? App Store Connect API cannot not determine this on its own (yet)",
68
+ optional: true,
69
+ type: Boolean)
70
+ ]
71
+ end
72
+
73
+ def self.output
74
+ [
75
+ ['APP_STORE_CONNECT_API_KEY', 'The App Store Connect API key information used for authorization requests. This hash can be passed directly into the :api_key options on other tools or into Spaceship::ConnectAPI::Token.create method']
76
+ ]
77
+ end
78
+
79
+ def self.author
80
+ ["joshdholtz"]
81
+ end
82
+
83
+ def self.is_supported?(platform)
84
+ true
85
+ end
86
+
87
+ def self.details
88
+ [
89
+ "Load the App Store Connect API token to use in other fastlane tools and actions"
90
+ ].join("\n")
91
+ end
92
+
93
+ def self.example_code
94
+ [
95
+ 'app_store_connect_api_key(
96
+ key_id: "D83848D23",
97
+ issuer_id: "227b0bbf-ada8-458c-9d62-3d8022b7d07f",
98
+ key_filepath: "D83848D23.p8"
99
+ )',
100
+ 'app_store_connect_api_key(
101
+ key_id: "D83848D23",
102
+ issuer_id: "227b0bbf-ada8-458c-9d62-3d8022b7d07f",
103
+ key_filepath: "D83848D23.p8",
104
+ duration: 200,
105
+ in_house: true
106
+ )',
107
+ 'app_store_connect_api_key(
108
+ key_id: "D83848D23",
109
+ issuer_id: "227b0bbf-ada8-458c-9d62-3d8022b7d07f",
110
+ key_content: "-----BEGIN EC PRIVATE KEY-----\nfewfawefawfe\n-----END EC PRIVATE KEY-----"
111
+ )'
112
+ ]
113
+ end
114
+
115
+ def self.category
116
+ :app_store_connect
117
+ end
118
+ end
119
+ end
120
+ end
@@ -220,7 +220,7 @@ module Fastlane
220
220
  'commit_version_bump',
221
221
  'commit_version_bump(
222
222
  message: "Version Bump", # create a commit with a custom message
223
- xcodeproj: "./path/to/MyProject.xcodeproj", # optional, if you have multiple Xcode project files, you must specify your main project here
223
+ xcodeproj: "./path/to/MyProject.xcodeproj" # optional, if you have multiple Xcode project files, you must specify your main project here
224
224
  )',
225
225
  'commit_version_bump(
226
226
  settings: true # Include Settings.bundle/Root.plist
@@ -49,6 +49,8 @@ The previous p12 configuration is still currently supported.
49
49
 
50
50
  ## Quick Start
51
51
 
52
+ > Before using _supply_ to connect to Google Play Store, you'll need to set up your app manually first by uploading at least one build to Google Play Store. See [fastane/fastlane#14686](https://github.com/fastlane/fastlane/issues/14686) for more info.
53
+
52
54
  - `cd [your_project_folder]`
53
55
  - `fastlane supply init`
54
56
  - Make changes to the downloaded metadata, add images, screenshots and/or an APK
@@ -26,7 +26,23 @@ _pilot_ uses [spaceship.airforce](https://spaceship.airforce) to interact with A
26
26
 
27
27
  # Usage
28
28
 
29
- For all commands you can specify the Apple ID to use using `-u felix@krausefx.com`. If you execute _pilot_ in a project already using [_fastlane_](https://fastlane.tools) the username and app identifier will automatically be determined.
29
+ For all commands, you can either use an [API Key](#app-store-connect-api-key) or your [Apple ID](#apple-id).
30
+
31
+ ### App Store Connect API Key
32
+
33
+ The App Store Connect API Key is the preferred authentication method (if you are able to use it).
34
+
35
+ - Uses offial App Store Connect API
36
+ - No need for 2FA
37
+ - Better performance over Apple ID
38
+
39
+ Specify the API key using `--api_key_path ./path/to/api_key_info.json` or `--api_key "{\"key_id\": \"D83848D23\", \"issuer_id\": \"227b0bbf-ada8-458c-9d62-3d8022b7d07f\", \"key_filepath\": \"D83848D23.p8\"}"`
40
+
41
+ Go to [Using App Store Connect API](/app-store-connect-api) for information on obtaining an API key, the _fastlane_ `api_key_info.json` format, and other API key usage.
42
+
43
+ ### Apple ID
44
+
45
+ Specify the Apple ID to use using `-u felix@krausefx.com`. If you execute _pilot_ in a project already using [_fastlane_](https://fastlane.tools) the username and app identifier will automatically be determined.
30
46
 
31
47
  ## Uploading builds
32
48
 
@@ -6,16 +6,18 @@ module Fastlane
6
6
  class DownloadDsymsAction < Action
7
7
  # rubocop:disable Metrics/PerceivedComplexity
8
8
  def self.run(params)
9
+ require 'openssl'
9
10
  require 'spaceship'
10
11
  require 'net/http'
11
12
 
13
+ # Team selection passed though FASTLANE_ITC_TEAM_ID and FASTLANE_ITC_TEAM_NAME environment variables
14
+ # Prompts select team if multiple teams and none specified
12
15
  UI.message("Login to App Store Connect (#{params[:username]})")
13
- Spaceship::Tunes.login(params[:username])
14
- Spaceship::Tunes.select_team
16
+ Spaceship::ConnectAPI.login(params[:username], use_portal: false, use_tunes: true)
15
17
  UI.message("Login successful")
16
18
 
17
19
  # Get App
18
- app = Spaceship::Application.find(params[:app_identifier])
20
+ app = Spaceship::ConnectAPI::App.find(params[:app_identifier])
19
21
  unless app
20
22
  UI.user_error!("Could not find app with bundle identifier '#{params[:app_identifier]}' on account #{params[:username]}")
21
23
  end
@@ -23,38 +25,35 @@ module Fastlane
23
25
  # Process options
24
26
  version = params[:version]
25
27
  build_number = params[:build_number].to_s unless params[:build_number].nil?
26
- platform = params[:platform]
28
+ itc_platform = params[:platform]
27
29
  output_directory = params[:output_directory]
28
30
  wait_for_dsym_processing = params[:wait_for_dsym_processing]
29
31
  wait_timeout = params[:wait_timeout]
30
32
  min_version = Gem::Version.new(params[:min_version]) if params[:min_version]
31
33
 
34
+ platform = Spaceship::ConnectAPI::Platform.map(itc_platform)
35
+
32
36
  # Set version if it is latest
33
37
  if version == 'latest'
34
38
  # Try to grab the edit version first, else fallback to live version
35
39
  UI.message("Looking for latest version...")
36
- latest_version = app.edit_version(platform: platform) || app.live_version(platform: platform)
37
-
38
- UI.user_error!("Could not find latest version for your app, please try setting a specific version") if latest_version.version.nil?
39
-
40
- latest_candidate_build = latest_version.candidate_builds.max_by(&:upload_date)
41
- if latest_candidate_build.nil?
42
- version = latest_version.version
43
- build_number = latest_version.build_version
44
- else
45
- # The build_version of a candidate build does not always match the one in latest_version so get the version and build number from the same place.
46
- version = latest_candidate_build.train_version
47
- build_number = latest_candidate_build.build_version
48
- end
40
+ latest_version = app.get_edit_app_store_version(platform: platform) || app.get_live_app_store_version(platform: platform)
41
+
42
+ UI.user_error!("Could not find latest version for your app, please try setting a specific version") if latest_version.nil?
43
+
44
+ latest_build = get_latest_build!(app_id: app.id, version: latest_version.version_string, platform: platform)
45
+
46
+ version = latest_build.app_version
47
+ build_number = latest_build.version
49
48
  elsif version == 'live'
50
49
  UI.message("Looking for live version...")
51
- live_version = app.live_version(platform: platform)
50
+ live_version = app.get_live_app_store_version(platform: platform)
52
51
 
53
52
  UI.user_error!("Could not find live version for your app, please try setting 'latest' or a specific version") if live_version.nil?
54
53
 
55
54
  # No need to search for candidates, because released App Store version should only have one build
56
- version = live_version.version
57
- build_number = live_version.build_version
55
+ version = live_version.version_string
56
+ build_number = live_version.build.version
58
57
  end
59
58
 
60
59
  # Remove leading zeros from version string (eg. 1.02 -> 1.2)
@@ -74,76 +73,98 @@ module Fastlane
74
73
  message << "(#{build_number})" if build_number
75
74
  UI.message(message.join(" "))
76
75
 
77
- app.tunes_all_build_trains(platform: platform).each do |train|
76
+ filter = { app: app.id }
77
+ filter["preReleaseVersion.platform"] = platform
78
+ build_resps = Spaceship::ConnectAPI.get_builds(filter: filter, sort: "-uploadedDate", includes: "preReleaseVersion").all_pages
79
+ builds = build_resps.flat_map(&:to_models)
80
+
81
+ builds.each do |build|
82
+ asc_app_version = build.app_version
83
+ asc_build_number = build.version
84
+
78
85
  message = []
79
- message << "Found train (version): #{train.version_string}"
86
+ message << "Found train (version): #{asc_app_version}"
80
87
  message << ", comparing to supplied version: #{version}" if version
81
88
  UI.verbose(message.join(" "))
82
89
 
83
- if version && version != train.version_string
84
- UI.verbose("Version #{version} doesn't match: #{train.version_string}")
90
+ if version && version != asc_app_version
91
+ UI.verbose("Version #{version} doesn't match: #{asc_app_version}")
85
92
  next
86
93
  end
87
94
 
88
- if min_version && min_version > Gem::Version.new(train.version_string)
89
- UI.verbose("Min version #{min_version} not reached: #{train.version_string}")
95
+ if min_version && min_version > Gem::Version.new(asc_app_version)
96
+ UI.verbose("Min version #{min_version} not reached: #{asc_app_version}")
90
97
  next
91
98
  end
92
99
 
93
- app.tunes_all_builds_for_train(train: train.version_string, platform: platform).each do |build|
94
- message = []
95
- message << "Found build version: #{build.build_version}"
96
- message << ", comparing to supplied build_number: #{build_number}" if build_number
97
- UI.verbose(message.join(" "))
100
+ message = []
101
+ message << "Found build version: #{asc_build_number}"
102
+ message << ", comparing to supplied build_number: #{build_number}" if build_number
103
+ UI.verbose(message.join(" "))
98
104
 
99
- if build_number && build.build_version != build_number
100
- UI.verbose("build_version: #{build.build_version} doesn't match: #{build_number}")
101
- next
102
- end
105
+ if build_number && asc_build_number != build_number
106
+ UI.verbose("build_version: #{asc_build_number} doesn't match: #{build_number}")
107
+ next
108
+ end
103
109
 
104
- UI.verbose("Build_version: #{build.build_version} matches #{build_number}, grabbing dsym_url") if build_number
105
-
106
- start = Time.now
107
- download_url = nil
108
-
109
- loop do
110
- begin
111
- build_details = app.tunes_build_details(train: train.version_string, build_number: build.build_version, platform: platform)
112
- download_url = build_details.dsym_url
113
- UI.verbose("dsym_url: #{download_url}")
114
- rescue Spaceship::TunesClient::ITunesConnectError => ex
115
- UI.error("Error accessing dSYM file for build\n\n#{build}\n\nException: #{ex}")
116
- end
117
-
118
- unless download_url
119
- if !wait_for_dsym_processing || (Time.now - start) > wait_timeout
120
- # In some cases, AppStoreConnect does not process the dSYMs, thus no error should be thrown.
121
- UI.message("Could not find any dSYM for #{build.build_version} (#{train.version_string})")
122
- else
123
- UI.message("Waiting for dSYM file to appear...")
124
- sleep(30)
125
- next
126
- end
127
- end
128
-
129
- break
130
- end
110
+ UI.verbose("Build_version: #{asc_build_number} matches #{build_number}, grabbing dsym_url") if build_number
111
+ get_details_and_download_dsym(app: app, train: asc_app_version, build_number: asc_build_number, platform: itc_platform, wait_for_dsym_processing: wait_for_dsym_processing, wait_timeout: wait_timeout, output_directory: output_directory)
112
+ end
113
+ end
114
+
115
+ def self.get_details_and_download_dsym(app: nil, train: nil, build_number: nil, platform: nil, wait_for_dsym_processing: nil, wait_timeout: nil, output_directory: nil)
116
+ start = Time.now
117
+ download_url = nil
118
+
119
+ loop do
120
+ begin
121
+ resp = Spaceship::Tunes.client.build_details(app_id: app.id, train: train, build_number: build_number, platform: platform)
122
+
123
+ resp['apple_id'] = app.id
124
+ build_details = Spaceship::Tunes::BuildDetails.factory(resp)
131
125
 
132
- if download_url
133
- self.download(download_url, app.bundle_id, train.version_string, build.build_version, output_directory)
134
- break if build_number
126
+ download_url = build_details.dsym_url
127
+ UI.verbose("dsym_url: #{download_url}")
128
+ rescue Spaceship::TunesClient::ITunesConnectError => ex
129
+ UI.error("Error accessing dSYM file for build\n\n#{build}\n\nException: #{ex}")
130
+ end
131
+
132
+ unless download_url
133
+ if !wait_for_dsym_processing || (Time.now - start) > wait_timeout
134
+ # In some cases, AppStoreConnect does not process the dSYMs, thus no error should be thrown.
135
+ UI.message("Could not find any dSYM for #{build_number} (#{train})")
135
136
  else
136
- UI.message("No dSYM URL for #{build.build_version} (#{train.version_string})")
137
+ UI.message("Waiting for dSYM file to appear...")
138
+ sleep(30)
139
+ next
137
140
  end
138
141
  end
142
+
143
+ break
139
144
  end
140
145
 
141
- if (Actions.lane_context[SharedValues::DSYM_PATHS] || []).count == 0
142
- UI.error("No dSYM files found on App Store Connect - this usually happens when no recompiling has happened yet")
146
+ if download_url
147
+ self.download(download_url, app.bundle_id, train, build_number, output_directory)
148
+ return if build_number
149
+ else
150
+ UI.message("No dSYM URL for #{build_number} (#{train})")
143
151
  end
144
152
  end
145
153
  # rubocop:enable Metrics/PerceivedComplexity
146
154
 
155
+ def self.get_latest_build!(app_id: nil, version: nil, platform: nil)
156
+ filter = { app: app_id }
157
+ filter["preReleaseVersion.version"] = version
158
+ filter["preReleaseVersion.platform"] = platform
159
+ latest_build = Spaceship::ConnectAPI.get_builds(filter: filter, sort: "-uploadedDate", includes: "preReleaseVersion").first
160
+
161
+ if latest_build.nil?
162
+ UI.user_error!("Could not find latest bulid for version #{version}")
163
+ end
164
+
165
+ return latest_build
166
+ end
167
+
147
168
  def self.download(download_url, bundle_id, train_number, build_version, output_directory)
148
169
  result = self.download_file(download_url)
149
170
  path = write_dsym(result, bundle_id, train_number, build_version, output_directory)
@@ -4,9 +4,10 @@ module Fastlane
4
4
  def self.run(params)
5
5
  require 'spaceship'
6
6
 
7
+ # Team selection passed though FASTLANE_ITC_TEAM_ID and FASTLANE_ITC_TEAM_NAME environment variables
8
+ # Prompts select team if multiple teams and none specified
7
9
  UI.message("Login to App Store Connect (#{params[:username]})")
8
- Spaceship::Tunes.login(params[:username])
9
- Spaceship::Tunes.select_team
10
+ Spaceship::ConnectAPI.login(params[:username], use_portal: false, use_tunes: true)
10
11
  UI.message("Login successful")
11
12
 
12
13
  app = Spaceship::ConnectAPI::App.find(params[:app_identifier])
@@ -16,6 +16,7 @@ module Fastlane
16
16
  sonar_scanner_args << "-Dsonar.projectName=\"#{params[:project_name]}\"" if params[:project_name]
17
17
  sonar_scanner_args << "-Dsonar.projectVersion=\"#{params[:project_version]}\"" if params[:project_version]
18
18
  sonar_scanner_args << "-Dsonar.sources=\"#{params[:sources_path]}\"" if params[:sources_path]
19
+ sonar_scanner_args << "-Dsonar.exclusions=\"#{params[:exclusions]}\"" if params[:exclusions]
19
20
  sonar_scanner_args << "-Dsonar.language=\"#{params[:project_language]}\"" if params[:project_language]
20
21
  sonar_scanner_args << "-Dsonar.sourceEncoding=\"#{params[:source_encoding]}\"" if params[:source_encoding]
21
22
  sonar_scanner_args << "-Dsonar.login=\"#{params[:sonar_login]}\"" if params[:sonar_login]
@@ -81,6 +82,10 @@ module Fastlane
81
82
  env_name: "FL_SONAR_RUNNER_SOURCES_PATH",
82
83
  description: "Comma-separated paths to directories containing source files. Must either be specified here or inside the sonar project configuration file",
83
84
  optional: true),
85
+ FastlaneCore::ConfigItem.new(key: :exclusions,
86
+ env_name: "FL_SONAR_RUNNER_EXCLUSIONS",
87
+ description: "Comma-separated paths to directories to be excluded from the analysis",
88
+ optional: true),
84
89
  FastlaneCore::ConfigItem.new(key: :project_language,
85
90
  env_name: "FL_SONAR_RUNNER_PROJECT_LANGUAGE",
86
91
  description: "Language key, e.g. objc",