fastlane-plugin-automated_test_emulator_run 1.3.2 → 1.4.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
2
  SHA1:
3
- metadata.gz: 4efe1400bac26d1735995b06154b3346abffb700
4
- data.tar.gz: fbd8571537739c15d7d6d68882966f51e51b0b0d
3
+ metadata.gz: 2b032b461fca83d22afe6d7d6719ba99e7105609
4
+ data.tar.gz: 50564704edf446c44eb40fac017886523cd7666e
5
5
  SHA512:
6
- metadata.gz: 86e0d37ccc35d80c396a5e4bea8b5f16d1bbafbbc2daafd1849746de37197a1a94df13df19802ef388518d0364b47efd6381e5238f807c1647e8869e105eb243
7
- data.tar.gz: 59175c009d68a99b117508782ab199ebe699df48cb8a91d606274cfe5dc4d7d3f3448d04080ab0c7310d517265bce3db80e5fc2632dfbe77f0403c272178109b
6
+ metadata.gz: 7fad381af5c445a754553460e24bf37c90fab34ca31a7a2b8e2952c033e8f7eb9c0ba6094c8f2d6086aa275ab4c8ae8a5745c6ef971d91960a9a4adee33a4bfc
7
+ data.tar.gz: 623bb718b4f2768594ef20d673197ba2834500867c608fc91bfd8318b38b80f3a4ddb5aa325012e6cc4a1e19101aa19c42778764f2cb7fc9facea53146aad7a0
@@ -48,7 +48,7 @@ module Fastlane
48
48
 
49
49
  for i in 0...avd_schemes.length
50
50
  unless devices.match(avd_schemes[i].avd_name).nil?
51
- UI.message(["AVD with name '", avd_schemes[i].avd_name, " 'currently exists."].join("").yellow)
51
+ UI.message(["AVD with name '", avd_schemes[i].avd_name, "' currently exists."].join("").yellow)
52
52
  if params[:AVD_recreate_new]
53
53
  # Delete existing AVDs
54
54
  UI.message("AVD_create_new parameter set to true.".yellow)
@@ -192,8 +192,9 @@ module Fastlane
192
192
 
193
193
  def self.wait_for_emulator_boot_by_adb(adb_controller, avd_schemes, timeout)
194
194
  timeoutInSeconds= timeout.to_i
195
+ interval = 1000 * 10
195
196
  startTime = Time.now
196
-
197
+ lastCheckTime = Time.now
197
198
  launch_status_hash = Hash.new
198
199
  device_visibility_hash = Hash.new
199
200
 
@@ -206,37 +207,55 @@ module Fastlane
206
207
  launch_status = false
207
208
  loop do
208
209
  currentTime = Time.now
209
- devices = Action.sh(adb_controller.command_get_devices)
210
+ if ((currentTime - lastCheckTime) * 1000) > interval
211
+ lastCheckTime = currentTime
212
+ devices = Action.sh(adb_controller.command_get_devices)
213
+
214
+ # Check if device is visible
215
+ all_devices_visible = true
216
+ device_visibility_hash.each do |name, is_visible|
217
+ unless (devices.match(name).nil? || is_visible)
218
+ device_visibility_hash[name] = true
219
+ end
220
+ all_devices_visible = false unless is_visible
221
+ end
210
222
 
211
- # Check if device is visible
212
- all_devices_visible = true
213
- device_visibility_hash.each do |name, is_visible|
214
- unless (devices.match(name).nil? || is_visible)
215
- device_visibility_hash[name] = true
223
+ # Check for unauthorized statuses and break further check if any found - WORKAROUND (temporary I hope...)
224
+ any_of_devices_unauthorized = devices.include?("unauthorized")
225
+ if any_of_devices_unauthorized
226
+ UI.message(["This seems to be bug of recent Build Tools 25.0.2. Device is launched but ADB status froze with value 'unauthorized'."].join("").red)
227
+ UI.message(["Unfortunately to workaround this, ADB server has to be restarted - in order to update device statuses. We hope it can be fixed soon. More info at:"].join("").red)
228
+ UI.message(["https://github.com/AzimoLabs/fastlane-plugin-automated-test-emulator-run/issues/8"].join("").yellow)
229
+
230
+ # Restart ADB
231
+ UI.message("Restarting adb".yellow)
232
+ Action.sh(adb_controller.command_stop)
233
+ Action.sh(adb_controller.command_start)
234
+ next
216
235
  end
217
- all_devices_visible = false unless is_visible
218
- end
219
236
 
220
- # Check if device is booted
221
- all_devices_booted = true
222
- launch_status_hash.each do |name, is_booted|
223
- unless (devices.match(name + " device").nil? || is_booted)
224
- launch_status_hash[name] = true
237
+ # Check if device is booted
238
+ all_devices_booted = true
239
+ launch_status_hash.each do |name, is_booted|
240
+ unless (devices.match(name + " device").nil? || is_booted)
241
+ launch_status_hash[name] = true
242
+ end
243
+ all_devices_booted = false unless launch_status_hash[name]
225
244
  end
226
- all_devices_booted = false unless is_booted
227
- end
228
245
 
229
- if ((currentTime - startTime) >= timeoutInSeconds)
230
- UI.message(["AVD ADB loading took more than ", timeout, ". Attempting to re-launch."].join("").red)
231
- launch_status = false
232
- break
233
- end
246
+ # Quit if timout reached
247
+ if ((currentTime - startTime) >= timeoutInSeconds)
248
+ UI.message(["AVD ADB loading took more than ", timeout, ". Attempting to re-launch."].join("").red)
249
+ launch_status = false
250
+ break
251
+ end
234
252
 
235
- if (all_devices_booted && all_devices_visible)
236
- launch_status = true
237
- break
253
+ # Quit if all devices booted
254
+ if (all_devices_booted && all_devices_visible)
255
+ launch_status = true
256
+ break
257
+ end
238
258
  end
239
- sleep(10)
240
259
  end
241
260
  return launch_status
242
261
  end
@@ -272,7 +291,7 @@ module Fastlane
272
291
  FastlaneCore::ConfigItem.new(key: :AVD_path,
273
292
  env_name: "AVD_PATH",
274
293
  description: "The path to your android AVD directory (root). ANDROID_SDK_HOME by default",
275
- default_value: ENV['ANDROID_SDK_HOME'],
294
+ default_value: (ENV['ANDROID_SDK_HOME'].nil? or ENV['ANDROID_SDK_HOME'].eql?("")) ? "~/.android/avd" : ENV['ANDROID_SDK_HOME'],
276
295
  is_string: true,
277
296
  optional: true),
278
297
  FastlaneCore::ConfigItem.new(key: :AVD_setup_path,
@@ -12,7 +12,7 @@ module Fastlane
12
12
 
13
13
  # Get paths
14
14
  path_sdk = "#{params[:SDK_path]}"
15
- path_android_binary = path_sdk + "/tools/android"
15
+ path_avdmanager_binary = path_sdk + "/tools/bin/avdmanager"
16
16
  path_adb = path_sdk + "/platform-tools/adb"
17
17
 
18
18
  # ADB shell command parts
@@ -45,7 +45,7 @@ module Fastlane
45
45
  ].join(" ")
46
46
 
47
47
  adb_controller.command_get_avds = [
48
- path_android_binary,
48
+ path_avdmanager_binary,
49
49
  sh_list_avd_adb].join(" ").chomp
50
50
 
51
51
  return adb_controller
@@ -19,7 +19,7 @@ module Fastlane
19
19
 
20
20
  # Get paths
21
21
  path_sdk = "#{params[:SDK_path]}"
22
- path_android_binary = path_sdk + "/tools/android"
22
+ path_avdmanager_binary = path_sdk + "/tools/bin/avdmanager"
23
23
  path_adb = path_sdk + "/platform-tools/adb"
24
24
  path_avd = "#{params[:AVD_path]}"
25
25
 
@@ -27,13 +27,12 @@ module Fastlane
27
27
  sh_create_answer_no = "echo \"no\" |"
28
28
  sh_create_avd = "create avd"
29
29
  sh_create_avd_name = ["--name \"", avd_scheme.avd_name, "\""].join("")
30
- sh_create_avd_additional_options = avd_scheme.create_avd_additional_options
31
- sh_create_config_loc = "#{path_avd}/#{avd_scheme.avd_name}.avd/config.ini"
30
+ sh_create_avd_package = ["--package \"", avd_scheme.create_avd_package, "\""].join("")
32
31
 
33
- if avd_scheme.create_avd_target.eql? ""
34
- sh_create_avd_target = ""
32
+ if avd_scheme.create_avd_device.eql? ""
33
+ sh_create_avd_device = ""
35
34
  else
36
- sh_create_avd_target = ["--target \"", avd_scheme.create_avd_target, "\""].join("")
35
+ sh_create_avd_device = ["--device \"", avd_scheme.create_avd_device, "\""].join("")
37
36
  end
38
37
 
39
38
  if avd_scheme.create_avd_abi.eql? ""
@@ -41,6 +40,15 @@ module Fastlane
41
40
  else
42
41
  sh_create_avd_abi = ["--abi ", avd_scheme.create_avd_abi].join("")
43
42
  end
43
+
44
+ if avd_scheme.create_avd_tag.eql? ""
45
+ sh_create_avd_tag = ""
46
+ else
47
+ sh_create_avd_tag = ["--tag ", avd_scheme.create_avd_tag].join("")
48
+ end
49
+
50
+ sh_create_avd_additional_options = avd_scheme.create_avd_additional_options
51
+ sh_create_config_loc = "#{path_avd}/#{avd_scheme.avd_name}.avd/config.ini"
44
52
 
45
53
  # Launch AVD shell command parts
46
54
  sh_launch_emulator_binray = [path_sdk, "/tools/", avd_scheme.launch_avd_launch_binary_name].join("")
@@ -66,13 +74,15 @@ module Fastlane
66
74
  # Assemble AVD controller
67
75
  avd_controller = AVD_Controller.new
68
76
  avd_controller.command_create_avd = [
69
- sh_create_answer_no,
70
- path_android_binary,
71
- sh_create_avd,
72
- sh_create_avd_name,
73
- sh_create_avd_target,
74
- sh_create_avd_abi,
75
- sh_create_avd_additional_options].join(" ")
77
+ sh_create_answer_no,
78
+ path_avdmanager_binary,
79
+ sh_create_avd,
80
+ sh_create_avd_name,
81
+ sh_create_avd_package,
82
+ sh_create_avd_device,
83
+ sh_create_avd_tag,
84
+ sh_create_avd_abi,
85
+ sh_create_avd_additional_options].join(" ")
76
86
 
77
87
  avd_controller.output_file = Tempfile.new('emulator_output')
78
88
  avd_output = File.exists?(avd_controller.output_file) ? ["&>", avd_controller.output_file.path, "&"].join("") : "&>/dev/null &"
@@ -86,7 +96,7 @@ module Fastlane
86
96
  avd_output].join(" ")
87
97
 
88
98
  avd_controller.command_delete_avd = [
89
- path_android_binary,
99
+ path_avdmanager_binary,
90
100
  sh_delete_avd].join(" ")
91
101
 
92
102
  if path_avd.nil? || (avd_scheme.create_avd_hardware_config_filepath.eql? "")
@@ -2,7 +2,7 @@ module Fastlane
2
2
  module Provider
3
3
 
4
4
  class AVD_scheme
5
- attr_accessor :avd_name, :create_avd_target, :create_avd_abi, :create_avd_hardware_config_filepath, :create_avd_additional_options,
5
+ attr_accessor :avd_name, :create_avd_package, :create_avd_device, :create_avd_tag, :create_avd_abi, :create_avd_hardware_config_filepath, :create_avd_additional_options,
6
6
  :launch_avd_port, :launch_avd_launch_binary_name, :launch_avd_additional_options, :launch_avd_snapshot_filepath
7
7
  end
8
8
 
@@ -27,10 +27,13 @@ module Fastlane
27
27
 
28
28
  avd_scheme = AVD_scheme.new
29
29
  avd_scheme.avd_name = avd_hash['avd_name']
30
- avd_scheme.create_avd_target = avd_hash['create_avd_target']
30
+
31
+ avd_scheme.create_avd_package = avd_hash['create_avd_package']
32
+ avd_scheme.create_avd_device = avd_hash['create_avd_device']
33
+ avd_scheme.create_avd_tag = avd_hash['create_avd_tag']
31
34
  avd_scheme.create_avd_abi = avd_hash['create_avd_abi']
32
35
  avd_scheme.create_avd_hardware_config_filepath = avd_hash['create_avd_hardware_config_filepath']
33
- avd_scheme.create_avd_additional_options = avd_hash['create_avd_additional_options']
36
+
34
37
  avd_scheme.launch_avd_port = avd_hash['launch_avd_port']
35
38
  avd_scheme.launch_avd_launch_binary_name = avd_hash['launch_avd_launch_binary_name']
36
39
  avd_scheme.launch_avd_additional_options = avd_hash['launch_avd_additional_options']
@@ -130,8 +133,14 @@ module Fastlane
130
133
  if avd_scheme.avd_name.nil?
131
134
  errors.push("avd_name not found")
132
135
  end
133
- if avd_scheme.create_avd_target.nil?
134
- errors.push("create_avd_target not found")
136
+ if avd_scheme.create_avd_package.nil?
137
+ errors.push("create_avd_package not found")
138
+ end
139
+ if avd_scheme.create_avd_device.nil?
140
+ errors.push("create_avd_device not found")
141
+ end
142
+ if avd_scheme.create_avd_tag.nil?
143
+ errors.push("create_avd_tag not found")
135
144
  end
136
145
  if avd_scheme.create_avd_abi.nil?
137
146
  errors.push("create_avd_abi not found")
@@ -139,9 +148,6 @@ module Fastlane
139
148
  if avd_scheme.create_avd_hardware_config_filepath.nil?
140
149
  errors.push("create_avd_hardware_config_filepath not found")
141
150
  end
142
- if avd_scheme.create_avd_additional_options.nil?
143
- errors.push("create_avd_additional_options not found")
144
- end
145
151
  if avd_scheme.launch_avd_snapshot_filepath.nil?
146
152
  errors.push("launch_avd_snapshot_filepath not found")
147
153
  end
@@ -154,7 +160,6 @@ module Fastlane
154
160
  if avd_scheme.launch_avd_additional_options.nil?
155
161
  errors.push("launch_avd_additional_options not found")
156
162
  end
157
-
158
163
  return errors
159
164
  end
160
165
 
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module AutomatedTestEmulatorRun
3
- VERSION = "1.3.2"
3
+ VERSION = "1.4.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-automated_test_emulator_run
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.2
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kamil Krzyk
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-02-28 00:00:00.000000000 Z
11
+ date: 2017-03-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pry