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
6d37867c
Unverified
Commit
6d37867c
authored
Sep 11, 2019
by
Jonah Williams
Committed by
GitHub
Sep 11, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Place hot reload artifacts in a temp directory (#40171)
parent
963c8a89
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
38 additions
and
14 deletions
+38
-14
resident_runner.dart
packages/flutter_tools/lib/src/resident_runner.dart
+22
-14
run_cold.dart
packages/flutter_tools/lib/src/run_cold.dart
+1
-0
run_hot.dart
packages/flutter_tools/lib/src/run_hot.dart
+1
-0
resident_runner_test.dart
...lutter_tools/test/general.shard/resident_runner_test.dart
+14
-0
No files found.
packages/flutter_tools/lib/src/resident_runner.dart
View file @
6d37867c
...
...
@@ -536,34 +536,33 @@ abstract class ResidentRunner {
this
.
ipv6
,
this
.
stayResident
=
true
,
this
.
hotMode
=
true
,
this
.
dillOutputPath
,
String
dillOutputPath
,
})
:
mainPath
=
findMainDartFile
(
target
),
projectRootPath
=
projectRootPath
??
fs
.
currentDirectory
.
path
,
packagesFilePath
=
packagesFilePath
??
fs
.
path
.
absolute
(
PackageMap
.
globalPackagesPath
),
_dillOutputPath
=
dillOutputPath
,
artifactDirectory
=
dillOutputPath
==
null
?
fs
.
systemTempDirectory
.
createTempSync
(
'_fluttter_tool'
)
:
fs
.
file
(
dillOutputPath
).
parent
,
assetBundle
=
AssetBundleFactory
.
instance
.
createBundle
()
{
// TODO(jonahwilliams): this is transitionary logic to allow us to support
// platforms that are not yet using flutter assemble. In the "new world",
// builds are isolated based on a number of factors. Thus, we cannot assume
// that a debug build will create the expected `build/app.dill` file. For
// now, I'm working around this by just creating it if it is missing here.
// In the future, once build & run are more strongly separated, the build
// environment will be plumbed through so that it all comes from a single
// source of truth, the [Environment].
final
File
dillOutput
=
fs
.
file
(
dillOutputPath
??
fs
.
path
.
join
(
'build'
,
'app.dill'
));
if
(!
dillOutput
.
existsSync
())
{
dillOutput
.
createSync
(
recursive:
true
);
if
(!
artifactDirectory
.
existsSync
())
{
artifactDirectory
.
createSync
(
recursive:
true
);
}
}
@protected
@visibleForTesting
final
List
<
FlutterDevice
>
flutterDevices
;
final
String
target
;
final
DebuggingOptions
debuggingOptions
;
final
bool
stayResident
;
final
bool
ipv6
;
final
String
_dillOutputPath
;
/// The parent location of the incremental artifacts.
@visibleForTesting
final
Directory
artifactDirectory
;
final
Completer
<
int
>
_finished
=
Completer
<
int
>();
final
String
dillOutputPath
;
final
String
packagesFilePath
;
final
String
projectRootPath
;
final
String
mainPath
;
...
...
@@ -571,6 +570,8 @@ abstract class ResidentRunner {
bool
_exited
=
false
;
bool
hotMode
;
String
get
dillOutputPath
=>
_dillOutputPath
??
fs
.
path
.
join
(
artifactDirectory
.
path
,
'app.dill'
);
String
getReloadPath
({
bool
fullRestart
})
=>
mainPath
+
(
fullRestart
?
''
:
'.incremental'
)
+
'.dill'
;
bool
get
debuggingEnabled
=>
debuggingOptions
.
debuggingEnabled
;
...
...
@@ -716,6 +717,7 @@ abstract class ResidentRunner {
/// Throws an [AssertionError] if [Devce.supportsScreenshot] is not true.
Future
<
void
>
screenshot
(
FlutterDevice
device
)
async
{
assert
(
device
.
device
.
supportsScreenshot
);
final
Status
status
=
logger
.
startProgress
(
'Taking screenshot for
${device.device.name}
...'
,
timeout:
timeoutConfiguration
.
fastOperation
);
final
File
outputFile
=
getUniqueFile
(
fs
.
currentDirectory
,
'flutter'
,
'png'
);
try
{
...
...
@@ -850,7 +852,13 @@ abstract class ResidentRunner {
return
exitCode
;
}
Future
<
void
>
preExit
()
async
{
}
@mustCallSuper
Future
<
void
>
preExit
()
async
{
// If _dillOutputPath is null, we created a temporary directory for the dill.
if
(
_dillOutputPath
==
null
&&
artifactDirectory
.
existsSync
())
{
artifactDirectory
.
deleteSync
(
recursive:
true
);
}
}
Future
<
void
>
exitApp
()
async
{
final
List
<
Future
<
void
>>
futures
=
<
Future
<
void
>>[];
...
...
packages/flutter_tools/lib/src/run_cold.dart
View file @
6d37867c
...
...
@@ -206,5 +206,6 @@ class ColdRunner extends ResidentRunner {
if
(
device
.
vmServices
==
null
||
device
.
vmServices
.
isEmpty
)
await
device
.
device
.
stopApp
(
device
.
package
);
}
await
super
.
preExit
();
}
}
packages/flutter_tools/lib/src/run_hot.dart
View file @
6d37867c
...
...
@@ -1010,6 +1010,7 @@ class HotRunner extends ResidentRunner {
Future
<
void
>
preExit
()
async
{
await
_cleanupDevFS
();
await
hotRunnerConfig
.
runPreShutdownOperations
();
await
super
.
preExit
();
}
@override
...
...
packages/flutter_tools/test/general.shard/resident_runner_test.dart
View file @
6d37867c
...
...
@@ -298,6 +298,20 @@ void main() {
Usage:
()
=>
MockUsage
(),
}));
test
(
'ResidentRunner uses temp directory when there is no output dill path'
,
()
=>
testbed
.
run
(()
{
expect
(
residentRunner
.
artifactDirectory
.
path
,
contains
(
'_fluttter_tool'
));
final
ResidentRunner
otherRunner
=
HotRunner
(
<
FlutterDevice
>[
mockFlutterDevice
,
],
stayResident:
false
,
debuggingOptions:
DebuggingOptions
.
enabled
(
BuildInfo
.
debug
),
dillOutputPath:
fs
.
path
.
join
(
'foobar'
,
'app.dill'
),
);
expect
(
otherRunner
.
artifactDirectory
.
path
,
contains
(
'foobar'
));
}));
test
(
'ResidentRunner printHelpDetails'
,
()
=>
testbed
.
run
(()
{
when
(
mockDevice
.
supportsHotRestart
).
thenReturn
(
true
);
when
(
mockDevice
.
supportsScreenshot
).
thenReturn
(
true
);
...
...
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