fastlane-plugin-flutter 0.3.18 → 0.6.0
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 +4 -4
- data/README.md +1 -0
- data/lib/fastlane/plugin/flutter/actions/flutter_bootstrap_action.rb +4 -1
- data/lib/fastlane/plugin/flutter/actions/flutter_build_action.rb +27 -6
- data/lib/fastlane/plugin/flutter/actions/flutter_generate_action.rb +59 -3
- data/lib/fastlane/plugin/flutter/helper/flutter_helper.rb +29 -1
- data/lib/fastlane/plugin/flutter/version.rb +1 -1
- metadata +18 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c0484e466e397f4bacea7891de3becea2e85c5b4bf04684f06a167788d57735b
|
4
|
+
data.tar.gz: f9996d24c9a41cc4aec9ce774c41ce8a01e8e1055c3e6a153bd23c08dc701d98
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7d580e8ed5bb91a9ad0d3ae87657757ce74b88adfb3eea8dff96bd361c48d69b326913c233339274a7869141d839fe3690f42c24bf74bfa408afdcb2f4feb08a
|
7
|
+
data.tar.gz: 731f76c07eb9715b79f6705826204fe580446069b46d85da17c9b8ff14ed5ba80ea76e4cb9622bced34a6d5090db69e0f5bd55a6cd2f0164cb9e8221c1dca29c
|
data/README.md
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
[](https://badge.fury.io/rb/fastlane-plugin-flutter)
|
4
4
|
[](https://rubygems.org/gems/fastlane-plugin-flutter)
|
5
|
+
[](https://codecov.io/gh/dotdoom/fastlane-plugin-flutter)
|
5
6
|
[](https://github.com/dotdoom/fastlane-plugin-flutter/actions?query=workflow%3A"end-to-end+test"+branch%3Amaster)
|
6
7
|
|
7
8
|
Automated end-to-end test (download Flutter, create an app, build it) on the
|
@@ -34,13 +34,16 @@ module Fastlane
|
|
34
34
|
else
|
35
35
|
Helper::FlutterHelper.git(
|
36
36
|
'clone', # no --depth limit to keep Flutter tag-based versioning.
|
37
|
-
"--branch=#{flutter_channel || '
|
37
|
+
"--branch=#{flutter_channel || 'stable'}",
|
38
38
|
'--quiet',
|
39
39
|
'--',
|
40
40
|
FLUTTER_REMOTE_REPOSITORY,
|
41
41
|
flutter_sdk_root,
|
42
42
|
)
|
43
43
|
end
|
44
|
+
|
45
|
+
# Return installation path of Flutter SDK.
|
46
|
+
flutter_sdk_root
|
44
47
|
end
|
45
48
|
|
46
49
|
def self.need_upgrade_to_channel?(flutter_sdk_root, flutter_channel)
|
@@ -52,12 +52,7 @@ module Fastlane
|
|
52
52
|
|
53
53
|
Helper::FlutterHelper.flutter('build', *build_args) do |status, res|
|
54
54
|
if status.success?
|
55
|
-
|
56
|
-
lane_context[SharedValues::FLUTTER_OUTPUT] =
|
57
|
-
File.absolute_path($1)
|
58
|
-
else
|
59
|
-
UI.important('Cannot parse built file path from "flutter build"')
|
60
|
-
end
|
55
|
+
process_build_output(res, build_args)
|
61
56
|
# gym (aka build_ios_app) action call may follow build; let's help
|
62
57
|
# it identify the project, since Flutter project structure is
|
63
58
|
# usually standard.
|
@@ -71,6 +66,17 @@ module Fastlane
|
|
71
66
|
false
|
72
67
|
end
|
73
68
|
|
69
|
+
# Fill in some well-known context variables so that next commands may
|
70
|
+
# pick them up.
|
71
|
+
case params[:build]
|
72
|
+
when 'apk'
|
73
|
+
lane_context[SharedValues::GRADLE_APK_OUTPUT_PATH] =
|
74
|
+
lane_context[SharedValues::FLUTTER_OUTPUT]
|
75
|
+
when 'appbundle'
|
76
|
+
lane_context[SharedValues::GRADLE_AAB_OUTPUT_PATH] =
|
77
|
+
lane_context[SharedValues::FLUTTER_OUTPUT]
|
78
|
+
end
|
79
|
+
|
74
80
|
lane_context[SharedValues::FLUTTER_OUTPUT]
|
75
81
|
end
|
76
82
|
|
@@ -110,6 +116,21 @@ form instead.
|
|
110
116
|
end
|
111
117
|
end
|
112
118
|
|
119
|
+
def self.process_build_output(output, build_args)
|
120
|
+
artifacts = output.scan(/Built (.*?)(:? \([^)]*\))?\.$/).
|
121
|
+
map { |path| File.absolute_path(path[0]) }
|
122
|
+
if artifacts.size == 1
|
123
|
+
lane_context[SharedValues::FLUTTER_OUTPUT] = artifacts.first
|
124
|
+
elsif artifacts.size > 1
|
125
|
+
# Could be the result of "flutter build apk --split-per-abi".
|
126
|
+
lane_context[SharedValues::FLUTTER_OUTPUT] = artifacts
|
127
|
+
elsif build_args.include?('--config-only')
|
128
|
+
UI.message('Config-only "build" detected, no output file name')
|
129
|
+
else
|
130
|
+
UI.important('Cannot parse built file path from "flutter build"')
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
113
134
|
def self.description
|
114
135
|
'Run "flutter build" to build a Flutter application'
|
115
136
|
end
|
@@ -9,6 +9,13 @@ module Fastlane
|
|
9
9
|
class FlutterGenerateAction < Action
|
10
10
|
extend FlutterActionBase
|
11
11
|
|
12
|
+
# Although this file is autogenerated, we should not call it ".g.dart",
|
13
|
+
# because it is common for coverage configuration to exclude such files.
|
14
|
+
# Note that it's also common to configure Dart analyser to exclude these
|
15
|
+
# files from checks; this won't match, and we have to use ignore_for_file
|
16
|
+
# for all known lint rules that we might be breaking.
|
17
|
+
ALL_IMPORTS_TEST_FILE = 'test/all_imports_for_coverage_test.dart'
|
18
|
+
|
12
19
|
def self.run(params)
|
13
20
|
Helper::FlutterHelper.flutter(*%w(packages get)) {}
|
14
21
|
|
@@ -26,6 +33,38 @@ module Fastlane
|
|
26
33
|
UI.message('Found build_runner dependency, running build...')
|
27
34
|
Helper::FlutterGenerateBuildRunnerHelper.build
|
28
35
|
end
|
36
|
+
|
37
|
+
if params[:coverage_all_imports]
|
38
|
+
UI.message("Generating #{ALL_IMPORTS_TEST_FILE} for coverage...")
|
39
|
+
|
40
|
+
dart_file_literals = Dir['lib/**/*.dart'].reject do |file_name|
|
41
|
+
# ".g.dart" files often are "part of" files and can not be imported
|
42
|
+
# directly. Commonly coverage for generated files is not that useful
|
43
|
+
file_name.end_with?('.g.dart')
|
44
|
+
end.map do |file_name|
|
45
|
+
Helper::FlutterHelper.
|
46
|
+
import_path_for_test(file_name, '..').
|
47
|
+
gsub("'", "\\\\'")
|
48
|
+
end
|
49
|
+
|
50
|
+
File.write(
|
51
|
+
ALL_IMPORTS_TEST_FILE,
|
52
|
+
<<-DART
|
53
|
+
// This file is autogenerated by fastlane flutter_generate action.
|
54
|
+
// It imports all files in lib/ so that test coverage in percentage
|
55
|
+
// of overall project is calculated correctly. Do not modify this
|
56
|
+
// file manually!
|
57
|
+
|
58
|
+
// ignore_for_file: unused_import, directives_ordering
|
59
|
+
// ignore_for_file: avoid_relative_lib_imports
|
60
|
+
// ignore_for_file: lines_longer_than_80_chars
|
61
|
+
|
62
|
+
#{dart_file_literals.map { |fn| "import '#{fn}';" }.sort.join("\n")}
|
63
|
+
|
64
|
+
void main() {}
|
65
|
+
DART
|
66
|
+
)
|
67
|
+
end
|
29
68
|
end
|
30
69
|
|
31
70
|
def self.generate_translation?
|
@@ -33,11 +72,15 @@ module Fastlane
|
|
33
72
|
end
|
34
73
|
|
35
74
|
def self.description
|
36
|
-
"1
|
37
|
-
"2
|
75
|
+
"(1) Run `flutter packages get`; " \
|
76
|
+
"(2) Run `build_runner build` if build_runner is in dev_dependencies;" \
|
77
|
+
" " \
|
78
|
+
"(3) According to `package:intl`, take `$strings_file` and generate " \
|
38
79
|
"`${strings_file.dirname}/arb/intl_messages.arb`, then take all " \
|
39
80
|
"files matching `${strings_file.dirname}/intl_*.arb`, fix them and " \
|
40
|
-
"generate .dart files from them"
|
81
|
+
"generate .dart files from them. " \
|
82
|
+
"(4) Generate an empty test importing all files, which would be used " \
|
83
|
+
"to calculate correct full coverage numbers."
|
41
84
|
end
|
42
85
|
|
43
86
|
def self.available_options
|
@@ -62,6 +105,19 @@ module Fastlane
|
|
62
105
|
description: 'Locale of the default data in the strings_file',
|
63
106
|
optional: true,
|
64
107
|
),
|
108
|
+
FastlaneCore::ConfigItem.new(
|
109
|
+
key: :coverage_all_imports,
|
110
|
+
env_name: 'FL_FLUTTER_COVERAGE_ALL_IMPORTS',
|
111
|
+
description: <<-DESCRIPTION,
|
112
|
+
Set to true to generate an empty test importing all .dart files in
|
113
|
+
lib/, which would allow calculating correct coverage numbers for the
|
114
|
+
whole project. NOTE: Don't forget to add
|
115
|
+
/#{ALL_IMPORTS_TEST_FILE}
|
116
|
+
to .gitignore!
|
117
|
+
DESCRIPTION
|
118
|
+
optional: true,
|
119
|
+
type: Boolean,
|
120
|
+
),
|
65
121
|
]
|
66
122
|
end
|
67
123
|
end
|
@@ -14,7 +14,10 @@ module Fastlane
|
|
14
14
|
|
15
15
|
def self.flutter_sdk_root
|
16
16
|
@flutter_sdk_root ||= File.expand_path(
|
17
|
-
if
|
17
|
+
if File.executable?(File.join(Dir.pwd, '.flutter', 'bin', 'flutter'))
|
18
|
+
# Support flutterw and compatible projects.
|
19
|
+
File.join(Dir.pwd, '.flutter')
|
20
|
+
elsif ENV.include?('FLUTTER_SDK_ROOT')
|
18
21
|
UI.deprecated(
|
19
22
|
'FLUTTER_SDK_ROOT environment variable is deprecated. ' \
|
20
23
|
'To point to a Flutter installation directory, use ' \
|
@@ -27,6 +30,7 @@ module Fastlane
|
|
27
30
|
elsif flutter_binary = FastlaneCore::CommandExecutor.which('flutter')
|
28
31
|
File.dirname(File.dirname(flutter_binary))
|
29
32
|
else
|
33
|
+
# Where we'd prefer to install flutter.
|
30
34
|
File.join(Dir.pwd, 'vendor', 'flutter')
|
31
35
|
end
|
32
36
|
)
|
@@ -45,6 +49,30 @@ module Fastlane
|
|
45
49
|
(YAML.load_file('pubspec.yaml')['dev_dependencies'] || {}).key?(package)
|
46
50
|
end
|
47
51
|
|
52
|
+
def self.pub_package_name
|
53
|
+
YAML.load_file('pubspec.yaml')['name']
|
54
|
+
end
|
55
|
+
|
56
|
+
def self.import_path_for_test(file_to_import, relative_path)
|
57
|
+
unless file_to_import.start_with?('lib/')
|
58
|
+
return File.join(relative_path, file_to_import)
|
59
|
+
end
|
60
|
+
|
61
|
+
# Import file schema in tests have to match files in lib/ exactly. From
|
62
|
+
# Dart perspective, symbols in files imported via relative and
|
63
|
+
# "package:" file paths are different symbols.
|
64
|
+
package_specification = "package:#{pub_package_name}/"
|
65
|
+
if File.read(file_to_import, 4096).include?(package_specification)
|
66
|
+
# If there's a package reference in the first few bytes of the file,
|
67
|
+
# chances are, it's using "package:..." imports. Indeed, checking the
|
68
|
+
# file itself isn't sufficient to explore all of its dependencies, but
|
69
|
+
# we expect imports to be consistent in the project.
|
70
|
+
"#{package_specification}#{file_to_import['lib/'.size..-1]}"
|
71
|
+
else
|
72
|
+
File.join(relative_path, file_to_import)
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
48
76
|
def self.execute(*command)
|
49
77
|
# TODO(dotdoom): make CommandExecutor (and Actions.sh) behave similarly.
|
50
78
|
command = command.shelljoin
|
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.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Artem Sheremet
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-05-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pry
|
@@ -122,6 +122,20 @@ dependencies:
|
|
122
122
|
- - ">="
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: codecov
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
125
139
|
- !ruby/object:Gem::Dependency
|
126
140
|
name: fastlane
|
127
141
|
requirement: !ruby/object:Gem::Requirement
|
@@ -174,7 +188,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
174
188
|
- !ruby/object:Gem::Version
|
175
189
|
version: '0'
|
176
190
|
requirements: []
|
177
|
-
|
191
|
+
rubyforge_project:
|
192
|
+
rubygems_version: 2.7.6.2
|
178
193
|
signing_key:
|
179
194
|
specification_version: 4
|
180
195
|
summary: Flutter actions plugin for Fastlane
|