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
2bf0627d
Unverified
Commit
2bf0627d
authored
May 25, 2021
by
Jenn Magder
Committed by
GitHub
May 25, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Migrate localizations and generate_synthetic_packages to null safety (#83310)
parent
6b6b71ff
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
22 deletions
+19
-22
localizations.dart
...ter_tools/lib/src/build_system/targets/localizations.dart
+8
-6
generate_synthetic_packages.dart
...utter_tools/lib/src/dart/generate_synthetic_packages.dart
+6
-9
localizations_test.dart
...eneral.shard/build_system/targets/localizations_test.dart
+2
-3
generate_synthetic_packages_test.dart
.../general.shard/dart/generate_synthetic_packages_test.dart
+3
-4
No files found.
packages/flutter_tools/lib/src/build_system/targets/localizations.dart
View file @
2bf0627d
...
...
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.8
import
'../../base/file_system.dart'
;
import
'../../convert.dart'
;
import
'../../localizations/gen_l10n.dart'
;
...
...
@@ -69,15 +67,19 @@ class GenerateLocalizationsTarget extends Target {
final
Map
<
String
,
Object
>
dependencies
=
json
.
decode
(
environment
.
buildDir
.
childFile
(
_kDependenciesFileName
).
readAsStringSync
()
)
as
Map
<
String
,
Object
>;
final
List
<
Object
?>?
inputs
=
dependencies
[
'inputs'
]
as
List
<
Object
?>?;
final
List
<
Object
?>?
outputs
=
dependencies
[
'outputs'
]
as
List
<
Object
?>?;
final
Depfile
depfile
=
Depfile
(
<
File
>[
configFile
,
for
(
dynamic
inputFile
in
dependencies
[
'inputs'
]
as
List
<
dynamic
>)
environment
.
fileSystem
.
file
(
inputFile
)
if
(
inputs
!=
null
)
for
(
Object
inputFile
in
inputs
.
whereType
<
Object
>())
environment
.
fileSystem
.
file
(
inputFile
)
],
<
File
>[
for
(
dynamic
outputFile
in
dependencies
[
'outputs'
]
as
List
<
dynamic
>)
environment
.
fileSystem
.
file
(
outputFile
)
if
(
outputs
!=
null
)
for
(
Object
outputFile
in
outputs
.
whereType
<
Object
>())
environment
.
fileSystem
.
file
(
outputFile
)
],
);
depfileService
.
writeToFile
(
...
...
packages/flutter_tools/lib/src/dart/generate_synthetic_packages.dart
View file @
2bf0627d
...
...
@@ -2,9 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.8
import
'package:meta/meta.dart'
;
import
'package:yaml/yaml.dart'
;
import
'../base/common.dart'
;
...
...
@@ -14,8 +11,8 @@ import '../build_system/build_system.dart';
import
'../build_system/targets/localizations.dart'
;
Future
<
void
>
generateLocalizationsSyntheticPackage
({
@
required
Environment
environment
,
@
required
BuildSystem
buildSystem
,
required
Environment
environment
,
required
BuildSystem
buildSystem
,
})
async
{
assert
(
environment
!=
null
);
assert
(
buildSystem
!=
null
);
...
...
@@ -42,7 +39,7 @@ Future<void> generateLocalizationsSyntheticPackage({
// it.
if
(
yamlNode
.
value
!=
null
)
{
final
YamlMap
yamlMap
=
yamlNode
as
YamlMap
;
final
Object
value
=
yamlMap
[
'synthetic-package'
];
final
Object
?
value
=
yamlMap
[
'synthetic-package'
];
if
(
value
is
!
bool
&&
value
!=
null
)
{
throwToolExit
(
'Expected "synthetic-package" to have a bool value, '
...
...
@@ -52,8 +49,8 @@ Future<void> generateLocalizationsSyntheticPackage({
// Generate gen_l10n synthetic package only if synthetic-package: true or
// synthetic-package is null.
final
bool
isSyntheticL10nPackage
=
value
as
bool
??
true
;
if
(
!
isSyntheticL10nPackag
e
)
{
final
bool
?
isSyntheticL10nPackage
=
value
as
bool
?
;
if
(
isSyntheticL10nPackage
==
fals
e
)
{
return
;
}
}
...
...
@@ -70,7 +67,7 @@ Future<void> generateLocalizationsSyntheticPackage({
throwToolExit
(
'Generating synthetic localizations package failed with
${result.exceptions.length}
${pluralize('error', result.exceptions.length)}
:'
'
\n\n
'
'
${result.exceptions.values.map<Object>((ExceptionMeasurement e) => e.exception).join('\n\n')}
'
,
'
${result.exceptions.values.map<Object
?
>((ExceptionMeasurement e) => e.exception).join('\n\n')}
'
,
);
}
}
packages/flutter_tools/test/general.shard/build_system/targets/localizations_test.dart
View file @
2bf0627d
...
...
@@ -2,9 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.8
import
'package:file/memory.dart'
;
import
'package:flutter_tools/src/artifacts.dart'
;
import
'package:flutter_tools/src/base/file_system.dart'
;
import
'package:flutter_tools/src/base/logger.dart'
;
import
'package:flutter_tools/src/build_system/build_system.dart'
;
...
...
@@ -19,7 +18,7 @@ void main() {
final
FileSystem
fileSystem
=
MemoryFileSystem
.
test
();
final
Environment
environment
=
Environment
.
test
(
fileSystem
.
currentDirectory
,
artifacts:
null
,
artifacts:
Artifacts
.
test
()
,
fileSystem:
fileSystem
,
logger:
BufferLogger
.
test
(),
processManager:
FakeProcessManager
.
any
(),
...
...
packages/flutter_tools/test/general.shard/dart/generate_synthetic_packages_test.dart
View file @
2bf0627d
...
...
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.8
import
'dart:async'
;
...
...
@@ -45,7 +44,7 @@ void main() {
);
final
Completer
<
void
>
completer
=
Completer
<
void
>();
final
BuildResult
exception
=
BuildResult
(
success:
false
,
exceptions:
<
String
,
ExceptionMeasurement
>{
'hello'
:
ExceptionMeasurement
(
'hello'
,
const
FormatException
(
'illegal character in input string'
),
null
),
'hello'
:
ExceptionMeasurement
(
'hello'
,
const
FormatException
(
'illegal character in input string'
),
StackTrace
.
current
),
});
final
TestBuildSystem
buildSystem
=
TestBuildSystem
.
all
(
exception
,
(
Target
target
,
Environment
environment
)
{
expect
(
target
,
const
GenerateLocalizationsTarget
());
...
...
@@ -94,7 +93,7 @@ void main() {
);
final
Completer
<
void
>
completer
=
Completer
<
void
>();
final
BuildResult
exception
=
BuildResult
(
success:
false
,
exceptions:
<
String
,
ExceptionMeasurement
>{
'hello'
:
ExceptionMeasurement
(
'hello'
,
const
FormatException
(
'illegal character in input string'
),
null
),
'hello'
:
ExceptionMeasurement
(
'hello'
,
const
FormatException
(
'illegal character in input string'
),
StackTrace
.
current
),
});
final
TestBuildSystem
buildSystem
=
TestBuildSystem
.
all
(
exception
,
(
Target
target
,
Environment
environment
)
{
expect
(
target
,
const
GenerateLocalizationsTarget
());
...
...
@@ -141,7 +140,7 @@ void main() {
);
final
Completer
<
void
>
completer
=
Completer
<
void
>();
final
BuildResult
exception
=
BuildResult
(
success:
false
,
exceptions:
<
String
,
ExceptionMeasurement
>{
'hello'
:
ExceptionMeasurement
(
'hello'
,
const
FormatException
(
'illegal character in input string'
),
null
),
'hello'
:
ExceptionMeasurement
(
'hello'
,
const
FormatException
(
'illegal character in input string'
),
StackTrace
.
current
),
});
final
TestBuildSystem
buildSystem
=
TestBuildSystem
.
all
(
exception
,
(
Target
target
,
Environment
environment
)
{
expect
(
target
,
const
GenerateLocalizationsTarget
());
...
...
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