fastlane-plugin-match_keystore 0.1.15 → 0.1.16

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: 87a32db98559102adaf6fd2b1d7da31143fe593fa0ed170865a1da8b3ef5d4d8
4
- data.tar.gz: 4c3b0130a705055ad7d9e6c51f8ac1a19c2a4a2df96ddca7011d72275487bb89
3
+ metadata.gz: aaedb3d25e8614b96c43af4e88ddbc46f56e71a7a97a92d2336507afc3afded8
4
+ data.tar.gz: 741fc33e956879046126da3fec54cb6f939b34eb8859e22d27244de8a7e6f823
5
5
  SHA512:
6
- metadata.gz: 9522a73a0ca9b71adcc82f8d986c39a68d2c7b64f4273df5736933d1a0db43c4e9f6aa3414cfe538c99c513f2d3eeb06efb93e2624844ca9fac045b62f7a989d
7
- data.tar.gz: 0f7fe8a732b905f6bf751d42e87c622412e1e446561e2e8b0ee534997d562246afbe5deef77827002f8ca3198cf07a490603aef684815ec06f38d9de836a0f6c
6
+ metadata.gz: e0d3ef8b5d0b9c5a66fcc8bece867e8d230e9f44764b963774cbdfbe110b38f7ef2446bf9592fd913716da8267471ef1cb7d2b6d30a70e494ef8ae75d78c84a9
7
+ data.tar.gz: 37849dd986d716d6ce16ab7fe8af4f3d18d7b8c3a1840f6f7d4ccade7121b7ced9ac2085e486c8c4442da6f7bf76435ac7581267a730bb204619f5c41d8b558a
@@ -63,17 +63,31 @@ module Fastlane
63
63
  android_home
64
64
  end
65
65
 
66
- def self.get_build_tools
66
+ def self.get_build_tools_version(targeted_version)
67
+ path = self.get_build_tools(targeted_version)
68
+ version = path.split('/').last
69
+ version
70
+ end
71
+
72
+ def self.get_build_tools(targeted_version)
67
73
  android_home = self.get_android_home()
68
74
  build_tools_root = File.join(android_home, '/build-tools')
69
75
 
70
- sub_dirs = Dir.glob(File.join(build_tools_root, '*', ''))
71
- build_tools_last_version = ''
72
- for sub_dir in sub_dirs
73
- build_tools_last_version = sub_dir
76
+ build_tools_path = ""
77
+ if !targeted_version.to_s.strip.empty?
78
+ build_tools_path = File.join(build_tools_root, "/#{targeted_version}/")
74
79
  end
75
80
 
76
- build_tools_last_version
81
+ if !File.directory?(build_tools_path)
82
+ sub_dirs = Dir.glob(File.join(build_tools_root, '*', ''))
83
+ build_tools_last_version = ''
84
+ for sub_dir in sub_dirs
85
+ build_tools_last_version = sub_dir
86
+ end
87
+ build_tools_path = build_tools_last_version
88
+ end
89
+
90
+ build_tools_path
77
91
  end
78
92
 
79
93
  def self.check_ssl_version(forceOpenSSL)
@@ -231,9 +245,9 @@ module Fastlane
231
245
 
232
246
  end
233
247
 
234
- def self.sign_apk(apk_path, keystore_path, key_password, alias_name, alias_password, zip_align)
248
+ def self.sign_apk(apk_path, keystore_path, key_password, alias_name, alias_password, zip_align, version_targeted)
235
249
 
236
- build_tools_path = self.get_build_tools()
250
+ build_tools_path = self.get_build_tools(version_targeted)
237
251
  UI.message("Build-tools path: #{build_tools_path}")
238
252
 
239
253
  # https://developer.android.com/studio/command-line/zipalign
@@ -260,7 +274,13 @@ module Fastlane
260
274
  # https://developer.android.com/studio/command-line/apksigner
261
275
  `rm -f '#{apk_path_signed}'`
262
276
  UI.message("Signing APK: #{apk_path_aligned}")
263
- output = `#{build_tools_path}apksigner sign --ks '#{keystore_path}' --ks-key-alias '#{alias_name}' --ks-pass pass:'#{key_password}' --key-pass pass:'#{alias_password}' --v1-signing-enabled true --v2-signing-enabled true --v4-signing-enabled false --out '#{apk_path_signed}' '#{apk_path_aligned}'`
277
+ apksigner_opts = ""
278
+ build_tools_version = self.get_build_tools_version(version_targeted)
279
+ UI.message("Build-tools version: #{build_tools_version}")
280
+ if Gem::Version.new(build_tools_version) >= Gem::Version.new('30')
281
+ apksigner_opts = "--v4-signing-enabled false "
282
+ end
283
+ output = `#{build_tools_path}apksigner sign --ks '#{keystore_path}' --ks-key-alias '#{alias_name}' --ks-pass pass:'#{key_password}' --key-pass pass:'#{alias_password}' --v1-signing-enabled true --v2-signing-enabled true #{apksigner_opts}--out '#{apk_path_signed}' '#{apk_path_aligned}'`
264
284
  puts ""
265
285
  puts output
266
286
 
@@ -346,6 +366,7 @@ module Fastlane
346
366
  keystore_data = params[:keystore_data]
347
367
  clear_keystore = params[:clear_keystore]
348
368
  unit_test = params[:unit_test]
369
+ build_tools_version = params[:build_tools_version]
349
370
 
350
371
  # Test OpenSSL/LibreSSL
351
372
  if unit_test
@@ -558,7 +579,8 @@ module Fastlane
558
579
  key_password,
559
580
  alias_name,
560
581
  alias_password,
561
- true # Zip align
582
+ true, # Zip align
583
+ build_tools_version # Buil-tools version
562
584
  )
563
585
  puts ''
564
586
  end
@@ -636,6 +658,11 @@ module Fastlane
636
658
  description: "Required data to import an existing keystore, or create a new one",
637
659
  optional: true,
638
660
  type: String),
661
+ FastlaneCore::ConfigItem.new(key: :build_tools_version,
662
+ env_name: "MATCH_KEYSTORE_BUILD_TOOLS_VERSION",
663
+ description: "Set built-tools version (by default latest available on machine)",
664
+ optional: true,
665
+ type: String),
639
666
  FastlaneCore::ConfigItem.new(key: :clear_keystore,
640
667
  env_name: "MATCH_KEYSTORE_CLEAR",
641
668
  description: "Clear the local keystore (false by default)",
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module MatchKeystore
3
- VERSION = "0.1.15"
3
+ VERSION = "0.1.16"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-match_keystore
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.15
4
+ version: 0.1.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christopher NEY