fastlane-plugin-bundletool 1.0.7 → 1.0.8
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: 0df0a840288a7028a5052aba0ab6beede179d3c7f8c8151c89ee5f6223779924
|
4
|
+
data.tar.gz: 472c240a4018e1a22a91f14379944c8ecb764cf65c27792d7e30b966fb083943
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4640820cc8011541892f8979ccc870de5751d4f067d5ed74cfe6219317c09565b85f94b680dbc04b6e7952ef1b908f23792f7d9c04ba023ff2248293965a090d
|
7
|
+
data.tar.gz: 5f9e32338638c28d7210bfbdc2ed100cac55f7ec7d66f6283c8d75e370e005b18bb1d2ad1e0e9d07b2272ce1592c3d038a43fc26822d4a3dd1a72bdabb444c31
|
data/README.md
CHANGED
@@ -13,7 +13,7 @@ fastlane add_plugin bundletool
|
|
13
13
|
or in your Pluginfile under fastlane folder write the following line and run `bundle install`.
|
14
14
|
|
15
15
|
```
|
16
|
-
gem 'fastlane-plugin-bundletool', '1.0.
|
16
|
+
gem 'fastlane-plugin-bundletool', '1.0.8'
|
17
17
|
```
|
18
18
|
|
19
19
|
## About bundletool
|
@@ -37,7 +37,8 @@ bundletool(
|
|
37
37
|
bundletool_version: '1.10.0', # For searching a specific version of bundletool visit https://github.com/google/bundletool/releases
|
38
38
|
aab_path: aab_path,
|
39
39
|
apk_output_path: apk_output_path,
|
40
|
-
verbose: true
|
40
|
+
verbose: true,
|
41
|
+
cache_path: cache_path
|
41
42
|
)
|
42
43
|
```
|
43
44
|
|
@@ -23,12 +23,33 @@ module Fastlane
|
|
23
23
|
download_url = params[:download_url]
|
24
24
|
aab_path = params[:aab_path]
|
25
25
|
output_path = params[:apk_output_path] || '.'
|
26
|
+
cache_path = params[:cache_path]
|
26
27
|
|
27
28
|
return unless validate_aab!(aab_path)
|
28
29
|
|
29
|
-
|
30
|
+
if(cache_path.nil?)
|
31
|
+
installation_path = @bundletool_temp_path
|
32
|
+
else
|
33
|
+
installation_path = Pathname.new(File.expand_path(cache_path)).to_s
|
34
|
+
end
|
35
|
+
|
36
|
+
unless(Dir.exist?(installation_path))
|
37
|
+
Dir.mkdir(installation_path)
|
38
|
+
end
|
39
|
+
|
40
|
+
unless(Dir.exist?(@bundletool_temp_path))
|
41
|
+
Dir.mkdir(@bundletool_temp_path)
|
42
|
+
end
|
43
|
+
|
44
|
+
unless download_url.nil?
|
45
|
+
bundletool_filename = "bundletool_#{id = Digest::SHA256.hexdigest(download_url)}.jar"
|
46
|
+
else
|
47
|
+
bundletool_filename = "bundletool_#{bundletool_version}.jar"
|
48
|
+
end
|
30
49
|
|
31
|
-
|
50
|
+
return unless download_bundletool(bundletool_version, download_url, bundletool_filename, installation_path)
|
51
|
+
|
52
|
+
extract_universal_apk_from(aab_path, output_path, keystore_info, bundletool_filename, installation_path)
|
32
53
|
end
|
33
54
|
|
34
55
|
def self.validate_aab!(aab_path)
|
@@ -41,29 +62,24 @@ module Fastlane
|
|
41
62
|
return true
|
42
63
|
end
|
43
64
|
|
44
|
-
def self.download_bundletool(version, download_url)
|
45
|
-
Dir.mkdir "#{@project_root}/bundletool_temp"
|
46
|
-
|
65
|
+
def self.download_bundletool(version, download_url, bundletool_filename, cache_path)
|
47
66
|
unless download_url.nil?
|
48
|
-
|
49
|
-
puts_message("Downloading bundletool from #{download_url}")
|
50
|
-
download_and_write_bundletool(download_url)
|
67
|
+
download_and_write_bundletool(download_url, bundletool_filename, cache_path)
|
51
68
|
else
|
52
|
-
|
53
|
-
download_and_write_bundletool(
|
54
|
-
end
|
55
|
-
|
56
|
-
true
|
69
|
+
bundletool_url = "https://github.com/google/bundletool/releases/download/#{version}/bundletool-all-#{version}.jar"
|
70
|
+
download_and_write_bundletool(bundletool_url, bundletool_filename, cache_path)
|
71
|
+
end
|
72
|
+
return true
|
57
73
|
rescue OpenURI::HTTPError => e
|
58
74
|
clean_temp!
|
59
75
|
puts_error!("Something went wrong when downloading bundletool version #{version}" + ". \nError message\n #{e.message}")
|
60
|
-
false
|
76
|
+
return false
|
61
77
|
end
|
62
78
|
|
63
|
-
def self.extract_universal_apk_from(aab_path, apk_output_path, keystore_info)
|
79
|
+
def self.extract_universal_apk_from(aab_path, apk_output_path, keystore_info, bundletool_filename, installation_path)
|
64
80
|
aab_absolute_path = Pathname.new(File.expand_path(aab_path)).to_s
|
65
81
|
apk_output_absolute_path = Pathname.new(File.expand_path(apk_output_path)).to_s
|
66
|
-
output_path = run_bundletool!(aab_absolute_path, keystore_info)
|
82
|
+
output_path = run_bundletool!(aab_absolute_path, keystore_info, bundletool_filename, installation_path)
|
67
83
|
prepare_apk!(output_path, apk_output_absolute_path)
|
68
84
|
rescue StandardError => e
|
69
85
|
puts_error!("Bundletool could not extract universal apk from aab at #{aab_absolute_path}. \nError message\n #{e.message}")
|
@@ -71,7 +87,7 @@ module Fastlane
|
|
71
87
|
clean_temp!
|
72
88
|
end
|
73
89
|
|
74
|
-
def self.run_bundletool!(aab_path, keystore_info)
|
90
|
+
def self.run_bundletool!(aab_path, keystore_info, bundletool_filename, installation_path)
|
75
91
|
puts_message("Extracting apk from #{aab_path}...")
|
76
92
|
output_path = "#{@bundletool_temp_path}/output.apks"
|
77
93
|
keystore_params = ''
|
@@ -80,7 +96,7 @@ module Fastlane
|
|
80
96
|
keystore_params = "--ks='#{keystore_info[:keystore_path]}' --ks-pass='pass:#{keystore_info[:keystore_password]}' --ks-key-alias='#{keystore_info[:alias]}' --key-pass='pass:#{keystore_info[:alias_password]}'"
|
81
97
|
end
|
82
98
|
|
83
|
-
cmd = "java -jar #{
|
99
|
+
cmd = "java -jar #{installation_path}/#{bundletool_filename} build-apks --bundle=\"#{aab_path}\" --output=\"#{output_path}\" --mode=universal #{keystore_params}"
|
84
100
|
|
85
101
|
Open3.popen3(cmd) do |_, _, stderr, wait_thr|
|
86
102
|
exit_status = wait_thr.value
|
@@ -184,7 +200,11 @@ module Fastlane
|
|
184
200
|
is_string: false,
|
185
201
|
type: Boolean,
|
186
202
|
optional: true,
|
187
|
-
default_value: false)
|
203
|
+
default_value: false),
|
204
|
+
FastlaneCore::ConfigItem.new(key: :cache_path,
|
205
|
+
description: 'Cache downloaded bundletool binary into the cache path specified',
|
206
|
+
is_string: true,
|
207
|
+
optional: true)
|
188
208
|
|
189
209
|
]
|
190
210
|
end
|
@@ -214,12 +234,21 @@ module Fastlane
|
|
214
234
|
|
215
235
|
private
|
216
236
|
|
217
|
-
def self.download_and_write_bundletool(download_url)
|
237
|
+
def self.download_and_write_bundletool(download_url, bundletool_filename, installation_path)
|
238
|
+
if(File.exist?"#{installation_path}/#{bundletool_filename}")
|
239
|
+
puts_message("Using binary cached at #{installation_path}/#{bundletool_filename}")
|
240
|
+
return
|
241
|
+
end
|
242
|
+
|
243
|
+
puts_message("Downloading bundletool from #{download_url}")
|
244
|
+
|
218
245
|
URI.open(download_url) do |bundletool|
|
219
|
-
File.open("#{
|
246
|
+
File.open("#{installation_path}/#{bundletool_filename}", 'wb') do |file|
|
220
247
|
file.write(bundletool.read)
|
221
248
|
end
|
222
249
|
end
|
250
|
+
|
251
|
+
puts_success('Downloaded bundletool')
|
223
252
|
end
|
224
253
|
end
|
225
254
|
end
|
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.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Martin Gonzalez
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-03-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pry
|