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
6135091d
Unverified
Commit
6135091d
authored
Jun 02, 2020
by
Jonah Williams
Committed by
GitHub
Jun 02, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "[flutter_tools] only copy cached dill after startup (#58188)" (#58454)
This reverts commit
39d1e4b7
.
parent
cf17e8bc
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
28 additions
and
93 deletions
+28
-93
resident_web_runner.dart
...utter_tools/lib/src/build_runner/resident_web_runner.dart
+0
-1
resident_runner.dart
packages/flutter_tools/lib/src/resident_runner.dart
+7
-15
run_hot.dart
packages/flutter_tools/lib/src/run_hot.dart
+1
-1
resident_runner_test.dart
...lutter_tools/test/general.shard/resident_runner_test.dart
+13
-61
resident_web_runner_test.dart
...er_tools/test/general.shard/resident_web_runner_test.dart
+7
-15
No files found.
packages/flutter_tools/lib/src/build_runner/resident_web_runner.dart
View file @
6135091d
...
...
@@ -434,7 +434,6 @@ class _ResidentWebRunner extends ResidentWebRunner {
return
1
;
}
device
.
generator
.
accept
();
cacheInitialDillCompilation
();
}
else
{
await
buildWeb
(
flutterProject
,
...
...
packages/flutter_tools/lib/src/resident_runner.dart
View file @
6135091d
...
...
@@ -1099,19 +1099,6 @@ abstract class ResidentRunner {
);
}
@protected
void
cacheInitialDillCompilation
()
{
globals
.
logger
.
printTrace
(
'Caching compiled dill'
);
final
File
outputDill
=
globals
.
fs
.
file
(
dillOutputPath
);
if
(
outputDill
.
existsSync
())
{
final
String
copyPath
=
getDefaultCachedKernelPath
(
trackWidgetCreation:
trackWidgetCreation
,
);
globals
.
fs
.
file
(
copyPath
).
parent
.
createSync
(
recursive:
true
);
outputDill
.
copySync
(
copyPath
);
}
}
/// If the [reloadSources] parameter is not null the 'reloadSources' service
/// will be registered.
//
...
...
@@ -1221,9 +1208,14 @@ abstract class ResidentRunner {
@mustCallSuper
Future
<
void
>
preExit
()
async
{
// If _dillOutputPath is null, the tool created a temporary directory for
// the dill.
// If _dillOutputPath is null, we created a temporary directory for the dill.
if
(
_dillOutputPath
==
null
&&
artifactDirectory
.
existsSync
())
{
final
File
outputDill
=
globals
.
fs
.
file
(
dillOutputPath
);
if
(
outputDill
.
existsSync
())
{
outputDill
.
copySync
(
getDefaultCachedKernelPath
(
trackWidgetCreation:
trackWidgetCreation
,
));
}
artifactDirectory
.
deleteSync
(
recursive:
true
);
}
}
...
...
packages/flutter_tools/lib/src/run_hot.dart
View file @
6135091d
...
...
@@ -63,6 +63,7 @@ class DeviceReloadReport {
List
<
vm_service
.
ReloadReport
>
reports
;
// List has one report per Flutter view.
}
// TODO(mklim): Test this, flutter/flutter#23031.
class
HotRunner
extends
ResidentRunner
{
HotRunner
(
List
<
FlutterDevice
>
devices
,
{
...
...
@@ -387,7 +388,6 @@ class HotRunner extends ResidentRunner {
if
(!
results
.
every
((
bool
passed
)
=>
passed
))
{
return
1
;
}
cacheInitialDillCompilation
();
}
on
Exception
catch
(
err
)
{
globals
.
printError
(
err
.
toString
());
return
1
;
...
...
packages/flutter_tools/test/general.shard/resident_runner_test.dart
View file @
6135091d
...
...
@@ -521,12 +521,22 @@ void main() {
expect
(
otherRunner
.
artifactDirectory
.
path
,
contains
(
'foobar'
));
}));
test
(
'ResidentRunner
deletes artifact directory on
preExit'
,
()
=>
testbed
.
run
(()
async
{
test
(
'ResidentRunner
copies output dill to cache location during
preExit'
,
()
=>
testbed
.
run
(()
async
{
fakeVmServiceHost
=
FakeVmServiceHost
(
requests:
<
VmServiceExpectation
>[]);
residentRunner
.
artifactDirectory
.
childFile
(
'app.dill'
).
createSync
(
);
residentRunner
.
artifactDirectory
.
childFile
(
'app.dill'
).
writeAsStringSync
(
'hello'
);
await
residentRunner
.
preExit
();
final
File
cacheDill
=
globals
.
fs
.
file
(
globals
.
fs
.
path
.
join
(
getBuildDirectory
(),
'cache.dill'
));
expect
(
residentRunner
.
artifactDirectory
,
isNot
(
exists
));
expect
(
cacheDill
,
exists
);
expect
(
cacheDill
.
readAsStringSync
(),
'hello'
);
}));
test
(
'ResidentRunner handles output dill missing during preExit'
,
()
=>
testbed
.
run
(()
async
{
fakeVmServiceHost
=
FakeVmServiceHost
(
requests:
<
VmServiceExpectation
>[]);
await
residentRunner
.
preExit
();
final
File
cacheDill
=
globals
.
fs
.
file
(
globals
.
fs
.
path
.
join
(
getBuildDirectory
(),
'cache.dill'
));
expect
(
cacheDill
,
isNot
(
exists
));
}));
test
(
'ResidentRunner can run source generation'
,
()
=>
testbed
.
run
(()
async
{
...
...
@@ -1050,64 +1060,6 @@ void main() {
expect
(
await
globals
.
fs
.
file
(
'foo'
).
readAsString
(),
testUri
.
toString
());
}));
test
(
'HotRunner copies compiled app.dill to cache during startup'
,
()
=>
testbed
.
run
(()
async
{
fakeVmServiceHost
=
FakeVmServiceHost
(
requests:
<
VmServiceExpectation
>[
listViews
,
listViews
,
]);
setWsAddress
(
testUri
,
fakeVmServiceHost
.
vmService
);
globals
.
fs
.
file
(
globals
.
fs
.
path
.
join
(
'lib'
,
'main.dart'
)).
createSync
(
recursive:
true
);
residentRunner
=
HotRunner
(
<
FlutterDevice
>[
mockFlutterDevice
,
],
stayResident:
false
,
debuggingOptions:
DebuggingOptions
.
enabled
(
BuildInfo
.
debug
),
);
residentRunner
.
artifactDirectory
.
childFile
(
'app.dill'
).
writeAsStringSync
(
'ABC'
);
when
(
mockFlutterDevice
.
runHot
(
hotRunner:
anyNamed
(
'hotRunner'
),
route:
anyNamed
(
'route'
),
)).
thenAnswer
((
Invocation
invocation
)
async
{
return
0
;
});
await
residentRunner
.
run
();
expect
(
await
globals
.
fs
.
file
(
globals
.
fs
.
path
.
join
(
'build'
,
'cache.dill'
)).
readAsString
(),
'ABC'
);
}));
test
(
'HotRunner copies compiled app.dill to cache during startup with --track-widget-creation'
,
()
=>
testbed
.
run
(()
async
{
fakeVmServiceHost
=
FakeVmServiceHost
(
requests:
<
VmServiceExpectation
>[
listViews
,
listViews
,
]);
setWsAddress
(
testUri
,
fakeVmServiceHost
.
vmService
);
globals
.
fs
.
file
(
globals
.
fs
.
path
.
join
(
'lib'
,
'main.dart'
)).
createSync
(
recursive:
true
);
residentRunner
=
HotRunner
(
<
FlutterDevice
>[
mockFlutterDevice
,
],
stayResident:
false
,
debuggingOptions:
DebuggingOptions
.
enabled
(
const
BuildInfo
(
BuildMode
.
debug
,
''
,
treeShakeIcons:
false
,
trackWidgetCreation:
true
,
)),
);
residentRunner
.
artifactDirectory
.
childFile
(
'app.dill'
).
writeAsStringSync
(
'ABC'
);
when
(
mockFlutterDevice
.
runHot
(
hotRunner:
anyNamed
(
'hotRunner'
),
route:
anyNamed
(
'route'
),
)).
thenAnswer
((
Invocation
invocation
)
async
{
return
0
;
});
await
residentRunner
.
run
();
expect
(
await
globals
.
fs
.
file
(
globals
.
fs
.
path
.
join
(
'build'
,
'cache.dill.track.dill'
)).
readAsString
(),
'ABC'
);
}));
test
(
'HotRunner unforwards device ports'
,
()
=>
testbed
.
run
(()
async
{
fakeVmServiceHost
=
FakeVmServiceHost
(
requests:
<
VmServiceExpectation
>[
listViews
,
...
...
packages/flutter_tools/test/general.shard/resident_web_runner_test.dart
View file @
6135091d
...
...
@@ -257,21 +257,13 @@ void main() {
expect
(
bufferLogger
.
statusText
,
contains
(
'Debug service listening on ws://127.0.0.1/abcd/'
));
expect
(
debugConnectionInfo
.
wsUri
.
toString
(),
'ws://127.0.0.1/abcd/'
);
},
overrides:
<
Type
,
Generator
>{
Logger:
()
=>
DelegateLogger
(
BufferLogger
.
test
()),
}));
test
(
'WebRunner copies compiled app.dill to cache during startup'
,
()
=>
testbed
.
run
(()
async
{
fakeVmServiceHost
=
FakeVmServiceHost
(
requests:
kAttachExpectations
.
toList
());
_setupMocks
();
residentWebRunner
.
artifactDirectory
.
childFile
(
'app.dill'
).
writeAsStringSync
(
'ABC'
);
final
Completer
<
DebugConnectionInfo
>
connectionInfoCompleter
=
Completer
<
DebugConnectionInfo
>();
unawaited
(
residentWebRunner
.
run
(
connectionInfoCompleter:
connectionInfoCompleter
,
));
await
connectionInfoCompleter
.
future
;
expect
(
await
globals
.
fs
.
file
(
globals
.
fs
.
path
.
join
(
'build'
,
'cache.dill'
)).
readAsString
(),
'ABC'
);
Logger:
()
=>
DelegateLogger
(
BufferLogger
(
terminal:
AnsiTerminal
(
stdio:
null
,
platform:
const
LocalPlatform
(),
),
outputPreferences:
OutputPreferences
.
test
(),
)),
}));
test
(
'Can successfully run without an index.html including status warning'
,
()
=>
testbed
.
run
(()
async
{
...
...
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