fastlane-plugin-match_keystore 0.1.18 → 0.2.0

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: a109e0eb2a91578a04778376e7a615618e06a85e4b62f303bb05e02b17475d82
4
- data.tar.gz: 1d1c7e90bded78f03eb4056e5a1789f06de6e47fa8b1c0d53eb70e2f5a7c224a
3
+ metadata.gz: 554236b09184bb0b50f9209ae0de3ba469e58bd66a5c0cc28880e8e259f3721a
4
+ data.tar.gz: b6c33c5ec05a4f72e2cbc04db6e64b2048b361408bedbaa9fe58e52908cbc5b3
5
5
  SHA512:
6
- metadata.gz: 1da211c6429b73a41c3f997215902de7329d397e8976e42bbb79c4a61663bf4843ea1872e3a9756bb112039c7d11e0f42ec9f3d2346f7c4e0071fe0f190d92a4
7
- data.tar.gz: 1c6abba20d95cd5b01659fd787c6e0fbbb718fc62cb4785781c3710bc6289933f6454fc54d67bd03c5dae4e47c03690b94992713c1ca18cdd0a2a4c52d975e84
6
+ metadata.gz: f99fe0dbb68617919711aaded1054d931a85dbc8730f2ac69fd289341389014fb02a25cc58b833c148991e85bb871cf360450821cff284427c60c6d7000f0f42
7
+ data.tar.gz: c9de35e3c6cae52e1dca0d78823079f1239bc890df3c5865fb288f1fbe666e181ddba39d5de9136bb82622bdfc380c79b5b045907ca2e5d5df95df87448222b4
@@ -16,10 +16,8 @@ module Fastlane
16
16
 
17
17
  class MatchKeystoreAction < Action
18
18
 
19
- def self.openssl_path
20
- path = "/usr/local/opt/openssl@1.1/bin"
21
- path
22
- end
19
+ KEY_VERSION = "2"
20
+ OPENSSL_BIN_PATH_MAC = "/usr/local/opt/openssl@1.1/bin"
23
21
 
24
22
  def self.to_md5(value)
25
23
  hash_value = Digest::MD5.hexdigest value
@@ -120,8 +118,7 @@ module Fastlane
120
118
 
121
119
  def self.openssl(forceOpenSSL)
122
120
  if forceOpenSSL
123
- path = openssl_path
124
- output = "#{path}/openssl"
121
+ output = "#{self::OPENSSL_BIN_PATH_MAC}/openssl"
125
122
  else
126
123
  output = "openssl"
127
124
  end
@@ -256,46 +253,47 @@ module Fastlane
256
253
  build_tools_path = self.get_build_tools(version_targeted)
257
254
  UI.message("Build-tools path: #{build_tools_path}")
258
255
 
259
- # https://developer.android.com/studio/command-line/zipalign
260
- if zip_align != false
261
- apk_path_aligned = apk_path.gsub(".apk", "-aligned.apk")
262
- `rm -f '#{apk_path_aligned}'`
263
- UI.message("Aligning APK (zipalign): #{apk_path}")
264
- output = `#{build_tools_path}zipalign -v 4 '#{apk_path}' '#{apk_path_aligned}'`
265
- puts ""
266
- puts output
267
-
268
- if !File.file?(apk_path_aligned)
269
- raise "Aligned APK not exists!"
270
- end
271
-
272
- else
273
- UI.message("No zip align - deactivated via parameter!")
274
- apk_path_aligned = apk_path
275
- end
256
+ # https://developer.android.com/studio/command-line/apksigner
276
257
  apk_path_signed = apk_path.gsub(".apk", "-signed.apk")
277
258
  apk_path_signed = apk_path_signed.gsub("unsigned", "")
278
259
  apk_path_signed = apk_path_signed.gsub("--", "-")
279
-
280
- # https://developer.android.com/studio/command-line/apksigner
281
260
  `rm -f '#{apk_path_signed}'`
282
- UI.message("Signing APK: #{apk_path_aligned}")
261
+
262
+ UI.message("Signing APK (input): #{apk_path}")
283
263
  apksigner_opts = ""
284
264
  build_tools_version = self.get_build_tools_version(version_targeted)
285
265
  UI.message("Build-tools version: #{build_tools_version}")
286
266
  if Gem::Version.new(build_tools_version) >= Gem::Version.new('30')
287
267
  apksigner_opts = "--v4-signing-enabled false "
288
268
  end
289
- 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}'`
269
+ 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}'`
290
270
  puts ""
291
271
  puts output
292
272
 
293
- UI.message("Verifing APK signature: #{apk_path_signed}")
273
+ UI.message("Verifing APK signature (output): #{apk_path_signed}")
294
274
  output = `#{build_tools_path}apksigner verify '#{apk_path_signed}'`
295
275
  puts ""
296
276
  puts output
277
+
278
+
279
+ # https://developer.android.com/studio/command-line/zipalign
297
280
  if zip_align != false
281
+ apk_path_aligned = apk_path_signed.gsub(".apk", "-aligned.apk")
298
282
  `rm -f '#{apk_path_aligned}'`
283
+ UI.message("Aligning APK (zipalign): #{apk_path_signed}")
284
+ output = `#{build_tools_path}zipalign -v 4 '#{apk_path_signed}' '#{apk_path_aligned}'`
285
+ puts ""
286
+ puts output
287
+
288
+ if !File.file?(apk_path_aligned)
289
+ raise "Aligned APK not exists!"
290
+ end
291
+
292
+ `rm -f '#{apk_path_signed}'`
293
+ apk_path_signed = apk_path_aligned
294
+
295
+ else
296
+ UI.message("No zip align - deactivated via parameter!")
299
297
  end
300
298
 
301
299
  apk_path_signed
@@ -400,6 +398,11 @@ module Fastlane
400
398
  # Check OpenSSL:
401
399
  self.check_ssl_version(false)
402
400
 
401
+ # Check is backward-compatibility is required:
402
+ if !compat_key.to_s.strip.empty?
403
+ UI.message("Compatiblity version: #{compat_key}")
404
+ end
405
+
403
406
  # Init workign local directory:
404
407
  dir_name = ENV['HOME'] + '/.match_keystore'
405
408
  unless File.directory?(dir_name)
@@ -408,7 +411,11 @@ module Fastlane
408
411
  end
409
412
 
410
413
  # Init 'security password' for AES encryption:
411
- key_name = "#{self.to_md5(git_url)}.hex"
414
+ if compat_key == "1"
415
+ key_name = "#{self.to_md5(git_url)}.hex"
416
+ else
417
+ key_name = "#{self.to_md5(git_url)}-#{self::KEY_VERSION}.hex"
418
+ end
412
419
  key_path = File.join(dir_name, key_name)
413
420
  # UI.message(key_path)
414
421
  if !File.file?(key_path)
@@ -456,14 +463,10 @@ module Fastlane
456
463
  gitDir = File.join(repo_dir, '/.git')
457
464
  if !File.directory?(gitDir)
458
465
  UI.message("Cloning remote Keystores repository...")
459
- puts ''
460
466
  `git clone #{git_url} #{repo_dir}`
461
- puts ''
462
467
  else
463
468
  UI.message("Pulling remote Keystores repository...")
464
- puts ''
465
469
  `cd #{repo_dir} && git pull`
466
- puts ''
467
470
  end
468
471
 
469
472
  # Load parameters from JSON for CI or Unit Tests:
@@ -564,7 +567,7 @@ module Fastlane
564
567
  self.decrypt_file(properties_encrypt_path, properties_path, key_path, false)
565
568
 
566
569
  properties = self.load_properties(properties_path)
567
- Pry::ColorPrinter.pp(properties)
570
+ # Pry::ColorPrinter.pp(properties)
568
571
  key_password = properties['keyPassword']
569
572
  alias_name = properties['aliasName']
570
573
  alias_password = properties['aliasPassword']
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module MatchKeystore
3
- VERSION = "0.1.18"
3
+ VERSION = "0.2.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-match_keystore
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.18
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christopher NEY
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-09-09 00:00:00.000000000 Z
11
+ date: 2021-03-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pry
@@ -167,7 +167,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
167
167
  - !ruby/object:Gem::Version
168
168
  version: '0'
169
169
  requirements: []
170
- rubygems_version: 3.0.3
170
+ rubygems_version: 3.2.6
171
171
  signing_key:
172
172
  specification_version: 4
173
173
  summary: Easily sync your Android keystores across your team