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
b3014ff5
Unverified
Commit
b3014ff5
authored
Aug 23, 2019
by
Jonah Williams
Committed by
GitHub
Aug 23, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add profile mode to flutter web applications (#39073)
parent
b2d19d2a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
10 deletions
+22
-10
build_script.dart
...ages/flutter_tools/lib/src/build_runner/build_script.dart
+17
-7
web_fs.dart
packages/flutter_tools/lib/src/build_runner/web_fs.dart
+5
-3
No files found.
packages/flutter_tools/lib/src/build_runner/build_script.dart
View file @
b3014ff5
...
...
@@ -38,6 +38,8 @@ const String digestsEntrypointExtension = '.digests';
const
String
jsModuleErrorsExtension
=
'.ddc.js.errors'
;
const
String
jsModuleExtension
=
'.ddc.js'
;
const
String
jsSourceMapExtension
=
'.ddc.js.map'
;
const
String
kReleaseFlag
=
'release'
;
const
String
kProfileFlag
=
'profile'
;
final
DartPlatform
flutterWebPlatform
=
DartPlatform
.
register
(
'flutter_web'
,
<
String
>[
...
...
@@ -141,7 +143,8 @@ final List<core.BuilderApplication> builders = <core.BuilderApplication>[
'flutter_tools:entrypoint'
,
<
BuilderFactory
>[
(
BuilderOptions
options
)
=>
FlutterWebEntrypointBuilder
(
options
.
config
[
'release'
]
??
false
,
options
.
config
[
kReleaseFlag
]
??
false
,
options
.
config
[
kProfileFlag
]
??
false
,
options
.
config
[
'flutterWebSdk'
],
),
],
...
...
@@ -201,9 +204,10 @@ class FlutterWebTestEntrypointBuilder implements Builder {
/// A ddc-only entrypoint builder that respects the Flutter target flag.
class
FlutterWebEntrypointBuilder
implements
Builder
{
const
FlutterWebEntrypointBuilder
(
this
.
release
,
this
.
flutterWebSdk
);
const
FlutterWebEntrypointBuilder
(
this
.
release
,
this
.
profile
,
this
.
flutterWebSdk
);
final
bool
release
;
final
bool
profile
;
final
String
flutterWebSdk
;
@override
...
...
@@ -219,8 +223,8 @@ class FlutterWebEntrypointBuilder implements Builder {
@override
Future
<
void
>
build
(
BuildStep
buildStep
)
async
{
if
(
release
)
{
await
bootstrapDart2Js
(
buildStep
,
flutterWebSdk
);
if
(
release
||
profile
)
{
await
bootstrapDart2Js
(
buildStep
,
flutterWebSdk
,
profile
);
}
else
{
await
bootstrapDdc
(
buildStep
,
platform:
flutterWebPlatform
);
}
...
...
@@ -366,7 +370,7 @@ Future<void> main() async {
};
}
Future<void> bootstrapDart2Js(BuildStep buildStep, String flutterWebSdk) async {
Future<void> bootstrapDart2Js(BuildStep buildStep, String flutterWebSdk
, bool profile
) async {
final AssetId dartEntrypointId = buildStep.inputId;
final AssetId moduleId = dartEntrypointId.changeExtension(moduleExtension(flutterWebPlatform));
final Module module = Module.fromJson(json.decode(await buildStep.readAsString(moduleId)));
...
...
@@ -388,11 +392,17 @@ Future<void> bootstrapDart2Js(BuildStep buildStep, String flutterWebSdk) async {
final String librariesPath = path.join(flutterWebSdkPath, '
libraries
.
json
');
final List<String> args = <String>[
'
--
libraries
-
spec
=
"
$librariesPath
"',
'
-
O4
',
if (profile)
'
-
O1
'
else
'
-
O4
',
'
-
o
',
'
$jsOutputPath
',
'
--
packages
=
"
$packageFile
"',
'
-
Ddart
.
vm
.
product
=
true
',
if (profile)
'
-
Ddart
.
vm
.
profile
=
true
'
else
'
-
Ddart
.
vm
.
product
=
true
',
dartPath,
];
final Dart2JsBatchWorkerPool dart2js = await buildStep.fetchResource(dart2JsWorkerResource);
...
...
packages/flutter_tools/lib/src/build_runner/web_fs.dart
View file @
b3014ff5
...
...
@@ -140,7 +140,7 @@ class WebFs {
})
async
{
// Start the build daemon and run an initial build.
final
BuildDaemonClient
client
=
await
buildDaemonCreator
.
startBuildDaemon
(
fs
.
currentDirectory
.
path
,
release:
buildInfo
.
isRelease
);
.
startBuildDaemon
(
fs
.
currentDirectory
.
path
,
release:
buildInfo
.
isRelease
,
profile:
buildInfo
.
isProfile
);
client
.
startBuild
();
// Only provide relevant build results
final
Stream
<
BuildResult
>
filteredBuildResults
=
client
.
buildResults
...
...
@@ -266,11 +266,12 @@ class BuildDaemonCreator {
const
BuildDaemonCreator
();
/// Start a build daemon and register the web targets.
Future
<
BuildDaemonClient
>
startBuildDaemon
(
String
workingDirectory
,
{
bool
release
=
false
})
async
{
Future
<
BuildDaemonClient
>
startBuildDaemon
(
String
workingDirectory
,
{
bool
release
=
false
,
bool
profile
=
false
})
async
{
try
{
final
BuildDaemonClient
client
=
await
_connectClient
(
workingDirectory
,
release:
release
,
profile:
profile
,
);
_registerBuildTargets
(
client
);
return
client
;
...
...
@@ -297,7 +298,7 @@ class BuildDaemonCreator {
Future
<
BuildDaemonClient
>
_connectClient
(
String
workingDirectory
,
{
bool
release
}
{
bool
release
,
bool
profile
}
)
{
final
String
flutterToolsPackages
=
fs
.
path
.
join
(
Cache
.
flutterRoot
,
'packages'
,
'flutter_tools'
,
'.packages'
);
final
String
buildScript
=
fs
.
path
.
join
(
Cache
.
flutterRoot
,
'packages'
,
'flutter_tools'
,
'lib'
,
'src'
,
'build_runner'
,
'build_script.dart'
);
...
...
@@ -316,6 +317,7 @@ class BuildDaemonCreator {
'--define'
,
'flutter_tools:ddc=flutterWebSdk=
$flutterWebSdk
'
,
'--define'
,
'flutter_tools:entrypoint=flutterWebSdk=
$flutterWebSdk
'
,
'--define'
,
'flutter_tools:entrypoint=release=
$release
'
,
'--define'
,
'flutter_tools:entrypoint=profile=
$profile
'
,
'--define'
,
'flutter_tools:shell=flutterWebSdk=
$flutterWebSdk
'
,
],
logHandler:
(
ServerLog
serverLog
)
{
...
...
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