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
bd125e2e
Commit
bd125e2e
authored
Sep 04, 2015
by
Ian Fischer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Return 0 or 2 from start and install commands.
parent
1245aa79
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
18 deletions
+40
-18
sky_tool
packages/flutter/lib/sky_tool
+40
-18
No files found.
packages/flutter/lib/sky_tool
View file @
bd125e2e
...
...
@@ -198,17 +198,23 @@ class InstallSky(object):
def
run
(
self
,
args
,
pids
):
android
=
AndroidDevice
()
installed_somewhere
=
False
# Install on connected Android device
if
android
.
is_connected
()
and
args
.
android_build_available
:
android
.
install_apk
(
android
.
get_apk_path
(
args
))
installed_somewhere
=
installed_somewhere
or
android
.
install_apk
(
android
.
get_apk_path
(
args
))
# Install on connected iOS device
if
IOSDevice
.
is_connected
()
and
args
.
ios_build_available
:
IOSDevice
.
install_app
(
IOSDevice
.
get_app_path
(
args
))
installed_somewhere
=
installed_somewhere
or
IOSDevice
.
install_app
(
IOSDevice
.
get_app_path
(
args
))
# Install on iOS simulator if it's running
if
IOSSimulator
.
is_booted
()
and
args
.
ios_sim_build_available
:
IOSSimulator
.
fork_install_app
(
IOSSimulator
.
get_app_path
(
args
))
installed_somewhere
=
installed_somewhere
or
IOSSimulator
.
fork_install_app
(
IOSSimulator
.
get_app_path
(
args
))
if
installed_somewhere
:
return
0
else
:
return
2
# TODO(iansf): get rid of need for args
def
needs_install
(
self
,
args
):
...
...
@@ -226,13 +232,14 @@ class StartSky(object):
start_parser
.
set_defaults
(
func
=
self
.
run
)
def
run
(
self
,
args
,
pids
):
started_sky_somewhere
=
False
if
not
args
.
poke
:
StopSky
()
.
run
(
args
,
pids
)
# Only install if the user did not specify a poke
installer
=
InstallSky
()
if
installer
.
needs_install
(
args
):
installer
.
run
(
args
,
pids
)
started_sky_somewhere
=
(
installer
.
run
(
args
,
pids
)
==
0
)
project_or_path
=
os
.
path
.
abspath
(
args
.
project_or_path
)
...
...
@@ -258,7 +265,12 @@ class StartSky(object):
android
=
AndroidDevice
()
# TODO(iansf): fix this so that we don't have to pass sky_server_root, main_dart, pid, and args.
android
.
setup_servers
(
sky_server_root
,
main_dart
,
pids
,
args
)
started_sky_on_android
=
android
.
setup_servers
(
sky_server_root
,
main_dart
,
pids
,
args
)
if
started_sky_somewhere
or
started_sky_on_android
:
return
0
else
:
return
2
class
StopSky
(
object
):
...
...
@@ -420,7 +432,7 @@ class AndroidDevice(object):
def
install_apk
(
self
,
apk_path
):
if
not
os
.
path
.
exists
(
apk_path
):
logging
.
error
(
'"
%
s" does not exist.'
%
apk_path
)
return
return
False
cmd
=
[
self
.
adb_path
,
'install'
,
'-r'
,
apk_path
]
logging
.
info
(
' '
.
join
(
cmd
))
...
...
@@ -433,10 +445,13 @@ class AndroidDevice(object):
logging
.
info
(
' '
.
join
(
cmd
))
subprocess
.
check_call
(
cmd
)
return
True
# TODO(iansf): refactor setup_servers
def
setup_servers
(
self
,
sky_server_root
,
main_dart
,
pids
,
args
):
if
not
self
.
is_connected
():
return
return
False
# Set up port forwarding for observatory
observatory_port_string
=
'tcp:
%
s'
%
OBSERVATORY_PORT
...
...
@@ -490,6 +505,8 @@ class AndroidDevice(object):
logging
.
info
(
' '
.
join
(
cmd
))
subprocess
.
check_output
(
cmd
)
return
True
def
logs
(
self
,
clear
=
False
):
def
do_logs
():
if
clear
:
...
...
@@ -582,7 +599,7 @@ class IOSDevice(object):
@
classmethod
def
install_app
(
cls
,
ios_app_path
):
if
not
cls
.
has_ios_deploy
():
return
return
False
try
:
cmd
=
[
'ios-deploy'
,
...
...
@@ -595,7 +612,8 @@ class IOSDevice(object):
logging
.
info
(
' '
.
join
(
cmd
))
subprocess
.
check_call
(
cmd
)
except
subprocess
.
CalledProcessError
:
pass
return
False
return
True
@
classmethod
def
copy_file
(
cls
,
bundle_id
,
local_path
,
device_path
):
...
...
@@ -782,15 +800,19 @@ class IOSSimulator(object):
@
classmethod
def
fork_install_app
(
cls
,
ios_app_path
):
cmd
=
[
os
.
path
.
abspath
(
__file__
),
'ios_sim'
,
'-p'
,
ios_app_path
,
'launch'
]
logging
.
info
(
' '
.
join
(
cmd
))
subprocess
.
check_call
(
cmd
)
try
:
cmd
=
[
os
.
path
.
abspath
(
__file__
),
'ios_sim'
,
'-p'
,
ios_app_path
,
'launch'
]
logging
.
info
(
' '
.
join
(
cmd
))
subprocess
.
check_call
(
cmd
)
return
True
except
subprocess
.
CalledProcessError
:
return
False
def
_process_args
(
self
,
args
):
if
args
.
ios_sim_build_path
is
None
:
...
...
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