fastlane-plugin-waldo 1.3.0 → 1.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 1ed8c04c2045ecc72f5bae2886d924aa267dbf01
4
- data.tar.gz: 56f47c14e035e955ca002a891648d4a96cfc1596
2
+ SHA256:
3
+ metadata.gz: c63c5e44aa13f38c39db0a944c6ac663ed82b1c568c839cee17563e5d0f659d2
4
+ data.tar.gz: 1874dcff9398d14a9cd6b0587fc2e1a3bd129c49bdbf228fb9ee9a3a7d444f39
5
5
  SHA512:
6
- metadata.gz: 9507565edfe335c48757bc2283057b7a5235e0cf712c94fd5e70d4fd26ad3ba3f9ee8c13fcbad1126cc8c29ca178e6a188ce27d5ea85ce0fe569fba7cc6efb07
7
- data.tar.gz: 5a07ca19ae171dddb902bfb96677c40fa0b00ab5a42b201529d89c3708d6328689105db90a081e033daf0b1fe19ddbd466a78409169cbd54eb377a66459a4f9c
6
+ metadata.gz: cbcbbf1b372bfcdaefcce1c1b211f0bbfa8e0142780abe73a7863006356e321ec18b7b22778a6a82effa4a2f59963c233cc8ba6b08fd8707370bab77b508adc4
7
+ data.tar.gz: 38fb3a7fb99ca9572cf7a573cd85abe0179e7b21b126e4c23958929d903ed21e83c72527d4859fc51a1feb126b367dc7ce1bc7a2df7d945fc5b6044a2e8d51f0
@@ -10,6 +10,7 @@ module Fastlane
10
10
  title: "Summary for waldo #{Fastlane::Waldo::VERSION.to_s}")
11
11
 
12
12
  Helper::WaldoHelper.upload_build
13
+ Helper::WaldoHelper.upload_symbols
13
14
  end
14
15
 
15
16
  def self.authors
@@ -22,6 +23,8 @@ module Fastlane
22
23
  apk_path_default = Dir["*.apk"].last || Dir[File.join('app', 'build', 'outputs', 'apk', 'app-release.apk')].last
23
24
  when :ios
24
25
  app_path_default = Dir["*.app"].sort_by { |x| File.mtime(x) }.last
26
+ # No default dsym_path for now; user must specify it explicitly:
27
+ # dsym_path_default = (Dir["./**/*.dSYM"] + Dir["./**/*.dSYM.zip"]).sort_by { |x| File.mtime(x) }.last
25
28
  ipa_path_default = Dir["*.ipa"].sort_by { |x| File.mtime(x) }.last
26
29
  end
27
30
 
@@ -39,6 +42,14 @@ module Fastlane
39
42
  default_value: Actions.lane_context[Actions::SharedValues::IPA_OUTPUT_PATH] || ipa_path_default,
40
43
  default_value_dynamic: true,
41
44
  optional: true),
45
+ FastlaneCore::ConfigItem.new(key: :dsym_path,
46
+ env_name: 'WALDO_DSYM_PATH',
47
+ # No default dsym_path for now; user must specify it explicitly:
48
+ description: 'Path to your dSYM file(s)',
49
+ # description: 'Path to your dSYM file(s) (optional if you use the _gym_ or _xcodebuild_ action)',
50
+ # default_value: Actions.lane_context[Actions::SharedValues::DSYM_OUTPUT_PATH] || dsym_path_default,
51
+ # default_value_dynamic: true,
52
+ optional: true),
42
53
  # Android-specific
43
54
  FastlaneCore::ConfigItem.new(key: :apk_path,
44
55
  env_name: 'WALDO_APK_PATH',
@@ -1,4 +1,5 @@
1
1
  require 'base64'
2
+ require 'json'
2
3
  require 'net/http'
3
4
 
4
5
  module Fastlane
@@ -48,12 +49,14 @@ module Fastlane
48
49
 
49
50
  apk_path = in_params[:apk_path]
50
51
  app_path = in_params[:app_path]
52
+ dsym_path = in_params[:dsym_path]
51
53
  ipa_path = in_params[:ipa_path]
52
54
  upload_token = in_params[:upload_token]
53
55
  variant_name = in_params[:variant_name]
54
56
 
55
57
  apk_path.gsub!("\\ ", ' ') if apk_path
56
58
  app_path.gsub!("\\ ", ' ') if app_path
59
+ dsym_path.gsub!("\\ ", ' ') if dsym_path
57
60
  ipa_path.gsub!("\\ ", ' ') if ipa_path
58
61
 
59
62
  out_params[:apk_path] = apk_path if apk_path
@@ -73,6 +76,7 @@ module Fastlane
73
76
  out_params[:ipa_path] = ipa_path if ipa_path
74
77
  end
75
78
 
79
+ out_params[:dsym_path] = dsym_path if dsym_path && (app_path || ipa_path)
76
80
  out_params[:upload_token] = upload_token if upload_token && !upload_token.empty?
77
81
  out_params[:variant_name] = variant_name if variant_name
78
82
 
@@ -246,6 +250,43 @@ module Fastlane
246
250
  URI(uri_string)
247
251
  end
248
252
 
253
+ def self.make_symbols_request(uri)
254
+ if File.file?(@dsym_path)
255
+ body_path = @dsym_path
256
+ else
257
+ dsym_basename = File.basename(@dsym_path)
258
+ dsym_dirname = File.dirname(@dsym_path)
259
+
260
+ body_path = File.join(Dir.tmpdir, "#{dsym_basename}.zip")
261
+
262
+ unless zip(src_path: dsym_basename,
263
+ zip_path: body_path,
264
+ cd_path: dsym_dirname)
265
+ return nil
266
+ end
267
+ end
268
+
269
+ request = Net::HTTP::Post.new(uri.request_uri)
270
+
271
+ request['Authorization'] = get_authorization
272
+ request['Transfer-Encoding'] = 'chunked'
273
+ request['User-Agent'] = get_user_agent
274
+
275
+ request.body_stream = WaldoReadIO.new(body_path)
276
+ request.content_type = 'application/zip'
277
+
278
+ request
279
+ end
280
+
281
+ def self.make_symbols_uri
282
+ uri_string = 'https://api.waldo.io/versions/'
283
+
284
+ uri_string += @build_upload_id
285
+ uri_string += '/symbols'
286
+
287
+ URI(uri_string)
288
+ end
289
+
249
290
  def self.parse_build_response(response)
250
291
  dump_response(response) if FastlaneCore::Globals.verbose?
251
292
 
@@ -257,6 +298,10 @@ module Fastlane
257
298
  else
258
299
  handle_error("Build failed to upload to Waldo: #{response.code} #{response.message}")
259
300
  end
301
+
302
+ result = JSON.parse(response.body)
303
+
304
+ @build_upload_id = result["id"]
260
305
  end
261
306
 
262
307
  def self.parse_error_response(response)
@@ -272,6 +317,19 @@ module Fastlane
272
317
  end
273
318
  end
274
319
 
320
+ def self.parse_symbols_response(response)
321
+ dump_response(response) if FastlaneCore::Globals.verbose?
322
+
323
+ case response.code.to_i
324
+ when 200..299
325
+ UI.success('Symbols successfully uploaded to Waldo!')
326
+ when 401
327
+ UI.error('Token is invalid or missing for symbols upload to Waldo!')
328
+ else
329
+ UI.error("Symbols failed to upload to Waldo: #{response.code} #{response.message}")
330
+ end
331
+ end
332
+
275
333
  def self.upload_build
276
334
  begin
277
335
  @variant_name ||= Actions.lane_context[Actions::SharedValues::GRADLE_BUILD_TYPE]
@@ -282,12 +340,12 @@ module Fastlane
282
340
 
283
341
  return unless request
284
342
 
285
- UI.success('Uploading the build to Waldo. This could take a while…')
343
+ UI.success('Uploading build to Waldo')
286
344
 
287
345
  dump_request(request) if FastlaneCore::Globals.verbose?
288
346
 
289
347
  Net::HTTP.start(uri.host, uri.port, :use_ssl => true) do |http|
290
- http.read_timeout = 120 # 2 minutes
348
+ http.read_timeout = 120 # 2 minutes
291
349
 
292
350
  parse_build_response(http.request(request))
293
351
  end
@@ -306,7 +364,7 @@ module Fastlane
306
364
 
307
365
  request = make_error_request(uri, message)
308
366
 
309
- UI.error('Uploading error report to Waldo')
367
+ UI.error('Uploading error report to Waldo')
310
368
 
311
369
  dump_request(request) if FastlaneCore::Globals.verbose?
312
370
 
@@ -322,9 +380,38 @@ module Fastlane
322
380
  end
323
381
  end
324
382
 
383
+ def self.upload_symbols
384
+ begin
385
+ return unless @dsym_path
386
+
387
+ uri = make_symbols_uri
388
+
389
+ request = make_symbols_request(uri)
390
+
391
+ return unless request
392
+
393
+ UI.success('Uploading symbols to Waldo')
394
+
395
+ dump_request(request) if FastlaneCore::Globals.verbose?
396
+
397
+ Net::HTTP.start(uri.host, uri.port, :use_ssl => true) do |http|
398
+ http.read_timeout = 120 # 2 minutes
399
+
400
+ parse_symbols_response(http.request(request))
401
+ end
402
+ rescue Net::ReadTimeout => exc
403
+ handle_error('Symbols upload to Waldo timed out!')
404
+ rescue => exc
405
+ handle_error("Something went wrong uploading symbols to Waldo: #{exc.inspect.to_s}")
406
+ ensure
407
+ request.body_stream.close if request && request.body_stream
408
+ end
409
+ end
410
+
325
411
  def self.validate_parameters(params)
326
412
  @apk_path = params[:apk_path]
327
413
  @app_path = params[:app_path]
414
+ @dsym_path = params[:dsym_path]
328
415
  @ipa_path = params[:ipa_path]
329
416
  @upload_token = params[:upload_token]
330
417
  @variant_name = params[:variant_name]
@@ -386,6 +473,20 @@ module Fastlane
386
473
  return false
387
474
  end
388
475
  end
476
+
477
+ if @dsym_path
478
+ unless File.exist?(@dsym_path)
479
+ handle_error("Unable to find symbols at path '#{@dsym_path.to_s}'")
480
+
481
+ return false
482
+ end
483
+
484
+ unless (File.directory?(@dsym_path) || File.file?(@dsym_path)) && File.readable?(@dsym_path)
485
+ handle_error("Unable to read symbols at path '#{@dsym_path.to_s}'")
486
+
487
+ return false
488
+ end
489
+ end
389
490
  else
390
491
  handle_error("Unsupported platform: '#{get_platform.to_s}'")
391
492
 
@@ -416,7 +517,7 @@ module Fastlane
416
517
  puts "#{cmd} => #{result}" if FastlaneCore::Globals.verbose?
417
518
 
418
519
  unless result.empty?
419
- handle_error("Unable to zip app at path '#{src_path.to_s}' into '#{zip_path.to_s}'")
520
+ handle_error("Unable to zip folder at path '#{src_path.to_s}' into '#{zip_path.to_s}'")
420
521
 
421
522
  return false
422
523
  end
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module Waldo
3
- VERSION = "1.3.0"
3
+ VERSION = "1.5.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-waldo
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - J. G. Pusey
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-08-05 00:00:00.000000000 Z
11
+ date: 2020-04-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -97,8 +97,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
97
97
  - !ruby/object:Gem::Version
98
98
  version: '0'
99
99
  requirements: []
100
- rubyforge_project:
101
- rubygems_version: 2.5.2.3
100
+ rubygems_version: 3.0.6
102
101
  signing_key:
103
102
  specification_version: 4
104
103
  summary: Upload build to Waldo