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
005724b1
Commit
005724b1
authored
Feb 28, 2016
by
Devon Carew
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2257 from devoncarew/call_stop_from_run
add back a call to device.stop() from the run command
parents
0316b023
f9adbcf2
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
36 additions
and
15 deletions
+36
-15
adb.dart
packages/flutter_tools/lib/src/android/adb.dart
+4
-0
android_device.dart
packages/flutter_tools/lib/src/android/android_device.dart
+4
-4
apk.dart
packages/flutter_tools/lib/src/commands/apk.dart
+6
-2
run.dart
packages/flutter_tools/lib/src/commands/run.dart
+22
-9
No files found.
packages/flutter_tools/lib/src/android/adb.dart
View file @
005724b1
...
...
@@ -234,6 +234,8 @@ class AdbDevice {
}
}
final
RegExp
_whitespaceRegex
=
new
RegExp
(
r'\s+'
);
String
cleanAdbDeviceName
(
String
name
)
{
// Some emulators use `___` in the name as separators.
name
=
name
.
replaceAll
(
'___'
,
', '
);
...
...
@@ -241,6 +243,8 @@ String cleanAdbDeviceName(String name) {
// Convert `Nexus_7` / `Nexus_5X` style names to `Nexus 7` ones.
name
=
name
.
replaceAll
(
'_'
,
' '
);
name
=
name
.
replaceAll
(
_whitespaceRegex
,
' '
).
trim
();
return
name
;
}
...
...
packages/flutter_tools/lib/src/android/android_device.dart
View file @
005724b1
...
...
@@ -207,6 +207,7 @@ class AndroidDevice extends Device {
this
.
clearLogs
();
runCheckedSync
(
adbCommandForDevice
(<
String
>[
'push'
,
bundlePath
,
_deviceBundlePath
]));
List
<
String
>
cmd
=
adbCommandForDevice
(<
String
>[
'shell'
,
'am'
,
'start'
,
'-a'
,
'android.intent.action.RUN'
,
...
...
@@ -270,10 +271,9 @@ class AndroidDevice extends Device {
}
}
Future
<
bool
>
stopApp
(
ApplicationPackage
app
)
async
{
final
AndroidApk
apk
=
app
;
runSync
(
adbCommandForDevice
(<
String
>[
'shell'
,
'am'
,
'force-stop'
,
apk
.
id
]));
return
true
;
Future
<
bool
>
stopApp
(
ApplicationPackage
app
)
{
List
<
String
>
command
=
adbCommandForDevice
(<
String
>[
'shell'
,
'am'
,
'force-stop'
,
app
.
id
]);
return
runCommandAndStreamOutput
(
command
).
then
((
int
exitCode
)
=>
exitCode
==
0
);
}
@override
...
...
packages/flutter_tools/lib/src/commands/apk.dart
View file @
005724b1
...
...
@@ -349,16 +349,20 @@ bool _needsRebuild(String apkPath, String manifest) {
Iterable
<
FileStat
>
dependenciesStat
=
[
manifest
,
_kFlutterManifestPath
,
_kPackagesStatusPath
,
'
$apkPath
.sha1'
_kPackagesStatusPath
].
map
((
String
path
)
=>
FileStat
.
statSync
(
path
));
if
(
apkStat
.
type
==
FileSystemEntityType
.
NOT_FOUND
)
return
true
;
for
(
FileStat
dep
in
dependenciesStat
)
{
if
(
dep
.
modified
==
null
||
dep
.
modified
.
isAfter
(
apkStat
.
modified
))
return
true
;
}
if
(!
FileSystemEntity
.
isFileSync
(
'
$apkPath
.sha1'
))
return
true
;
return
false
;
}
...
...
packages/flutter_tools/lib/src/commands/run.dart
View file @
005724b1
...
...
@@ -19,7 +19,6 @@ import '../toolchain.dart';
import
'apk.dart'
;
import
'devices.dart'
;
import
'install.dart'
;
import
'stop.dart'
;
/// Given the value of the --target option, return the path of the Dart file
/// where the app's main function should be.
...
...
@@ -65,7 +64,7 @@ class RunCommand extends RunCommandBase {
RunCommand
()
{
argParser
.
addFlag
(
'full-restart'
,
defaultsTo:
fals
e
,
defaultsTo:
tru
e
,
help:
'Stop any currently running application process before starting the app.'
);
argParser
.
addFlag
(
'clear-logs'
,
defaultsTo:
true
,
...
...
@@ -111,6 +110,7 @@ class RunCommand extends RunCommandBase {
return
1
;
}
// TODO(devoncarew): Switch this to using [devicesForCommand].
int
result
=
await
startApp
(
devices
,
applicationPackages
,
...
...
@@ -140,7 +140,7 @@ Future<int> startApp(
List
<
BuildConfiguration
>
configs
,
{
String
target
,
String
enginePath
,
bool
stop:
fals
e
,
bool
stop:
tru
e
,
bool
install:
true
,
bool
checked:
true
,
bool
traceStartup:
false
,
...
...
@@ -169,11 +169,27 @@ Future<int> startApp(
return
result
;
}
// TODO(devoncarew): Move this into the device.startApp() impls. They should
// wait on the stop command to complete before (re-)starting the app. We could
// plumb a Future through the start command from here, but that seems a little
// messy.
if
(
stop
)
{
printTrace
(
'Running stop command.'
);
await
stopAll
(
devices
,
applicationPackages
);
for
(
Device
device
in
devices
.
all
)
{
if
(!
device
.
isSupported
())
continue
;
ApplicationPackage
package
=
applicationPackages
.
getPackageForPlatform
(
device
.
platform
);
if
(
package
!=
null
)
{
printTrace
(
"Stopping app '
${package.name}
' on
${device.name}
."
);
// We don't wait for the stop command to complete.
device
.
stopApp
(
package
);
}
}
}
// Allow any stop commands from above to start work.
await
new
Future
.
delayed
(
Duration
.
ZERO
);
if
(
install
)
{
printTrace
(
'Running install command.'
);
// TODO(devoncarew): This fails for ios devices - we haven't built yet.
...
...
@@ -194,8 +210,6 @@ Future<int> startApp(
continue
;
}
printTrace
(
'Running build command for
$device
.'
);
Map
<
String
,
dynamic
>
platformArgs
=
<
String
,
dynamic
>{};
if
(
traceStartup
!=
null
)
...
...
@@ -223,9 +237,8 @@ Future<int> startApp(
// If the user specified --start-paused (and the device supports it) then
// wait for the observatory port to become available before returning from
// `startApp()`.
if
(
startPaused
&&
device
.
supportsStartPaused
)
{
if
(
startPaused
&&
device
.
supportsStartPaused
)
await
delayUntilObservatoryAvailable
(
'localhost'
,
debugPort
);
}
}
}
...
...
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