fastlane-plugin-flutter 0.3.4 → 0.3.6

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
  SHA1:
3
- metadata.gz: 8218973005eea440047e5cee9dfbeba1f6646cda
4
- data.tar.gz: 4f97597a00ccb11a8e06cbb21cb168932984d987
3
+ metadata.gz: 3401caabc2c40bdeaa3cd30b75f06c0eb3b738a9
4
+ data.tar.gz: 8ee1e4db0532b1107d1b83ac8de93f2b7e41d218
5
5
  SHA512:
6
- metadata.gz: d17d251d30d1231762cd54d3f056544939a450f028c1ca9771f4a9cef16f780b804a2bf7c24a4c452978f6625c138c3cd5f6f4186d347db27f34e81951c08c3c
7
- data.tar.gz: 24a6445e48fe4e1b7e00ed2a2ade067ad30e6a58179b1c055bdb780a5200a1a4f67df606cb23bf2ef4154de27ed230f43943d52fd9326211028d6a0dbf3cb0cd
6
+ metadata.gz: 7933a7a644f24a6b860dc364c8deab13ae6ebd36f02f2f4e1d79a5c4c84567784f802170f797d75d9169fa562d4f0ea5233dd244801c068b0230b0a08becbdf0
7
+ data.tar.gz: 9d4f64602a4c85ddaca7fd1afb26ca959e4acb71ff77e3ce8e6080a8362dc5ba2f756744010a86be4b66fa18943e83fb5147633ec67bf8fbb7721b72f9d47a93
@@ -8,6 +8,8 @@ module Fastlane
8
8
  class FlutterBootstrapAction < Action
9
9
  extend FlutterActionBase
10
10
 
11
+ FLUTTER_REMOTE_REPOSITORY = 'https://github.com/flutter/flutter.git'
12
+
11
13
  def self.run(params)
12
14
  if params[:android_licenses]
13
15
  Helper::FlutterBootstrapHelper.accept_licenses(
@@ -19,29 +21,58 @@ module Fastlane
19
21
  # Upgrade or install Flutter SDK.
20
22
  flutter_sdk_root = Helper::FlutterHelper.flutter_sdk_root
21
23
  flutter_channel = params[:flutter_channel]
22
- if File.directory?(flutter_sdk_root)
24
+ if Helper::FlutterHelper.flutter_installed?
23
25
  if flutter_channel
24
26
  UI.message("Making sure Flutter is on channel #{flutter_channel}")
25
27
  Helper::FlutterHelper.flutter('channel', flutter_channel) {}
26
28
  end
27
- if params[:flutter_auto_upgrade]
29
+ if params[:flutter_auto_upgrade] &&
30
+ need_upgrade_to_channel?(flutter_sdk_root, flutter_channel)
28
31
  UI.message("Upgrading Flutter SDK in #{flutter_sdk_root}...")
29
32
  Helper::FlutterHelper.flutter('upgrade') {}
30
33
  end
31
34
  else
32
35
  Helper::FlutterHelper.git(
33
- 'clone', # no --depth to keep Flutter tag-based versioning.
36
+ 'clone', # no --depth limit to keep Flutter tag-based versioning.
34
37
  "--branch=#{flutter_channel || 'beta'}",
35
38
  '--quiet',
36
39
  '--',
37
- 'https://github.com/flutter/flutter.git',
40
+ FLUTTER_REMOTE_REPOSITORY,
38
41
  flutter_sdk_root,
39
42
  )
40
43
  end
44
+
41
45
  UI.message('Precaching Flutter SDK binaries...')
42
46
  Helper::FlutterHelper.flutter('precache') {}
43
47
  end
44
48
 
49
+ def self.need_upgrade_to_channel?(flutter_sdk_root, flutter_channel)
50
+ # No channel specified -- always upgrade.
51
+ return true unless flutter_channel
52
+
53
+ remote_hash = Helper::FlutterHelper.git(
54
+ 'ls-remote', FLUTTER_REMOTE_REPOSITORY, flutter_channel
55
+ ) do |status, output, errors_thread|
56
+ output.split[0].strip if status.success?
57
+ end
58
+ local_hash = Helper::FlutterHelper.git(
59
+ '-C', flutter_sdk_root, 'rev-parse', 'HEAD'
60
+ ) do |status, output, errors_thread|
61
+ output.strip if status.success?
62
+ end
63
+
64
+ if !local_hash.nil? && local_hash == remote_hash
65
+ UI.message("Local and remote Flutter repository hashes match " \
66
+ "(#{local_hash}), no upgrade necessary. Keeping Git " \
67
+ "index untouched!")
68
+ false
69
+ else
70
+ UI.message("Local hash (#{local_hash}) of Flutter repository " \
71
+ "differs from remote (#{remote_hash}), upgrading")
72
+ true
73
+ end
74
+ end
75
+
45
76
  def self.android_sdk_root!
46
77
  (ENV['ANDROID_HOME'] || ENV['ANDROID_SDK_ROOT']).tap do |path|
47
78
  unless path
@@ -5,7 +5,7 @@ module Fastlane
5
5
  module Helper
6
6
  class FlutterHelper
7
7
  def self.flutter(*argv, &block)
8
- execute(File.join(flutter_sdk_root, 'bin', 'flutter'), *argv, &block)
8
+ execute(flutter_binary, *argv, &block)
9
9
  end
10
10
 
11
11
  def self.git(*argv, &block)
@@ -24,6 +24,14 @@ module Fastlane
24
24
  )
25
25
  end
26
26
 
27
+ def self.flutter_installed?
28
+ File.executable?(flutter_binary)
29
+ end
30
+
31
+ def self.flutter_binary
32
+ File.join(flutter_sdk_root, 'bin', 'flutter')
33
+ end
34
+
27
35
  def self.dev_dependency?(package)
28
36
  (YAML.load_file('pubspec.yaml')['dev_dependencies'] || {}).key?(package)
29
37
  end
@@ -55,6 +63,8 @@ $ #{command}
55
63
  #{errors_thread.value}
56
64
  ERROR
57
65
  end
66
+
67
+ ignore_error
58
68
  end
59
69
  end
60
70
  end
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module Flutter
3
- VERSION = '0.3.4'
3
+ VERSION = '0.3.6'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-flutter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.4
4
+ version: 0.3.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Artem Sheremet
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-08-18 00:00:00.000000000 Z
11
+ date: 2019-08-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pry