fastlane-plugin-flutter 0.3.19 → 0.4.1
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_build_action.rb +7 -3
- data/lib/fastlane/plugin/flutter/actions/flutter_generate_action.rb +55 -1
- data/lib/fastlane/plugin/flutter/helper/flutter_helper.rb +24 -0
- data/lib/fastlane/plugin/flutter/version.rb +1 -1
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: db3474e6f0494dc87b920d46e9d10c6db3c1c2bd3fd287302e566c6ca2c75257
|
4
|
+
data.tar.gz: 818dea65a21344a03305ee25b2f6485850c3ecffbdc0289bfa7dab5c256e2211
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e1b4913c36b02a40fd76943fe959199da720a17670beabcc84bb341c85e9c29a7cd54da5b2f2ebeafa6962c95d735ff195e1753aa97f603e6deea2439c0764ec
|
7
|
+
data.tar.gz: aa7b41e76456eb3b971ab47e22b02c5798401a449492192f2cb7ad5e431d9e455b3b0c016a9c8712036cdd6f674c68853f67b069871cd904bb7a525fa6d233a4
|
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
|
@@ -52,9 +52,13 @@ module Fastlane
|
|
52
52
|
|
53
53
|
Helper::FlutterHelper.flutter('build', *build_args) do |status, res|
|
54
54
|
if status.success?
|
55
|
-
|
56
|
-
|
57
|
-
|
55
|
+
artifacts = res.scan(/Built (.*?)(:? \([^)]*\))?\.$/).
|
56
|
+
map { |path| File.absolute_path(path[0]) }
|
57
|
+
if artifacts.size == 1
|
58
|
+
lane_context[SharedValues::FLUTTER_OUTPUT] = artifacts.first
|
59
|
+
elsif artifacts.size > 1
|
60
|
+
# Could be the result of "flutter build apk --split-per-abi".
|
61
|
+
lane_context[SharedValues::FLUTTER_OUTPUT] = artifacts
|
58
62
|
else
|
59
63
|
UI.important('Cannot parse built file path from "flutter build"')
|
60
64
|
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?
|
@@ -39,7 +78,9 @@ module Fastlane
|
|
39
78
|
"(3) According to `package:intl`, take `$strings_file` and generate " \
|
40
79
|
"`${strings_file.dirname}/arb/intl_messages.arb`, then take all " \
|
41
80
|
"files matching `${strings_file.dirname}/intl_*.arb`, fix them and " \
|
42
|
-
"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."
|
43
84
|
end
|
44
85
|
|
45
86
|
def self.available_options
|
@@ -64,6 +105,19 @@ module Fastlane
|
|
64
105
|
description: 'Locale of the default data in the strings_file',
|
65
106
|
optional: true,
|
66
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
|
+
),
|
67
121
|
]
|
68
122
|
end
|
69
123
|
end
|
@@ -45,6 +45,30 @@ module Fastlane
|
|
45
45
|
(YAML.load_file('pubspec.yaml')['dev_dependencies'] || {}).key?(package)
|
46
46
|
end
|
47
47
|
|
48
|
+
def self.pub_package_name
|
49
|
+
YAML.load_file('pubspec.yaml')['name']
|
50
|
+
end
|
51
|
+
|
52
|
+
def self.import_path_for_test(file_to_import, relative_path)
|
53
|
+
unless file_to_import.start_with?('lib/')
|
54
|
+
return File.join(relative_path, file_to_import)
|
55
|
+
end
|
56
|
+
|
57
|
+
# Import file schema in tests have to match files in lib/ exactly. From
|
58
|
+
# Dart perspective, symbols in files imported via relative and
|
59
|
+
# "package:" file paths are different symbols.
|
60
|
+
package_specification = "package:#{pub_package_name}/"
|
61
|
+
if File.read(file_to_import, 4096).include?(package_specification)
|
62
|
+
# If there's a package reference in the first few bytes of the file,
|
63
|
+
# chances are, it's using "package:..." imports. Indeed, checking the
|
64
|
+
# file itself isn't sufficient to explore all of its dependencies, but
|
65
|
+
# we expect imports to be consistent in the project.
|
66
|
+
"#{package_specification}#{file_to_import['lib/'.size..-1]}"
|
67
|
+
else
|
68
|
+
File.join(relative_path, file_to_import)
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
48
72
|
def self.execute(*command)
|
49
73
|
# TODO(dotdoom): make CommandExecutor (and Actions.sh) behave similarly.
|
50
74
|
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.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Artem Sheremet
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-04-26 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
|