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
762d9f7f
Unverified
Commit
762d9f7f
authored
Aug 05, 2020
by
Jonah Williams
Committed by
GitHub
Aug 05, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_tools] warn when main library is relocated (#62930)
parent
ef62463e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
71 additions
and
1 deletion
+71
-1
run_hot.dart
packages/flutter_tools/lib/src/run_hot.dart
+10
-1
resident_runner_test.dart
...lutter_tools/test/general.shard/resident_runner_test.dart
+61
-0
No files found.
packages/flutter_tools/lib/src/run_hot.dart
View file @
762d9f7f
...
...
@@ -376,10 +376,19 @@ class HotRunner extends ResidentRunner {
asyncScanning:
hotRunnerConfig
.
asyncScanning
,
packageConfig:
flutterDevices
[
0
].
devFS
.
lastPackageConfig
,
);
final
File
entrypointFile
=
globals
.
fs
.
file
(
mainPath
);
if
(!
entrypointFile
.
existsSync
())
{
globals
.
printError
(
'The entrypoint file (i.e. the file with main())
${entrypointFile.path}
'
'cannot be found. Moving or renaming this file will prevent changes to '
'its contents from being discovered during hot reload/restart until '
'flutter is restarted or the file is restored.'
);
}
final
UpdateFSReport
results
=
UpdateFSReport
(
success:
true
);
for
(
final
FlutterDevice
device
in
flutterDevices
)
{
results
.
incorporateResults
(
await
device
.
updateDevFS
(
mainUri:
globals
.
fs
.
file
(
mainPath
)
.
absolute
.
uri
,
mainUri:
entrypointFile
.
absolute
.
uri
,
target:
target
,
bundle:
assetBundle
,
firstBuildTime:
firstBuildTime
,
...
...
packages/flutter_tools/test/general.shard/resident_runner_test.dart
View file @
762d9f7f
...
...
@@ -609,6 +609,67 @@ void main() {
Usage:
()
=>
MockUsage
(),
}));
testUsingContext
(
'ResidentRunner reports error with missing entrypoint file'
,
()
=>
testbed
.
run
(()
async
{
fakeVmServiceHost
=
FakeVmServiceHost
(
requests:
<
VmServiceExpectation
>[
listViews
,
listViews
,
listViews
,
listViews
,
FakeVmServiceRequest
(
method:
'getIsolate'
,
args:
<
String
,
Object
>{
'isolateId'
:
'1'
,
},
jsonResponse:
fakeUnpausedIsolate
.
toJson
(),
),
FakeVmServiceRequest
(
method:
'ext.flutter.reassemble'
,
args:
<
String
,
Object
>{
'isolateId'
:
fakeUnpausedIsolate
.
id
,
},
),
]);
when
(
mockDevice
.
sdkNameAndVersion
).
thenAnswer
((
Invocation
invocation
)
async
{
return
'Example'
;
});
when
(
mockDevice
.
targetPlatform
).
thenAnswer
((
Invocation
invocation
)
async
{
return
TargetPlatform
.
android_arm
;
});
when
(
mockDevice
.
isLocalEmulator
).
thenAnswer
((
Invocation
invocation
)
async
{
return
false
;
});
final
Completer
<
DebugConnectionInfo
>
onConnectionInfo
=
Completer
<
DebugConnectionInfo
>.
sync
();
final
Completer
<
void
>
onAppStart
=
Completer
<
void
>.
sync
();
unawaited
(
residentRunner
.
attach
(
appStartedCompleter:
onAppStart
,
connectionInfoCompleter:
onConnectionInfo
,
));
await
onAppStart
.
future
;
when
(
mockFlutterDevice
.
updateDevFS
(
mainUri:
anyNamed
(
'mainUri'
),
target:
anyNamed
(
'target'
),
bundle:
anyNamed
(
'bundle'
),
firstBuildTime:
anyNamed
(
'firstBuildTime'
),
bundleFirstUpload:
anyNamed
(
'bundleFirstUpload'
),
bundleDirty:
anyNamed
(
'bundleDirty'
),
fullRestart:
anyNamed
(
'fullRestart'
),
projectRootPath:
anyNamed
(
'projectRootPath'
),
pathToReload:
anyNamed
(
'pathToReload'
),
invalidatedFiles:
anyNamed
(
'invalidatedFiles'
),
dillOutputPath:
anyNamed
(
'dillOutputPath'
),
packageConfig:
anyNamed
(
'packageConfig'
),
)).
thenAnswer
((
Invocation
invocation
)
async
{
return
UpdateFSReport
(
success:
true
);
});
final
OperationResult
result
=
await
residentRunner
.
restart
(
fullRestart:
false
);
expect
(
globals
.
fs
.
file
(
globals
.
fs
.
path
.
join
(
'lib'
,
'main.dart'
)),
isNot
(
exists
));
expect
(
testLogger
.
errorText
,
contains
(
'The entrypoint file (i.e. the file with main())'
));
expect
(
result
.
fatal
,
false
);
expect
(
result
.
code
,
0
);
}));
testUsingContext
(
'ResidentRunner can send target platform to analytics from hot reload'
,
()
=>
testbed
.
run
(()
async
{
fakeVmServiceHost
=
FakeVmServiceHost
(
requests:
<
VmServiceExpectation
>[
...
...
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