fastlane-plugin-bundletool 1.0.6 → 1.0.8

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: 767f07f7ad832c2f3fbd48a0042b61164401e17cb7036ec5443d3bf661b84398
4
- data.tar.gz: 8471216a1e08a0d07ce357557b304cdf19cc2e50a19514bdb22bc6dc494102c3
3
+ metadata.gz: 0df0a840288a7028a5052aba0ab6beede179d3c7f8c8151c89ee5f6223779924
4
+ data.tar.gz: 472c240a4018e1a22a91f14379944c8ecb764cf65c27792d7e30b966fb083943
5
5
  SHA512:
6
- metadata.gz: 409b0158b1983b047670cc77ab5da427536d15ccc3073148a685f72b25ec19685913acc1a0aeef7c7caaba0878827e3c6e981e4a145140a6d884c1cd0aa653b3
7
- data.tar.gz: 0d8e1689a07e0369579619d65b0ddaf11f20aa2121bef104990aa2fc4053fea9582eabd396d6131ce6380dfd0300305cf62fd2a9ea4437ae8d39aea9cbfea571
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.4'
16
+ gem 'fastlane-plugin-bundletool', '1.0.8'
17
17
  ```
18
18
 
19
19
  ## About bundletool
@@ -34,10 +34,11 @@ bundletool(
34
34
  ks_password: keystore_password,
35
35
  ks_key_alias: keystore_alias,
36
36
  ks_key_alias_password: keystore_alias_password,
37
- bundletool_version: '0.11.0',
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
- return unless download_bundletool(bundletool_version, download_url)
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
- extract_universal_apk_from(aab_path, output_path, keystore_info)
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)
@@ -38,29 +59,27 @@ module Fastlane
38
59
  return false
39
60
  end
40
61
  puts_success('Checking if .aab file exists')
62
+ return true
41
63
  end
42
64
 
43
- def self.download_bundletool(version, download_url)
44
- Dir.mkdir "#{@project_root}/bundletool_temp"
45
-
65
+ def self.download_bundletool(version, download_url, bundletool_filename, cache_path)
46
66
  unless download_url.nil?
47
- puts_message("Downloading bundletool from #{download_url}")
48
- download_and_write_bundletool(download_url)
67
+ download_and_write_bundletool(download_url, bundletool_filename, cache_path)
49
68
  else
50
- puts_message("Downloading bundletool (#{version}) from https://github.com/google/bundletool/releases/download/#{version}/bundletool-all-#{version}.jar...")
51
- download_and_write_bundletool("https://github.com/google/bundletool/releases/download/#{version}/bundletool-all-#{version}.jar")
52
- end
53
- puts_success('Downloaded bundletool')
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
54
73
  rescue OpenURI::HTTPError => e
55
74
  clean_temp!
56
75
  puts_error!("Something went wrong when downloading bundletool version #{version}" + ". \nError message\n #{e.message}")
57
- false
76
+ return false
58
77
  end
59
78
 
60
- 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)
61
80
  aab_absolute_path = Pathname.new(File.expand_path(aab_path)).to_s
62
81
  apk_output_absolute_path = Pathname.new(File.expand_path(apk_output_path)).to_s
63
- output_path = run_bundletool!(aab_absolute_path, keystore_info)
82
+ output_path = run_bundletool!(aab_absolute_path, keystore_info, bundletool_filename, installation_path)
64
83
  prepare_apk!(output_path, apk_output_absolute_path)
65
84
  rescue StandardError => e
66
85
  puts_error!("Bundletool could not extract universal apk from aab at #{aab_absolute_path}. \nError message\n #{e.message}")
@@ -68,7 +87,7 @@ module Fastlane
68
87
  clean_temp!
69
88
  end
70
89
 
71
- def self.run_bundletool!(aab_path, keystore_info)
90
+ def self.run_bundletool!(aab_path, keystore_info, bundletool_filename, installation_path)
72
91
  puts_message("Extracting apk from #{aab_path}...")
73
92
  output_path = "#{@bundletool_temp_path}/output.apks"
74
93
  keystore_params = ''
@@ -77,7 +96,7 @@ module Fastlane
77
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]}'"
78
97
  end
79
98
 
80
- cmd = "java -jar #{@bundletool_temp_path}/bundletool.jar build-apks --bundle=\"#{aab_path}\" --output=\"#{output_path}\" --mode=universal #{keystore_params}"
99
+ cmd = "java -jar #{installation_path}/#{bundletool_filename} build-apks --bundle=\"#{aab_path}\" --output=\"#{output_path}\" --mode=universal #{keystore_params}"
81
100
 
82
101
  Open3.popen3(cmd) do |_, _, stderr, wait_thr|
83
102
  exit_status = wait_thr.value
@@ -181,7 +200,11 @@ module Fastlane
181
200
  is_string: false,
182
201
  type: Boolean,
183
202
  optional: true,
184
- 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)
185
208
 
186
209
  ]
187
210
  end
@@ -211,12 +234,21 @@ module Fastlane
211
234
 
212
235
  private
213
236
 
214
- 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
+
215
245
  URI.open(download_url) do |bundletool|
216
- File.open("#{@bundletool_temp_path}/bundletool.jar", 'wb') do |file|
246
+ File.open("#{installation_path}/#{bundletool_filename}", 'wb') do |file|
217
247
  file.write(bundletool.read)
218
248
  end
219
249
  end
250
+
251
+ puts_success('Downloaded bundletool')
220
252
  end
221
253
  end
222
254
  end
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module Bundletool
3
- VERSION = "1.0.6"
3
+ VERSION = "1.0.8"
4
4
  end
5
5
  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.6
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: 2022-03-29 00:00:00.000000000 Z
11
+ date: 2023-03-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pry
@@ -168,7 +168,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
168
168
  - !ruby/object:Gem::Version
169
169
  version: '0'
170
170
  requirements: []
171
- rubygems_version: 3.0.3.1
171
+ rubygems_version: 3.1.6
172
172
  signing_key:
173
173
  specification_version: 4
174
174
  summary: Extracts a universal apk from an .aab file