fastlane-plugin-bundletool 1.0.12 → 1.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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 86168114efe411a2131c772024c4bdecc2390f59b16718fba36d5ecf377c17ac
|
4
|
+
data.tar.gz: d4a85823a3cad1f35a443440e33467e9bc85cbe1126e987200550681b927a888
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 284a3920bb14be5e26d51d132571cc993b2ee7576d3ddc08e2f490a70dc555b61cea0926f6ce244bbabf18eec34663200be25bdfa017e05ad414a17991206a87
|
7
|
+
data.tar.gz: 2067707f374e46626374787a95432e8a352a31701a53bb7cb3815325a404b3ef6c4148f61091d3f9d0f4de1d45a8f79ba2ff85c7f186fe4d8565a13e99298891
|
data/README.md
CHANGED
@@ -22,7 +22,7 @@ gem 'fastlane-plugin-bundletool'
|
|
22
22
|
|
23
23
|
https://developer.android.com/studio/command-line/bundletool
|
24
24
|
|
25
|
-
The motivation of this plugin is to extract an universal `.apk`
|
25
|
+
The motivation of this plugin is to extract an universal `.apk` or split `.apks` from an [.aab](https://fileinfo.com/extension/aab) file. Since we cannot distribute aab files, it's great that we can extract from the very same binary a file that we can distribute internally.
|
26
26
|
|
27
27
|
## Usage
|
28
28
|
|
@@ -38,7 +38,8 @@ bundletool(
|
|
38
38
|
aab_path: aab_path,
|
39
39
|
apk_output_path: apk_output_path,
|
40
40
|
verbose: true,
|
41
|
-
cache_path: cache_path
|
41
|
+
cache_path: cache_path,
|
42
|
+
universal_apk: true
|
42
43
|
)
|
43
44
|
```
|
44
45
|
|
@@ -60,6 +61,7 @@ This will output the universal `.apk` in the output path you set.
|
|
60
61
|
| apk_output_path | Path where the apk file is going to be placed | FL_BUNDLETOOL_APK_OUTPUT_PATH | . |
|
61
62
|
| verbose | Show every messages of the action | FL_BUNDLETOOL_VERBOSE | false |
|
62
63
|
| cache_path | Cache downloaded bundletool binary into the cache path | FL_BUNDLETOOL_CACHE_PATH | |
|
64
|
+
| universal_apk | Create universal APK (true) or split APKs (false) | FL_BUNDLETOOL_UNIVERSAL_APK | true |
|
63
65
|
|-----------------------|---------------------------------------------------------|---------------------------------|---------|
|
64
66
|
|
65
67
|
## Use case
|
@@ -25,6 +25,7 @@ module Fastlane
|
|
25
25
|
aab_path = params[:aab_path]
|
26
26
|
output_path = params[:apk_output_path] || '.'
|
27
27
|
cache_path = params[:cache_path]
|
28
|
+
universal_apk = params[:universal_apk]
|
28
29
|
|
29
30
|
return unless validate_aab!(aab_path)
|
30
31
|
|
@@ -50,7 +51,7 @@ module Fastlane
|
|
50
51
|
|
51
52
|
return unless download_bundletool(bundletool_version, download_url, bundletool_filename, installation_path)
|
52
53
|
|
53
|
-
|
54
|
+
extract_apk_from(aab_path, output_path, keystore_info, bundletool_filename, installation_path, universal_apk)
|
54
55
|
end
|
55
56
|
|
56
57
|
def self.validate_aab!(aab_path)
|
@@ -77,18 +78,18 @@ module Fastlane
|
|
77
78
|
return false
|
78
79
|
end
|
79
80
|
|
80
|
-
def self.
|
81
|
+
def self.extract_apk_from(aab_path, apk_output_path, keystore_info, bundletool_filename, installation_path, universal_apk)
|
81
82
|
aab_absolute_path = Pathname.new(File.expand_path(aab_path)).to_s
|
82
83
|
apk_output_absolute_path = Pathname.new(File.expand_path(apk_output_path)).to_s
|
83
|
-
output_path = run_bundletool!(aab_absolute_path, keystore_info, bundletool_filename, installation_path)
|
84
|
-
prepare_apk!(output_path, apk_output_absolute_path)
|
84
|
+
output_path = run_bundletool!(aab_absolute_path, keystore_info, bundletool_filename, installation_path, universal_apk)
|
85
|
+
prepare_apk!(output_path, apk_output_absolute_path, universal_apk)
|
85
86
|
rescue StandardError => e
|
86
87
|
puts_error!("Bundletool could not extract universal apk from aab at #{aab_absolute_path}. \nError message\n #{e.message}")
|
87
88
|
ensure
|
88
89
|
clean_temp!
|
89
90
|
end
|
90
91
|
|
91
|
-
def self.run_bundletool!(aab_path, keystore_info, bundletool_filename, installation_path)
|
92
|
+
def self.run_bundletool!(aab_path, keystore_info, bundletool_filename, installation_path, universal_apk)
|
92
93
|
puts_message("Extracting apk from #{aab_path}...")
|
93
94
|
output_path = "#{@bundletool_temp_path}/output.apks"
|
94
95
|
keystore_params = ''
|
@@ -100,7 +101,9 @@ module Fastlane
|
|
100
101
|
keystore_params = "--ks='#{keystore_info[:keystore_path]}' --ks-pass=#{key_store_password} --ks-key-alias=#{key_alias} --key-pass=#{key_alias_password}"
|
101
102
|
end
|
102
103
|
|
103
|
-
|
104
|
+
universal_apk_param = universal_apk == true ? "--mode=universal" : ""
|
105
|
+
|
106
|
+
cmd = "java -jar #{installation_path}/#{bundletool_filename} build-apks --bundle=\"#{aab_path}\" --output=\"#{output_path}\" #{universal_apk_param} #{keystore_params}"
|
104
107
|
|
105
108
|
Open3.popen3(cmd) do |_, _, stderr, wait_thr|
|
106
109
|
exit_status = wait_thr.value
|
@@ -110,7 +113,7 @@ module Fastlane
|
|
110
113
|
output_path
|
111
114
|
end
|
112
115
|
|
113
|
-
def self.prepare_apk!(output_path, target_path)
|
116
|
+
def self.prepare_apk!(output_path, target_path, universal_apk)
|
114
117
|
puts_message("Preparing apk to #{target_path}...")
|
115
118
|
if File.file?(target_path)
|
116
119
|
puts_important("Apk at path #{target_path} exists. Replacing it.")
|
@@ -121,9 +124,14 @@ module Fastlane
|
|
121
124
|
FileUtils.mkdir_p target_dir_name
|
122
125
|
end
|
123
126
|
|
124
|
-
cmd =
|
125
|
-
|
126
|
-
|
127
|
+
cmd = ''
|
128
|
+
if universal_apk == true
|
129
|
+
cmd = "mv \"#{output_path}\" \"#{@bundletool_temp_path}/output.zip\" &&"\
|
130
|
+
"unzip \"#{@bundletool_temp_path}/output.zip\" -d \"#{@bundletool_temp_path}\" &&"\
|
131
|
+
"mv \"#{@bundletool_temp_path}/universal.apk\" \"#{target_path}\""
|
132
|
+
else
|
133
|
+
cmd = "mv \"#{output_path}\" \"#{target_path}\""
|
134
|
+
end
|
127
135
|
|
128
136
|
Open3.popen3(cmd) do |_, _, stderr, wait_thr|
|
129
137
|
exit_status = wait_thr.value
|
@@ -220,7 +228,14 @@ module Fastlane
|
|
220
228
|
env_name: 'FL_BUNDLETOOL_CACHE_PATH',
|
221
229
|
description: 'Cache downloaded bundletool binary into the cache path specified',
|
222
230
|
is_string: true,
|
223
|
-
optional: true)
|
231
|
+
optional: true),
|
232
|
+
FastlaneCore::ConfigItem.new(key: :universal_apk,
|
233
|
+
env_name: 'FL_BUNDLETOOL_UNIVERSAL_APK',
|
234
|
+
description: 'Create universal APK (true) or split APKs (false)',
|
235
|
+
is_string: false,
|
236
|
+
type: Boolean,
|
237
|
+
optional: true,
|
238
|
+
default_value: true)
|
224
239
|
]
|
225
240
|
end
|
226
241
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fastlane-plugin-bundletool
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Martin Gonzalez
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-01-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pry
|
@@ -150,7 +150,7 @@ dependencies:
|
|
150
150
|
- - "~>"
|
151
151
|
- !ruby/object:Gem::Version
|
152
152
|
version: 0.2.0
|
153
|
-
description:
|
153
|
+
description:
|
154
154
|
email: gonzalez.martin90@gmail.com
|
155
155
|
executables: []
|
156
156
|
extensions: []
|
@@ -167,7 +167,7 @@ homepage: https://github.com/MartinGonzalez/fastlane-plugin-bundletool
|
|
167
167
|
licenses:
|
168
168
|
- MIT
|
169
169
|
metadata: {}
|
170
|
-
post_install_message:
|
170
|
+
post_install_message:
|
171
171
|
rdoc_options: []
|
172
172
|
require_paths:
|
173
173
|
- lib
|
@@ -183,7 +183,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
183
183
|
version: '0'
|
184
184
|
requirements: []
|
185
185
|
rubygems_version: 3.2.3
|
186
|
-
signing_key:
|
186
|
+
signing_key:
|
187
187
|
specification_version: 4
|
188
188
|
summary: Extracts a universal apk from an .aab file
|
189
189
|
test_files: []
|