fastlane-plugin-android_emulator 1.1.1 → 1.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 33d637ebe1e7683f11934e24eb2b44f6c54f3d68d7d11de267dfe96430f470cd
4
- data.tar.gz: cf0ea1ba36adc86cb8fcdf6ea7cdc5a9f85dfdd2286a2686661da333e5a8abc6
3
+ metadata.gz: c342be284340d90d3080c8548d3eeeeabb7d0c36f59029f2e8e8e9e762a64dca
4
+ data.tar.gz: 67f0593397dbe0179bbee05734668e3bc1ca38ffd9da6ed1780608c127f93e55
5
5
  SHA512:
6
- metadata.gz: 14967fcd9016c6cff22c1cef79c416f9979014dda18902a0e926ab37de7a663737cd3e288d3b372c3b5a2559dafcc68566bc8eb3a8b6d9fca811771f8b0558ec
7
- data.tar.gz: c1f04d42d410e5ea7359ac3312d5367f9feffa15da1ba8502e6685807ff470efda1b061050e8a44483778e67749bb295a79ce95175d22db40b36ea9a7009d1f0
6
+ metadata.gz: 25a713f0b52b55c5b78342cd3f977b68874e29239c5f6b2686abb9268d353241b3637b6b5e5be254424be7cd7b7556b2d34668f7a0c8168c5c46324aa4656796
7
+ data.tar.gz: 7385cc4e351984156f4f14f98b0e899f9a255345c56605f73e65d10260120e0ee911cc0124a1bb0a0242c35c182a9b4915a86c08f41034394679da40e144da4c
data/README.md CHANGED
@@ -21,7 +21,7 @@ With additional features:
21
21
 
22
22
  ## Example
23
23
 
24
- **Available Options:** sdk_dir, package, name, device, port, location, demo_mode
24
+ **Available Options:** sdk_dir, package, name, device, port, location, demo_mode, cold_boot
25
25
 
26
26
  ```ruby
27
27
  android_emulator(
@@ -29,7 +29,8 @@ android_emulator(
29
29
  package: "system-images;android-24;google_apis;x86_64",
30
30
  demo_mode: true,
31
31
  sdk_dir: "PATH_TO_SDK",
32
- device: "Nexus 5"
32
+ device: "Nexus 5",
33
+ cold_boot: false
33
34
  )
34
35
  ```
35
36
 
@@ -4,6 +4,11 @@ require_relative '../helper/android_emulator_helper'
4
4
  module Fastlane
5
5
  module Actions
6
6
  class AndroidEmulatorAction < Action
7
+ def self.avd_active(params)
8
+ image = params[:package].gsub(";", "/")
9
+ return File.readlines("#{Dir.home}/.android/avd/#{params[:name]}.avd/config.ini").grep(/#{image}/).size > 0
10
+ end
11
+
7
12
  def self.run(params)
8
13
  sdk_dir = params[:sdk_dir]
9
14
  port = params[:port]
@@ -11,22 +16,24 @@ module Fastlane
11
16
 
12
17
  UI.message("Stopping emulator")
13
18
  system("#{adb} emu kill > /dev/null 2>&1 &")
14
- sleep(2)
15
-
16
- UI.message("Creating new emulator")
17
- FastlaneCore::CommandExecutor.execute(
18
- command: "#{sdk_dir}/tools/bin/avdmanager create avd -n '#{params[:name]}' -f -k '#{params[:package]}' -d '#{params[:device]}'",
19
- print_all: true,
20
- print_command: false
21
- )
22
-
23
- UI.message("Override configuration")
24
- open("#{Dir.home}/.android/avd/#{params[:name]}.avd/config.ini", 'a') { |f|
25
- f << "hw.gpu.mode=auto\n"
26
- f << "hw.gpu.enabled=yes\n"
27
- f << "skin.dynamic=yes\n"
28
- f << "skin.name=1080x1920\n"
29
- }
19
+ sleep(3)
20
+
21
+ if !avd_active(params) || params[:cold_boot]
22
+ UI.message("Creating new emulator")
23
+ FastlaneCore::CommandExecutor.execute(
24
+ command: "#{sdk_dir}/tools/bin/avdmanager create avd -n '#{params[:name]}' -f -k '#{params[:package]}' -d '#{params[:device]}'",
25
+ print_all: true,
26
+ print_command: false
27
+ )
28
+
29
+ UI.message("Override configuration")
30
+ open("#{Dir.home}/.android/avd/#{params[:name]}.avd/config.ini", 'a') { |f|
31
+ f << "hw.gpu.mode=auto\n"
32
+ f << "hw.gpu.enabled=yes\n"
33
+ f << "skin.dynamic=yes\n"
34
+ f << "skin.name=1080x1920\n"
35
+ }
36
+ end
30
37
 
31
38
  # Verify HAXM installed on mac
32
39
  if FastlaneCore::Helper.mac?
@@ -113,7 +120,12 @@ module Fastlane
113
120
  env_name: "AVD_DEMO_MODE",
114
121
  description: "Set the emulator in demo mode",
115
122
  is_string: false,
116
- default_value: true)
123
+ default_value: true),
124
+ FastlaneCore::ConfigItem.new(key: :cold_boot,
125
+ env_name: "AVD_COLD_BOOT",
126
+ description: "Create a new AVD every run",
127
+ is_string: false,
128
+ default_value: false)
117
129
  ]
118
130
  end
119
131
 
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module AndroidEmulator
3
- VERSION = "1.1.1"
3
+ VERSION = "1.2.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-android_emulator
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Ruhl
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-05-22 00:00:00.000000000 Z
11
+ date: 2021-07-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pry
@@ -136,7 +136,7 @@ dependencies:
136
136
  - - ">="
137
137
  - !ruby/object:Gem::Version
138
138
  version: 2.78.0
139
- description:
139
+ description:
140
140
  email: michael.ruhl@novatec-gmbh.de
141
141
  executables: []
142
142
  extensions: []
@@ -152,7 +152,7 @@ homepage: https://github.com/NovaTecConsulting/fastlane-plugin-android_emulator
152
152
  licenses:
153
153
  - MIT
154
154
  metadata: {}
155
- post_install_message:
155
+ post_install_message:
156
156
  rdoc_options: []
157
157
  require_paths:
158
158
  - lib
@@ -167,8 +167,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
167
167
  - !ruby/object:Gem::Version
168
168
  version: '0'
169
169
  requirements: []
170
- rubygems_version: 3.0.3
171
- signing_key:
170
+ rubygems_version: 3.1.2
171
+ signing_key:
172
172
  specification_version: 4
173
173
  summary: Creates and starts an Android Emulator (AVD)
174
174
  test_files: []