fastlane-plugin-flutter 0.2.3 → 0.2.4

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: befee442f822fcd72b0f03757ea9dab1c6e46928
4
- data.tar.gz: c5b82f37810c5339f365bb4e29e4eeeb9deb8e8b
3
+ metadata.gz: 3285411bae73b95137074776448187327f176908
4
+ data.tar.gz: ea813359aba6ea098d16aff0483e1c75c2617dbc
5
5
  SHA512:
6
- metadata.gz: 1ae9f15d861ee0ecfcf1c463479c095e0d10b879c8e895931f26c132ef75a18f498b032b00c0df226692b07d6440a11a58590dfb5fd766bf6029631393197caa
7
- data.tar.gz: 67f0085577d0ed74738b57559c99e7a16ad392e2c5ecd2356ed43dd946d5d5daf0309558bebfc617326cd3b3606d3bd28405081640f604172360c5e5414fb2ad
6
+ metadata.gz: ce2458bb2d0243aefe7779e0e56483721773de4c19a89893ce14d845b635791b8a8e988cef934f398a8a7a4e13693d7f53a7039a1d65afbb8879faf84762633b
7
+ data.tar.gz: b67967887ab9bd14b65b9eb0a02b8f12f334406b8163b30d7ab593e6dbca04c9274b8bd77ea7a26cfaf3af454324646a1b5cd1c541d54abb8e62d282db65197f
@@ -15,7 +15,7 @@ module Fastlane
15
15
  end
16
16
 
17
17
  class FlutterAction < Action
18
- FLUTTER_ACTIONS = %(build analyze test format l10n)
18
+ FLUTTER_ACTIONS = %w(build analyze test format l10n bootstrap)
19
19
 
20
20
  PLATFORM_TO_FLUTTER = {
21
21
  ios: 'ios',
@@ -105,6 +105,8 @@ module Fastlane
105
105
  sh *%w(flutter format .)
106
106
  when 'l10n'
107
107
  run_l10n(params)
108
+ when 'bootstrap'
109
+ Helper::FlutterHelper.bootstrap_android(params[:android_licenses])
108
110
  end
109
111
  end
110
112
 
@@ -128,7 +130,7 @@ module Fastlane
128
130
  )
129
131
  end
130
132
 
131
- sh *%w(flutter pub pub run intl_translation:extract_to_arb),
133
+ sh *%w(flutter packages pub run intl_translation:extract_to_arb),
132
134
  *extract_to_arb_options, params[:l10n_strings_file]
133
135
 
134
136
  if l10n_messages_was
@@ -175,7 +177,7 @@ module Fastlane
175
177
  end
176
178
  end
177
179
 
178
- sh *%W(flutter pub pub run intl_translation:generate_from_arb
180
+ sh *%W(flutter packages pub run intl_translation:generate_from_arb
179
181
  --output-dir=#{output_dir}
180
182
  --no-use-deferred-loading
181
183
  #{params[:l10n_strings_file]}) + arb_files
@@ -209,7 +211,9 @@ module Fastlane
209
211
  optional: false,
210
212
  type: String,
211
213
  verify_block: proc do |value|
212
- UI.user_error!("Supported actions are: #{FLUTTER_ACTIONS}") unless FLUTTER_ACTIONS.include?(value)
214
+ unless FLUTTER_ACTIONS.include?(value)
215
+ UI.user_error!("Supported actions are: #{FLUTTER_ACTIONS}")
216
+ end
213
217
  end,
214
218
  ),
215
219
  FastlaneCore::ConfigItem.new(
@@ -236,9 +240,6 @@ module Fastlane
236
240
  Override build number in pubspec.yaml. Can be either a number, or
237
241
  a schema definition, ex.: ci (take from CI) vcs (take from Git),
238
242
  ci+1000 (take from CI and add 1000).
239
- WARNING: does not override Android build number specified in
240
- pubspec.yaml due to Flutter bug:
241
- https://github.com/flutter/flutter/issues/22788.
242
243
  DESCRIPTION
243
244
  optional: true,
244
245
  verify_block: Helper::FlutterHelper.method(:build_number),
@@ -252,9 +253,6 @@ module Fastlane
252
253
  tree), vcs (take from VCS, no dirty mark).
253
254
  NOTE: for App Store, must be in the format of at most 3 integeres
254
255
  separated by a dot (".").
255
- WARNING: does not override Android build number specified in
256
- pubspec.yaml due to Flutter bug:
257
- https://github.com/flutter/flutter/issues/22788.
258
256
  DESCRIPTION
259
257
  optional: true,
260
258
  verify_block: Helper::FlutterHelper.method(:build_name),
@@ -291,6 +289,16 @@ module Fastlane
291
289
  is_string: false,
292
290
  default_value: true,
293
291
  ),
292
+ FastlaneCore::ConfigItem.new(
293
+ key: :android_licenses,
294
+ env_name: 'FL_FLUTTER_ANDROID_LICENSES',
295
+ description: 'Hashes of accepted Android SDK linceses, which may ' \
296
+ 'be found in $ANDROID_SDK_ROOT/licenses',
297
+ optional: true,
298
+ is_string: false,
299
+ verify_block: proc { |value| value.kind_of?(Hash) },
300
+ default_value: {},
301
+ ),
294
302
  ]
295
303
  end
296
304
 
@@ -1,6 +1,8 @@
1
1
  require 'fastlane_core/ui/ui'
2
+ require 'fileutils'
2
3
  require 'json'
3
4
  require 'set'
5
+ require 'tempfile'
4
6
 
5
7
  module Fastlane
6
8
  # UI = FastlaneCore::UI unless Fastlane.const_defined?("UI")
@@ -93,6 +95,90 @@ module Fastlane
93
95
  schema
94
96
  end
95
97
  end
98
+
99
+ # Bootstrap Flutter application for build with Android SDK:
100
+ # https://github.com/flutter/flutter/issues/28076
101
+ def self.bootstrap_android(licenses = {})
102
+ # Gradle will refuse to install Android SDK unless the SDK directory
103
+ # exists and licenses are accepted.
104
+ licenses_directory = File.join(android_sdk_root!, 'licenses')
105
+ FileUtils.mkdir_p(licenses_directory)
106
+ if licenses.any?
107
+ licenses.each_pair do |license, hash|
108
+ license_file = File.join(licenses_directory, license)
109
+ unless File.exist?(license_file) &&
110
+ File.readlines(license_file).include?(hash)
111
+ File.open(license_file, 'a') { |f| f.puts('', hash) }
112
+ end
113
+ end
114
+ end
115
+
116
+ android_properties_file = 'android/local.properties'
117
+ flutter_sdk_par = 'flutter.sdk'
118
+ unless File.exist?(android_properties_file) &&
119
+ File.read(android_properties_file).include?(flutter_sdk_par)
120
+ flutter_sdk_path = File.dirname(File.dirname(which('flutter')))
121
+ File.open(android_properties_file, 'a') do |properties|
122
+ properties.write(<<-CONFIG.gsub(/^\s+/, ''))
123
+
124
+ ### Generated by #{$0}#{__method__} ###
125
+ #{flutter_sdk_par}=#{flutter_sdk_path}
126
+ CONFIG
127
+ end
128
+ end
129
+
130
+ download_android_dependencies
131
+ end
132
+
133
+ def self.android_sdk_root!
134
+ (ENV['ANDROID_HOME'] || ENV['ANDROID_SDK_ROOT']).tap do |path|
135
+ unless path
136
+ raise 'Android SDK directory environment variables are not set. ' \
137
+ 'See https://developer.android.com/studio/command-line/variables'
138
+ end
139
+ end
140
+ end
141
+
142
+ def self.download_android_dependencies
143
+ Tempfile.create('resolveDependencies.gradle') do |init_script|
144
+ init_script.puts(<<-GRADLE)
145
+ allprojects {
146
+ task resolveDependencies {
147
+ doLast {
148
+ project.configurations.each { configuration ->
149
+ if (configuration.isCanBeResolved()) {
150
+ configuration.resolve()
151
+ }
152
+ }
153
+ project.buildscript.configurations.each { configuration ->
154
+ if (configuration.isCanBeResolved()) {
155
+ configuration.resolve()
156
+ }
157
+ }
158
+ }
159
+ }
160
+ }
161
+ GRADLE
162
+ init_script.flush
163
+
164
+ Dir.chdir('android') do
165
+ Actions.sh('./gradlew', '--init-script', init_script.path,
166
+ '--', ':resolveDependencies')
167
+ end
168
+ end
169
+ end
170
+
171
+ # https://stackoverflow.com/a/5471032/8584735
172
+ def self.which(cmd)
173
+ exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']
174
+ ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|
175
+ exts.each do |ext|
176
+ exe = File.join(path, "#{cmd}#{ext}")
177
+ return exe if File.executable?(exe) && !File.directory?(exe)
178
+ end
179
+ end
180
+ nil
181
+ end
96
182
  end
97
183
  end
98
184
  end
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module Flutter
3
- VERSION = "0.2.3"
3
+ VERSION = "0.2.4"
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.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Artem Sheremet
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-12-30 00:00:00.000000000 Z
11
+ date: 2019-02-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pry