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
f3d182f4
Unverified
Commit
f3d182f4
authored
Aug 09, 2022
by
Dillon Nys
Committed by
GitHub
Aug 09, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_tools] Fix tool crash for map cast (#107648)
parent
9e2ef76b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
2 deletions
+49
-2
localizations.dart
...ter_tools/lib/src/build_system/targets/localizations.dart
+2
-2
pub_get_test.dart
...tter_tools/test/commands.shard/hermetic/pub_get_test.dart
+47
-0
No files found.
packages/flutter_tools/lib/src/build_system/targets/localizations.dart
View file @
f3d182f4
...
...
@@ -61,9 +61,9 @@ class GenerateLocalizationsTarget extends Target {
fileSystem:
environment
.
fileSystem
,
);
final
Map
<
String
,
Object
>
dependencies
=
json
.
decode
(
final
Map
<
String
,
Object
?
>
dependencies
=
json
.
decode
(
environment
.
buildDir
.
childFile
(
_kDependenciesFileName
).
readAsStringSync
()
)
as
Map
<
String
,
Object
>;
)
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
(
...
...
packages/flutter_tools/test/commands.shard/hermetic/pub_get_test.dart
View file @
f3d182f4
...
...
@@ -10,6 +10,7 @@ import 'package:flutter_tools/src/commands/packages.dart';
import
'package:flutter_tools/src/dart/pub.dart'
;
import
'package:flutter_tools/src/project.dart'
;
import
'package:flutter_tools/src/reporting/reporting.dart'
;
import
'package:flutter_tools/src/runner/flutter_command.dart'
;
import
'package:test/fake.dart'
;
import
'../../src/context.dart'
;
...
...
@@ -112,6 +113,52 @@ void main() {
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
FileSystem:
()
=>
fileSystem
,
});
testUsingContext
(
'pub get triggers localizations generation when generate: true'
,
()
async
{
final
File
pubspecFile
=
fileSystem
.
currentDirectory
.
childFile
(
'pubspec.yaml'
)
..
createSync
();
pubspecFile
.
writeAsStringSync
(
'''
flutter:
generate: true
'''
);
fileSystem
.
currentDirectory
.
childFile
(
'l10n.yaml'
)
..
createSync
()
..
writeAsStringSync
(
'''
arb-dir: lib/l10n
'''
);
final
File
arbFile
=
fileSystem
.
file
(
fileSystem
.
path
.
join
(
'lib'
,
'l10n'
,
'app_en.arb'
))
..
createSync
(
recursive:
true
);
arbFile
.
writeAsStringSync
(
'''
{
"helloWorld": "Hello, World!",
"@helloWorld": {
"description": "Sample description"
}
}
'''
);
final
PackagesGetCommand
command
=
PackagesGetCommand
(
'get'
,
false
);
final
CommandRunner
<
void
>
commandRunner
=
createTestCommandRunner
(
command
);
await
commandRunner
.
run
(<
String
>[
'get'
]);
final
FlutterCommandResult
result
=
await
command
.
runCommand
();
expect
(
result
.
exitStatus
,
ExitStatus
.
success
);
final
Directory
outputDirectory
=
fileSystem
.
directory
(
fileSystem
.
path
.
join
(
'.dart_tool'
,
'flutter_gen'
,
'gen_l10n'
));
expect
(
outputDirectory
.
existsSync
(),
true
);
expect
(
outputDirectory
.
childFile
(
'app_localizations_en.dart'
).
existsSync
(),
true
);
expect
(
outputDirectory
.
childFile
(
'app_localizations.dart'
).
existsSync
(),
true
);
},
overrides:
<
Type
,
Generator
>{
Pub:
()
=>
pub
,
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
FileSystem:
()
=>
fileSystem
,
});
}
class
FakePub
extends
Fake
implements
Pub
{
...
...
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