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
e9086552
Commit
e9086552
authored
Nov 10, 2016
by
John McCutchan
Committed by
GitHub
Nov 10, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove legacy restart support (#6801)
parent
83be3e59
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
15 additions
and
204 deletions
+15
-204
android_device.dart
packages/flutter_tools/lib/src/android/android_device.dart
+0
-113
daemon.dart
packages/flutter_tools/lib/src/commands/daemon.dart
+1
-1
device.dart
packages/flutter_tools/lib/src/device.dart
+1
-25
hot.dart
packages/flutter_tools/lib/src/hot.dart
+4
-1
devices.dart
packages/flutter_tools/lib/src/ios/devices.dart
+0
-12
resident_runner.dart
packages/flutter_tools/lib/src/resident_runner.dart
+7
-1
run.dart
packages/flutter_tools/lib/src/run.dart
+2
-51
No files found.
packages/flutter_tools/lib/src/android/android_device.dart
View file @
e9086552
...
...
@@ -6,20 +6,15 @@ import 'dart:async';
import
'dart:convert'
;
import
'dart:io'
;
import
'package:path/path.dart'
as
path
;
import
'../android/android_sdk.dart'
;
import
'../application_package.dart'
;
import
'../base/os.dart'
;
import
'../base/logger.dart'
;
import
'../base/process.dart'
;
import
'../build_info.dart'
;
import
'../dart/package_map.dart'
;
import
'../device.dart'
;
import
'../flx.dart'
as
flx
;
import
'../globals.dart'
;
import
'../toolchain.dart'
;
import
'../vmservice.dart'
;
import
'../protocol_discovery.dart'
;
import
'adb.dart'
;
import
'android.dart'
;
...
...
@@ -30,8 +25,6 @@ const String _defaultAdbPath = 'adb';
// Path where the FLX bundle will be copied on the device.
const
String
_deviceBundlePath
=
'/data/local/tmp/dev.flx'
;
// Path where the snapshot will be copied on the device.
const
String
_deviceSnapshotPath
=
'/data/local/tmp/dev_snapshot.bin'
;
class
AndroidDevices
extends
PollingDeviceDiscovery
{
AndroidDevices
()
:
super
(
'AndroidDevices'
);
...
...
@@ -434,74 +427,6 @@ class AndroidDevice extends Device {
@override
bool
get
supportsHotMode
=>
true
;
@override
Future
<
bool
>
runFromFile
(
ApplicationPackage
package
,
String
scriptUri
,
String
packagesUri
)
async
{
AndroidApk
apk
=
package
;
List
<
String
>
cmd
=
adbCommandForDevice
(<
String
>[
'shell'
,
'am'
,
'start'
,
'-a'
,
'android.intent.action.RUN'
,
'-d'
,
_deviceBundlePath
,
'-f'
,
'0x20000000'
,
// FLAG_ACTIVITY_SINGLE_TOP
]);
cmd
.
addAll
(<
String
>[
'--es'
,
'file'
,
scriptUri
]);
cmd
.
addAll
(<
String
>[
'--es'
,
'packages'
,
packagesUri
]);
cmd
.
add
(
apk
.
launchActivity
);
String
result
=
runCheckedSync
(
cmd
);
if
(
result
.
contains
(
'Error: '
))
{
printError
(
result
.
trim
());
return
false
;
}
return
true
;
}
@override
bool
get
supportsRestart
=>
true
;
@override
Future
<
bool
>
restartApp
(
ApplicationPackage
package
,
LaunchResult
result
,
{
String
mainPath
,
VMService
observatory
,
bool
prebuiltApplication:
false
})
async
{
Directory
tempDir
=
await
Directory
.
systemTemp
.
createTemp
(
'flutter_tools'
);
if
(
prebuiltApplication
)
{
return
false
;
}
try
{
String
snapshotPath
=
path
.
join
(
tempDir
.
path
,
'snapshot_blob.bin'
);
int
result
=
await
flx
.
createSnapshot
(
snapshotterPath:
tools
.
getHostToolPath
(
HostTool
.
SkySnapshot
),
mainPath:
mainPath
,
snapshotPath:
snapshotPath
,
packages:
path
.
absolute
(
PackageMap
.
globalPackagesPath
),
);
if
(
result
!=
0
)
{
printError
(
'Failed to run the Flutter compiler; exit code:
$result
'
);
return
false
;
}
AndroidApk
apk
=
package
;
String
androidActivity
=
apk
.
launchActivity
;
bool
success
=
await
refreshSnapshot
(
androidActivity
,
snapshotPath
);
if
(!
success
)
{
printError
(
'Error refreshing snapshot on
$this
.'
);
return
false
;
}
return
true
;
}
finally
{
tempDir
.
deleteSync
(
recursive:
true
);
}
}
@override
Future
<
bool
>
stopApp
(
ApplicationPackage
app
)
{
List
<
String
>
command
=
adbCommandForDevice
(<
String
>[
'shell'
,
'am'
,
'force-stop'
,
app
.
id
]);
...
...
@@ -544,44 +469,6 @@ class AndroidDevice extends Device {
@override
bool
isSupported
()
=>
true
;
Future
<
bool
>
refreshSnapshot
(
String
activity
,
String
snapshotPath
)
async
{
if
(!
FileSystemEntity
.
isFileSync
(
snapshotPath
))
{
printError
(
'Cannot find
$snapshotPath
'
);
return
false
;
}
RunResult
result
=
await
runAsync
(
adbCommandForDevice
(<
String
>[
'push'
,
snapshotPath
,
_deviceSnapshotPath
])
);
if
(
result
.
exitCode
!=
0
)
{
printStatus
(
result
.
toString
());
return
false
;
}
List
<
String
>
cmd
=
adbCommandForDevice
(<
String
>[
'shell'
,
'am'
,
'start'
,
'-a'
,
'android.intent.action.RUN'
,
'-d'
,
_deviceBundlePath
,
'-f'
,
'0x20000000'
,
// FLAG_ACTIVITY_SINGLE_TOP
'--es'
,
'snapshot'
,
_deviceSnapshotPath
,
activity
,
]);
result
=
await
runAsync
(
cmd
);
if
(
result
.
exitCode
!=
0
)
{
printStatus
(
result
.
toString
());
return
false
;
}
final
RegExp
errorRegExp
=
new
RegExp
(
r'^Error: .*$'
,
multiLine:
true
);
Match
errorMatch
=
errorRegExp
.
firstMatch
(
result
.
processResult
.
stdout
);
if
(
errorMatch
!=
null
)
{
printError
(
errorMatch
.
group
(
0
));
return
false
;
}
return
true
;
}
@override
bool
get
supportsScreenshot
=>
true
;
...
...
packages/flutter_tools/lib/src/commands/daemon.dart
View file @
e9086552
...
...
@@ -386,7 +386,7 @@ class AppDomain extends Domain {
}
bool
isRestartSupported
(
bool
enableHotReload
,
Device
device
)
=>
enableHotReload
?
device
.
supportsHotMode
:
device
.
supportsRestart
;
enableHotReload
&&
device
.
supportsHotMode
;
Future
<
OperationResult
>
restart
(
Map
<
String
,
dynamic
>
args
)
async
{
String
appId
=
_getStringArg
(
args
,
'appId'
,
required:
true
);
...
...
packages/flutter_tools/lib/src/device.dart
View file @
e9086552
...
...
@@ -13,7 +13,6 @@ import 'base/os.dart';
import
'base/utils.dart'
;
import
'build_info.dart'
;
import
'globals.dart'
;
import
'vmservice.dart'
;
import
'ios/devices.dart'
;
import
'ios/simulators.dart'
;
...
...
@@ -189,30 +188,7 @@ abstract class Device {
});
/// Does this device implement support for hot reloading / restarting?
bool
get
supportsHotMode
=>
false
;
/// Run from a file. Necessary for hot mode.
Future
<
bool
>
runFromFile
(
ApplicationPackage
package
,
String
scriptUri
,
String
packagesUri
)
{
throw
'runFromFile unsupported'
;
}
bool
get
supportsRestart
=>
false
;
bool
get
restartSendsFrameworkInitEvent
=>
true
;
/// Restart the given app; the application will already have been launched with
/// [startApp].
Future
<
bool
>
restartApp
(
ApplicationPackage
package
,
LaunchResult
result
,
{
String
mainPath
,
VMService
observatory
,
bool
prebuiltApplication:
false
})
async
{
throw
'unsupported'
;
}
bool
get
supportsHotMode
=>
true
;
/// Stop an app package on the current device.
Future
<
bool
>
stopApp
(
ApplicationPackage
app
);
...
...
packages/flutter_tools/lib/src/hot.dart
View file @
e9086552
...
...
@@ -443,6 +443,9 @@ class HotRunner extends ResidentRunner {
return
true
;
}
@override
bool
get
supportsRestart
=>
true
;
@override
Future
<
OperationResult
>
restart
({
bool
fullRestart:
false
,
bool
pauseAfterRestart:
false
})
async
{
if
(
fullRestart
)
{
...
...
@@ -555,7 +558,7 @@ class HotRunner extends ResidentRunner {
printStatus
(
'The Observatory debugger and profiler is available at: http://127.0.0.1:
$_observatoryPort
/'
);
if
(
details
)
{
printStatus
(
'To dump the widget hierarchy of the app (debugDumpApp), press "w".'
);
printStatus
(
'To dump the rendering tree of the app (debugDumpRenderTree), press "
r
".'
);
printStatus
(
'To dump the rendering tree of the app (debugDumpRenderTree), press "
t
".'
);
printStatus
(
'To repeat this help message, press "h" or F1. To quit, press "q", F10, or Ctrl-C.'
);
}
else
{
printStatus
(
'For a more detailed help message, press "h" or F1. To quit, press "q", F10, or Ctrl-C.'
);
...
...
packages/flutter_tools/lib/src/ios/devices.dart
View file @
e9086552
...
...
@@ -12,7 +12,6 @@ import '../base/process.dart';
import
'../build_info.dart'
;
import
'../device.dart'
;
import
'../globals.dart'
;
import
'../vmservice.dart'
;
import
'../protocol_discovery.dart'
;
import
'mac.dart'
;
...
...
@@ -330,17 +329,6 @@ class IOSDevice extends Device {
return
localPort
;
}
@override
Future
<
bool
>
restartApp
(
ApplicationPackage
package
,
LaunchResult
result
,
{
String
mainPath
,
VMService
observatory
,
bool
prebuiltApplication:
false
})
async
{
throw
'unsupported'
;
}
@override
Future
<
bool
>
stopApp
(
ApplicationPackage
app
)
async
{
// Currently we don't have a way to stop an app running on iOS.
...
...
packages/flutter_tools/lib/src/resident_runner.dart
View file @
e9086552
...
...
@@ -45,7 +45,11 @@ abstract class ResidentRunner {
bool
shouldBuild:
true
});
Future
<
OperationResult
>
restart
({
bool
fullRestart:
false
,
bool
pauseAfterRestart:
false
});
bool
get
supportsRestart
=>
false
;
Future
<
OperationResult
>
restart
({
bool
fullRestart:
false
,
bool
pauseAfterRestart:
false
})
{
throw
'unsupported'
;
}
Future
<
Null
>
stop
()
async
{
await
stopEchoingDeviceLog
();
...
...
@@ -80,6 +84,8 @@ abstract class ResidentRunner {
});
if
(!
supportsServiceProtocol
)
return
;
if
(!
supportsRestart
)
return
;
ProcessSignal
.
SIGUSR1
.
watch
().
listen
((
ProcessSignal
signal
)
async
{
printStatus
(
'Caught SIGUSR1'
);
await
restart
(
fullRestart:
false
);
...
...
packages/flutter_tools/lib/src/run.dart
View file @
e9086552
...
...
@@ -9,7 +9,6 @@ import 'package:meta/meta.dart';
import
'package:stack_trace/stack_trace.dart'
;
import
'application_package.dart'
;
import
'base/logger.dart'
;
import
'base/utils.dart'
;
import
'commands/build_apk.dart'
;
import
'commands/install.dart'
;
...
...
@@ -17,7 +16,6 @@ import 'commands/trace.dart';
import
'device.dart'
;
import
'globals.dart'
;
import
'resident_runner.dart'
;
import
'vmservice.dart'
;
class
RunAndStayResident
extends
ResidentRunner
{
RunAndStayResident
(
...
...
@@ -62,40 +60,6 @@ class RunAndStayResident extends ResidentRunner {
});
}
@override
Future
<
OperationResult
>
restart
({
bool
fullRestart:
false
,
bool
pauseAfterRestart:
false
})
async
{
if
(
vmService
==
null
)
{
printError
(
'Debugging is not enabled.'
);
return
new
OperationResult
(
1
,
'debugging not enabled'
);
}
else
{
Status
status
=
logger
.
startProgress
(
'Re-starting application...'
);
Future
<
ServiceEvent
>
extensionAddedEvent
;
if
(
device
.
restartSendsFrameworkInitEvent
)
{
extensionAddedEvent
=
vmService
.
onExtensionEvent
.
where
((
ServiceEvent
event
)
=>
event
.
extensionKind
==
'Flutter.FrameworkInitialization'
)
.
first
;
}
bool
result
=
await
device
.
restartApp
(
_package
,
_result
,
mainPath:
_mainPath
,
observatory:
vmService
,
prebuiltApplication:
prebuiltMode
);
status
.
stop
();
if
(
result
&&
extensionAddedEvent
!=
null
)
{
await
extensionAddedEvent
;
}
return
result
?
OperationResult
.
ok
:
new
OperationResult
(
1
,
'restart error'
);
}
}
Future
<
int
>
_run
({
bool
traceStartup:
false
,
Completer
<
DebugConnectionInfo
>
connectionInfoCompleter
,
...
...
@@ -219,17 +183,7 @@ class RunAndStayResident extends ResidentRunner {
}
@override
Future
<
Null
>
handleTerminalCommand
(
String
code
)
async
{
String
lower
=
code
.
toLowerCase
();
if
(
lower
==
'r'
||
code
==
AnsiTerminal
.
KEY_F5
)
{
if
(!
supportsServiceProtocol
)
return
;
if
(
device
.
supportsRestart
)
{
// F5, restart
await
restart
();
}
}
}
Future
<
Null
>
handleTerminalCommand
(
String
code
)
async
=>
null
;
@override
Future
<
Null
>
cleanupAfterSignal
()
async
{
...
...
@@ -245,15 +199,13 @@ class RunAndStayResident extends ResidentRunner {
@override
void
printHelp
({
@required
bool
details
})
{
bool
haveDetails
=
false
;
if
(!
prebuiltMode
&&
device
.
supportsRestart
&&
supportsServiceProtocol
)
printStatus
(
'To restart the app, press "r" or F5.'
);
if
(
_result
.
hasObservatory
)
printStatus
(
'The Observatory debugger and profiler is available at: http://127.0.0.1:
${_result.observatoryPort}
/'
);
if
(
supportsServiceProtocol
)
{
haveDetails
=
true
;
if
(
details
)
{
printStatus
(
'To dump the widget hierarchy of the app (debugDumpApp), press "w".'
);
printStatus
(
'To dump the rendering tree of the app (debugDumpRenderTree), press "
r
".'
);
printStatus
(
'To dump the rendering tree of the app (debugDumpRenderTree), press "
t
".'
);
}
}
if
(
haveDetails
&&
!
details
)
{
...
...
@@ -270,4 +222,3 @@ class RunAndStayResident extends ResidentRunner {
await
device
.
stopApp
(
_package
);
}
}
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