Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
131f59f1
Unverified
Commit
131f59f1
authored
Feb 25, 2021
by
Perqin
Committed by
GitHub
Feb 25, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_tools] Avoid duplicated calls to l10n generation (#76066)
parent
3e5efc02
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
20 deletions
+15
-20
AUTHORS
AUTHORS
+1
-0
generate_synthetic_packages.dart
...utter_tools/lib/src/dart/generate_synthetic_packages.dart
+4
-10
generate_synthetic_packages_test.dart
.../general.shard/dart/generate_synthetic_packages_test.dart
+10
-10
No files found.
AUTHORS
View file @
131f59f1
...
...
@@ -74,3 +74,4 @@ Andrey Kabylin <andrey@kabylin.ru>
vimerzhao <vimerzhao@gmail.com>
Pedro Massango <pedromassango.developer@gmail.com>
Hidenori Matsubayashi <Hidenori.Matsubayashi@sony.com>
Perqin Xie <perqinxie@gmail.com>
packages/flutter_tools/lib/src/dart/generate_synthetic_packages.dart
View file @
131f59f1
...
...
@@ -37,15 +37,9 @@ Future<void> generateLocalizationsSyntheticPackage({
);
}
BuildResult
result
;
// If an l10n.yaml file exists but is empty, attempt to build synthetic
// package with default settings.
if
(
yamlNode
.
value
==
null
)
{
result
=
await
buildSystem
.
build
(
const
GenerateLocalizationsTarget
(),
environment
,
);
}
else
{
// If an l10n.yaml file exists and is not empty, attempt to parse settings in
// it.
if
(
yamlNode
.
value
!=
null
)
{
final
YamlMap
yamlMap
=
yamlNode
as
YamlMap
;
final
Object
value
=
yamlMap
[
'synthetic-package'
];
if
(
value
is
!
bool
&&
value
!=
null
)
{
...
...
@@ -63,7 +57,7 @@ Future<void> generateLocalizationsSyntheticPackage({
}
}
result
=
await
buildSystem
.
build
(
final
BuildResult
result
=
await
buildSystem
.
build
(
const
GenerateLocalizationsTarget
(),
environment
,
);
...
...
packages/flutter_tools/test/general.shard/dart/generate_synthetic_packages_test.dart
View file @
131f59f1
...
...
@@ -18,7 +18,7 @@ import '../../src/context.dart';
import
'../../src/fake_process_manager.dart'
;
void
main
(
)
{
testWithoutContext
(
'calls buildSystem.build with blank l10n.yaml file'
,
()
{
testWithoutContext
(
'calls buildSystem.build with blank l10n.yaml file'
,
()
async
{
// Project directory setup for gen_l10n logic
final
MemoryFileSystem
fileSystem
=
MemoryFileSystem
.
test
();
...
...
@@ -44,7 +44,7 @@ void main() {
);
final
BuildSystem
buildSystem
=
MockBuildSystem
();
expect
(
await
expectLater
(
()
=>
generateLocalizationsSyntheticPackage
(
environment:
environment
,
buildSystem:
buildSystem
,
...
...
@@ -58,7 +58,7 @@ void main() {
)).
called
(
1
);
});
testWithoutContext
(
'calls buildSystem.build with l10n.yaml synthetic-package: true'
,
()
{
testWithoutContext
(
'calls buildSystem.build with l10n.yaml synthetic-package: true'
,
()
async
{
// Project directory setup for gen_l10n logic
final
MemoryFileSystem
fileSystem
=
MemoryFileSystem
.
test
();
...
...
@@ -85,7 +85,7 @@ void main() {
);
final
BuildSystem
buildSystem
=
MockBuildSystem
();
expect
(
await
expectLater
(
()
=>
generateLocalizationsSyntheticPackage
(
environment:
environment
,
buildSystem:
buildSystem
,
...
...
@@ -99,7 +99,7 @@ void main() {
)).
called
(
1
);
});
testWithoutContext
(
'calls buildSystem.build with l10n.yaml synthetic-package: null'
,
()
{
testWithoutContext
(
'calls buildSystem.build with l10n.yaml synthetic-package: null'
,
()
async
{
// Project directory setup for gen_l10n logic
final
MemoryFileSystem
fileSystem
=
MemoryFileSystem
.
test
();
...
...
@@ -124,7 +124,7 @@ void main() {
);
final
BuildSystem
buildSystem
=
MockBuildSystem
();
expect
(
await
expectLater
(
()
=>
generateLocalizationsSyntheticPackage
(
environment:
environment
,
buildSystem:
buildSystem
,
...
...
@@ -171,7 +171,7 @@ void main() {
));
});
testWithoutContext
(
'does not call buildSystem.build with incorrect l10n.yaml format'
,
()
{
testWithoutContext
(
'does not call buildSystem.build with incorrect l10n.yaml format'
,
()
async
{
// Project directory setup for gen_l10n logic
final
MemoryFileSystem
fileSystem
=
MemoryFileSystem
.
test
();
...
...
@@ -196,7 +196,7 @@ void main() {
);
final
BuildSystem
buildSystem
=
MockBuildSystem
();
expect
(
await
expectLater
(
()
=>
generateLocalizationsSyntheticPackage
(
environment:
environment
,
buildSystem:
buildSystem
,
...
...
@@ -210,7 +210,7 @@ void main() {
));
});
testWithoutContext
(
'does not call buildSystem.build with non-bool "synthetic-package" value'
,
()
{
testWithoutContext
(
'does not call buildSystem.build with non-bool "synthetic-package" value'
,
()
async
{
// Project directory setup for gen_l10n logic
final
MemoryFileSystem
fileSystem
=
MemoryFileSystem
.
test
();
...
...
@@ -235,7 +235,7 @@ void main() {
);
final
BuildSystem
buildSystem
=
MockBuildSystem
();
expect
(
await
expectLater
(
()
=>
generateLocalizationsSyntheticPackage
(
environment:
environment
,
buildSystem:
buildSystem
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment