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
3056f419
Unverified
Commit
3056f419
authored
Oct 29, 2020
by
Angjie Li
Committed by
GitHub
Oct 29, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix issue with --web-renderer. (#69319)
parent
2fa03438
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
58 additions
and
14 deletions
+58
-14
devfs_web.dart
packages/flutter_tools/lib/src/isolated/devfs_web.dart
+1
-1
flutter_command.dart
packages/flutter_tools/lib/src/runner/flutter_command.dart
+10
-7
run_test.dart
.../flutter_tools/test/commands.shard/hermetic/run_test.dart
+41
-0
devfs_web_test.dart
.../flutter_tools/test/general.shard/web/devfs_web_test.dart
+6
-6
No files found.
packages/flutter_tools/lib/src/isolated/devfs_web.dart
View file @
3056f419
...
...
@@ -814,7 +814,7 @@ class WebDevFS implements DevFS {
webAssetServer
.
webRenderer
=
WebRendererMode
.
autoDetect
;
}
else
if
(
buildInfo
.
dartDefines
.
contains
(
'FLUTTER_WEB_USE_SKIA=true'
))
{
webAssetServer
.
webRenderer
=
WebRendererMode
.
canvaskit
;
}
}
if
(
hostname
==
'any'
)
{
_baseUri
=
Uri
.
http
(
'localhost:
$port
'
,
''
);
}
else
{
...
...
packages/flutter_tools/lib/src/runner/flutter_command.dart
View file @
3056f419
...
...
@@ -838,12 +838,12 @@ abstract class FlutterCommand extends Command<void> {
?
stringArg
(
FlutterOptions
.
kPerformanceMeasurementFile
)
:
null
;
final
List
<
String
>
dartDefines
=
argParser
.
options
.
containsKey
(
FlutterOptions
.
kDartDefinesOption
)
List
<
String
>
dartDefines
=
argParser
.
options
.
containsKey
(
FlutterOptions
.
kDartDefinesOption
)
?
stringsArg
(
FlutterOptions
.
kDartDefinesOption
)
:
<
String
>[];
if
(
argParser
.
options
.
containsKey
(
'web-renderer'
)
&&
argResults
.
wasParsed
(
'web-renderer'
))
{
_
updateDartDefines
(
dartDefines
,
stringArg
(
'web-renderer'
));
dartDefines
=
updateDartDefines
(
dartDefines
,
stringArg
(
'web-renderer'
));
}
return
BuildInfo
(
buildMode
,
...
...
@@ -944,12 +944,15 @@ abstract class FlutterCommand extends Command<void> {
}
/// Updates dart-defines based on [webRenderer].
void
_updateDartDefines
(
List
<
String
>
dartDefines
,
String
webRenderer
)
{
if
(
dartDefines
.
any
((
String
d
)
=>
d
.
startsWith
(
'FLUTTER_WEB_USE_SKIA='
)))
{
throwToolExit
(
'Only one of "--web-renderer" and '
'"--dart-defines=FLUTTER_WEB_USE_SKIA" may be specified.'
);
@visibleForTesting
static
List
<
String
>
updateDartDefines
(
List
<
String
>
dartDefines
,
String
webRenderer
)
{
final
Set
<
String
>
dartDefinesSet
=
dartDefines
.
toSet
();
if
(!
dartDefines
.
any
((
String
d
)
=>
d
.
startsWith
(
'FLUTTER_WEB_AUTO_DETECT='
))
&&
dartDefines
.
any
((
String
d
)
=>
d
.
startsWith
(
'FLUTTER_WEB_USE_SKIA='
)))
{
dartDefinesSet
.
removeWhere
((
String
d
)
=>
d
.
startsWith
(
'FLUTTER_WEB_USE_SKIA='
));
}
dartDefines
.
addAll
(
_webRendererDartDefines
[
webRenderer
]);
dartDefinesSet
.
addAll
(
_webRendererDartDefines
[
webRenderer
]);
return
dartDefinesSet
.
toList
();
}
void
_registerSignalHandlers
(
String
commandPath
,
DateTime
startTime
)
{
...
...
packages/flutter_tools/test/commands.shard/hermetic/run_test.dart
View file @
3056f419
...
...
@@ -505,6 +505,47 @@ void main() {
DeviceManager:
()
=>
mockDeviceManager
,
});
});
group
(
'dart-defines and web-renderer options'
,
()
{
List
<
String
>
dartDefines
;
setUp
(()
{
dartDefines
=
<
String
>[];
});
test
(
'auto web-renderer with no dart-defines'
,
()
{
dartDefines
=
FlutterCommand
.
updateDartDefines
(
dartDefines
,
'auto'
);
expect
(
dartDefines
,
<
String
>[
'FLUTTER_WEB_AUTO_DETECT=true'
]);
});
test
(
'canvaskit web-renderer with no dart-defines'
,
()
{
dartDefines
=
FlutterCommand
.
updateDartDefines
(
dartDefines
,
'canvaskit'
);
expect
(
dartDefines
,
<
String
>[
'FLUTTER_WEB_AUTO_DETECT=false'
,
'FLUTTER_WEB_USE_SKIA=true'
]);
});
test
(
'html web-renderer with no dart-defines'
,
()
{
dartDefines
=
FlutterCommand
.
updateDartDefines
(
dartDefines
,
'html'
);
expect
(
dartDefines
,
<
String
>[
'FLUTTER_WEB_AUTO_DETECT=false'
,
'FLUTTER_WEB_USE_SKIA=false'
]);
});
test
(
'auto web-renderer with existing dart-defines'
,
()
{
dartDefines
=
<
String
>[
'FLUTTER_WEB_USE_SKIA=false'
];
dartDefines
=
FlutterCommand
.
updateDartDefines
(
dartDefines
,
'auto'
);
expect
(
dartDefines
,
<
String
>[
'FLUTTER_WEB_AUTO_DETECT=true'
]);
});
test
(
'canvaskit web-renderer with no dart-defines'
,
()
{
dartDefines
=
<
String
>[
'FLUTTER_WEB_USE_SKIA=false'
];
dartDefines
=
FlutterCommand
.
updateDartDefines
(
dartDefines
,
'canvaskit'
);
expect
(
dartDefines
,
<
String
>[
'FLUTTER_WEB_AUTO_DETECT=false'
,
'FLUTTER_WEB_USE_SKIA=true'
]);
});
test
(
'html web-renderer with no dart-defines'
,
()
{
dartDefines
=
<
String
>[
'FLUTTER_WEB_USE_SKIA=true'
];
dartDefines
=
FlutterCommand
.
updateDartDefines
(
dartDefines
,
'html'
);
expect
(
dartDefines
,
<
String
>[
'FLUTTER_WEB_AUTO_DETECT=false'
,
'FLUTTER_WEB_USE_SKIA=false'
]);
});
});
}
class
MockCache
extends
Mock
implements
Cache
{}
...
...
packages/flutter_tools/test/general.shard/web/devfs_web_test.dart
View file @
3056f419
...
...
@@ -942,12 +942,12 @@ void main() {
useSseForDebugBackend:
true
,
nullAssertions:
true
,
buildInfo:
const
BuildInfo
(
BuildMode
.
debug
,
''
,
treeShakeIcons:
false
,
dartDefines:
<
String
>[
'FLUTTER_WEB_AUTO_DETECT=true'
,
]
BuildMode
.
debug
,
''
,
treeShakeIcons:
false
,
dartDefines:
<
String
>[
'FLUTTER_WEB_AUTO_DETECT=true'
,
]
),
enableDwds:
false
,
entrypoint:
Uri
.
base
,
...
...
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