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
895879c1
Unverified
Commit
895879c1
authored
Apr 12, 2023
by
Kevin Moore
Committed by
GitHub
Apr 12, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
flutter_tools: Flutter Web CLI cleanup (#124564)
flutter_tools: Flutter Web CLI cleanup
parent
328635b3
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
71 additions
and
80 deletions
+71
-80
build_info.dart
packages/flutter_tools/lib/src/build_info.dart
+1
-1
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
+6
-47
compile.dart
packages/flutter_tools/lib/src/web/compile.dart
+36
-4
run_test.dart
.../flutter_tools/test/commands.shard/hermetic/run_test.dart
+2
-2
web_test.dart
...ols/test/general.shard/build_system/targets/web_test.dart
+23
-23
compile_web_test.dart
...lutter_tools/test/general.shard/web/compile_web_test.dart
+1
-1
devfs_web_test.dart
.../flutter_tools/test/general.shard/web/devfs_web_test.dart
+1
-1
No files found.
packages/flutter_tools/lib/src/build_info.dart
View file @
895879c1
...
@@ -35,7 +35,7 @@ class BuildInfo {
...
@@ -35,7 +35,7 @@ class BuildInfo {
List
<
String
>?
dartDefines
,
List
<
String
>?
dartDefines
,
this
.
bundleSkSLPath
,
this
.
bundleSkSLPath
,
List
<
String
>?
dartExperiments
,
List
<
String
>?
dartExperiments
,
this
.
webRenderer
=
WebRendererMode
.
auto
Detect
,
this
.
webRenderer
=
WebRendererMode
.
auto
,
required
this
.
treeShakeIcons
,
required
this
.
treeShakeIcons
,
this
.
performanceMeasurementFile
,
this
.
performanceMeasurementFile
,
this
.
dartDefineConfigJsonMap
,
this
.
dartDefineConfigJsonMap
,
...
...
packages/flutter_tools/lib/src/isolated/devfs_web.dart
View file @
895879c1
...
@@ -778,7 +778,7 @@ class WebDevFS implements DevFS {
...
@@ -778,7 +778,7 @@ class WebDevFS implements DevFS {
final
int
selectedPort
=
webAssetServer
.
selectedPort
;
final
int
selectedPort
=
webAssetServer
.
selectedPort
;
if
(
buildInfo
.
dartDefines
.
contains
(
'FLUTTER_WEB_AUTO_DETECT=true'
))
{
if
(
buildInfo
.
dartDefines
.
contains
(
'FLUTTER_WEB_AUTO_DETECT=true'
))
{
webAssetServer
.
webRenderer
=
WebRendererMode
.
auto
Detect
;
webAssetServer
.
webRenderer
=
WebRendererMode
.
auto
;
}
else
if
(
buildInfo
.
dartDefines
.
contains
(
'FLUTTER_WEB_USE_SKIA=true'
))
{
}
else
if
(
buildInfo
.
dartDefines
.
contains
(
'FLUTTER_WEB_USE_SKIA=true'
))
{
webAssetServer
.
webRenderer
=
WebRendererMode
.
canvaskit
;
webAssetServer
.
webRenderer
=
WebRendererMode
.
canvaskit
;
}
}
...
...
packages/flutter_tools/lib/src/runner/flutter_command.dart
View file @
895879c1
...
@@ -157,36 +157,6 @@ abstract class FlutterCommand extends Command<void> {
...
@@ -157,36 +157,6 @@ abstract class FlutterCommand extends Command<void> {
/// The flag name for whether or not to use ipv6.
/// The flag name for whether or not to use ipv6.
static
const
String
ipv6Flag
=
'ipv6'
;
static
const
String
ipv6Flag
=
'ipv6'
;
/// Maps command line web renderer strings to the corresponding web renderer mode
static
const
Map
<
String
,
WebRendererMode
>
_webRendererModeMap
=
<
String
,
WebRendererMode
>
{
'auto'
:
WebRendererMode
.
autoDetect
,
'canvaskit'
:
WebRendererMode
.
canvaskit
,
'html'
:
WebRendererMode
.
html
,
'skwasm'
:
WebRendererMode
.
skwasm
,
};
/// The map used to convert web renderer mode to a List of dart-defines.
static
const
Map
<
WebRendererMode
,
Iterable
<
String
>>
_webRendererDartDefines
=
<
WebRendererMode
,
Iterable
<
String
>>
{
WebRendererMode
.
autoDetect
:
<
String
>[
'FLUTTER_WEB_AUTO_DETECT=true'
,
],
WebRendererMode
.
canvaskit
:
<
String
>[
'FLUTTER_WEB_AUTO_DETECT=false'
,
'FLUTTER_WEB_USE_SKIA=true'
,
],
WebRendererMode
.
html
:
<
String
>[
'FLUTTER_WEB_AUTO_DETECT=false'
,
'FLUTTER_WEB_USE_SKIA=false'
,
],
WebRendererMode
.
skwasm
:
<
String
>[
'FLUTTER_WEB_AUTO_DETECT=false'
,
'FLUTTER_WEB_USE_SKIA=false'
,
'FLUTTER_WEB_USE_SKWASM=true'
,
]
};
@override
@override
ArgParser
get
argParser
=>
_argParser
;
ArgParser
get
argParser
=>
_argParser
;
final
ArgParser
_argParser
=
ArgParser
(
final
ArgParser
_argParser
=
ArgParser
(
...
@@ -668,15 +638,10 @@ abstract class FlutterCommand extends Command<void> {
...
@@ -668,15 +638,10 @@ abstract class FlutterCommand extends Command<void> {
void
usesWebRendererOption
()
{
void
usesWebRendererOption
()
{
argParser
.
addOption
(
argParser
.
addOption
(
FlutterOptions
.
kWebRendererFlag
,
FlutterOptions
.
kWebRendererFlag
,
defaultsTo:
'auto'
,
defaultsTo:
WebRendererMode
.
auto
.
name
,
allowed:
<
String
>[
'auto'
,
'canvaskit'
,
'html'
,
'skwasm'
]
,
allowed:
WebRendererMode
.
values
.
map
((
WebRendererMode
e
)
=>
e
.
name
)
,
help:
'The renderer implementation to use when building for the web.'
,
help:
'The renderer implementation to use when building for the web.'
,
allowedHelp:
<
String
,
String
>{
allowedHelp:
Map
<
String
,
String
>.
fromEntries
(
WebRendererMode
.
values
.
map
((
WebRendererMode
e
)
=>
MapEntry
<
String
,
String
>(
e
.
name
,
e
.
helpText
)))
'html'
:
'Always use the HTML renderer. This renderer uses a combination of HTML, CSS, SVG, 2D Canvas, and WebGL.'
,
'canvaskit'
:
'Always use the CanvasKit renderer. This renderer uses WebGL and WebAssembly to render graphics.'
,
'auto'
:
'Use the HTML renderer on mobile devices, and CanvasKit on desktop devices.'
,
'skwasm'
:
'Always use the experimental skwasm renderer.'
,
}
);
);
}
}
...
@@ -1236,12 +1201,9 @@ abstract class FlutterCommand extends Command<void> {
...
@@ -1236,12 +1201,9 @@ abstract class FlutterCommand extends Command<void> {
final
Map
<
String
,
Object
>?
defineConfigJsonMap
=
extractDartDefineConfigJsonMap
();
final
Map
<
String
,
Object
>?
defineConfigJsonMap
=
extractDartDefineConfigJsonMap
();
List
<
String
>
dartDefines
=
extractDartDefines
(
defineConfigJsonMap:
defineConfigJsonMap
);
List
<
String
>
dartDefines
=
extractDartDefines
(
defineConfigJsonMap:
defineConfigJsonMap
);
WebRendererMode
webRenderer
=
WebRendererMode
.
auto
Detect
;
WebRendererMode
webRenderer
=
WebRendererMode
.
auto
;
if
(
argParser
.
options
.
containsKey
(
FlutterOptions
.
kWebRendererFlag
))
{
if
(
argParser
.
options
.
containsKey
(
FlutterOptions
.
kWebRendererFlag
))
{
final
WebRendererMode
?
mappedMode
=
_webRendererModeMap
[
stringArg
(
FlutterOptions
.
kWebRendererFlag
)!];
webRenderer
=
WebRendererMode
.
values
.
byName
(
stringArg
(
FlutterOptions
.
kWebRendererFlag
)!);
if
(
mappedMode
!=
null
)
{
webRenderer
=
mappedMode
;
}
dartDefines
=
updateDartDefines
(
dartDefines
,
webRenderer
);
dartDefines
=
updateDartDefines
(
dartDefines
,
webRenderer
);
}
}
...
@@ -1427,10 +1389,7 @@ abstract class FlutterCommand extends Command<void> {
...
@@ -1427,10 +1389,7 @@ abstract class FlutterCommand extends Command<void> {
&&
dartDefines
.
any
((
String
d
)
=>
d
.
startsWith
(
'FLUTTER_WEB_USE_SKIA='
)))
{
&&
dartDefines
.
any
((
String
d
)
=>
d
.
startsWith
(
'FLUTTER_WEB_USE_SKIA='
)))
{
dartDefinesSet
.
removeWhere
((
String
d
)
=>
d
.
startsWith
(
'FLUTTER_WEB_USE_SKIA='
));
dartDefinesSet
.
removeWhere
((
String
d
)
=>
d
.
startsWith
(
'FLUTTER_WEB_USE_SKIA='
));
}
}
final
Iterable
<
String
>?
webRendererDefine
=
_webRendererDartDefines
[
webRenderer
];
dartDefinesSet
.
addAll
(
webRenderer
.
dartDefines
);
if
(
webRendererDefine
!=
null
)
{
dartDefinesSet
.
addAll
(
webRendererDefine
);
}
return
dartDefinesSet
.
toList
();
return
dartDefinesSet
.
toList
();
}
}
...
...
packages/flutter_tools/lib/src/web/compile.dart
View file @
895879c1
...
@@ -135,18 +135,50 @@ class WebBuilder {
...
@@ -135,18 +135,50 @@ class WebBuilder {
/// Web rendering backend mode.
/// Web rendering backend mode.
enum
WebRendererMode
{
enum
WebRendererMode
{
/// Auto detects which rendering backend to use.
/// Auto detects which rendering backend to use.
autoDetect
,
auto
,
/// Always uses canvaskit.
/// Always uses canvaskit.
canvaskit
,
canvaskit
,
/// Always uses html.
/// Always uses html.
html
,
html
,
/// Always use skwasm.
/// Always use skwasm.
skwasm
,
skwasm
;
String
get
helpText
=>
switch
(
this
)
{
auto
=>
'Use the HTML renderer on mobile devices, and CanvasKit on desktop devices.'
,
canvaskit
=>
'Always use the CanvasKit renderer. This renderer uses WebGL and WebAssembly to render graphics.'
,
html
=>
'Always use the HTML renderer. This renderer uses a combination of HTML, CSS, SVG, 2D Canvas, and WebGL.'
,
skwasm
=>
'Always use the experimental skwasm renderer.'
};
Iterable
<
String
>
get
dartDefines
=>
switch
(
this
)
{
WebRendererMode
.
auto
=>
<
String
>[
'FLUTTER_WEB_AUTO_DETECT=true'
,
],
WebRendererMode
.
canvaskit
=>
<
String
>[
'FLUTTER_WEB_AUTO_DETECT=false'
,
'FLUTTER_WEB_USE_SKIA=true'
,
],
WebRendererMode
.
html
=>
<
String
>[
'FLUTTER_WEB_AUTO_DETECT=false'
,
'FLUTTER_WEB_USE_SKIA=false'
,
],
WebRendererMode
.
skwasm
=>
<
String
>[
'FLUTTER_WEB_AUTO_DETECT=false'
,
'FLUTTER_WEB_USE_SKIA=false'
,
'FLUTTER_WEB_USE_SKWASM=true'
,
]
};
}
}
/// The correct precompiled artifact to use for each build and render mode.
/// The correct precompiled artifact to use for each build and render mode.
const
Map
<
WebRendererMode
,
Map
<
NullSafetyMode
,
HostArtifact
>>
kDartSdkJsArtifactMap
=
<
WebRendererMode
,
Map
<
NullSafetyMode
,
HostArtifact
>>{
const
Map
<
WebRendererMode
,
Map
<
NullSafetyMode
,
HostArtifact
>>
kDartSdkJsArtifactMap
=
<
WebRendererMode
,
Map
<
NullSafetyMode
,
HostArtifact
>>{
WebRendererMode
.
auto
Detect
:
<
NullSafetyMode
,
HostArtifact
>
{
WebRendererMode
.
auto
:
<
NullSafetyMode
,
HostArtifact
>
{
NullSafetyMode
.
sound
:
HostArtifact
.
webPrecompiledCanvaskitAndHtmlSoundSdk
,
NullSafetyMode
.
sound
:
HostArtifact
.
webPrecompiledCanvaskitAndHtmlSoundSdk
,
NullSafetyMode
.
unsound
:
HostArtifact
.
webPrecompiledCanvaskitAndHtmlSdk
,
NullSafetyMode
.
unsound
:
HostArtifact
.
webPrecompiledCanvaskitAndHtmlSdk
,
},
},
...
@@ -162,7 +194,7 @@ const Map<WebRendererMode, Map<NullSafetyMode, HostArtifact>> kDartSdkJsArtifact
...
@@ -162,7 +194,7 @@ const Map<WebRendererMode, Map<NullSafetyMode, HostArtifact>> kDartSdkJsArtifact
/// The correct source map artifact to use for each build and render mode.
/// The correct source map artifact to use for each build and render mode.
const
Map
<
WebRendererMode
,
Map
<
NullSafetyMode
,
HostArtifact
>>
kDartSdkJsMapArtifactMap
=
<
WebRendererMode
,
Map
<
NullSafetyMode
,
HostArtifact
>>{
const
Map
<
WebRendererMode
,
Map
<
NullSafetyMode
,
HostArtifact
>>
kDartSdkJsMapArtifactMap
=
<
WebRendererMode
,
Map
<
NullSafetyMode
,
HostArtifact
>>{
WebRendererMode
.
auto
Detect
:
<
NullSafetyMode
,
HostArtifact
>
{
WebRendererMode
.
auto
:
<
NullSafetyMode
,
HostArtifact
>
{
NullSafetyMode
.
sound
:
HostArtifact
.
webPrecompiledCanvaskitAndHtmlSoundSdkSourcemaps
,
NullSafetyMode
.
sound
:
HostArtifact
.
webPrecompiledCanvaskitAndHtmlSoundSdkSourcemaps
,
NullSafetyMode
.
unsound
:
HostArtifact
.
webPrecompiledCanvaskitAndHtmlSdkSourcemaps
,
NullSafetyMode
.
unsound
:
HostArtifact
.
webPrecompiledCanvaskitAndHtmlSdkSourcemaps
,
},
},
...
...
packages/flutter_tools/test/commands.shard/hermetic/run_test.dart
View file @
895879c1
...
@@ -929,7 +929,7 @@ void main() {
...
@@ -929,7 +929,7 @@ void main() {
});
});
test
(
'auto web-renderer with no dart-defines'
,
()
{
test
(
'auto web-renderer with no dart-defines'
,
()
{
dartDefines
=
FlutterCommand
.
updateDartDefines
(
dartDefines
,
WebRendererMode
.
auto
Detect
);
dartDefines
=
FlutterCommand
.
updateDartDefines
(
dartDefines
,
WebRendererMode
.
auto
);
expect
(
dartDefines
,
<
String
>[
'FLUTTER_WEB_AUTO_DETECT=true'
]);
expect
(
dartDefines
,
<
String
>[
'FLUTTER_WEB_AUTO_DETECT=true'
]);
});
});
...
@@ -945,7 +945,7 @@ void main() {
...
@@ -945,7 +945,7 @@ void main() {
test
(
'auto web-renderer with existing dart-defines'
,
()
{
test
(
'auto web-renderer with existing dart-defines'
,
()
{
dartDefines
=
<
String
>[
'FLUTTER_WEB_USE_SKIA=false'
];
dartDefines
=
<
String
>[
'FLUTTER_WEB_USE_SKIA=false'
];
dartDefines
=
FlutterCommand
.
updateDartDefines
(
dartDefines
,
WebRendererMode
.
auto
Detect
);
dartDefines
=
FlutterCommand
.
updateDartDefines
(
dartDefines
,
WebRendererMode
.
auto
);
expect
(
dartDefines
,
<
String
>[
'FLUTTER_WEB_AUTO_DETECT=true'
]);
expect
(
dartDefines
,
<
String
>[
'FLUTTER_WEB_AUTO_DETECT=true'
]);
});
});
...
...
packages/flutter_tools/test/general.shard/build_system/targets/web_test.dart
View file @
895879c1
...
@@ -101,7 +101,7 @@ void main() {
...
@@ -101,7 +101,7 @@ void main() {
webResources
.
childFile
(
'index.html'
)
webResources
.
childFile
(
'index.html'
)
.
createSync
(
recursive:
true
);
.
createSync
(
recursive:
true
);
environment
.
buildDir
.
childFile
(
'main.dart.js'
).
createSync
();
environment
.
buildDir
.
childFile
(
'main.dart.js'
).
createSync
();
await
const
WebReleaseBundle
(
WebRendererMode
.
auto
Detect
,
isWasm:
false
).
build
(
environment
);
await
const
WebReleaseBundle
(
WebRendererMode
.
auto
,
isWasm:
false
).
build
(
environment
);
expect
(
environment
.
outputDir
.
childFile
(
'version.json'
),
exists
);
expect
(
environment
.
outputDir
.
childFile
(
'version.json'
),
exists
);
}));
}));
...
@@ -113,7 +113,7 @@ void main() {
...
@@ -113,7 +113,7 @@ void main() {
final
Directory
webResources
=
environment
.
projectDir
.
childDirectory
(
'web'
);
final
Directory
webResources
=
environment
.
projectDir
.
childDirectory
(
'web'
);
webResources
.
childFile
(
'index.html'
).
createSync
(
recursive:
true
);
webResources
.
childFile
(
'index.html'
).
createSync
(
recursive:
true
);
environment
.
buildDir
.
childFile
(
'main.dart.js'
).
createSync
();
environment
.
buildDir
.
childFile
(
'main.dart.js'
).
createSync
();
await
const
WebReleaseBundle
(
WebRendererMode
.
auto
Detect
,
isWasm:
false
).
build
(
environment
);
await
const
WebReleaseBundle
(
WebRendererMode
.
auto
,
isWasm:
false
).
build
(
environment
);
final
String
versionFile
=
environment
.
outputDir
final
String
versionFile
=
environment
.
outputDir
.
childFile
(
'version.json'
)
.
childFile
(
'version.json'
)
...
@@ -131,7 +131,7 @@ void main() {
...
@@ -131,7 +131,7 @@ void main() {
<!DOCTYPE html><html><base href="
$kBaseHrefPlaceholder
"><head></head></html>
<!DOCTYPE html><html><base href="
$kBaseHrefPlaceholder
"><head></head></html>
'''
);
'''
);
environment
.
buildDir
.
childFile
(
'main.dart.js'
).
createSync
();
environment
.
buildDir
.
childFile
(
'main.dart.js'
).
createSync
();
await
const
WebReleaseBundle
(
WebRendererMode
.
auto
Detect
,
isWasm:
false
).
build
(
environment
);
await
const
WebReleaseBundle
(
WebRendererMode
.
auto
,
isWasm:
false
).
build
(
environment
);
expect
(
environment
.
outputDir
.
childFile
(
'index.html'
).
readAsStringSync
(),
contains
(
'/basehreftest/'
));
expect
(
environment
.
outputDir
.
childFile
(
'index.html'
).
readAsStringSync
(),
contains
(
'/basehreftest/'
));
}));
}));
...
@@ -144,7 +144,7 @@ void main() {
...
@@ -144,7 +144,7 @@ void main() {
<!DOCTYPE html><html><head><base href='
/
basehreftest
/
'></head></html>
<!DOCTYPE html><html><head><base href='
/
basehreftest
/
'></head></html>
'''
);
'''
);
environment
.
buildDir
.
childFile
(
'main.dart.js'
).
createSync
();
environment
.
buildDir
.
childFile
(
'main.dart.js'
).
createSync
();
await
const
WebReleaseBundle
(
WebRendererMode
.
auto
Detect
,
isWasm:
false
).
build
(
environment
);
await
const
WebReleaseBundle
(
WebRendererMode
.
auto
,
isWasm:
false
).
build
(
environment
);
expect
(
environment
.
outputDir
.
childFile
(
'index.html'
).
readAsStringSync
(),
contains
(
'/basehreftest/'
));
expect
(
environment
.
outputDir
.
childFile
(
'index.html'
).
readAsStringSync
(),
contains
(
'/basehreftest/'
));
}));
}));
...
@@ -166,7 +166,7 @@ void main() {
...
@@ -166,7 +166,7 @@ void main() {
.
writeAsStringSync
(
'A'
);
.
writeAsStringSync
(
'A'
);
environment
.
buildDir
.
childFile
(
'main.dart.js'
).
createSync
();
environment
.
buildDir
.
childFile
(
'main.dart.js'
).
createSync
();
await
const
WebReleaseBundle
(
WebRendererMode
.
auto
Detect
,
isWasm:
false
).
build
(
environment
);
await
const
WebReleaseBundle
(
WebRendererMode
.
auto
,
isWasm:
false
).
build
(
environment
);
expect
(
environment
.
outputDir
.
childFile
(
'foo.txt'
)
expect
(
environment
.
outputDir
.
childFile
(
'foo.txt'
)
.
readAsStringSync
(),
'A'
);
.
readAsStringSync
(),
'A'
);
...
@@ -178,7 +178,7 @@ void main() {
...
@@ -178,7 +178,7 @@ void main() {
// Update to arbitrary resource file triggers rebuild.
// Update to arbitrary resource file triggers rebuild.
webResources
.
childFile
(
'foo.txt'
).
writeAsStringSync
(
'B'
);
webResources
.
childFile
(
'foo.txt'
).
writeAsStringSync
(
'B'
);
await
const
WebReleaseBundle
(
WebRendererMode
.
auto
Detect
,
isWasm:
false
).
build
(
environment
);
await
const
WebReleaseBundle
(
WebRendererMode
.
auto
,
isWasm:
false
).
build
(
environment
);
expect
(
environment
.
outputDir
.
childFile
(
'foo.txt'
)
expect
(
environment
.
outputDir
.
childFile
(
'foo.txt'
)
.
readAsStringSync
(),
'B'
);
.
readAsStringSync
(),
'B'
);
...
@@ -361,7 +361,7 @@ void main() {
...
@@ -361,7 +361,7 @@ void main() {
]
]
));
));
await
Dart2JSTarget
(
WebRendererMode
.
auto
Detect
).
build
(
environment
);
await
Dart2JSTarget
(
WebRendererMode
.
auto
).
build
(
environment
);
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
ProcessManager:
()
=>
processManager
,
ProcessManager:
()
=>
processManager
,
}));
}));
...
@@ -401,7 +401,7 @@ void main() {
...
@@ -401,7 +401,7 @@ void main() {
]
]
));
));
await
Dart2JSTarget
(
WebRendererMode
.
auto
Detect
).
build
(
environment
);
await
Dart2JSTarget
(
WebRendererMode
.
auto
).
build
(
environment
);
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
ProcessManager:
()
=>
processManager
,
ProcessManager:
()
=>
processManager
,
}));
}));
...
@@ -437,7 +437,7 @@ void main() {
...
@@ -437,7 +437,7 @@ void main() {
]
]
));
));
await
Dart2JSTarget
(
WebRendererMode
.
auto
Detect
).
build
(
environment
);
await
Dart2JSTarget
(
WebRendererMode
.
auto
).
build
(
environment
);
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
ProcessManager:
()
=>
processManager
,
ProcessManager:
()
=>
processManager
,
}));
}));
...
@@ -472,7 +472,7 @@ void main() {
...
@@ -472,7 +472,7 @@ void main() {
]
]
));
));
await
Dart2JSTarget
(
WebRendererMode
.
auto
Detect
).
build
(
environment
);
await
Dart2JSTarget
(
WebRendererMode
.
auto
).
build
(
environment
);
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
ProcessManager:
()
=>
processManager
,
ProcessManager:
()
=>
processManager
,
}));
}));
...
@@ -510,7 +510,7 @@ void main() {
...
@@ -510,7 +510,7 @@ void main() {
]
]
));
));
await
Dart2JSTarget
(
WebRendererMode
.
auto
Detect
).
build
(
environment
);
await
Dart2JSTarget
(
WebRendererMode
.
auto
).
build
(
environment
);
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
ProcessManager:
()
=>
processManager
,
ProcessManager:
()
=>
processManager
,
}));
}));
...
@@ -546,7 +546,7 @@ void main() {
...
@@ -546,7 +546,7 @@ void main() {
]
]
));
));
await
Dart2JSTarget
(
WebRendererMode
.
auto
Detect
).
build
(
environment
);
await
Dart2JSTarget
(
WebRendererMode
.
auto
).
build
(
environment
);
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
ProcessManager:
()
=>
processManager
,
ProcessManager:
()
=>
processManager
,
}));
}));
...
@@ -570,7 +570,7 @@ void main() {
...
@@ -570,7 +570,7 @@ void main() {
.
writeAsStringSync
(
'file:///a.dart'
);
.
writeAsStringSync
(
'file:///a.dart'
);
},
},
));
));
await
Dart2JSTarget
(
WebRendererMode
.
auto
Detect
).
build
(
environment
);
await
Dart2JSTarget
(
WebRendererMode
.
auto
).
build
(
environment
);
expect
(
environment
.
buildDir
.
childFile
(
'dart2js.d'
),
exists
);
expect
(
environment
.
buildDir
.
childFile
(
'dart2js.d'
),
exists
);
final
Depfile
depfile
=
depfileService
.
parse
(
environment
.
buildDir
.
childFile
(
'dart2js.d'
));
final
Depfile
depfile
=
depfileService
.
parse
(
environment
.
buildDir
.
childFile
(
'dart2js.d'
));
...
@@ -617,7 +617,7 @@ void main() {
...
@@ -617,7 +617,7 @@ void main() {
]
]
));
));
await
Dart2JSTarget
(
WebRendererMode
.
auto
Detect
).
build
(
environment
);
await
Dart2JSTarget
(
WebRendererMode
.
auto
).
build
(
environment
);
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
ProcessManager:
()
=>
processManager
,
ProcessManager:
()
=>
processManager
,
}));
}));
...
@@ -651,7 +651,7 @@ void main() {
...
@@ -651,7 +651,7 @@ void main() {
]
]
));
));
await
Dart2JSTarget
(
WebRendererMode
.
auto
Detect
).
build
(
environment
);
await
Dart2JSTarget
(
WebRendererMode
.
auto
).
build
(
environment
);
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
ProcessManager:
()
=>
processManager
,
ProcessManager:
()
=>
processManager
,
}));
}));
...
@@ -693,7 +693,7 @@ void main() {
...
@@ -693,7 +693,7 @@ void main() {
]
]
));
));
await
Dart2JSTarget
(
WebRendererMode
.
auto
Detect
).
build
(
environment
);
await
Dart2JSTarget
(
WebRendererMode
.
auto
).
build
(
environment
);
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
ProcessManager:
()
=>
processManager
,
ProcessManager:
()
=>
processManager
,
}));
}));
...
@@ -922,7 +922,7 @@ void main() {
...
@@ -922,7 +922,7 @@ void main() {
environment
.
outputDir
.
childDirectory
(
'a'
).
childFile
(
'a.txt'
)
environment
.
outputDir
.
childDirectory
(
'a'
).
childFile
(
'a.txt'
)
..
createSync
(
recursive:
true
)
..
createSync
(
recursive:
true
)
..
writeAsStringSync
(
'A'
);
..
writeAsStringSync
(
'A'
);
await
WebServiceWorker
(
globals
.
fs
,
WebRendererMode
.
auto
Detect
,
isWasm:
false
).
build
(
environment
);
await
WebServiceWorker
(
globals
.
fs
,
WebRendererMode
.
auto
,
isWasm:
false
).
build
(
environment
);
expect
(
environment
.
outputDir
.
childFile
(
'flutter_service_worker.js'
),
exists
);
expect
(
environment
.
outputDir
.
childFile
(
'flutter_service_worker.js'
),
exists
);
// Contains file hash.
// Contains file hash.
...
@@ -941,7 +941,7 @@ void main() {
...
@@ -941,7 +941,7 @@ void main() {
environment
.
outputDir
environment
.
outputDir
.
childFile
(
'index.html'
)
.
childFile
(
'index.html'
)
.
createSync
(
recursive:
true
);
.
createSync
(
recursive:
true
);
await
WebServiceWorker
(
globals
.
fs
,
WebRendererMode
.
auto
Detect
,
isWasm:
false
).
build
(
environment
);
await
WebServiceWorker
(
globals
.
fs
,
WebRendererMode
.
auto
,
isWasm:
false
).
build
(
environment
);
expect
(
environment
.
outputDir
.
childFile
(
'flutter_service_worker.js'
),
exists
);
expect
(
environment
.
outputDir
.
childFile
(
'flutter_service_worker.js'
),
exists
);
// Contains file hash for both `/` and index.html.
// Contains file hash for both `/` and index.html.
...
@@ -959,7 +959,7 @@ void main() {
...
@@ -959,7 +959,7 @@ void main() {
environment
.
outputDir
environment
.
outputDir
.
childFile
(
'main.dart.js.map'
)
.
childFile
(
'main.dart.js.map'
)
.
createSync
(
recursive:
true
);
.
createSync
(
recursive:
true
);
await
WebServiceWorker
(
globals
.
fs
,
WebRendererMode
.
auto
Detect
,
isWasm:
false
).
build
(
environment
);
await
WebServiceWorker
(
globals
.
fs
,
WebRendererMode
.
auto
,
isWasm:
false
).
build
(
environment
);
// No caching of source maps.
// No caching of source maps.
expect
(
environment
.
outputDir
.
childFile
(
'flutter_service_worker.js'
).
readAsStringSync
(),
expect
(
environment
.
outputDir
.
childFile
(
'flutter_service_worker.js'
).
readAsStringSync
(),
...
@@ -991,7 +991,7 @@ void main() {
...
@@ -991,7 +991,7 @@ void main() {
..
createSync
(
recursive:
true
)
..
createSync
(
recursive:
true
)
..
writeAsStringSync
(
'OL'
);
..
writeAsStringSync
(
'OL'
);
await
WebBuiltInAssets
(
globals
.
fs
,
WebRendererMode
.
auto
Detect
,
isWasm:
false
).
build
(
environment
);
await
WebBuiltInAssets
(
globals
.
fs
,
WebRendererMode
.
auto
,
isWasm:
false
).
build
(
environment
);
// No caching of source maps.
// No caching of source maps.
final
String
fileGeneratorsPath
=
environment
.
artifacts
final
String
fileGeneratorsPath
=
environment
.
artifacts
...
@@ -1008,7 +1008,7 @@ void main() {
...
@@ -1008,7 +1008,7 @@ void main() {
globals
.
fs
.
file
(
'bin/cache/flutter_web_sdk/canvaskit/canvaskit.wasm'
)
globals
.
fs
.
file
(
'bin/cache/flutter_web_sdk/canvaskit/canvaskit.wasm'
)
.
createSync
(
recursive:
true
);
.
createSync
(
recursive:
true
);
await
WebBuiltInAssets
(
globals
.
fs
,
WebRendererMode
.
auto
Detect
,
isWasm:
true
).
build
(
environment
);
await
WebBuiltInAssets
(
globals
.
fs
,
WebRendererMode
.
auto
,
isWasm:
true
).
build
(
environment
);
expect
(
environment
.
outputDir
.
childFile
(
'main.dart.js'
).
existsSync
(),
true
);
expect
(
environment
.
outputDir
.
childFile
(
'main.dart.js'
).
existsSync
(),
true
);
expect
(
environment
.
outputDir
.
childDirectory
(
'canvaskit'
)
expect
(
environment
.
outputDir
.
childDirectory
(
'canvaskit'
)
...
@@ -1021,7 +1021,7 @@ void main() {
...
@@ -1021,7 +1021,7 @@ void main() {
..
createSync
(
recursive:
true
);
..
createSync
(
recursive:
true
);
canvasKitInput
.
writeAsStringSync
(
'foo'
,
flush:
true
);
canvasKitInput
.
writeAsStringSync
(
'foo'
,
flush:
true
);
await
WebBuiltInAssets
(
globals
.
fs
,
WebRendererMode
.
auto
Detect
,
isWasm:
true
).
build
(
environment
);
await
WebBuiltInAssets
(
globals
.
fs
,
WebRendererMode
.
auto
,
isWasm:
true
).
build
(
environment
);
final
File
canvasKitOutputBefore
=
environment
.
outputDir
.
childDirectory
(
'canvaskit'
)
final
File
canvasKitOutputBefore
=
environment
.
outputDir
.
childDirectory
(
'canvaskit'
)
.
childFile
(
'canvaskit.wasm'
);
.
childFile
(
'canvaskit.wasm'
);
...
@@ -1030,7 +1030,7 @@ void main() {
...
@@ -1030,7 +1030,7 @@ void main() {
canvasKitInput
.
writeAsStringSync
(
'bar'
,
flush:
true
);
canvasKitInput
.
writeAsStringSync
(
'bar'
,
flush:
true
);
await
WebBuiltInAssets
(
globals
.
fs
,
WebRendererMode
.
auto
Detect
,
isWasm:
true
).
build
(
environment
);
await
WebBuiltInAssets
(
globals
.
fs
,
WebRendererMode
.
auto
,
isWasm:
true
).
build
(
environment
);
final
File
canvasKitOutputAfter
=
environment
.
outputDir
.
childDirectory
(
'canvaskit'
)
final
File
canvasKitOutputAfter
=
environment
.
outputDir
.
childDirectory
(
'canvaskit'
)
.
childFile
(
'canvaskit.wasm'
);
.
childFile
(
'canvaskit.wasm'
);
...
...
packages/flutter_tools/test/general.shard/web/compile_web_test.dart
View file @
895879c1
...
@@ -39,7 +39,7 @@ void main() {
...
@@ -39,7 +39,7 @@ void main() {
TestBuildSystem
.
all
(
BuildResult
(
success:
true
),
(
Target
target
,
Environment
environment
)
{
TestBuildSystem
.
all
(
BuildResult
(
success:
true
),
(
Target
target
,
Environment
environment
)
{
final
WebServiceWorker
webServiceWorker
=
target
as
WebServiceWorker
;
final
WebServiceWorker
webServiceWorker
=
target
as
WebServiceWorker
;
expect
(
webServiceWorker
.
isWasm
,
isTrue
,
reason:
'should be wasm'
);
expect
(
webServiceWorker
.
isWasm
,
isTrue
,
reason:
'should be wasm'
);
expect
(
webServiceWorker
.
webRenderer
,
WebRendererMode
.
auto
Detect
);
expect
(
webServiceWorker
.
webRenderer
,
WebRendererMode
.
auto
);
expect
(
environment
.
defines
,
<
String
,
String
>{
expect
(
environment
.
defines
,
<
String
,
String
>{
'TargetFile'
:
'target'
,
'TargetFile'
:
'target'
,
...
...
packages/flutter_tools/test/general.shard/web/devfs_web_test.dart
View file @
895879c1
...
@@ -1052,7 +1052,7 @@ void main() {
...
@@ -1052,7 +1052,7 @@ void main() {
await
webDevFS
.
create
();
await
webDevFS
.
create
();
expect
(
webDevFS
.
webAssetServer
.
webRenderer
,
WebRendererMode
.
auto
Detect
);
expect
(
webDevFS
.
webAssetServer
.
webRenderer
,
WebRendererMode
.
auto
);
await
webDevFS
.
destroy
();
await
webDevFS
.
destroy
();
}));
}));
...
...
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