fastlane-plugin-bugsnag 2.3.1 → 3.1.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 +4 -4
- data/bin/arm64-linux-bugsnag-cli +0 -0
- data/bin/arm64-macos-bugsnag-cli +0 -0
- data/bin/i386-linux-bugsnag-cli +0 -0
- data/bin/i386-windows-bugsnag-cli.exe +0 -0
- data/bin/x86_64-linux-bugsnag-cli +0 -0
- data/bin/x86_64-macos-bugsnag-cli +0 -0
- data/bin/x86_64-windows-bugsnag-cli.exe +0 -0
- data/lib/fastlane/plugin/bugsnag/actions/bugsnag_cli.rb +116 -0
- data/lib/fastlane/plugin/bugsnag/actions/send_build_to_bugsnag.rb +82 -86
- data/lib/fastlane/plugin/bugsnag/actions/upload_symbols_to_bugsnag.rb +72 -27
- data/lib/fastlane/plugin/bugsnag/version.rb +1 -1
- data/spec/bugsnag_upload_dsym_action_spec.rb +62 -74
- data/spec/fixtures/dummy_bugsnag_cli.sh +13 -0
- data/spec/send_build_to_bugsnag_spec.rb +32 -64
- data/spec/spec_helper.rb +8 -0
- metadata +26 -21
- data/bugsnag-dsym-upload +0 -222
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 042d2b301e0ad19225ace580396fb7e28a3c6937b886c121a397638d9045c943
|
|
4
|
+
data.tar.gz: 55b92ac267ac88e808bfa5b321d49619f2277915de491529315fcba948a15b18
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f78c4a5367838ec3cad6c73babe205613fc568a46410f5d1ae229f331b7349dbfc94d6a3f06c8a205cd313e56cd30645f81fe080d89c8b9468927a815458de03
|
|
7
|
+
data.tar.gz: 167d065c493176c4011801d16d95b811cf4c48eef54754883b5ff98a1ee4236520f524df2458072698c373e466a3cdc0594e2e6cdd3069cfbd80ff6ecc0bc94d
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
require 'os'
|
|
2
|
+
require 'rbconfig'
|
|
3
|
+
|
|
4
|
+
class BugsnagCli
|
|
5
|
+
def self.get_bugsnag_cli_path(params)
|
|
6
|
+
bundled_bugsnag_cli_path = self.get_bundled_path
|
|
7
|
+
bundled_bugsnag_cli_version = Gem::Version.new(`#{bundled_bugsnag_cli_path} --version`.scan(/(?:\d+\.?){3}/).first)
|
|
8
|
+
|
|
9
|
+
if params[:bugsnag_cli_path]
|
|
10
|
+
bugsnag_cli_path = params[:bugsnag_cli_path] || bundled_bugsnag_cli_path
|
|
11
|
+
|
|
12
|
+
bugsnag_cli_version = Gem::Version.new(`#{bugsnag_cli_path} --version`.scan(/(?:\d+\.?){3}/).first)
|
|
13
|
+
|
|
14
|
+
if bugsnag_cli_version < bundled_bugsnag_cli_version
|
|
15
|
+
FastlaneCore::UI.warning("The installed bugsnag-cli at #{bugsnag_cli_path} is outdated (#{bugsnag_cli_version}). The current bundled version is: #{bundled_bugsnag_cli_version}. It is recommended that you either update your installed version or use the bundled version.")
|
|
16
|
+
end
|
|
17
|
+
FastlaneCore::UI.verbose("Using bugsnag-cli from path: #{bugsnag_cli_path}")
|
|
18
|
+
bugsnag_cli_path
|
|
19
|
+
else
|
|
20
|
+
FastlaneCore::UI.verbose("Using bundled bugsnag-cli from path: #{bundled_bugsnag_cli_path}")
|
|
21
|
+
bundled_bugsnag_cli_path
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def self.get_bundled_path
|
|
26
|
+
host_cpu = RbConfig::CONFIG['host_cpu']
|
|
27
|
+
if OS.mac?
|
|
28
|
+
if host_cpu =~ /arm|aarch64/
|
|
29
|
+
self.bin_folder('arm64-macos-bugsnag-cli')
|
|
30
|
+
else
|
|
31
|
+
self.bin_folder('x86_64-macos-bugsnag-cli')
|
|
32
|
+
end
|
|
33
|
+
elsif OS.windows?
|
|
34
|
+
if OS.bits == 64
|
|
35
|
+
self.bin_folder('x86_64-windows-bugsnag-cli.exe')
|
|
36
|
+
else
|
|
37
|
+
self.bin_folder('i386-windows-bugsnag-cli.exe')
|
|
38
|
+
end
|
|
39
|
+
else
|
|
40
|
+
if host_cpu =~ /arm|aarch64/
|
|
41
|
+
self.bin_folder('arm64-linux-bugsnag-cli')
|
|
42
|
+
elsif OS.bits == 64
|
|
43
|
+
self.bin_folder('x86_64-linux-bugsnag-cli')
|
|
44
|
+
else
|
|
45
|
+
self.bin_folder('i386-linux-bugsnag-cli')
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def self.bin_folder(filename)
|
|
51
|
+
File.expand_path("../../../../../bin/#{filename}", File.dirname(__FILE__))
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def self.create_build_args(api_key, version_name, version_code, bundle_version, release_stage, builder, revision, repository, provider, auto_assign_release, metadata, retries, timeout, endpoint)
|
|
55
|
+
args = []
|
|
56
|
+
args += ["--api-key", api_key] unless api_key.nil?
|
|
57
|
+
args += ["--version-name", version_name] unless version_name.nil?
|
|
58
|
+
args += ["--version-code", version_code] unless version_code.nil?
|
|
59
|
+
args += ["--bundle-version", bundle_version] unless bundle_version.nil?
|
|
60
|
+
args += ["--release-stage", release_stage] unless release_stage.nil?
|
|
61
|
+
args += ["--builder-name", builder] unless builder.nil?
|
|
62
|
+
args += ["--revision", revision] unless revision.nil?
|
|
63
|
+
args += ["--repository", repository] unless repository.nil?
|
|
64
|
+
args += ["--provider", provider] unless provider.nil?
|
|
65
|
+
args += ["--auto-assign-release"] if auto_assign_release
|
|
66
|
+
unless metadata.nil?
|
|
67
|
+
if metadata.is_a?(String)
|
|
68
|
+
#
|
|
69
|
+
args += ["--metadata", metadata]
|
|
70
|
+
elsif metadata.is_a?(Hash)
|
|
71
|
+
formatted_metadata = metadata.map { |k, v| %Q{"#{k}"="#{v}"} }.join(",")
|
|
72
|
+
args += ["--metadata", formatted_metadata]
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
args += ["--retries", retries] unless retries.nil?
|
|
76
|
+
args += ["--timeout", timeout] unless timeout.nil?
|
|
77
|
+
args += ["--build-api-root-url", endpoint] unless endpoint.nil?
|
|
78
|
+
args += ["--verbose"] if FastlaneCore::Globals.verbose?
|
|
79
|
+
args
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
def self.upload_args dir, upload_url, project_root, api_key, ignore_missing_dwarf, ignore_empty_dsym, dryrun, log_level, port, retries, timeout, configuration, scheme, plist, xcode_project
|
|
83
|
+
args = []
|
|
84
|
+
args += ["--verbose"] if FastlaneCore::Globals.verbose?
|
|
85
|
+
args += ["--ignore-missing-dwarf"] if ignore_missing_dwarf
|
|
86
|
+
args += ["--ignore-empty-dsym"] if ignore_empty_dsym
|
|
87
|
+
args += ["--api-key", api_key] unless api_key.nil?
|
|
88
|
+
args += ["--upload-api-root-url", upload_url] unless upload_url.nil?
|
|
89
|
+
args += ["--project-root", project_root] unless project_root.nil?
|
|
90
|
+
args += ["--dry-run"] if dryrun
|
|
91
|
+
args += ["--log-level", log_level] unless log_level.nil?
|
|
92
|
+
args += ["--port", port] unless port.nil?
|
|
93
|
+
args += ["--retries", retries] unless retries.nil?
|
|
94
|
+
args += ["--timeout", timeout] unless timeout.nil?
|
|
95
|
+
args += ["--configuration", configuration] unless configuration.nil?
|
|
96
|
+
args += ["--scheme", scheme] unless scheme.nil?
|
|
97
|
+
args += ["--plist", plist] unless plist.nil?
|
|
98
|
+
args += ["--xcode-project", xcode_project] unless xcode_project.nil?
|
|
99
|
+
args << dir
|
|
100
|
+
args
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
def self.upload_dsym cli_path, args
|
|
104
|
+
bugsnag_cli_command = "#{cli_path} upload dsym #{args.join(' ')}"
|
|
105
|
+
FastlaneCore::UI.verbose("Running command: #{bugsnag_cli_command}")
|
|
106
|
+
Kernel.system(bugsnag_cli_command)
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
def self.create_build cli_path, args
|
|
110
|
+
bugsnag_cli_command = "#{cli_path} create-build #{args.join(' ')}"
|
|
111
|
+
FastlaneCore::UI.verbose("Running command: #{bugsnag_cli_command}")
|
|
112
|
+
Kernel.system(bugsnag_cli_command)
|
|
113
|
+
end
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
|
|
@@ -1,63 +1,66 @@
|
|
|
1
|
-
require "
|
|
1
|
+
require "rexml/document"
|
|
2
2
|
require "json"
|
|
3
3
|
require_relative "find_info_plist_path"
|
|
4
|
+
require_relative "bugsnag_cli"
|
|
4
5
|
|
|
5
6
|
module Fastlane
|
|
6
7
|
module Actions
|
|
7
8
|
class SendBuildToBugsnagAction < Action
|
|
8
|
-
|
|
9
|
-
BUILD_TOOL = "bugsnag-fastlane-plugin"
|
|
10
|
-
|
|
11
9
|
def self.run(params)
|
|
12
|
-
|
|
10
|
+
bugsnag_cli_path = BugsnagCli.get_bugsnag_cli_path(params)
|
|
13
11
|
|
|
14
12
|
# If a configuration file was found or was specified, load in the options:
|
|
13
|
+
config_options = {}
|
|
15
14
|
if params[:config_file]
|
|
16
15
|
UI.message("Loading build information from #{params[:config_file]}")
|
|
17
16
|
config_options = load_config_file_options(params[:config_file])
|
|
18
|
-
|
|
19
|
-
# for each of the config options, if it's not been overriden by any
|
|
20
|
-
# input to the lane, write it to the payload:
|
|
21
|
-
payload[:apiKey] = params[:api_key] || config_options[:apiKey]
|
|
22
|
-
payload[:appVersion] = params[:app_version] || config_options[:appVersion]
|
|
23
|
-
payload[:appVersionCode] = params[:android_version_code] || config_options[:appVersionCode]
|
|
24
|
-
payload[:appBundleVersion] = params[:ios_bundle_version] || config_options[:appBundleVersion]
|
|
25
|
-
payload[:releaseStage] = params[:release_stage] || config_options[:releaseStage] || "production"
|
|
26
|
-
else
|
|
27
|
-
# No configuration file was found or specified, use the input parameters:
|
|
28
|
-
payload[:apiKey] = params[:api_key]
|
|
29
|
-
payload[:appVersion] = params[:app_version]
|
|
30
|
-
payload[:appVersionCode] = params[:android_version_code]
|
|
31
|
-
payload[:appBundleVersion] = params[:ios_bundle_version]
|
|
32
|
-
payload[:releaseStage] = params[:release_stage] || "production"
|
|
33
17
|
end
|
|
34
18
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
19
|
+
api_key = params[:api_key] || config_options[:apiKey] unless (params[:api_key].nil? && config_options[:apiKey].nil?)
|
|
20
|
+
version_name = params[:app_version] || config_options[:appVersion] unless (params[:app_version].nil? && config_options[:appVersion].nil?)
|
|
21
|
+
version_code = params[:android_version_code] || config_options[:appVersionCode] unless (params[:android_version_code].nil? && config_options[:appVersionCode].nil?)
|
|
22
|
+
bundle_version = params[:ios_bundle_version] || config_options[:appBundleVersion] unless (params[:ios_bundle_version].nil? && config_options[:appBundleVersion].nil?)
|
|
23
|
+
release_stage = params[:release_stage] || config_options[:releaseStage] || "production" unless (params[:release_stage].nil? && config_options[:releaseStage].nil?)
|
|
24
|
+
builder = params[:builder] unless params[:builder].nil?
|
|
25
|
+
revision = params[:revision] unless params[:revision].nil?
|
|
26
|
+
repository = params[:repository] unless params[:repository].nil?
|
|
27
|
+
provider = params[:provider] unless params[:provider].nil?
|
|
28
|
+
auto_assign_release = params[:auto_assign_release] unless params[:auto_assign_release].nil?
|
|
29
|
+
metadata = params[:metadata] unless params[:metadata].nil?
|
|
30
|
+
retries = params[:retries] unless params[:retries].nil?
|
|
31
|
+
timeout = params[:timeout] unless params[:timeout].nil?
|
|
32
|
+
endpoint = params[:endpoint] unless params[:endpoint].nil?
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
if api_key.nil? || !api_key.is_a?(String)
|
|
48
36
|
UI.user_error! missing_api_key_message(params)
|
|
49
37
|
end
|
|
50
|
-
if
|
|
38
|
+
if version_name.nil?
|
|
51
39
|
UI.user_error! missing_app_version_message(params)
|
|
52
40
|
end
|
|
53
41
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
42
|
+
args = BugsnagCli.create_build_args(
|
|
43
|
+
api_key,
|
|
44
|
+
version_name,
|
|
45
|
+
version_code,
|
|
46
|
+
bundle_version,
|
|
47
|
+
release_stage,
|
|
48
|
+
builder,
|
|
49
|
+
revision,
|
|
50
|
+
repository,
|
|
51
|
+
provider,
|
|
52
|
+
auto_assign_release,
|
|
53
|
+
metadata,
|
|
54
|
+
retries,
|
|
55
|
+
timeout,
|
|
56
|
+
endpoint
|
|
57
|
+
)
|
|
58
|
+
success = BugsnagCli.create_build bugsnag_cli_path, args
|
|
59
|
+
if success
|
|
60
|
+
UI.success("Build successfully sent to Bugsnag")
|
|
61
|
+
else
|
|
62
|
+
UI.user_error!("Failed to send build to Bugsnag.")
|
|
58
63
|
end
|
|
59
|
-
|
|
60
|
-
send_notification(params[:endpoint], ::JSON.dump(payload))
|
|
61
64
|
end
|
|
62
65
|
|
|
63
66
|
def self.missing_api_key_message(params)
|
|
@@ -146,6 +149,11 @@ module Fastlane
|
|
|
146
149
|
FastlaneCore::ConfigItem.new(key: :release_stage,
|
|
147
150
|
description: "Release stage being built, i.e. staging, production",
|
|
148
151
|
optional: true),
|
|
152
|
+
FastlaneCore::ConfigItem.new(key: :auto_assign_release,
|
|
153
|
+
description: "Whether to automatically associate this build with any new error events and sessions that are received for",
|
|
154
|
+
optional: true,
|
|
155
|
+
default_value: false,
|
|
156
|
+
is_string: false),
|
|
149
157
|
FastlaneCore::ConfigItem.new(key: :builder,
|
|
150
158
|
description: "The name of the entity triggering the build",
|
|
151
159
|
optional: true,
|
|
@@ -170,13 +178,28 @@ module Fastlane
|
|
|
170
178
|
end),
|
|
171
179
|
FastlaneCore::ConfigItem.new(key: :endpoint,
|
|
172
180
|
description: "Bugsnag deployment endpoint",
|
|
173
|
-
|
|
174
|
-
|
|
181
|
+
default_value: nil,
|
|
182
|
+
optional: true),
|
|
175
183
|
FastlaneCore::ConfigItem.new(key: :metadata,
|
|
176
184
|
description: "Metadata",
|
|
177
185
|
optional:true,
|
|
178
|
-
type: Object,
|
|
179
|
-
default_value: nil)
|
|
186
|
+
type: Object,
|
|
187
|
+
default_value: nil),
|
|
188
|
+
FastlaneCore::ConfigItem.new(key: :retries,
|
|
189
|
+
description: "The number of retry attempts before failing an upload request",
|
|
190
|
+
optional: true,
|
|
191
|
+
is_string: false),
|
|
192
|
+
FastlaneCore::ConfigItem.new(key: :timeout,
|
|
193
|
+
description: "The number of seconds to wait before failing an upload request",
|
|
194
|
+
optional: true,
|
|
195
|
+
is_string: false),
|
|
196
|
+
FastlaneCore::ConfigItem.new(key: :bugsnag_cli_path,
|
|
197
|
+
env_name: "BUGSNAG_CLI_PATH",
|
|
198
|
+
description: "Path to your bugsnag-cli",
|
|
199
|
+
optional: true,
|
|
200
|
+
verify_block: proc do |value|
|
|
201
|
+
UI.user_error! "'#{value}' is not executable" unless FastlaneCore::Helper.executable?(value)
|
|
202
|
+
end)
|
|
180
203
|
]
|
|
181
204
|
end
|
|
182
205
|
|
|
@@ -194,7 +217,8 @@ module Fastlane
|
|
|
194
217
|
git_options[:repository] = origin.url
|
|
195
218
|
git_options[:revision] = repo.revparse("HEAD")
|
|
196
219
|
end
|
|
197
|
-
rescue
|
|
220
|
+
rescue => e
|
|
221
|
+
UI.verbose("Could not load git options: #{e.message}")
|
|
198
222
|
end
|
|
199
223
|
return git_options
|
|
200
224
|
end
|
|
@@ -263,11 +287,18 @@ module Fastlane
|
|
|
263
287
|
def self.options_from_android_manifest file_path
|
|
264
288
|
options = {}
|
|
265
289
|
begin
|
|
266
|
-
|
|
290
|
+
xml_content = File.read(file_path)
|
|
291
|
+
doc = REXML::Document.new(xml_content)
|
|
292
|
+
meta_data = {}
|
|
293
|
+
REXML::XPath.each(doc, "//meta-data") do |element|
|
|
294
|
+
name = element.attributes["android:name"]
|
|
295
|
+
value = element.attributes["android:value"]
|
|
296
|
+
meta_data[name] = value if name
|
|
297
|
+
end
|
|
267
298
|
options[:apiKey] = meta_data["com.bugsnag.android.API_KEY"]
|
|
268
299
|
options[:appVersion] = meta_data["com.bugsnag.android.APP_VERSION"]
|
|
269
300
|
options[:releaseStage] = meta_data["com.bugsnag.android.RELEASE_STAGE"]
|
|
270
|
-
rescue ArgumentError
|
|
301
|
+
rescue ArgumentError, REXML::ParseException, Errno::ENOENT, Errno::EACCES => e
|
|
271
302
|
nil
|
|
272
303
|
end
|
|
273
304
|
options
|
|
@@ -288,6 +319,10 @@ module Fastlane
|
|
|
288
319
|
options
|
|
289
320
|
end
|
|
290
321
|
|
|
322
|
+
# NOTE: The following methods are no longer used.
|
|
323
|
+
# XML parsing is now handled directly via REXML::XPath in options_from_android_manifest.
|
|
324
|
+
# Kept for reference only.
|
|
325
|
+
|
|
291
326
|
def self.parse_android_manifest_options config_hash
|
|
292
327
|
map_meta_data(get_meta_data(config_hash))
|
|
293
328
|
end
|
|
@@ -316,45 +351,6 @@ module Fastlane
|
|
|
316
351
|
end
|
|
317
352
|
output
|
|
318
353
|
end
|
|
319
|
-
|
|
320
|
-
def self.parse_response_body(response)
|
|
321
|
-
begin
|
|
322
|
-
JSON.load(response.body)
|
|
323
|
-
rescue
|
|
324
|
-
nil
|
|
325
|
-
end
|
|
326
|
-
end
|
|
327
|
-
|
|
328
|
-
def self.send_notification(url, body)
|
|
329
|
-
require "net/http"
|
|
330
|
-
uri = URI.parse(url)
|
|
331
|
-
http = Net::HTTP.new(uri.host, uri.port)
|
|
332
|
-
http.read_timeout = 15
|
|
333
|
-
http.open_timeout = 15
|
|
334
|
-
|
|
335
|
-
http.use_ssl = uri.scheme == "https"
|
|
336
|
-
|
|
337
|
-
uri.path == "" ? "/" : uri.path
|
|
338
|
-
request = Net::HTTP::Post.new(uri, {"Content-Type" => "application/json"})
|
|
339
|
-
request.body = body
|
|
340
|
-
begin
|
|
341
|
-
response = http.request(request)
|
|
342
|
-
rescue => e
|
|
343
|
-
UI.user_error! "Failed to notify Bugsnag of a new build: #{e}"
|
|
344
|
-
end
|
|
345
|
-
if body = parse_response_body(response)
|
|
346
|
-
if body.has_key? "errors"
|
|
347
|
-
errors = body["errors"].map {|error| "\n * #{error}"}.join
|
|
348
|
-
UI.user_error! "The following errors occurred while notifying Bugsnag:#{errors}.\n\nPlease update your lane config and retry."
|
|
349
|
-
elsif response.code != "200"
|
|
350
|
-
UI.user_error! "Failed to notify Bugsnag of a new build. Please retry. HTTP status code: #{response.code}"
|
|
351
|
-
end
|
|
352
|
-
if body.has_key? "warnings"
|
|
353
|
-
warnings = body["warnings"].map {|warn| "\n * #{warn}"}.join
|
|
354
|
-
UI.important "Sending the build to Bugsnag succeeded with the following warnings:#{warnings}\n\nPlease update your lane config."
|
|
355
|
-
end
|
|
356
|
-
end
|
|
357
|
-
end
|
|
358
354
|
end
|
|
359
355
|
end
|
|
360
356
|
end
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
require_relative "find_info_plist_path"
|
|
2
|
+
require_relative "bugsnag_cli"
|
|
3
|
+
|
|
2
4
|
|
|
3
5
|
module Fastlane
|
|
4
6
|
module Actions
|
|
5
7
|
class UploadSymbolsToBugsnagAction < Action
|
|
6
|
-
|
|
7
|
-
UPLOAD_SCRIPT_PATH = File.expand_path(
|
|
8
|
-
File.join(File.dirname(__FILE__), '..', '..', '..', '..', '..', 'bugsnag-dsym-upload'))
|
|
9
|
-
|
|
10
8
|
def self.run(params)
|
|
9
|
+
bugsnag_cli_path = BugsnagCli.get_bugsnag_cli_path(params)
|
|
10
|
+
UI.verbose("Using bugsnag-cli from path: #{bugsnag_cli_path}")
|
|
11
|
+
|
|
11
12
|
# If we have not explicitly set an API key through env, or parameter
|
|
12
|
-
# input in Fastfile, find an API key
|
|
13
|
+
# input in Fastfile, find an API key from the Info.plist in config_file param
|
|
13
14
|
api_key = params[:api_key]
|
|
14
15
|
if params[:config_file] && params[:api_key] == nil
|
|
15
16
|
UI.message("Using the API Key from #{params[:config_file]}")
|
|
@@ -18,7 +19,7 @@ module Fastlane
|
|
|
18
19
|
|
|
19
20
|
# If verbose flag is enabled (`--verbose`), display the plugin action debug info
|
|
20
21
|
# Store the verbose flag for use in the upload arguments.
|
|
21
|
-
|
|
22
|
+
UI.verbose("Uploading dSYMs to Bugsnag with the following parameters:")
|
|
22
23
|
rjust = 30 # set justification width for keys for the list of parameters to output
|
|
23
24
|
params.values.each do |param|
|
|
24
25
|
UI.verbose(" #{param[0].to_s.rjust(rjust)}: #{param[1]}")
|
|
@@ -28,8 +29,24 @@ module Fastlane
|
|
|
28
29
|
|
|
29
30
|
parse_dsym_paths(params[:dsym_path]).each do |dsym_path|
|
|
30
31
|
if dsym_path.end_with?(".zip") or File.directory?(dsym_path)
|
|
31
|
-
args = upload_args(
|
|
32
|
-
|
|
32
|
+
args = BugsnagCli.upload_args(
|
|
33
|
+
"\"#{dsym_path}\"",
|
|
34
|
+
params[:upload_url],
|
|
35
|
+
params[:project_root],
|
|
36
|
+
api_key,
|
|
37
|
+
params[:ignore_missing_dwarf],
|
|
38
|
+
params[:ignore_empty_dsym],
|
|
39
|
+
params[:dryrun],
|
|
40
|
+
params[:log_level],
|
|
41
|
+
params[:port],
|
|
42
|
+
params[:retries],
|
|
43
|
+
params[:timeout],
|
|
44
|
+
params[:configuration],
|
|
45
|
+
params[:scheme],
|
|
46
|
+
params[:config_file],
|
|
47
|
+
params[:xcode_project]
|
|
48
|
+
)
|
|
49
|
+
success = BugsnagCli.upload_dsym bugsnag_cli_path, args
|
|
33
50
|
if success
|
|
34
51
|
UI.success("Uploaded dSYMs in #{dsym_path}")
|
|
35
52
|
else
|
|
@@ -106,12 +123,6 @@ module Fastlane
|
|
|
106
123
|
description: "URL of the server receiving uploaded files",
|
|
107
124
|
default_value: nil,
|
|
108
125
|
optional: true),
|
|
109
|
-
FastlaneCore::ConfigItem.new(key: :symbol_maps_path,
|
|
110
|
-
env_name: "BUGSNAG_SYMBOL_MAPS_PATH",
|
|
111
|
-
description: "Path to the BCSymbolMaps directory to build complete dSYM files",
|
|
112
|
-
default_value: nil,
|
|
113
|
-
optional: true,
|
|
114
|
-
verify_block: validate_symbol_maps),
|
|
115
126
|
FastlaneCore::ConfigItem.new(key: :project_root,
|
|
116
127
|
env_name: "BUGSNAG_PROJECT_ROOT",
|
|
117
128
|
description: "Root path of the project",
|
|
@@ -129,11 +140,55 @@ module Fastlane
|
|
|
129
140
|
optional: true,
|
|
130
141
|
default_value: false,
|
|
131
142
|
is_string: false),
|
|
143
|
+
FastlaneCore::ConfigItem.new(key: :dryrun,
|
|
144
|
+
env_name: "BUGSNAG_DRYRUN",
|
|
145
|
+
description: "Performs a dry-run of the command without sending any information to BugSnag",
|
|
146
|
+
optional: true,
|
|
147
|
+
default_value: false,
|
|
148
|
+
is_string: false),
|
|
149
|
+
FastlaneCore::ConfigItem.new(key: :log_level,
|
|
150
|
+
env_name: "BUGSNAG_LOG_LEVEL",
|
|
151
|
+
description: "Sets the level of logging to debug, info, warn or fatal",
|
|
152
|
+
optional: true),
|
|
153
|
+
FastlaneCore::ConfigItem.new(key: :port,
|
|
154
|
+
env_name: "BUGSNAG_PORT",
|
|
155
|
+
description: "The port number for the BugSnag upload server",
|
|
156
|
+
optional: true,
|
|
157
|
+
is_string: false),
|
|
158
|
+
FastlaneCore::ConfigItem.new(key: :retries,
|
|
159
|
+
env_name: "BUGSNAG_RETRIES",
|
|
160
|
+
description: "The number of retry attempts before failing an upload request",
|
|
161
|
+
optional: true,
|
|
162
|
+
is_string: false),
|
|
163
|
+
FastlaneCore::ConfigItem.new(key: :timeout,
|
|
164
|
+
env_name: "BUGSNAG_TIMEOUT",
|
|
165
|
+
description: "The number of seconds to wait before failing an upload request",
|
|
166
|
+
optional: true,
|
|
167
|
+
is_string: false),
|
|
168
|
+
FastlaneCore::ConfigItem.new(key: :configuration,
|
|
169
|
+
env_name: "BUGSNAG_CONFIGURATION",
|
|
170
|
+
description: "The configuration used to build the application",
|
|
171
|
+
optional: true),
|
|
172
|
+
FastlaneCore::ConfigItem.new(key: :scheme,
|
|
173
|
+
env_name: "BUGSNAG_SCHEME",
|
|
174
|
+
description: "The name of the Xcode options.Scheme used to build the application",
|
|
175
|
+
optional: true),
|
|
132
176
|
FastlaneCore::ConfigItem.new(key: :config_file,
|
|
133
177
|
env_name: "BUGSNAG_CONFIG_FILE",
|
|
134
178
|
description: "Info.plist location",
|
|
135
179
|
optional: true,
|
|
136
|
-
default_value: FindInfoPlist.default_info_plist_path)
|
|
180
|
+
default_value: FindInfoPlist.default_info_plist_path),
|
|
181
|
+
FastlaneCore::ConfigItem.new(key: :xcode_project,
|
|
182
|
+
env_name: "BUGSNAG_XCODE_PROJECT",
|
|
183
|
+
description: "The path to an Xcode project, workspace or containing directory from which to obtain build information",
|
|
184
|
+
optional: true),
|
|
185
|
+
FastlaneCore::ConfigItem.new(key: :bugsnag_cli_path,
|
|
186
|
+
env_name: "BUGSNAG_CLI_PATH",
|
|
187
|
+
description: "Path to your bugsnag-cli",
|
|
188
|
+
optional: true,
|
|
189
|
+
verify_block: proc do |value|
|
|
190
|
+
UI.user_error! "'#{value}' is not executable" unless FastlaneCore::Helper.executable?(value)
|
|
191
|
+
end)
|
|
137
192
|
]
|
|
138
193
|
end
|
|
139
194
|
|
|
@@ -154,17 +209,7 @@ module Fastlane
|
|
|
154
209
|
}
|
|
155
210
|
end
|
|
156
211
|
|
|
157
|
-
|
|
158
|
-
args = [verbose ? "--verbose" : "--silent"]
|
|
159
|
-
args += ["--ignore-missing-dwarf"] if ignore_missing_dwarf
|
|
160
|
-
args += ["--ignore-empty-dsym"] if ignore_empty_dsym
|
|
161
|
-
args += ["--api-key", api_key] unless api_key.nil?
|
|
162
|
-
args += ["--upload-server", upload_url] unless upload_url.nil?
|
|
163
|
-
args += ["--symbol-maps", symbol_maps_dir] unless symbol_maps_dir.nil?
|
|
164
|
-
args += ["--project-root", project_root] unless project_root.nil?
|
|
165
|
-
args << dir
|
|
166
|
-
args
|
|
167
|
-
end
|
|
212
|
+
|
|
168
213
|
|
|
169
214
|
# returns an array of unique dSYM-containing directory paths to upload
|
|
170
215
|
def self.parse_dsym_paths dsym_path
|
|
@@ -207,4 +252,4 @@ module Fastlane
|
|
|
207
252
|
end
|
|
208
253
|
end
|
|
209
254
|
end
|
|
210
|
-
end
|
|
255
|
+
end
|