fastlane-plugin-android_emulator 1.2.0 → 1.2.1
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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: beb865e27d0b2be0c355ddba749cc7097993f89bfae2804f6c99151eed0f013c
|
4
|
+
data.tar.gz: 9ec7938d8ccc8846b5b3404412105207c772d03151082286e3a82a7f6ab2f182
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ca1b197134b7bea5b817bc47678099579d4d1eb63a7aeb559cacf3546dbdb6d66029c9f0ff474ddbc363b9f50833812408d3eeb36a08be8076cfcd59df179805
|
7
|
+
data.tar.gz: 376f98f5022bc8e3194f8a6be1064dc3f100def542cc99e94f0521f0fe7788ded3ba0653e3d30e28faa3ae361893a70d4f2d77634cc45c048e1402998bb05246
|
data/README.md
CHANGED
@@ -16,12 +16,12 @@ Creates and starts a new Android Emulator (AVD)
|
|
16
16
|
|
17
17
|
With additional features:
|
18
18
|
|
19
|
-
|
20
|
-
|
19
|
+
- set location
|
20
|
+
- set demo-mode (great for Screengrab 😀)
|
21
21
|
|
22
22
|
## Example
|
23
23
|
|
24
|
-
**Available Options:** sdk_dir, package, name, device, port, location, demo_mode, cold_boot
|
24
|
+
**Available Options:** sdk_dir, package, name, device, port, location, demo_mode, cold_boot, additional_options
|
25
25
|
|
26
26
|
```ruby
|
27
27
|
android_emulator(
|
@@ -30,12 +30,14 @@ android_emulator(
|
|
30
30
|
demo_mode: true,
|
31
31
|
sdk_dir: "PATH_TO_SDK",
|
32
32
|
device: "Nexus 5",
|
33
|
-
cold_boot: false
|
33
|
+
cold_boot: false,
|
34
|
+
additional_options: [
|
35
|
+
"key=value"
|
36
|
+
]
|
34
37
|
)
|
35
38
|
```
|
36
39
|
|
37
|
-
Or you can use it with our [Android SDK Update Plugin](https://github.com/NovaTecConsulting/fastlane-plugin-android_sdk_update)
|
38
|
-
|
40
|
+
Or you can use it with our [Android SDK Update Plugin](https://github.com/NovaTecConsulting/fastlane-plugin-android_sdk_update)
|
39
41
|
|
40
42
|
```ruby
|
41
43
|
ENV["AVD_PACKAGE"] = "system-images;android-24;google_apis;x86_64"
|
@@ -62,6 +64,7 @@ rake
|
|
62
64
|
```
|
63
65
|
|
64
66
|
To automatically fix many of the styling issues, use
|
67
|
+
|
65
68
|
```
|
66
69
|
rubocop -a
|
67
70
|
```
|
@@ -4,9 +4,13 @@ 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)
|
7
|
+
def self.avd_active(params, config_file)
|
8
8
|
image = params[:package].gsub(";", "/")
|
9
|
-
|
9
|
+
if File.exist?(config_file)
|
10
|
+
return File.readlines(config_file).grep(/#{image}/).size > 0
|
11
|
+
else
|
12
|
+
return false
|
13
|
+
end
|
10
14
|
end
|
11
15
|
|
12
16
|
def self.run(params)
|
@@ -18,21 +22,41 @@ module Fastlane
|
|
18
22
|
system("#{adb} emu kill > /dev/null 2>&1 &")
|
19
23
|
sleep(3)
|
20
24
|
|
21
|
-
|
25
|
+
config_file = "#{Dir.home}/.android/avd/#{params[:name]}.avd/config.ini"
|
26
|
+
|
27
|
+
if !avd_active(params, config_file) || params[:cold_boot]
|
22
28
|
UI.message("Creating new emulator")
|
23
29
|
FastlaneCore::CommandExecutor.execute(
|
24
|
-
command: "#{sdk_dir}/tools/bin/avdmanager create avd -n '#{params[:name]}' -f -k '#{params[:package]}' -d '#{params[:device]}'",
|
30
|
+
command: "#{sdk_dir}/cmdline-tools/latest/bin/avdmanager create avd -n '#{params[:name]}' -f -k '#{params[:package]}' -d '#{params[:device]}'",
|
25
31
|
print_all: true,
|
26
|
-
print_command:
|
32
|
+
print_command: true
|
27
33
|
)
|
28
34
|
|
35
|
+
configuration = {}
|
36
|
+
File.readlines(config_file).each do |definition|
|
37
|
+
key, value = definition.split("=")
|
38
|
+
configuration[key.strip] = value.strip
|
39
|
+
end
|
40
|
+
|
29
41
|
UI.message("Override configuration")
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
42
|
+
additional = {
|
43
|
+
"hw.gpu.mode" => "auto",
|
44
|
+
"hw.gpu.enabled" => "yes",
|
45
|
+
"skin.dynamic" => "yes",
|
46
|
+
"skin.name" => "1080x1920"
|
35
47
|
}
|
48
|
+
|
49
|
+
if params[:additional_options]
|
50
|
+
params[:additional_options].each do |option|
|
51
|
+
key, value = option.split("=")
|
52
|
+
additional[key.strip] = value.strip
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
configuration = configuration.merge(additional)
|
57
|
+
open(config_file, 'w') do |f|
|
58
|
+
configuration.each { |key, value| f << "#{key.strip}=#{value.strip}\n" }
|
59
|
+
end
|
36
60
|
end
|
37
61
|
|
38
62
|
# Verify HAXM installed on mac
|
@@ -46,7 +70,7 @@ module Fastlane
|
|
46
70
|
system("LC_NUMERIC=C; #{sdk_dir}/emulator/emulator @#{params[:name]} -port #{port} > /dev/null 2>&1 &")
|
47
71
|
sh("#{adb} -e wait-for-device")
|
48
72
|
|
49
|
-
until Actions.sh("#{adb} -e shell getprop dev.bootcomplete", log: false).strip == "1"
|
73
|
+
until Actions.sh("#{adb} -e shell getprop dev.bootcomplete", log: false).strip == "1"
|
50
74
|
sleep(5)
|
51
75
|
end
|
52
76
|
|
@@ -78,7 +102,8 @@ module Fastlane
|
|
78
102
|
location: "9.1808 48.7771",
|
79
103
|
package: "system-images;android-24;google_apis;x86_64",
|
80
104
|
demo_mode: true,
|
81
|
-
sdk_dir: "PATH_TO_SDK"
|
105
|
+
sdk_dir: "PATH_TO_SDK",
|
106
|
+
additional_options: []
|
82
107
|
)'
|
83
108
|
]
|
84
109
|
end
|
@@ -114,7 +139,7 @@ module Fastlane
|
|
114
139
|
optional: false),
|
115
140
|
FastlaneCore::ConfigItem.new(key: :location,
|
116
141
|
env_name: "AVD_LOCATION",
|
117
|
-
description: "Set location of the
|
142
|
+
description: "Set location of the emulator '<longitude> <latitude>'",
|
118
143
|
optional: true),
|
119
144
|
FastlaneCore::ConfigItem.new(key: :demo_mode,
|
120
145
|
env_name: "AVD_DEMO_MODE",
|
@@ -125,7 +150,14 @@ module Fastlane
|
|
125
150
|
env_name: "AVD_COLD_BOOT",
|
126
151
|
description: "Create a new AVD every run",
|
127
152
|
is_string: false,
|
128
|
-
default_value: false)
|
153
|
+
default_value: false),
|
154
|
+
FastlaneCore::ConfigItem.new(key: :additional_options,
|
155
|
+
env_name: "AVD_ADDITIONAL_OPTIONS",
|
156
|
+
description: "Set additional options of the emulation",
|
157
|
+
type: Array,
|
158
|
+
is_string: false,
|
159
|
+
optional: true)
|
160
|
+
|
129
161
|
]
|
130
162
|
end
|
131
163
|
|
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.2.
|
4
|
+
version: 1.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Ruhl
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-08-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pry
|